static: use modern getJSON and ajax callbacks

Use done() and fail() instead of complete() and success() that got
removed in jquery 3.0.
add-modified-date-importedfile
Riccardo Magliocchetti 2018-07-17 09:48:32 +02:00 committed by Eric Holscher
parent cb7f865863
commit 059413cb47
3 changed files with 9 additions and 9 deletions

View File

@ -103,7 +103,7 @@ function attach_elastic_search_query(data) {
return search_def.resolve(resp.responseJSON.results);
}
})
.error(function (resp, status_code, error) {
.fail(function (resp, status_code, error) {
return search_def.reject();
});
};

View File

@ -9,7 +9,7 @@ function poll_task(data) {
function poll_task_loop() {
jquery
.getJSON(data.url)
.success(function (task) {
.done(function (task) {
if (task.finished) {
if (task.success) {
defer.resolve();
@ -22,7 +22,7 @@ function poll_task(data) {
setTimeout(poll_task_loop, 2000);
}
})
.error(function (error) {
.fail(function (error) {
console.error('Error polling task:', error);
tries -= 1;
if (tries > 0) {

View File

@ -230,7 +230,7 @@ function ProjectImportView(instance, config) {
self.error(null);
$.getJSON(url)
.success(function (projects_list) {
.done(function (projects_list) {
var projects = [];
self.page_next(projects_list.next);
self.page_previous(projects_list.previous);
@ -241,7 +241,7 @@ function ProjectImportView(instance, config) {
}
self.projects(projects);
})
.error(function (error) {
.fail(function (error) {
var error_msg = error.responseJSON.detail || error.statusText;
self.error({message: error_msg});
})
@ -252,10 +252,10 @@ function ProjectImportView(instance, config) {
self.get_organizations = function () {
$.getJSON(self.urls['remoteorganization-list'])
.success(function (organizations) {
.done(function (organizations) {
self.organizations_raw(organizations.results);
})
.error(function (error) {
.fail(function (error) {
var error_msg = error.responseJSON.detail || error.statusText;
self.error({message: error_msg});
});
@ -263,10 +263,10 @@ function ProjectImportView(instance, config) {
self.get_accounts = function () {
$.getJSON(self.urls['remoteaccount-list'])
.success(function (accounts) {
.done(function (accounts) {
self.accounts_raw(accounts.results);
})
.error(function (error) {
.fail(function (error) {
var error_msg = error.responseJSON.detail || error.statusText;
self.error({message: error_msg});
});