aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/coding-rules/bulk-change-modal-view.js
diff options
context:
space:
mode:
authorStas Vilchik <stas.vilchik@sonarsource.com>2017-10-19 16:32:33 +0200
committerStas Vilchik <stas.vilchik@sonarsource.com>2017-10-20 14:52:01 +0200
commit97df5136aa8b05ed3e56c47e457a5e53288697e9 (patch)
tree89243890bbe3cfd5394585b63ca4aa8d62e0e1aa /server/sonar-web/src/main/js/apps/coding-rules/bulk-change-modal-view.js
parent2c1b9cae54f36b9d62a65de6ef631f091bea99b6 (diff)
downloadsonarqube-97df5136aa8b05ed3e56c47e457a5e53288697e9.tar.gz
sonarqube-97df5136aa8b05ed3e56c47e457a5e53288697e9.zip
stop using jquery for ajax calls
Diffstat (limited to 'server/sonar-web/src/main/js/apps/coding-rules/bulk-change-modal-view.js')
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/bulk-change-modal-view.js33
1 files changed, 18 insertions, 15 deletions
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/bulk-change-modal-view.js b/server/sonar-web/src/main/js/apps/coding-rules/bulk-change-modal-view.js
index 953c9c7900e..31de119d09f 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/bulk-change-modal-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/bulk-change-modal-view.js
@@ -17,10 +17,10 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import $ from 'jquery';
import ModalFormView from '../../components/common/modal-form';
import Template from './templates/coding-rules-bulk-change-modal.hbs';
import { translateWithParameters } from '../../helpers/l10n';
+import { postJSON } from '../../helpers/request';
export default ModalFormView.extend({
template: Template,
@@ -75,12 +75,12 @@ export default ModalFormView.extend({
sendRequests(url, options, profiles) {
const that = this;
- let looper = $.Deferred().resolve();
+ let looper = Promise.resolve();
this.disableForm();
profiles.forEach(profile => {
const opts = { ...options, profile_key: profile };
- looper = looper.then(() => {
- return $.post(url, opts).done(r => {
+ looper = looper.then(() =>
+ postJSON(url, opts).then(r => {
if (!that.isDestroyed) {
if (r.failed) {
that.showWarnMessage(profile, r.succeeded, r.failed);
@@ -88,18 +88,21 @@ export default ModalFormView.extend({
that.showSuccessMessage(profile, r.succeeded);
}
}
- });
- });
- });
- looper.done(() => {
- that.options.app.controller.fetchList();
- if (!that.isDestroyed) {
- that.$(that.ui.codingRulesSubmitBulkChange.selector).hide();
- that.enableForm();
- that.$('.modal-field').hide();
- that.$('.js-modal-close').focus();
- }
+ })
+ );
});
+ looper.then(
+ () => {
+ that.options.app.controller.fetchList();
+ if (!that.isDestroyed) {
+ that.$(that.ui.codingRulesSubmitBulkChange.selector).hide();
+ that.enableForm();
+ that.$('.modal-field').hide();
+ that.$('.js-modal-close').focus();
+ }
+ },
+ () => {}
+ );
},
getAvailableQualityProfiles() {