Replace deprecated success, error callbacks in $.ajax call with new functions .done and .fail.

This commit is contained in:
Aditya Toshniwal 2018-07-09 13:54:00 +01:00 committed by Dave Page
parent 81312d17e2
commit 41a8333145
39 changed files with 2817 additions and 2821 deletions

View File

@ -201,17 +201,15 @@ define('pgadmin.node.cast', [
cache: false,
async: false,
data: {'srctyp' : srcTyp, 'trgtyp' : trgtyp},
})
// On success return function list from server
success: function(result) {
.done(function(result) {
res = result.data;
return res;
},
})
// On failure show error appropriate error message to user
error: function(xhr, status, error) {
.fail(function(xhr, status, error) {
alertify.pgRespErrorNotify(xhr, error);
},
});
}
return res;

View File

@ -350,17 +350,17 @@ define('pgadmin.node.foreign_table', [
async: false,
url: full_url,
data: data,
success: function(res) {
})
.done(function(res) {
/*
* We will cache this data for short period of time for avoiding
* same calls.
*/
data = cache_node.cache(url, node_info, cache_level, res.data);
},
error: function() {
})
.fail(function() {
m.trigger('pgadmin:view:fetch:error', m, self.field);
},
});
m.trigger('pgadmin:view:fetched', m, self.field);

View File

@ -111,7 +111,8 @@ define('pgadmin.node.fts_configuration', [
$.ajax({
async: false,
url: full_url,
success: function(res) {
})
.done(function(res) {
/*
* We will cache this data for short period of time for
* avoiding same calls.
@ -121,10 +122,9 @@ define('pgadmin.node.fts_configuration', [
cache_level,
res.data
);
},
error: function() {
})
.fail(function() {
m.trigger('pgadmin:view:fetch:error', m, self.field);
},
});
m.trigger('pgadmin:view:fetched', m, self.field);
}

View File

@ -31,12 +31,12 @@ define('pgadmin.node.schema', [
$.ajax({
async: false,
url: full_url,
success: function (res) {
})
.done(function (res) {
data = res;
},
error: function() {
})
.fail(function() {
m.trigger('pgadmin-view:fetch:error', m, self.field);
},
});
m.trigger('pgadmin-view:fetched', m, self.field);

View File

@ -154,17 +154,15 @@ define('pgadmin.node.synonym', [
cache: false,
async: false,
data: {'trgTyp' : trgTyp, 'trgSchema' : trgSchema},
})
// On success return function list from server
success: function(result) {
.done(function(result) {
res = result.data;
return res;
},
})
// On failure show error appropriate error message to user
error: function(xhr, status, error) {
.fail(function(xhr, status, error) {
alertify.pgRespErrorNotify(xhr, error);
},
});
return res;
},

View File

@ -61,7 +61,8 @@ define('pgadmin.node.check_constraint', [
$.ajax({
url: obj.generate_url(i, 'validate', d, true),
type:'GET',
success: function(res) {
})
.done(function(res) {
if (res.success == 1) {
alertify.success(res.info);
t.removeIcon(i);
@ -71,11 +72,10 @@ define('pgadmin.node.check_constraint', [
setTimeout(function() {t.deselect(i);}, 10);
setTimeout(function() {t.select(i);}, 100);
}
},
error: function(xhr, status, error) {
})
.fail(function(xhr, status, error) {
alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
},
});
return false;

View File

@ -82,13 +82,13 @@ define('pgadmin.node.exclusion_constraint', [
async: false,
data : {indextype:indextype},
url: full_url,
success: function(res) {
})
.done(function(res) {
data = res.data;
self.column.set('options', data);
},
error: function() {
})
.fail(function() {
eventHandler.trigger('pgadmin:view:fetch:error', m, self.column);
},
});
eventHandler.trigger('pgadmin:view:fetched', m, self.column);
}
@ -183,13 +183,13 @@ define('pgadmin.node.exclusion_constraint', [
async: false,
data : {col_type:col_type},
url: full_url,
success: function(res) {
})
.done(function(res) {
data = res.data;
self.column.set('options', data);
},
error: function() {
})
.fail(function() {
eventHandler.trigger('pgadmin:view:fetch:error', m, self.column);
},
});
eventHandler.trigger('pgadmin:view:fetched', m, self.column);
}

View File

@ -214,12 +214,12 @@ define('pgadmin.node.foreign_key', [
async: false,
data : {tid:tid},
url: full_url,
success: function(res) {
})
.done(function(res) {
data = res.data;
},
error: function() {
})
.fail(function() {
m.trigger('pgadmin:view:fetch:error', m, self.field);
},
});
m.trigger('pgadmin:view:fetched', m, self.field);
}
@ -558,12 +558,12 @@ define('pgadmin.node.foreign_key', [
async: false,
data : {cols:JSON.stringify(cols)},
url: full_url,
success: function(res) {
})
.done(function(res) {
coveringindex = res.data;
},
error: function() {
})
.fail(function() {
m.trigger('pgadmin:view:fetch:error', m, self.field);
},
});
m.trigger('pgadmin:view:fetched', m, self.field);
}
@ -653,7 +653,8 @@ define('pgadmin.node.foreign_key', [
$.ajax({
url: obj.generate_url(i, 'validate', d, true),
type:'GET',
success: function(res) {
})
.done(function(res) {
if (res.success == 1) {
Alertify.success(res.info);
t.removeIcon(i);
@ -663,11 +664,10 @@ define('pgadmin.node.foreign_key', [
setTimeout(function() {t.deselect(i);}, 10);
setTimeout(function() {t.select(i);}, 100);
}
},
error: function(xhr, status, error) {
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
},
});
return false;

View File

@ -134,7 +134,8 @@ function(
type:'PUT',
data: params,
dataType: 'json',
success: function(res) {
})
.done(function(res) {
if (res.success == 1) {
Alertify.success(res.info);
t.unload(i);
@ -144,11 +145,10 @@ function(
t.select(i);
}, 10);
}
},
error: function(xhr, status, error) {
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
},
});
},
/* Truncate table */
@ -182,7 +182,8 @@ function(
type:'PUT',
data: params,
dataType: 'json',
success: function(res) {
})
.done(function(res) {
if (res.success == 1) {
Alertify.success(res.info);
t.removeIcon(i);
@ -196,11 +197,10 @@ function(
t.select(i);
}, 10);
}
},
error: function(xhr, status, error) {
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
},
});
}},
function() {}
@ -225,7 +225,8 @@ function(
$.ajax({
url: obj.generate_url(i, 'reset' , d, true),
type:'DELETE',
success: function(res) {
})
.done(function(res) {
if (res.success == 1) {
Alertify.success(res.info);
t.removeIcon(i);
@ -239,11 +240,10 @@ function(
t.select(i);
}, 10);
}
},
error: function(xhr, status, error) {
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
},
});
}
},
@ -268,7 +268,8 @@ function(
$.ajax({
url: obj.generate_url(i, 'detach' , d, true),
type:'PUT',
success: function(res) {
})
.done(function(res) {
if (res.success == 1) {
Alertify.success(res.info);
var n = t.next(i);
@ -284,10 +285,9 @@ function(
t.select(n);
}
}
},
error: function(xhr, status, error) {
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
},
});
}
},
@ -874,7 +874,8 @@ function(
type: 'GET',
async: false,
success: function(res) {
})
.done(function(res) {
if (res.success == 1) {
self.model.table_options = res.data;
}
@ -883,10 +884,9 @@ function(
gettext('Error fetching tables to be attached'), res.data.result
);
}
},
error: function(xhr, status, error) {
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error, gettext('Error fetching tables to be attached'));
},
});
}
},
@ -1148,12 +1148,12 @@ function(
async: false,
url: full_url,
data: arg,
success: function(res) {
})
.done(function(res) {
data = cache_node.cache(url, node_info, cache_level, res.data);
},
error: function() {
})
.fail(function() {
m.trigger('pgadmin:view:fetch:error', m, self.field);
},
});
m.trigger('pgadmin:view:fetched', m, self.field);
data = (data && data.data) || [];

View File

@ -164,7 +164,8 @@ define('pgadmin.node.table', [
type:'PUT',
data: params,
dataType: 'json',
success: function(res) {
})
.done(function(res) {
if (res.success == 1) {
Alertify.success(res.info);
t.removeIcon(i);
@ -178,11 +179,10 @@ define('pgadmin.node.table', [
t.select(i);
}, 10);
}
},
error: function(xhr, status, error) {
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
},
});
}
}, function() {}
@ -207,7 +207,8 @@ define('pgadmin.node.table', [
$.ajax({
url: obj.generate_url(i, 'reset' , d, true),
type:'DELETE',
success: function(res) {
})
.done(function(res) {
if (res.success == 1) {
Alertify.success(res.info);
t.removeIcon(i);
@ -221,11 +222,10 @@ define('pgadmin.node.table', [
t.select(i);
}, 10);
}
},
error: function(xhr, status, error) {
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
},
});
}
},
@ -245,7 +245,8 @@ define('pgadmin.node.table', [
$.ajax({
url: obj.generate_url(i, 'count_rows' , d, true),
type:'GET',
success: function(res) {
})
.done(function(res) {
Alertify.success(res.info);
d.rows_cnt = res.data.total_rows;
t.unload(i);
@ -254,11 +255,10 @@ define('pgadmin.node.table', [
setTimeout(function() {
t.select(i);
}, 10);
},
error: function(xhr, status, error) {
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
},
});
},
},
@ -983,7 +983,8 @@ define('pgadmin.node.table', [
type: 'GET',
async: false,
success: function(res) {
})
.done(function(res) {
if (res.success == 1) {
self.model.table_options = res.data;
}
@ -992,10 +993,9 @@ define('pgadmin.node.table', [
gettext('Error fetching tables to be attached'), res.data.result
);
}
},
error: function(xhr, status, error) {
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
},
});
}
},
@ -1261,12 +1261,12 @@ define('pgadmin.node.table', [
async: false,
url: full_url,
data: arg,
success: function(res) {
})
.done(function(res) {
data = cache_node.cache(url, node_info, cache_level, res.data);
},
error: function() {
})
.fail(function() {
m.trigger('pgadmin:view:fetch:error', m, self.field);
},
});
m.trigger('pgadmin:view:fetched', m, self.field);
data = (data && data.data) || [];

View File

@ -118,7 +118,8 @@ define('pgadmin.node.trigger', [
type:'PUT',
data: {'enable' : true},
dataType: 'json',
success: function(res) {
})
.done(function(res) {
if (res.success == 1) {
alertify.success(res.info);
t.removeIcon(i);
@ -132,11 +133,10 @@ define('pgadmin.node.trigger', [
t.select(i);
}, 10);
}
},
error: function(xhr, status, error) {
})
.fail(function(xhr, status, error) {
alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
},
});
},
/* Disable trigger */
@ -156,7 +156,8 @@ define('pgadmin.node.trigger', [
type:'PUT',
data: {'enable' : false},
dataType: 'json',
success: function(res) {
})
.done(function(res) {
if (res.success == 1) {
alertify.success(res.info);
t.removeIcon(i);
@ -170,11 +171,10 @@ define('pgadmin.node.trigger', [
t.select(i);
}, 10);
}
},
error: function(xhr, status, error) {
})
.fail(function(xhr, status, error) {
alertify.pgRespErrorNotify(xhr, error, gettext('Disable trigger failed'));
t.unload(i);
},
});
},
},

View File

@ -423,12 +423,12 @@ define('pgadmin.node.type', [
url: _url,
cache: false,
data: {'typname' : l_typname},
success: function(res) {
})
.done(function(res) {
result = res.data;
},
error: function() {
})
.fail(function() {
self.model.trigger('pgadmin:view:fetch:error', self.model, self.field);
},
});
//
}
@ -491,13 +491,13 @@ define('pgadmin.node.type', [
url: _url,
cache: false,
data: {'name' : name},
success: function(res) {
})
.done(function(res) {
result = res.data;
},
error: function() {
})
.fail(function() {
self.model.trigger('pgadmin:view:fetch:error',
self.model, self.field);
},
});
}
return result;
@ -527,13 +527,13 @@ define('pgadmin.node.type', [
url: _url,
cache: false,
data: {'typname' : l_typname, 'opcname': l_opcname},
success: function(res) {
})
.done(function(res) {
result = res.data;
},
error: function() {
})
.fail(function() {
self.model.trigger('pgadmin:view:fetch:error',
self.model, self.field);
},
});
}
return result;

View File

@ -253,7 +253,8 @@ define('pgadmin.node.mview', [
type: 'PUT',
data: {'concurrent': args.concurrent, 'with_data': args.with_data},
dataType: 'json',
success: function(res) {
})
.done(function(res) {
if (res.success == 1) {
Alertify.success(gettext('View refreshed successfully'));
}
@ -263,10 +264,9 @@ define('pgadmin.node.mview', [
res.data.result
);
}
},
error: function(xhr, status, error) {
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error, gettext('Error refreshing view'));
},
});
},

View File

@ -185,7 +185,8 @@ define('pgadmin.node.database', [
$.ajax({
url: obj.generate_url(i, 'connect', d, true),
type:'DELETE',
success: function(res) {
})
.done(function(res) {
if (res.success == 1) {
var prv_i = t.parent(i);
Alertify.success(res.info);
@ -207,11 +208,10 @@ define('pgadmin.node.database', [
}
t.unload(i);
}
},
error: function(xhr, status, error) {
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
},
});
},
function() { return true; });

View File

@ -172,13 +172,13 @@ define('pgadmin.node.pga_job', [
$.ajax({
url: obj.generate_url(i, 'run_now', d, true),
method:'PUT',
})
// 'pgagent.pga_job' table updated with current time to run the job
// now.
success: function() { t.unload(i); },
error: function(xhr, status, error) {
.done(function() { t.unload(i); })
.fail(function(xhr, status, error) {
alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
},
});
return false;

View File

@ -189,7 +189,8 @@ define('pgadmin.node.server', [
$.ajax({
url: obj.generate_url(i, 'connect', d, true),
type:'DELETE',
success: function(res) {
})
.done(function(res) {
if (res.success == 1) {
Alertify.success(res.info);
d = t.itemData(i);
@ -216,11 +217,10 @@ define('pgadmin.node.server', [
}
t.unload(i);
}
},
error: function(xhr, status, error) {
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
},
});
};
@ -284,18 +284,18 @@ define('pgadmin.node.server', [
$.ajax({
url: obj.generate_url(i, 'reload', d, true),
method:'GET',
success: function(res) {
})
.done(function(res) {
if (res.data.status) {
Alertify.success(res.data.result);
}
else {
Alertify.error(res.data.result);
}
},
error: function(xhr, status, error) {
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
},
});
},
function() { return true; }
@ -325,13 +325,13 @@ define('pgadmin.node.server', [
url: obj.generate_url(i, 'restore_point', d, true),
method:'POST',
data:{ 'value': JSON.stringify(value) },
success: function(res) {
})
.done(function(res) {
Alertify.success(res.data.result, 10);
},
error: function(xhr, status, error) {
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
},
});
} else {
evt.cancel = true;
@ -481,7 +481,8 @@ define('pgadmin.node.server', [
url: url,
method:'POST',
data:{'data': JSON.stringify(args) },
success: function(res) {
})
.done(function(res) {
if (res.success) {
// Notify user to update pgpass file
if(is_pgpass_file_used) {
@ -498,10 +499,9 @@ define('pgadmin.node.server', [
} else {
Alertify.error(res.errormsg);
}
},
error: function(xhr, status, error) {
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
},
});
}
},
@ -513,15 +513,15 @@ define('pgadmin.node.server', [
$.ajax({
url: check_pgpass_url,
method:'GET',
success: function(res) {
})
.done(function(res) {
if (res.success && res.data.is_pgpass) {
is_pgpass_file_used = true;
}
Alertify.changeServerPassword(d).resizeTo('40%','52%');
},
error: function(xhr, status, error) {
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
},
});
return false;
@ -542,7 +542,8 @@ define('pgadmin.node.server', [
url: obj.generate_url(i, 'wal_replay' , d, true),
type:'DELETE',
dataType: 'json',
success: function(res) {
})
.done(function(res) {
if (res.success == 1) {
Alertify.success(res.info);
t.itemData(i).wal_pause=res.data.wal_pause;
@ -554,11 +555,10 @@ define('pgadmin.node.server', [
t.select(i);
}, 10);
}
},
error: function(xhr, status, error) {
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
},
});
},
@ -577,7 +577,8 @@ define('pgadmin.node.server', [
url: obj.generate_url(i, 'wal_replay' , d, true),
type:'PUT',
dataType: 'json',
success: function(res) {
})
.done(function(res) {
if (res.success == 1) {
Alertify.success(res.info);
t.itemData(i).wal_pause=res.data.wal_pause;
@ -589,11 +590,10 @@ define('pgadmin.node.server', [
t.select(i);
}, 10);
}
},
error: function(xhr, status, error) {
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
},
});
},
},
@ -1128,16 +1128,16 @@ define('pgadmin.node.server', [
timeout: 30000,
url: _url,
data: $('#frmPassword').serialize(),
success: function(res) {
})
.done(function(res) {
return _onSuccess(
res, _node, _data, _tree, _item, _status
);
},
error: function(xhr, status, error) {
})
.fail(function(xhr, status, error) {
return _onFailure(
xhr, status, error, _node, _data, _tree, _item, _status
);
},
});
} else {
_onCancel && typeof(_onCancel) == 'function' &&

View File

@ -303,12 +303,12 @@ define([
$.ajax({
async: false,
url: full_url,
success: function (res) {
})
.done(function (res) {
data = res.data;
},
error: function() {
})
.fail(function() {
m.trigger('pgadmin-view:fetch:error', m, self.field);
},
});
m.trigger('pgadmin-view:fetched', m, self.field);

View File

@ -277,17 +277,17 @@ define('pgadmin.node.tablespace', [
url: url,
method:'PUT',
data:{'data': JSON.stringify(args) },
success: function(res) {
})
.done(function(res) {
if (res.success) {
Alertify.success(res.info);
self.close();
} else {
Alertify.error(res.errormsg);
}
},
error: function(xhr, status, error) {
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
},
});
},
function() {

View File

@ -503,9 +503,9 @@ define('pgadmin.browser', [
$.ajax({
url: url_for('misc.cleanup'),
type:'POST',
success: function() {},
error: function() {},
});
})
.done(function() {})
.fail(function() {});
}, 300000);
obj.Events.on('pgadmin:browser:tree:add', obj.onAddTreeNode, obj);
obj.Events.on('pgadmin:browser:tree:update', obj.onUpdateTreeNode, obj);
@ -1539,7 +1539,8 @@ define('pgadmin.browser', [
type: 'GET',
cache: false,
dataType: 'json',
success: function(res) {
})
.done(function(res) {
// Node information can come as result/data
var data = res.result || res.data;
@ -1565,8 +1566,8 @@ define('pgadmin.browser', [
if (success && typeof(success) == 'function') {
success();
}
},
error: function(xhr, error, status) {
})
.fail(function(xhr, error, status) {
if (
!Alertify.pgHandleItemError(
xhr, error, status, {item: _i, info: info}
@ -1601,7 +1602,6 @@ define('pgadmin.browser', [
function() { console.warn(arguments); }
);
}
},
});
}.bind(this);
@ -1786,16 +1786,16 @@ define('pgadmin.browser', [
$.ajax({
url: childNodeUrl,
dataType: 'json',
success: function(res) {
})
.done(function(res) {
if (res.success) {
arrayChildNodeData.push(res.data);
}
fetchNodeInfo(_callback);
},
error: function(xhr, status, error) {
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
fetchNodeInfo(_callback);
},
});
};

View File

@ -729,15 +729,16 @@ define('pgadmin.browser.node', [
$.ajax({
url: obj.generate_url(i, input.url, d, true),
type: 'DELETE',
success: function(res) {
})
.done(function(res) {
if (res.success == 0) {
pgBrowser.report_error(res.errormsg, res.info);
} else {
pgBrowser.removeTreeNode(i, true);
}
return true;
},
error: function(jqx) {
})
.fail(function(jqx) {
var msg = jqx.responseText;
/* Error from the server */
if (jqx.status == 417 || jqx.status == 410 || jqx.status == 500) {
@ -752,7 +753,6 @@ define('pgadmin.browser.node', [
S(gettext('Error dropping %s: "%s"'))
.sprintf(obj.label, objName)
.value(), msg);
},
});
},
null).show();

View File

@ -146,16 +146,16 @@ define([
$.ajax({
async: false,
url: full_url,
success: function(res) {
})
.done(function(res) {
/*
* We will cache this data for short period of time for avoiding
* same calls.
*/
data = cache_node.cache(node.type + '#' + url, node_info, cache_level, res.data);
},
error: function() {
})
.fail(function() {
m.trigger('pgadmin:view:fetch:error', m, self.field);
},
});
m.trigger('pgadmin:view:fetched', m, self.field);
}
@ -387,16 +387,16 @@ define([
$.ajax({
async: false,
url: full_url,
success: function(res) {
})
.done(function(res) {
/*
* We will cache this data for short period of time for avoiding
* same calls.
*/
data = cache_node.cache(node.type + '#' + url, node_info, cache_level, res.data);
},
error: function() {
})
.fail(function() {
eventHandler.trigger('pgadmin:view:fetch:error', m, column);
},
});
eventHandler.trigger('pgadmin:view:fetched', m, column);
}

View File

@ -80,7 +80,8 @@ _.extend(pgBrowser, {
setTimeout(function() {
$.ajax({
url: url_for('preferences.get_all'),
success: function(res) {
})
.done(function(res) {
self.preferences_cache = res;
self.preference_version(self.generate_preference_version());
@ -102,10 +103,9 @@ _.extend(pgBrowser, {
});
}
}
},
error: function(xhr, status, error) {
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
},
});
}, 500);
},

View File

@ -89,17 +89,17 @@ define('pgadmin.dashboard', [
$.ajax({
url: action_url,
type: 'DELETE',
success: function(res) {
})
.done(function(res) {
if (res == gettext('Success')) {
Alertify.success(txtSuccess);
refresh_grid();
} else {
Alertify.error(txtError);
}
},
error: function(xhr, status, error) {
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
},
});
},
function() {
@ -214,14 +214,14 @@ define('pgadmin.dashboard', [
url: url,
type: 'GET',
dataType: 'html',
success: function(data) {
})
.done(function(data) {
$(div).html(data);
},
error: function() {
})
.fail(function() {
$(div).html(
'<div class="alert alert-danger pg-panel-message" role="alert">' + gettext('An error occurred whilst loading the dashboard.') + '</div>'
);
},
});
// Cache the current IDs for next time
@ -306,14 +306,14 @@ define('pgadmin.dashboard', [
url: url,
type: 'GET',
dataType: 'html',
success: function(data) {
})
.done(function(data) {
$(div).html(data);
},
error: function() {
})
.fail(function() {
$(div).html(
'<div class="alert alert-danger pg-panel-message" role="alert">' + gettext('An error occurred whilst loading the dashboard.') + '</div>'
);
},
});
$(dashboardPanel).data('server_status', true);
}
@ -431,12 +431,13 @@ define('pgadmin.dashboard', [
url: path,
type: 'GET',
dataType: 'html',
success: function(resp) {
})
.done(function(resp) {
$(container).removeClass('graph-error');
data = JSON.parse(resp);
pgAdmin.Dashboard.render_chart(container, data, dataset, sid, did, url, options, counter, refresh);
},
error: function(xhr) {
})
.fail(function(xhr) {
let err = '';
let msg = '';
let cls = 'info';
@ -467,7 +468,6 @@ define('pgadmin.dashboard', [
if (container.clientHeight > 0 && container.clientWidth > 0) {
setTimeout(setTimeoutFunc, refresh * 1000);
}
},
});
};

View File

@ -226,18 +226,18 @@ define('misc.bgprocess', [
cache: false,
async: true,
contentType: 'application/json',
success: function(res) {
})
.done(function(res) {
setTimeout(function() {
self.update(res);
}, 10);
},
error: function(res) {
})
.fail(function(res) {
// Try after some time only if job id present
if (res.status != 410)
setTimeout(function() {
self.update(res);
}, 10000);
},
});
},
@ -429,12 +429,12 @@ define('misc.bgprocess', [
cache: false,
async: true,
contentType: 'application/json',
success: function() {
})
.done(function() {
return;
},
error: function() {
})
.fail(function() {
console.warn(arguments);
},
});
},
});
@ -478,7 +478,8 @@ define('misc.bgprocess', [
cache: false,
async: true,
contentType: 'application/json',
success: function(res) {
})
.done(function(res) {
if (!res || !_.isArray(res)) {
return;
}
@ -498,11 +499,10 @@ define('misc.bgprocess', [
}, 3000
);
}
},
error: function() {
})
.fail(function() {
// FIXME:: What to do now?
console.warn(arguments);
},
});
},

View File

@ -82,14 +82,14 @@ module.exports = Alertify.dialog('createModeDlg', function() {
dataType: 'json',
contentType: 'application/x-download; charset=utf-8',
async: false,
success: function(resp) {
})
.done(function(resp) {
var data = resp.data.result;
if (data['Code'] === 1) {
is_exist = true;
} else {
is_exist = false;
}
},
});
return is_exist;
},
@ -109,7 +109,8 @@ module.exports = Alertify.dialog('createModeDlg', function() {
dataType: 'json',
contentType: 'application/json; charset=utf-8',
async: false,
success: function(resp) {
})
.done(function(resp) {
var data = resp.data.result;
if (data.Code === 1) {
permission = true;
@ -117,11 +118,10 @@ module.exports = Alertify.dialog('createModeDlg', function() {
$('.file_manager_ok').addClass('disabled');
Alertify.error(data.Error);
}
},
error: function() {
})
.fail(function() {
$('.file_manager_ok').addClass('disabled');
Alertify.error(gettext('Error occurred while checking access permission.'));
},
});
return permission;
},

View File

@ -242,7 +242,8 @@ define([
dataType: 'json',
contentType: 'application/json; charset=utf-8',
async: false,
success: function(resp) {
})
.done(function(resp) {
var result = resp.data.result;
if (result.Code === 1) {
var newPath = result['New Path'],
@ -275,7 +276,6 @@ define([
}
finalName = result['New Name'];
},
});
}
};
@ -305,7 +305,8 @@ define([
dataType: 'json',
contentType: 'application/json; charset=utf-8',
async: false,
success: function(resp) {
})
.done(function(resp) {
var result = resp.data.result;
if (result.Code === 1) {
isDeleted = true;
@ -319,7 +320,6 @@ define([
isDeleted = false;
Alertify.error(result.Error);
}
},
});
return isDeleted;
};
@ -356,7 +356,8 @@ define([
dataType: 'json',
contentType: 'application/json; charset=utf-8',
async: false,
success: function(resp) {
})
.done(function(resp) {
var data = resp.data.result;
if (data.Code === 1) {
$('.file_manager_ok').removeClass('disabled');
@ -383,7 +384,6 @@ define([
$('.file_manager_ok').attr('disabled', true);
Alertify.error(data.Error);
}
},
});
return is_file_valid;
};
@ -402,7 +402,8 @@ define([
dataType: 'json',
contentType: 'application/json; charset=utf-8',
async: false,
success: function(resp) {
})
.done(function(resp) {
var data = resp.data.result;
if (data.Code === 1) {
permission = true;
@ -411,14 +412,13 @@ define([
$('.file_manager_ok').attr('disabled', true);
Alertify.error(data.Error);
}
},
error: function() {
})
.fail(function() {
$('.file_manager_ok').addClass('disabled');
$('.file_manager_ok').attr('disabled', true);
Alertify.error(
gettext('Error occurred while checking access permission.')
);
},
});
return permission;
};
@ -488,7 +488,8 @@ define([
dataType: 'json',
contentType: 'application/json; charset=utf-8',
async: false,
success: function(resp) {
})
.done(function(resp) {
$('.storage_dialog #uploader .input-path').prop('disabled', false);
var result = '',
data = resp.data.result;
@ -993,10 +994,9 @@ define([
}
//input_object.set_cap(data_cap);
},
error: function() {
})
.fail(function() {
$('.storage_dialog #uploader .input-path').prop('disabled', false);
},
});
};

View File

@ -105,13 +105,14 @@ define('misc.sql', [
);
}, 1000);
},
success: function(res) {
})
.done(function(res) {
if (pgAdmin.Browser.editor.getValue() != res) {
pgAdmin.Browser.editor.setValue(res);
}
clearTimeout(timer);
},
error: function(xhr, error, message) {
})
.fail(function(xhr, error, message) {
var _label = treeHierarchy[n_type].label;
pgBrowser.Events.trigger(
'pgadmin:node:retrieval:error', 'sql', xhr, error, message, item
@ -128,7 +129,6 @@ define('misc.sql', [
function() {}
);
}
},
});
}
}

View File

@ -229,7 +229,8 @@ define('misc.statistics', [
}
}, 1000);
},
success: function(res) {
})
.done(function(res) {
// clear timer and reset message.
clearTimeout(timer);
$msgContainer.text('');
@ -267,8 +268,8 @@ define('misc.statistics', [
$msgContainer.text(res.info);
$msgContainer.removeClass('hidden');
}
},
error: function(xhr, error, message) {
})
.fail(function(xhr, error, message) {
var _label = treeHierarchy[n_type].label;
pgBrowser.Events.trigger(
'pgadmin:node:retrieval:error', 'statistics', xhr, error, message, item
@ -287,7 +288,6 @@ define('misc.statistics', [
}
// show failed message.
$msgContainer.text(gettext('Failed to retrieve data from the server.'));
},
});
}
}

View File

@ -33,18 +33,18 @@ define('pgadmin.settings', [
url: url_for('settings.reset_layout'),
type: 'DELETE',
async: false,
success: function() {
})
.done(function() {
// Prevent saving layout on server for next page reload.
$(window).unbind('unload');
window.onbeforeunload = null;
// Now reload page
location.reload(true);
},
error: function() {
})
.fail(function() {
console.warn(
'Something went wrong on server while resetting layout.'
);
},
});
},

View File

@ -337,7 +337,8 @@ define([
null, 'connect', args.info.server, true, args.info
),
dataType: 'json',
success: function(res) {
})
.done(function(res) {
if (res.success && 'connected' in res.data) {
if (res.data.connected) {
// Server is connected, but - the connection with the
@ -352,10 +353,9 @@ define([
// Serever was not connected, we should first try to connect
// the server.
reconnectServer();
},
error: function() {
})
.fail(function() {
reconnectServer();
},
});
return true;
}

View File

@ -79,7 +79,8 @@ define(['jquery', 'sources/gettext', 'sources/url_for'],
$.ajax({
url: url,
method: 'GET',
success: function (res) {
})
.done(function (res) {
if(res && res.data) {
var status = res.data.status,
msg = res.data.message,
@ -155,8 +156,8 @@ define(['jquery', 'sources/gettext', 'sources/url_for'],
.addClass('fa-custom fa-query-tool-disconnected');
}
}
},
error: function (e) {
})
.fail(function (e) {
sqlEditorUtils.previousStatus = -1;
var msg = gettext('Transaction status check failed.');
if (e.readyState == 0) {
@ -174,7 +175,6 @@ define(['jquery', 'sources/gettext', 'sources/url_for'],
$status_el.removeClass()
.addClass('fa-custom fa-query-tool-disconnected');
}
},
});
},

View File

@ -323,7 +323,8 @@ define('pgadmin.datagrid', [
async: false,
contentType: 'application/json',
data: JSON.stringify(sql),
success: function(res) {
})
.done(function(res) {
if (res.data.status) {
// Initialize the data grid.
self.create_transaction(that.baseUrl, null, 'false', parentData.server.server_type, '', grid_title, sql, false);
@ -334,13 +335,12 @@ define('pgadmin.datagrid', [
res.data.result
);
}
},
error: function(e) {
})
.fail(function(e) {
alertify.alert(
gettext('Validation Error'),
e
);
},
});
}
},
@ -376,14 +376,15 @@ define('pgadmin.datagrid', [
dataType: 'json',
data: JSON.stringify(sql_filter),
contentType: 'application/json',
success: function(res) {
})
.done(function(res) {
res.data.is_query_tool = is_query_tool;
res.data.server_type = server_type;
res.data.sURL = sURL;
res.data.panel_title = panel_title;
target.trigger('pgadmin-datagrid:transaction:created', res.data);
},
error: function(xhr) {
})
.fail(function(xhr) {
if (target !== self) {
if(xhr.status == 503 && xhr.responseJSON.info != undefined &&
xhr.responseJSON.info == 'CONNECTION_LOST') {
@ -404,7 +405,6 @@ define('pgadmin.datagrid', [
e.statusText, gettext('Query Tool Initialize Error')
);
}
},
});
},
launch_grid: function(trans_obj) {

View File

@ -291,10 +291,11 @@ define([
$.ajax({
url: _url,
cache: false,
success: function() {
})
.done(function() {
self.start_global_debugger();
},
error: function(xhr) {
})
.fail(function(xhr) {
try {
var err = JSON.parse(xhr.responseText);
if (err.success == 0) {
@ -303,7 +304,6 @@ define([
} catch (e) {
console.warn(e.stack || e);
}
},
});
},
@ -378,7 +378,8 @@ define([
$.ajax({
url: baseUrl,
method: 'GET',
success: function(res) {
})
.done(function(res) {
var url = url_for('debugger.direct', {
'trans_id': res.data.debuggerTransId,
});
@ -413,8 +414,8 @@ define([
});
});
}
},
error: function(xhr) {
})
.fail(function(xhr) {
try {
var err = JSON.parse(xhr.responseText);
if (err.success == 0) {
@ -423,7 +424,6 @@ define([
} catch (e) {
console.warn(e.stack || e);
}
},
});
},
@ -446,7 +446,8 @@ define([
$.ajax({
url: _url,
cache: false,
success: function(res) {
})
.done(function(res) {
// Open Alertify the dialog to take the input arguments from user if function having input arguments
if (res.data[0]['require_input']) {
@ -491,7 +492,8 @@ define([
$.ajax({
url: baseUrl,
method: 'GET',
success: function(res) {
})
.done(function(res) {
var url = url_for('debugger.direct', {
'trans_id': res.data.debuggerTransId,
@ -527,17 +529,16 @@ define([
});
});
}
},
error: function(e) {
})
.fail(function(e) {
Alertify.alert(
gettext('Debugger Target Initialization Error'),
e.responseJSON.errormsg
);
},
});
}
},
error: function(xhr) {
})
.fail(function(xhr) {
try {
var err = JSON.parse(xhr.responseText);
if (err.success == 0) {
@ -546,7 +547,6 @@ define([
} catch (e) {
console.warn(e.stack || e);
}
},
});
},
};

View File

@ -192,7 +192,8 @@ define([
url: _Url,
method: 'GET',
async: false,
success: function(res) {
})
.done(function(res) {
if (res.data.args_count != 0) {
for (i = 0; i < res.data.result.length; i++) {
// Below will format the data to be stored in sqlite database
@ -205,13 +206,12 @@ define([
});
}
}
},
error: function() {
})
.fail(function() {
Alertify.alert(
gettext('Debugger Error'),
gettext('Unable to fetch the arguments from server')
);
},
});
var argname, argtype, argmode, default_args_count, default_args, arg_cnt;
@ -701,7 +701,8 @@ define([
data: {
'data': JSON.stringify(args_value_list),
},
success: function(res) {
})
.done(function(res) {
var url = url_for(
'debugger.direct', {
@ -777,21 +778,20 @@ define([
data: {
'data': JSON.stringify(sqlite_func_args_list),
},
success: function() {},
error: function() {
})
.done(function() {})
.fail(function() {
Alertify.alert(
gettext('Debugger Error'),
gettext('Unable to set the arguments on the server')
);
},
});
},
error: function(e) {
})
.fail(function(e) {
Alertify.alert(
gettext('Debugger Target Initialization Error'),
e.responseJSON.errormsg
);
},
});
} else {
// If the debugging is started again then we should only set the
@ -806,13 +806,13 @@ define([
data: {
'data': JSON.stringify(args_value_list),
},
success: function() {},
error: function(e) {
})
.done(function() {})
.fail(function(e) {
Alertify.alert(
gettext('Debugger Listener Startup Error'),
e.responseJSON.errormsg
);
},
});
// Set the new input arguments given by the user during debugging
@ -828,13 +828,13 @@ define([
data: {
'data': JSON.stringify(sqlite_func_args_list),
},
success: function() {},
error: function() {
})
.done(function() {})
.fail(function() {
Alertify.alert(
gettext('Debugger Error'),
gettext('Unable to set the arguments on the server')
);
},
});
}

View File

@ -45,17 +45,17 @@ define([
$.ajax({
url: baseUrl,
method: 'GET',
success: function(res) {
})
.done(function(res) {
if (res.data.status) {
// Breakpoint has been set by the user
}
},
error: function() {
})
.fail(function() {
Alertify.alert(
gettext('Debugger Error'),
gettext('Error while setting debugging breakpoint.')
);
},
});
},
@ -107,7 +107,8 @@ define([
url: baseUrl,
method: 'GET',
async: false,
success: function(res) {
})
.done(function(res) {
if (res.data.status === 'Success') {
result = res.data.result;
} else if (res.data.status === 'NotConnected') {
@ -116,13 +117,12 @@ define([
gettext('Error while fetching breakpoint information.')
);
}
},
error: function() {
})
.fail(function() {
Alertify.alert(
gettext('Debugger Error'),
gettext('Error while fetching breakpoint information.')
);
},
});
return result;
@ -140,7 +140,8 @@ define([
$.ajax({
url: baseUrl,
method: 'GET',
success: function(res) {
})
.done(function(res) {
if (res.data.status === 'Success') {
// If status is Success then find the port number to attach the executer.
self.execute_query(trans_id);
@ -150,13 +151,12 @@ define([
gettext('Error while starting debugging session.')
);
}
},
error: function() {
})
.fail(function() {
Alertify.alert(
gettext('Debugger Error'),
gettext('Error while starting debugging session.')
);
},
});
},
@ -172,7 +172,8 @@ define([
$.ajax({
url: baseUrl,
method: 'GET',
success: function(res) {
})
.done(function(res) {
if (res.data.status === 'Success') {
// set the return code to the code editor text area
if (
@ -197,13 +198,12 @@ define([
gettext('Error while executing requested debugging information.')
);
}
},
error: function() {
})
.fail(function() {
Alertify.alert(
gettext('Debugger Error'),
gettext('Error while executing requested debugging information.')
);
},
});
},
@ -220,7 +220,8 @@ define([
$.ajax({
url: baseUrl,
method: 'GET',
success: function(res) {
})
.done(function(res) {
if (res.data.status === 'Success') {
// Call function to create and update local variables
self.AddLocalVariables(res.data.result);
@ -239,13 +240,12 @@ define([
gettext('Error while fetching variable information.')
);
}
},
error: function() {
})
.fail(function() {
Alertify.alert(
gettext('Debugger Error'),
gettext('Error while fetching variable information.')
);
},
});
},
@ -262,7 +262,8 @@ define([
$.ajax({
url: baseUrl,
method: 'GET',
success: function(res) {
})
.done(function(res) {
if (res.data.status === 'Success') {
// Call function to create and update stack information
self.AddStackInformation(res.data.result);
@ -273,13 +274,12 @@ define([
gettext('Error while fetching stack information.')
);
}
},
error: function() {
})
.fail(function() {
Alertify.alert(
gettext('Debugger Error'),
gettext('Error while fetching stack information.')
);
},
});
},
@ -323,7 +323,8 @@ define([
// set cursor to progress before every poll.
$('.debugger-container').addClass('show_progress');
},
success: function(res) {
})
.done(function(res) {
// remove progress cursor
$('.debugger-container').removeClass('show_progress');
@ -415,13 +416,12 @@ define([
gettext('Error while polling result.')
);
}
},
error: function() {
})
.fail(function() {
Alertify.alert(
gettext('Debugger Error'),
gettext('Error while polling result.')
);
},
});
}, poll_timeout);
@ -484,7 +484,8 @@ define([
$.ajax({
url: baseUrl,
method: 'GET',
success: function(res) {
})
.done(function(res) {
if (res.data.status === 'Success') {
if (res.data.result == undefined) {
/*
@ -609,13 +610,12 @@ define([
// Stop further pooling
pgTools.DirectDebug.is_polling_required = false;
}
},
error: function() {
})
.fail(function() {
Alertify.alert(
gettext('Debugger Error'),
gettext('Error while polling result.')
);
},
});
}, poll_end_timeout);
@ -642,7 +642,8 @@ define([
$.ajax({
url: baseUrl,
success: function(res) {
})
.done(function(res) {
// Restart the same function debugging with previous arguments
var restart_dbg = res.data.restart_debug ? 1 : 0;
@ -674,21 +675,21 @@ define([
$.ajax({
url: baseUrl,
method: 'GET',
success: function() {
})
.done(function() {
if (pgTools.DirectDebug.debug_type) {
self.poll_end_execution_result(trans_id);
}
},
error: function() {
})
.fail(function() {
Alertify.alert(
gettext('Debugger Error'),
gettext('Error while polling result.')
);
},
});
}
},
error: function(xhr) {
})
.fail(function(xhr) {
try {
var err = JSON.parse(xhr.responseText);
if (err.success == 0) {
@ -697,7 +698,6 @@ define([
} catch (e) {
console.warn(e.stack || e);
}
},
});
},
@ -724,7 +724,8 @@ define([
$.ajax({
url: baseUrl,
method: 'GET',
success: function(res) {
})
.done(function(res) {
if (res.data.status) {
self.poll_result(trans_id);
} else {
@ -733,13 +734,12 @@ define([
gettext('Error while executing continue in debugging session.')
);
}
},
error: function() {
})
.fail(function() {
Alertify.alert(
gettext('Debugger Error'),
gettext('Error while executing continue in debugging session.')
);
},
});
}
},
@ -761,7 +761,8 @@ define([
$.ajax({
url: baseUrl,
method: 'GET',
success: function(res) {
})
.done(function(res) {
if (res.data.status) {
self.poll_result(trans_id);
} else {
@ -770,13 +771,12 @@ define([
gettext('Error while executing step over in debugging session.')
);
}
},
error: function() {
})
.fail(function() {
Alertify.alert(
gettext('Debugger Error'),
gettext('Error while executing step over in debugging session.')
);
},
});
},
@ -797,7 +797,8 @@ define([
$.ajax({
url: baseUrl,
method: 'GET',
success: function(res) {
})
.done(function(res) {
if (res.data.status) {
self.poll_result(trans_id);
} else {
@ -806,13 +807,12 @@ define([
gettext('Error while executing step into in debugging session.')
);
}
},
error: function() {
})
.fail(function() {
Alertify.alert(
gettext('Debugger Error'),
gettext('Error while executing step into in debugging session.')
);
},
});
},
@ -834,7 +834,8 @@ define([
$.ajax({
url: baseUrl,
method: 'GET',
success: function(res) {
})
.done(function(res) {
if (res.data.status) {
// Call function to create and update local variables ....
pgTools.DirectDebug.editor.removeLineClass(
@ -859,13 +860,12 @@ define([
gettext('Error while executing stop in debugging session.')
);
}
},
error: function() {
})
.fail(function() {
Alertify.alert(
gettext('Debugger Error'),
gettext('Error while executing stop in debugging session.')
);
},
});
},
@ -901,7 +901,8 @@ define([
$.ajax({
url: baseUrl,
method: 'GET',
success: function(res) {
})
.done(function(res) {
if (res.data.status) {
// Call function to create and update local variables ....
var info = pgTools.DirectDebug.editor.lineInfo(self.active_line_no);
@ -928,13 +929,12 @@ define([
gettext('Error while toggling breakpoint.')
);
}
},
error: function() {
})
.fail(function() {
Alertify.alert(
gettext('Debugger Error'),
gettext('Error while toggling breakpoint.')
);
},
});
},
@ -972,7 +972,8 @@ define([
data: {
'breakpoint_list': breakpoint_list.join(),
},
success: function(res) {
})
.done(function(res) {
if (res.data.status) {
for (var i = 0; i < breakpoint_list.length; i++) {
var info = pgTools.DirectDebug.editor.lineInfo((breakpoint_list[i] - 1));
@ -990,13 +991,12 @@ define([
self.enable('toggle_breakpoint', true);
self.enable('clear_all_breakpoints', true);
self.enable('continue', true);
},
error: function() {
})
.fail(function() {
Alertify.alert(
gettext('Debugger Error'),
gettext('Error while clearing all breakpoint.')
);
},
});
},
@ -1332,7 +1332,8 @@ define([
data: {
'data': JSON.stringify(name_value_list),
},
success: function(res) {
})
.done(function(res) {
if (res.data.status) {
// Get the updated variables value
self.GetLocalVariables(pgTools.DirectDebug.trans_id);
@ -1343,13 +1344,12 @@ define([
Alertify.error(res.data.info, 3);
}
}
},
error: function() {
})
.fail(function() {
Alertify.alert(
gettext('Debugger Error'),
gettext('Error while depositing variable value.')
);
},
});
},
@ -1364,7 +1364,8 @@ define([
$.ajax({
url: baseUrl,
method: 'GET',
success: function(res) {
})
.done(function(res) {
if (res.data.status) {
pgTools.DirectDebug.editor.setValue(res.data.result[0].src);
self.UpdateBreakpoint(pgTools.DirectDebug.trans_id);
@ -1377,13 +1378,12 @@ define([
// Call function to create and update local variables ....
self.GetLocalVariables(pgTools.DirectDebug.trans_id);
}
},
error: function() {
})
.fail(function() {
Alertify.alert(
gettext('Debugger Error'),
gettext('Error while selecting frame.')
);
},
});
},
}
@ -1597,18 +1597,18 @@ define([
$.ajax({
url: baseUrl,
method: 'GET',
success: function(res) {
})
.done(function(res) {
if (res.data.status) {
self.intializePanels();
controller.poll_result(trans_id);
}
},
error: function() {
})
.fail(function() {
Alertify.alert(
gettext('Debugger Error'),
gettext('Error while starting debugging listener.')
);
},
});
} else if (trans_id != undefined && debug_type) {
// Make ajax call to execute the and start the target for execution
@ -1619,17 +1619,17 @@ define([
$.ajax({
url: baseUrl,
method: 'GET',
success: function(res) {
})
.done(function(res) {
if (res.data.status) {
self.messages(trans_id);
}
},
error: function() {
})
.fail(function() {
Alertify.alert(
gettext('Debugger Error'),
gettext('Error while starting debugging listener.')
);
},
});
} else
this.intializePanels();
@ -1647,7 +1647,8 @@ define([
$.ajax({
url: baseUrl,
method: 'GET',
success: function(res) {
})
.done(function(res) {
if (res.data.status === 'Success') {
self.intializePanels();
// If status is Success then find the port number to attach the executer.
@ -1662,13 +1663,12 @@ define([
res.data.result
);
}
},
error: function() {
})
.fail(function() {
Alertify.alert(
gettext('Debugger Error'),
gettext('Error while fetching messages information.')
);
},
});
},

View File

@ -526,13 +526,14 @@ Backform, commonUtils, supportedNodes
data: {
'data': JSON.stringify(this.view.model.toJSON()),
},
success: function(res) {
})
.done(function(res) {
if (res.success) {
Alertify.success(gettext('Import/export job created.'), 5);
pgBrowser.Events.trigger('pgadmin-bgprocess:created', self);
}
},
error: function(xhr) {
})
.fail(function(xhr) {
try {
var err = JSON.parse(xhr.responseText);
Alertify.alert(
@ -542,7 +543,6 @@ Backform, commonUtils, supportedNodes
} catch (e) {
console.warn(e.stack || e);
}
},
});
}
},

View File

@ -385,7 +385,8 @@ define([
data: {
'data': JSON.stringify(this.view.model.toJSON()),
},
success: function(res) {
})
.done(function(res) {
if (res.data && res.data.status) {
//Do nothing as we are creating the job and exiting from the main dialog
Alertify.success(res.data.info);
@ -393,12 +394,11 @@ define([
} else {
Alertify.error(res.data.errmsg);
}
},
error: function() {
})
.fail(function() {
Alertify.alert(
gettext('Maintenance job creation failed.')
);
},
});
}
},

View File

@ -427,7 +427,8 @@ define('tools.querytool', [
method: 'POST',
contentType: 'application/json',
data: JSON.stringify(self.data),
success: function(res) {
})
.done(function(res) {
var result = [];
_.each(res.data.result, function(obj, key) {
@ -488,12 +489,11 @@ define('tools.querytool', [
ch: end,
},
});
},
error:function(e) {
})
.fail(function(e) {
return httpErrorHandler.handleLoginRequiredAndTransactionRequired(
pgAdmin, self, e, null, [], false
);
},
});
}.bind(ctx),
};
@ -1101,7 +1101,8 @@ define('tools.querytool', [
$.ajax({
url: url,
method: 'GET',
success: function(res) {
})
.done(function(res) {
self.handler.has_more_rows = res.data.has_more_rows;
$('#btn-flash').prop('disabled', false);
self.handler.trigger('pgadmin-sqleditor:loading-icon:hide');
@ -1110,8 +1111,8 @@ define('tools.querytool', [
if (typeof cb == 'function') {
cb();
}
},
error: function(e) {
})
.fail(function(e) {
$('#btn-flash').prop('disabled', false);
self.handler.trigger('pgadmin-sqleditor:loading-icon:hide');
self.handler.has_more_rows = false;
@ -1124,7 +1125,6 @@ define('tools.querytool', [
pgAdmin, self, e, null, [], false
);
self.update_msg_history(false, msg);
},
});
},
@ -1946,14 +1946,15 @@ define('tools.querytool', [
$.ajax({
url: script_type_url,
type:'GET',
success: function(res) {
})
.done(function(res) {
self.gridView.query_tool_obj.refresh();
if (res && res !== '') {
self.gridView.query_tool_obj.setValue(res);
}
self.init_events();
},
error: function(jqx) {
})
.fail(function(jqx) {
let msg = '';
self.init_events();
@ -1964,7 +1965,6 @@ define('tools.querytool', [
pgBrowser.report_error(
S(gettext('Error fetching SQL for script: %s.')).sprintf(msg).value()
);
},
});
} else {
self.init_events();
@ -2086,7 +2086,8 @@ define('tools.querytool', [
$.ajax({
url: url,
method: 'GET',
success: function(res) {
})
.done(function(res) {
if (res.data.status) {
self.can_edit = res.data.can_edit;
self.can_filter = res.data.can_filter;
@ -2125,14 +2126,13 @@ define('tools.querytool', [
self.trigger('pgadmin-sqleditor:loading-icon:hide');
self.update_msg_history(false, res.data.result);
}
},
error: function(e) {
})
.fail(function(e) {
self.trigger('pgadmin-sqleditor:loading-icon:hide');
let msg = httpErrorHandler.handleQueryToolAjaxError(
pgAdmin, self, e, '_run_query', [], true
);
self.update_msg_history(false, msg);
},
});
},
@ -2621,7 +2621,8 @@ define('tools.querytool', [
method: 'POST',
contentType: 'application/json',
data: JSON.stringify(req_data),
success: function(res) {
})
.done(function(res) {
var grid = self.slickgrid,
dataView = grid.getData(),
data_length = dataView.getLength(),
@ -2739,14 +2740,13 @@ define('tools.querytool', [
if (self.close_on_save) {
self.close();
}
},
error: function(e) {
})
.fail(function(e) {
let stateParams = [view, controller, save_as];
let msg = httpErrorHandler.handleQueryToolAjaxError(
pgAdmin, self, e, '_save', stateParams, true
);
self.update_msg_history(false, msg);
},
});
}
},
@ -2872,7 +2872,8 @@ define('tools.querytool', [
method: 'POST',
contentType: 'application/json',
data: JSON.stringify(data),
success: function(res) {
})
.done(function(res) {
self.gridView.query_tool_obj.setValue(res);
self.gridView.current_file = e;
self.setTitle(self.gridView.current_file.split('\\').pop().split('/').pop(), true);
@ -2887,8 +2888,8 @@ define('tools.querytool', [
// Update the flag as new content is just loaded.
self.is_query_changed = false;
setTimeout(() => { self.gridView.query_tool_obj.focus(); }, 200);
},
error: function(e) {
})
.fail(function(e) {
self.trigger('pgadmin-sqleditor:loading-icon:hide');
let stateParams = [_e];
let msg = httpErrorHandler.handleQueryToolAjaxError(
@ -2897,7 +2898,6 @@ define('tools.querytool', [
alertify.error(msg);
// hide cursor
$busy_icon_div.removeClass('show_progress');
},
});
},
@ -2920,7 +2920,8 @@ define('tools.querytool', [
method: 'POST',
contentType: 'application/json',
data: JSON.stringify(data),
success: function(res) {
})
.done(function(res) {
if (res.data.status) {
alertify.success(gettext('File saved successfully.'));
self.gridView.current_file = e;
@ -2937,15 +2938,14 @@ define('tools.querytool', [
if (self.close_on_save) {
self.close();
}
},
error: function(e) {
})
.fail(function(e) {
self.trigger('pgadmin-sqleditor:loading-icon:hide');
let stateParams = [_e];
let msg = httpErrorHandler.handleQueryToolAjaxError(
pgAdmin, self, e, '_save_file_handler', stateParams, false
);
alertify.error(msg);
},
});
},
@ -3046,7 +3046,8 @@ define('tools.querytool', [
method: 'POST',
contentType: 'application/json',
data: JSON.stringify(data),
success: function(res) {
})
.done(function(res) {
self.trigger('pgadmin-sqleditor:loading-icon:hide');
setTimeout(
function() {
@ -3058,14 +3059,13 @@ define('tools.querytool', [
}
}
);
},
error: function(e) {
})
.fail(function(e) {
self.trigger('pgadmin-sqleditor:loading-icon:hide');
let msg = httpErrorHandler.handleQueryToolAjaxError(
pgAdmin, self, e, '_include_filter', [], true
);
alertify.alert(gettext('Filter By Selection Error'), msg);
},
});
},
@ -3105,7 +3105,8 @@ define('tools.querytool', [
method: 'POST',
contentType: 'application/json',
data: JSON.stringify(data),
success: function(res) {
})
.done(function(res) {
self.trigger('pgadmin-sqleditor:loading-icon:hide');
setTimeout(
function() {
@ -3117,14 +3118,13 @@ define('tools.querytool', [
}
}, 10
);
},
error: function(e) {
})
.fail(function(e) {
self.trigger('pgadmin-sqleditor:loading-icon:hide');
let msg = httpErrorHandler.handleQueryToolAjaxError(
pgAdmin, self, e, '_exclude_filter', [], true
);
alertify.alert(gettext('Filter Exclude Selection Error'), msg);
},
});
},
@ -3143,7 +3143,8 @@ define('tools.querytool', [
'trans_id': self.transId,
}),
method: 'POST',
success: function(res) {
})
.done(function(res) {
self.trigger('pgadmin-sqleditor:loading-icon:hide');
setTimeout(
function() {
@ -3155,14 +3156,13 @@ define('tools.querytool', [
}
}
);
},
error: function(e) {
})
.fail(function(e) {
self.trigger('pgadmin-sqleditor:loading-icon:hide');
let msg = httpErrorHandler.handleQueryToolAjaxError(
pgAdmin, self, e, '_remove_filter', [], true
);
alertify.alert(gettext('Remove Filter Error'), msg);
},
});
},
@ -3184,7 +3184,8 @@ define('tools.querytool', [
method: 'POST',
contentType: 'application/json',
data: JSON.stringify(sql),
success: function(res) {
})
.done(function(res) {
self.trigger('pgadmin-sqleditor:loading-icon:hide');
setTimeout(
function() {
@ -3198,14 +3199,13 @@ define('tools.querytool', [
}
}, 10
);
},
error: function(e) {
})
.fail(function(e) {
self.trigger('pgadmin-sqleditor:loading-icon:hide');
let msg = httpErrorHandler.handleQueryToolAjaxError(
pgAdmin, self, e, '_apply_filter', [], true
);
alertify.alert(gettext('Apply Filter Error'), msg);
},
});
},
@ -3310,7 +3310,8 @@ define('tools.querytool', [
method: 'POST',
contentType: 'application/json',
data: JSON.stringify(limit),
success: function(res) {
})
.done(function(res) {
self.trigger('pgadmin-sqleditor:loading-icon:hide');
setTimeout(
function() {
@ -3321,14 +3322,13 @@ define('tools.querytool', [
alertify.alert(gettext('Change limit Error'), res.data.result);
}, 10
);
},
error: function(e) {
})
.fail(function(e) {
self.trigger('pgadmin-sqleditor:loading-icon:hide');
let msg = httpErrorHandler.handleQueryToolAjaxError(
pgAdmin, self, e, '_set_limit', [], true
);
alertify.alert(gettext('Change limit Error'), msg);
},
});
},
@ -3440,22 +3440,22 @@ define('tools.querytool', [
}),
method: 'POST',
contentType: 'application/json',
success: function(res) {
})
.done(function(res) {
if (!res.data.status) {
alertify.alert(gettext('Cancel Query Error'), res.data.result);
}
self.disable_tool_buttons(false);
is_query_running = false;
setTimeout(() => { self.gridView.query_tool_obj.focus(); }, 200);
},
error: function(e) {
})
.fail(function(e) {
self.disable_tool_buttons(false);
let msg = httpErrorHandler.handleQueryToolAjaxError(
pgAdmin, self, e, '_cancel_query', [], false
);
alertify.alert(gettext('Cancel Query Error'), msg);
},
});
},
@ -3502,19 +3502,19 @@ define('tools.querytool', [
method: 'POST',
contentType: 'application/json',
data: JSON.stringify(auto_rollback),
success: function(res) {
})
.done(function(res) {
if (!res.data.status)
alertify.alert(gettext('Auto Rollback Error'), res.data.result);
else
self.call_cache_preferences();
},
error: function(e) {
})
.fail(function(e) {
let msg = httpErrorHandler.handleQueryToolAjaxError(
pgAdmin, self, e, '_auto_rollback', [], true
);
alertify.alert(gettext('Auto Rollback Error'), msg);
},
});
},
@ -3537,18 +3537,18 @@ define('tools.querytool', [
method: 'POST',
contentType: 'application/json',
data: JSON.stringify(auto_commit),
success: function(res) {
})
.done(function(res) {
if (!res.data.status)
alertify.alert(gettext('Auto Commit Error'), res.data.result);
else
self.call_cache_preferences();
},
error: function(e) {
})
.fail(function(e) {
let msg = httpErrorHandler.handleQueryToolAjaxError(
pgAdmin, self, e, '_auto_commit', [], true
);
alertify.alert(gettext('Auto Commit Error'), msg);
},
});
},
@ -3562,7 +3562,8 @@ define('tools.querytool', [
method: 'PUT',
contentType: 'application/json',
data: JSON.stringify(data),
success: function(res) {
})
.done(function(res) {
if (res.success == undefined || !res.success) {
alertify.alert(gettext('Explain options error'),
gettext('Error occurred while setting %(subItem)s option in explain.',
@ -3571,13 +3572,12 @@ define('tools.querytool', [
}
else
self.call_cache_preferences();
},
error: function(e) {
})
.fail(function(e) {
let msg = httpErrorHandler.handleQueryToolAjaxError(
pgAdmin, self, e, caller, [], true
);
alertify.alert(gettext('Explain options error'), msg);
},
});
},

View File

@ -776,17 +776,17 @@ define([
url: ROLEURL,
method: 'GET',
async: false,
success: function(res) {
})
.done(function(res) {
Roles = res;
},
error: function() {
})
.fail(function() {
setTimeout(function() {
alertify.alert(
gettext('Error'),
gettext('Cannot load user roles.')
);
}, 100);
},
});
var view = this.view = new Backgrid.Grid({