aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2016-12-20 14:03:08 +0100
committerStas Vilchik <vilchiks@gmail.com>2016-12-20 14:16:07 +0100
commitf8941d21f5f38d5fed51350610b4b069bab4bb1e (patch)
treef12a32e3df093c5bda19066714bac2f3263028ed /server/sonar-web/src/main
parent10eb4e6efe8ab845629a451c8dfa6f2eea98494a (diff)
downloadsonarqube-f8941d21f5f38d5fed51350610b4b069bab4bb1e.tar.gz
sonarqube-f8941d21f5f38d5fed51350610b4b069bab4bb1e.zip
fix error message on quality gates page
Diffstat (limited to 'server/sonar-web/src/main')
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/views/copy-view.js15
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/views/create-view.js15
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/views/delete-view.js15
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/views/gate-conditions-delete-view.js12
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/views/rename-view.js15
5 files changed, 53 insertions, 19 deletions
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/views/copy-view.js b/server/sonar-web/src/main/js/apps/quality-gates/views/copy-view.js
index c93e7bc1f33..7f2846294c5 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/views/copy-view.js
+++ b/server/sonar-web/src/main/js/apps/quality-gates/views/copy-view.js
@@ -20,6 +20,7 @@
import ModalForm from '../../../components/common/modal-form';
import Template from '../templates/quality-gate-form.hbs';
import { copyQualityGate } from '../../../api/quality-gates';
+import { parseError } from '../../code/utils';
export default ModalForm.extend({
template: Template,
@@ -34,10 +35,16 @@ export default ModalForm.extend({
const { id } = this.options.qualityGate;
const name = this.$('#quality-gate-form-name').val();
- copyQualityGate(id, name).then(qualityGate => {
- this.destroy();
- this.options.onCopy(qualityGate);
- });
+ copyQualityGate(id, name).then(
+ qualityGate => {
+ this.destroy();
+ this.options.onCopy(qualityGate);
+ },
+ error => {
+ this.enableForm();
+ parseError(error).then(msg => this.showErrors([{ msg }]));
+ }
+ );
},
serializeData () {
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/views/create-view.js b/server/sonar-web/src/main/js/apps/quality-gates/views/create-view.js
index 2a12f24fdeb..0e4c1c057a5 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/views/create-view.js
+++ b/server/sonar-web/src/main/js/apps/quality-gates/views/create-view.js
@@ -20,6 +20,7 @@
import ModalForm from '../../../components/common/modal-form';
import Template from '../templates/quality-gate-form.hbs';
import { createQualityGate } from '../../../api/quality-gates';
+import { parseError } from '../../code/utils';
export default ModalForm.extend({
template: Template,
@@ -33,10 +34,16 @@ export default ModalForm.extend({
sendRequest () {
const name = this.$('#quality-gate-form-name').val();
- createQualityGate(name).then(qualityGate => {
- this.destroy();
- this.options.onAdd(qualityGate);
- });
+ createQualityGate(name).then(
+ qualityGate => {
+ this.destroy();
+ this.options.onAdd(qualityGate);
+ },
+ error => {
+ this.enableForm();
+ parseError(error).then(msg => this.showErrors([{ msg }]));
+ }
+ );
},
serializeData () {
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/views/delete-view.js b/server/sonar-web/src/main/js/apps/quality-gates/views/delete-view.js
index 8473319b570..f18c1732460 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/views/delete-view.js
+++ b/server/sonar-web/src/main/js/apps/quality-gates/views/delete-view.js
@@ -20,6 +20,7 @@
import ModalForm from '../../../components/common/modal-form';
import Template from '../templates/quality-gates-delete.hbs';
import { deleteQualityGate } from '../../../api/quality-gates';
+import { parseError } from '../../code/utils';
export default ModalForm.extend({
template: Template,
@@ -33,10 +34,16 @@ export default ModalForm.extend({
sendRequest () {
const { id } = this.options.qualityGate;
- deleteQualityGate(id).then(() => {
- this.destroy();
- this.options.onDelete(this.options.qualityGate);
- });
+ deleteQualityGate(id).then(
+ () => {
+ this.destroy();
+ this.options.onDelete(this.options.qualityGate);
+ },
+ error => {
+ this.enableForm();
+ parseError(error).then(msg => this.showErrors([{ msg }]));
+ }
+ );
},
serializeData () {
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/views/gate-conditions-delete-view.js b/server/sonar-web/src/main/js/apps/quality-gates/views/gate-conditions-delete-view.js
index 4df1682a907..f7d155b9a4e 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/views/gate-conditions-delete-view.js
+++ b/server/sonar-web/src/main/js/apps/quality-gates/views/gate-conditions-delete-view.js
@@ -21,6 +21,7 @@ import ModalForm from '../../../components/common/modal-form';
import Template from '../templates/quality-gates-condition-delete.hbs';
import { deleteCondition } from '../../../api/quality-gates';
import { getLocalizedMetricName } from '../../../helpers/l10n';
+import { parseError } from '../../code/utils';
export default ModalForm.extend({
template: Template,
@@ -32,11 +33,16 @@ export default ModalForm.extend({
},
sendRequest () {
- return deleteCondition(this.options.condition.id)
- .then(() => {
+ return deleteCondition(this.options.condition.id).then(
+ () => {
this.destroy();
this.options.onDelete();
- });
+ },
+ error => {
+ this.enableForm();
+ parseError(error).then(msg => this.showErrors([{ msg }]));
+ }
+ );
},
serializeData () {
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/views/rename-view.js b/server/sonar-web/src/main/js/apps/quality-gates/views/rename-view.js
index 1d989c681b0..be5e3928ae4 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/views/rename-view.js
+++ b/server/sonar-web/src/main/js/apps/quality-gates/views/rename-view.js
@@ -20,6 +20,7 @@
import ModalForm from '../../../components/common/modal-form';
import Template from '../templates/quality-gate-form.hbs';
import { renameQualityGate } from '../../../api/quality-gates';
+import { parseError } from '../../code/utils';
export default ModalForm.extend({
template: Template,
@@ -34,10 +35,16 @@ export default ModalForm.extend({
const { id } = this.options.qualityGate;
const name = this.$('#quality-gate-form-name').val();
- renameQualityGate(id, name).then(() => {
- this.destroy();
- this.options.onRename(this.options.qualityGate, name);
- });
+ renameQualityGate(id, name).then(
+ () => {
+ this.destroy();
+ this.options.onRename(this.options.qualityGate, name);
+ },
+ error => {
+ this.enableForm();
+ parseError(error).then(msg => this.showErrors([{ msg }]));
+ }
+ );
},
serializeData () {