aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/project-admin/links/views
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2016-08-08 11:29:32 +0200
committerStas Vilchik <vilchiks@gmail.com>2016-08-08 11:29:32 +0200
commit0d9ae4cc8308965fd0f638218f2026573bbc2051 (patch)
tree34d6fd3619e23eee1cb0b39f6970371653945200 /server/sonar-web/src/main/js/apps/project-admin/links/views
parent864b32a022faf7a476573edf8d66b0daffd578f3 (diff)
downloadsonarqube-0d9ae4cc8308965fd0f638218f2026573bbc2051.tar.gz
sonarqube-0d9ae4cc8308965fd0f638218f2026573bbc2051.zip
SONAR-7920 apply feedback
Diffstat (limited to 'server/sonar-web/src/main/js/apps/project-admin/links/views')
-rw-r--r--server/sonar-web/src/main/js/apps/project-admin/links/views/CreationModal.js13
-rw-r--r--server/sonar-web/src/main/js/apps/project-admin/links/views/DeletionModal.js9
2 files changed, 9 insertions, 13 deletions
diff --git a/server/sonar-web/src/main/js/apps/project-admin/links/views/CreationModal.js b/server/sonar-web/src/main/js/apps/project-admin/links/views/CreationModal.js
index a2fa0e36358..3d22d6744c2 100644
--- a/server/sonar-web/src/main/js/apps/project-admin/links/views/CreationModal.js
+++ b/server/sonar-web/src/main/js/apps/project-admin/links/views/CreationModal.js
@@ -19,6 +19,7 @@
*/
import ModalForm from '../../../../components/common/modal-form';
import Template from './CreationModalTemplate.hbs';
+import { parseError } from '../../../code/utils';
export default ModalForm.extend({
template: Template,
@@ -31,14 +32,10 @@ export default ModalForm.extend({
const url = this.$('#create-link-url').val();
this.options.onCreate(name, url)
- .then(() => {
- this.destroy();
- })
- .catch(function (e) {
- e.response.json().then(r => {
- this.showErrors(r.errors, r.warnings);
- this.enableForm();
- });
+ .then(() => this.destroy())
+ .catch(e => {
+ parseError(e).then(msg => this.showSingleError(msg));
+ this.enableForm();
});
}
});
diff --git a/server/sonar-web/src/main/js/apps/project-admin/links/views/DeletionModal.js b/server/sonar-web/src/main/js/apps/project-admin/links/views/DeletionModal.js
index a1064dfb66e..ee27fd38d01 100644
--- a/server/sonar-web/src/main/js/apps/project-admin/links/views/DeletionModal.js
+++ b/server/sonar-web/src/main/js/apps/project-admin/links/views/DeletionModal.js
@@ -20,6 +20,7 @@
import ModalForm from '../../../../components/common/modal-form';
import Template from './DeletionModalTemplate.hbs';
import { deleteLink } from '../../../../api/projectLinks';
+import { parseError } from '../../../code/utils';
export default ModalForm.extend({
template: Template,
@@ -33,11 +34,9 @@ export default ModalForm.extend({
this.trigger('done');
this.destroy();
})
- .catch(function (e) {
- e.response.json().then(r => {
- this.showErrors(r.errors, r.warnings);
- this.enableForm();
- });
+ .catch(e => {
+ parseError(e).then(msg => this.showSingleError(msg));
+ this.enableForm();
});
},