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, cache: false,
async: false, async: false,
data: {'srctyp' : srcTyp, 'trgtyp' : trgtyp}, data: {'srctyp' : srcTyp, 'trgtyp' : trgtyp},
})
// On success return function list from server // On success return function list from server
success: function(result) { .done(function(result) {
res = result.data; res = result.data;
return res; return res;
}, })
// On failure show error appropriate error message to user // On failure show error appropriate error message to user
error: function(xhr, status, error) { .fail(function(xhr, status, error) {
alertify.pgRespErrorNotify(xhr, error); alertify.pgRespErrorNotify(xhr, error);
},
}); });
} }
return res; return res;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -80,7 +80,8 @@ _.extend(pgBrowser, {
setTimeout(function() { setTimeout(function() {
$.ajax({ $.ajax({
url: url_for('preferences.get_all'), url: url_for('preferences.get_all'),
success: function(res) { })
.done(function(res) {
self.preferences_cache = res; self.preferences_cache = res;
self.preference_version(self.generate_preference_version()); 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); Alertify.pgRespErrorNotify(xhr, error);
},
}); });
}, 500); }, 500);
}, },

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -229,7 +229,8 @@ define('misc.statistics', [
} }
}, 1000); }, 1000);
}, },
success: function(res) { })
.done(function(res) {
// clear timer and reset message. // clear timer and reset message.
clearTimeout(timer); clearTimeout(timer);
$msgContainer.text(''); $msgContainer.text('');
@ -267,8 +268,8 @@ define('misc.statistics', [
$msgContainer.text(res.info); $msgContainer.text(res.info);
$msgContainer.removeClass('hidden'); $msgContainer.removeClass('hidden');
} }
}, })
error: function(xhr, error, message) { .fail(function(xhr, error, message) {
var _label = treeHierarchy[n_type].label; var _label = treeHierarchy[n_type].label;
pgBrowser.Events.trigger( pgBrowser.Events.trigger(
'pgadmin:node:retrieval:error', 'statistics', xhr, error, message, item 'pgadmin:node:retrieval:error', 'statistics', xhr, error, message, item
@ -287,7 +288,6 @@ define('misc.statistics', [
} }
// show failed message. // show failed message.
$msgContainer.text(gettext('Failed to retrieve data from the server.')); $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'), url: url_for('settings.reset_layout'),
type: 'DELETE', type: 'DELETE',
async: false, async: false,
success: function() { })
.done(function() {
// Prevent saving layout on server for next page reload. // Prevent saving layout on server for next page reload.
$(window).unbind('unload'); $(window).unbind('unload');
window.onbeforeunload = null; window.onbeforeunload = null;
// Now reload page // Now reload page
location.reload(true); location.reload(true);
}, })
error: function() { .fail(function() {
console.warn( console.warn(
'Something went wrong on server while resetting layout.' 'Something went wrong on server while resetting layout.'
); );
},
}); });
}, },

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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