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) {
res = result.data;
return res;
},
// On failure show error appropriate error message to user
error: function(xhr, status, error) {
alertify.pgRespErrorNotify(xhr, error);
},
})
// On success return function list from server
.done(function(result) {
res = result.data;
return res;
})
// On failure show error appropriate error message to user
.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) {
/*
* 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);
})
.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() {
m.trigger('pgadmin:view:fetch:error', m, self.field);
},
})
.fail(function() {
m.trigger('pgadmin:view:fetch:error', m, self.field);
});
m.trigger('pgadmin:view:fetched', m, self.field);

View File

@ -111,20 +111,20 @@ define('pgadmin.node.fts_configuration', [
$.ajax({
async: false,
url: full_url,
success: 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() {
m.trigger('pgadmin:view:fetch:error', m, self.field);
},
})
.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
);
})
.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) {
data = res;
},
error: function() {
m.trigger('pgadmin-view:fetch:error', m, self.field);
},
})
.done(function (res) {
data = res;
})
.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) {
res = result.data;
return res;
},
// On failure show error appropriate error message to user
error: function(xhr, status, error) {
alertify.pgRespErrorNotify(xhr, error);
},
})
// On success return function list from server
.done(function(result) {
res = result.data;
return res;
})
// On failure show error appropriate error message to user
.fail(function(xhr, status, error) {
alertify.pgRespErrorNotify(xhr, error);
});
return res;
},

View File

@ -61,21 +61,21 @@ define('pgadmin.node.check_constraint', [
$.ajax({
url: obj.generate_url(i, 'validate', d, true),
type:'GET',
success: function(res) {
if (res.success == 1) {
alertify.success(res.info);
t.removeIcon(i);
data.valid = true;
data.icon = 'icon-check_constraint';
t.addIcon(i, {icon: data.icon});
setTimeout(function() {t.deselect(i);}, 10);
setTimeout(function() {t.select(i);}, 100);
}
},
error: function(xhr, status, error) {
alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
},
})
.done(function(res) {
if (res.success == 1) {
alertify.success(res.info);
t.removeIcon(i);
data.valid = true;
data.icon = 'icon-check_constraint';
t.addIcon(i, {icon: data.icon});
setTimeout(function() {t.deselect(i);}, 10);
setTimeout(function() {t.select(i);}, 100);
}
})
.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) {
data = res.data;
self.column.set('options', data);
},
error: function() {
eventHandler.trigger('pgadmin:view:fetch:error', m, self.column);
},
})
.done(function(res) {
data = res.data;
self.column.set('options', data);
})
.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) {
data = res.data;
self.column.set('options', data);
},
error: function() {
eventHandler.trigger('pgadmin:view:fetch:error', m, self.column);
},
})
.done(function(res) {
data = res.data;
self.column.set('options', data);
})
.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) {
data = res.data;
},
error: function() {
m.trigger('pgadmin:view:fetch:error', m, self.field);
},
})
.done(function(res) {
data = res.data;
})
.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) {
coveringindex = res.data;
},
error: function() {
m.trigger('pgadmin:view:fetch:error', m, self.field);
},
})
.done(function(res) {
coveringindex = res.data;
})
.fail(function() {
m.trigger('pgadmin:view:fetch:error', m, self.field);
});
m.trigger('pgadmin:view:fetched', m, self.field);
}
@ -653,21 +653,21 @@ define('pgadmin.node.foreign_key', [
$.ajax({
url: obj.generate_url(i, 'validate', d, true),
type:'GET',
success: function(res) {
if (res.success == 1) {
Alertify.success(res.info);
t.removeIcon(i);
data.valid = true;
data.icon = 'icon-foreign_key';
t.addIcon(i, {icon: data.icon});
setTimeout(function() {t.deselect(i);}, 10);
setTimeout(function() {t.select(i);}, 100);
}
},
error: function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
},
})
.done(function(res) {
if (res.success == 1) {
Alertify.success(res.info);
t.removeIcon(i);
data.valid = true;
data.icon = 'icon-foreign_key';
t.addIcon(i, {icon: data.icon});
setTimeout(function() {t.deselect(i);}, 10);
setTimeout(function() {t.select(i);}, 100);
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
});
return false;

View File

@ -134,21 +134,21 @@ function(
type:'PUT',
data: params,
dataType: 'json',
success: function(res) {
if (res.success == 1) {
Alertify.success(res.info);
t.unload(i);
t.setInode(i);
t.deselect(i);
setTimeout(function() {
t.select(i);
}, 10);
}
},
error: function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
})
.done(function(res) {
if (res.success == 1) {
Alertify.success(res.info);
t.unload(i);
},
t.setInode(i);
t.deselect(i);
setTimeout(function() {
t.select(i);
}, 10);
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
});
},
/* Truncate table */
@ -182,25 +182,25 @@ function(
type:'PUT',
data: params,
dataType: 'json',
success: function(res) {
if (res.success == 1) {
Alertify.success(res.info);
t.removeIcon(i);
data.icon = 'icon-partition';
t.addIcon(i, {icon: data.icon});
t.unload(i);
t.setInode(i);
t.deselect(i);
// Fetch updated data from server
setTimeout(function() {
t.select(i);
}, 10);
}
},
error: function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
})
.done(function(res) {
if (res.success == 1) {
Alertify.success(res.info);
t.removeIcon(i);
data.icon = 'icon-partition';
t.addIcon(i, {icon: data.icon});
t.unload(i);
},
t.setInode(i);
t.deselect(i);
// Fetch updated data from server
setTimeout(function() {
t.select(i);
}, 10);
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
});
}},
function() {}
@ -225,25 +225,25 @@ function(
$.ajax({
url: obj.generate_url(i, 'reset' , d, true),
type:'DELETE',
success: function(res) {
if (res.success == 1) {
Alertify.success(res.info);
t.removeIcon(i);
data.icon = 'icon-partition';
t.addIcon(i, {icon: data.icon});
t.unload(i);
t.setInode(i);
t.deselect(i);
// Fetch updated data from server
setTimeout(function() {
t.select(i);
}, 10);
}
},
error: function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
})
.done(function(res) {
if (res.success == 1) {
Alertify.success(res.info);
t.removeIcon(i);
data.icon = 'icon-partition';
t.addIcon(i, {icon: data.icon});
t.unload(i);
},
t.setInode(i);
t.deselect(i);
// Fetch updated data from server
setTimeout(function() {
t.select(i);
}, 10);
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
});
}
},
@ -268,26 +268,26 @@ function(
$.ajax({
url: obj.generate_url(i, 'detach' , d, true),
type:'PUT',
success: function(res) {
if (res.success == 1) {
Alertify.success(res.info);
var n = t.next(i);
})
.done(function(res) {
if (res.success == 1) {
Alertify.success(res.info);
var n = t.next(i);
if (!n || !n.length) {
n = t.prev(i);
if (!n || !n.length) {
n = t.prev(i);
if (!n || !n.length) {
n = t.parent(i);
t.setInode(n, true);
}
}
t.remove(i);
if (n.length) {
t.select(n);
n = t.parent(i);
t.setInode(n, true);
}
}
},
error: function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
},
t.remove(i);
if (n.length) {
t.select(n);
}
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
});
}
},
@ -874,19 +874,19 @@ function(
type: 'GET',
async: false,
success: function(res) {
if (res.success == 1) {
self.model.table_options = res.data;
}
else {
Alertify.alert(
gettext('Error fetching tables to be attached'), res.data.result
);
}
},
error: function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error, gettext('Error fetching tables to be attached'));
},
})
.done(function(res) {
if (res.success == 1) {
self.model.table_options = res.data;
}
else {
Alertify.alert(
gettext('Error fetching tables to be attached'), res.data.result
);
}
})
.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) {
data = cache_node.cache(url, node_info, cache_level, res.data);
},
error: function() {
m.trigger('pgadmin:view:fetch:error', m, self.field);
},
})
.done(function(res) {
data = cache_node.cache(url, node_info, cache_level, res.data);
})
.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,25 +164,25 @@ define('pgadmin.node.table', [
type:'PUT',
data: params,
dataType: 'json',
success: function(res) {
if (res.success == 1) {
Alertify.success(res.info);
t.removeIcon(i);
data.icon = data.is_partitioned ? 'icon-partition': 'icon-table';
t.addIcon(i, {icon: data.icon});
t.unload(i);
t.setInode(i);
t.deselect(i);
// Fetch updated data from server
setTimeout(function() {
t.select(i);
}, 10);
}
},
error: function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
})
.done(function(res) {
if (res.success == 1) {
Alertify.success(res.info);
t.removeIcon(i);
data.icon = data.is_partitioned ? 'icon-partition': 'icon-table';
t.addIcon(i, {icon: data.icon});
t.unload(i);
},
t.setInode(i);
t.deselect(i);
// Fetch updated data from server
setTimeout(function() {
t.select(i);
}, 10);
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
});
}
}, function() {}
@ -207,25 +207,25 @@ define('pgadmin.node.table', [
$.ajax({
url: obj.generate_url(i, 'reset' , d, true),
type:'DELETE',
success: function(res) {
if (res.success == 1) {
Alertify.success(res.info);
t.removeIcon(i);
data.icon = data.is_partitioned ? 'icon-partition': 'icon-table';
t.addIcon(i, {icon: data.icon});
t.unload(i);
t.setInode(i);
t.deselect(i);
// Fetch updated data from server
setTimeout(function() {
t.select(i);
}, 10);
}
},
error: function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
})
.done(function(res) {
if (res.success == 1) {
Alertify.success(res.info);
t.removeIcon(i);
data.icon = data.is_partitioned ? 'icon-partition': 'icon-table';
t.addIcon(i, {icon: data.icon});
t.unload(i);
},
t.setInode(i);
t.deselect(i);
// Fetch updated data from server
setTimeout(function() {
t.select(i);
}, 10);
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
});
}
},
@ -245,20 +245,20 @@ define('pgadmin.node.table', [
$.ajax({
url: obj.generate_url(i, 'count_rows' , d, true),
type:'GET',
success: function(res) {
Alertify.success(res.info);
d.rows_cnt = res.data.total_rows;
t.unload(i);
t.setInode(i);
t.deselect(i);
setTimeout(function() {
t.select(i);
}, 10);
},
error: function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
},
})
.done(function(res) {
Alertify.success(res.info);
d.rows_cnt = res.data.total_rows;
t.unload(i);
t.setInode(i);
t.deselect(i);
setTimeout(function() {
t.select(i);
}, 10);
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
});
},
},
@ -983,19 +983,19 @@ define('pgadmin.node.table', [
type: 'GET',
async: false,
success: function(res) {
if (res.success == 1) {
self.model.table_options = res.data;
}
else {
Alertify.alert(
gettext('Error fetching tables to be attached'), res.data.result
);
}
},
error: function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
},
})
.done(function(res) {
if (res.success == 1) {
self.model.table_options = res.data;
}
else {
Alertify.alert(
gettext('Error fetching tables to be attached'), res.data.result
);
}
})
.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) {
data = cache_node.cache(url, node_info, cache_level, res.data);
},
error: function() {
m.trigger('pgadmin:view:fetch:error', m, self.field);
},
})
.done(function(res) {
data = cache_node.cache(url, node_info, cache_level, res.data);
})
.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,25 +118,25 @@ define('pgadmin.node.trigger', [
type:'PUT',
data: {'enable' : true},
dataType: 'json',
success: function(res) {
if (res.success == 1) {
alertify.success(res.info);
t.removeIcon(i);
data.icon = 'icon-trigger';
t.addIcon(i, {icon: data.icon});
t.unload(i);
t.setInode(false);
t.deselect(i);
// Fetch updated data from server
setTimeout(function() {
t.select(i);
}, 10);
}
},
error: function(xhr, status, error) {
alertify.pgRespErrorNotify(xhr, error);
})
.done(function(res) {
if (res.success == 1) {
alertify.success(res.info);
t.removeIcon(i);
data.icon = 'icon-trigger';
t.addIcon(i, {icon: data.icon});
t.unload(i);
},
t.setInode(false);
t.deselect(i);
// Fetch updated data from server
setTimeout(function() {
t.select(i);
}, 10);
}
})
.fail(function(xhr, status, error) {
alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
});
},
/* Disable trigger */
@ -156,25 +156,25 @@ define('pgadmin.node.trigger', [
type:'PUT',
data: {'enable' : false},
dataType: 'json',
success: function(res) {
if (res.success == 1) {
alertify.success(res.info);
t.removeIcon(i);
data.icon = 'icon-trigger-bad';
t.addIcon(i, {icon: data.icon});
t.unload(i);
t.setInode(false);
t.deselect(i);
// Fetch updated data from server
setTimeout(function() {
t.select(i);
}, 10);
}
},
error: function(xhr, status, error) {
alertify.pgRespErrorNotify(xhr, error, gettext('Disable trigger failed'));
})
.done(function(res) {
if (res.success == 1) {
alertify.success(res.info);
t.removeIcon(i);
data.icon = 'icon-trigger-bad';
t.addIcon(i, {icon: data.icon});
t.unload(i);
},
t.setInode(false);
t.deselect(i);
// Fetch updated data from server
setTimeout(function() {
t.select(i);
}, 10);
}
})
.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) {
result = res.data;
},
error: function() {
self.model.trigger('pgadmin:view:fetch:error', self.model, self.field);
},
})
.done(function(res) {
result = res.data;
})
.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) {
result = res.data;
},
error: function() {
self.model.trigger('pgadmin:view:fetch:error',
self.model, self.field);
},
})
.done(function(res) {
result = res.data;
})
.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) {
result = res.data;
},
error: function() {
self.model.trigger('pgadmin:view:fetch:error',
self.model, self.field);
},
})
.done(function(res) {
result = res.data;
})
.fail(function() {
self.model.trigger('pgadmin:view:fetch:error',
self.model, self.field);
});
}
return result;

View File

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

View File

@ -185,33 +185,33 @@ define('pgadmin.node.database', [
$.ajax({
url: obj.generate_url(i, 'connect', d, true),
type:'DELETE',
success: function(res) {
if (res.success == 1) {
var prv_i = t.parent(i);
Alertify.success(res.info);
t.removeIcon(i);
data.connected = false;
data.icon = 'icon-database-not-connected';
t.addIcon(i, {icon: data.icon});
t.unload(i);
t.setInode(i);
setTimeout(function() {
t.select(prv_i);
}, 10);
} else {
try {
Alertify.error(res.errormsg);
} catch (e) {
console.warn(e.stack || e);
}
t.unload(i);
}
},
error: function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
})
.done(function(res) {
if (res.success == 1) {
var prv_i = t.parent(i);
Alertify.success(res.info);
t.removeIcon(i);
data.connected = false;
data.icon = 'icon-database-not-connected';
t.addIcon(i, {icon: data.icon});
t.unload(i);
},
t.setInode(i);
setTimeout(function() {
t.select(prv_i);
}, 10);
} else {
try {
Alertify.error(res.errormsg);
} catch (e) {
console.warn(e.stack || e);
}
t.unload(i);
}
})
.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) {
alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
},
})
// 'pgagent.pga_job' table updated with current time to run the job
// now.
.done(function() { t.unload(i); })
.fail(function(xhr, status, error) {
alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
});
return false;

View File

@ -189,38 +189,38 @@ define('pgadmin.node.server', [
$.ajax({
url: obj.generate_url(i, 'connect', d, true),
type:'DELETE',
success: function(res) {
if (res.success == 1) {
Alertify.success(res.info);
d = t.itemData(i);
t.removeIcon(i);
d.connected = false;
d.icon = 'icon-server-not-connected';
t.addIcon(i, {icon: d.icon});
obj.callbacks.refresh.apply(obj, [null, i]);
if (pgBrowser.serverInfo && d._id in pgBrowser.serverInfo) {
delete pgBrowser.serverInfo[d._id];
}
pgBrowser.enable_disable_menus(i);
// Trigger server disconnect event
pgBrowser.Events.trigger(
'pgadmin:server:disconnect',
{item: i, data: d}, false
);
})
.done(function(res) {
if (res.success == 1) {
Alertify.success(res.info);
d = t.itemData(i);
t.removeIcon(i);
d.connected = false;
d.icon = 'icon-server-not-connected';
t.addIcon(i, {icon: d.icon});
obj.callbacks.refresh.apply(obj, [null, i]);
if (pgBrowser.serverInfo && d._id in pgBrowser.serverInfo) {
delete pgBrowser.serverInfo[d._id];
}
else {
try {
Alertify.error(res.errormsg);
} catch (e) {
console.warn(e.stack || e);
}
t.unload(i);
pgBrowser.enable_disable_menus(i);
// Trigger server disconnect event
pgBrowser.Events.trigger(
'pgadmin:server:disconnect',
{item: i, data: d}, false
);
}
else {
try {
Alertify.error(res.errormsg);
} catch (e) {
console.warn(e.stack || e);
}
},
error: function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
},
}
})
.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) {
if (res.data.status) {
Alertify.success(res.data.result);
}
else {
Alertify.error(res.data.result);
}
},
error: function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
},
})
.done(function(res) {
if (res.data.status) {
Alertify.success(res.data.result);
}
else {
Alertify.error(res.data.result);
}
})
.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) {
Alertify.success(res.data.result, 10);
},
error: function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
},
})
.done(function(res) {
Alertify.success(res.data.result, 10);
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
});
} else {
evt.cancel = true;
@ -481,27 +481,27 @@ define('pgadmin.node.server', [
url: url,
method:'POST',
data:{'data': JSON.stringify(args) },
success: function(res) {
if (res.success) {
// Notify user to update pgpass file
if(is_pgpass_file_used) {
Alertify.alert(
gettext('Change Password'),
gettext('Please make sure to disconnect the server'
+ ' and update the new password in the pgpass file'
+ ' before performing any other operation')
);
}
Alertify.success(res.info);
self.close();
} else {
Alertify.error(res.errormsg);
})
.done(function(res) {
if (res.success) {
// Notify user to update pgpass file
if(is_pgpass_file_used) {
Alertify.alert(
gettext('Change Password'),
gettext('Please make sure to disconnect the server'
+ ' and update the new password in the pgpass file'
+ ' before performing any other operation')
);
}
},
error: function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
},
Alertify.success(res.info);
self.close();
} else {
Alertify.error(res.errormsg);
}
})
.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) {
if (res.success && res.data.is_pgpass) {
is_pgpass_file_used = true;
}
Alertify.changeServerPassword(d).resizeTo('40%','52%');
},
error: function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
},
})
.done(function(res) {
if (res.success && res.data.is_pgpass) {
is_pgpass_file_used = true;
}
Alertify.changeServerPassword(d).resizeTo('40%','52%');
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
});
return false;
@ -542,23 +542,23 @@ define('pgadmin.node.server', [
url: obj.generate_url(i, 'wal_replay' , d, true),
type:'DELETE',
dataType: 'json',
success: function(res) {
if (res.success == 1) {
Alertify.success(res.info);
t.itemData(i).wal_pause=res.data.wal_pause;
t.unload(i);
t.setInode(i);
t.deselect(i);
// Fetch updated data from server
setTimeout(function() {
t.select(i);
}, 10);
}
},
error: function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
})
.done(function(res) {
if (res.success == 1) {
Alertify.success(res.info);
t.itemData(i).wal_pause=res.data.wal_pause;
t.unload(i);
},
t.setInode(i);
t.deselect(i);
// Fetch updated data from server
setTimeout(function() {
t.select(i);
}, 10);
}
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
t.unload(i);
});
},
@ -577,23 +577,23 @@ define('pgadmin.node.server', [
url: obj.generate_url(i, 'wal_replay' , d, true),
type:'PUT',
dataType: 'json',
success: function(res) {
if (res.success == 1) {
Alertify.success(res.info);
t.itemData(i).wal_pause=res.data.wal_pause;
t.unload(i);
t.setInode(i);
t.deselect(i);
// Fetch updated data from server
setTimeout(function() {
t.select(i);
}, 10);
}
},
error: function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
})
.done(function(res) {
if (res.success == 1) {
Alertify.success(res.info);
t.itemData(i).wal_pause=res.data.wal_pause;
t.unload(i);
},
t.setInode(i);
t.deselect(i);
// Fetch updated data from server
setTimeout(function() {
t.select(i);
}, 10);
}
})
.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) {
return _onSuccess(
res, _node, _data, _tree, _item, _status
);
},
error: function(xhr, status, error) {
return _onFailure(
xhr, status, error, _node, _data, _tree, _item, _status
);
},
})
.done(function(res) {
return _onSuccess(
res, _node, _data, _tree, _item, _status
);
})
.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) {
data = res.data;
},
error: function() {
m.trigger('pgadmin-view:fetch:error', m, self.field);
},
})
.done(function (res) {
data = res.data;
})
.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) {
if (res.success) {
Alertify.success(res.info);
self.close();
} else {
Alertify.error(res.errormsg);
}
},
error: function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
},
})
.done(function(res) {
if (res.success) {
Alertify.success(res.info);
self.close();
} else {
Alertify.error(res.errormsg);
}
})
.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,69 +1539,69 @@ define('pgadmin.browser', [
type: 'GET',
cache: false,
dataType: 'json',
success: function(res) {
// Node information can come as result/data
var data = res.result || res.data;
})
.done(function(res) {
// Node information can come as result/data
var data = res.result || res.data;
data._label = data.label;
data.label = _.escape(data.label);
var d = ctx.t.itemData(ctx.i);
_.extend(d, data);
ctx.t.setLabel(ctx.i, {label: _d.label});
ctx.t.addIcon(ctx.i, {icon: _d.icon});
ctx.t.setId(ctx.i, {id: _d.id});
ctx.t.setInode(ctx.i, {inode: data.inode});
data._label = data.label;
data.label = _.escape(data.label);
var d = ctx.t.itemData(ctx.i);
_.extend(d, data);
ctx.t.setLabel(ctx.i, {label: _d.label});
ctx.t.addIcon(ctx.i, {icon: _d.icon});
ctx.t.setId(ctx.i, {id: _d.id});
ctx.t.setInode(ctx.i, {inode: data.inode});
if (
_n.can_expand && typeof(_n.can_expand) == 'function'
) {
if (!_n.can_expand(d)) {
ctx.t.unload(ctx.i);
return;
}
if (
_n.can_expand && typeof(_n.can_expand) == 'function'
) {
if (!_n.can_expand(d)) {
ctx.t.unload(ctx.i);
return;
}
ctx.b._refreshNode(ctx, ctx.branch);
var success = (ctx.o && ctx.o.success) || ctx.success;
if (success && typeof(success) == 'function') {
success();
}
ctx.b._refreshNode(ctx, ctx.branch);
var success = (ctx.o && ctx.o.success) || ctx.success;
if (success && typeof(success) == 'function') {
success();
}
})
.fail(function(xhr, error, status) {
if (
!Alertify.pgHandleItemError(
xhr, error, status, {item: _i, info: info}
)
) {
var contentType = xhr.getResponseHeader('Content-Type'),
jsonResp = (
contentType &&
contentType.indexOf('application/json') == 0 &&
JSON.parse(xhr.responseText)
) || {};
if (xhr.status == 410 && jsonResp.success == 0) {
var p = ctx.t.parent(ctx.i);
ctx.t.remove(ctx.i, {
success: function() {
if (p) {
// Try to refresh the parent on error
try {
pgBrowser.Events.trigger(
'pgadmin:browser:tree:refresh', p
);
} catch (e) { console.warn(e.stack || e); }
}
},
});
}
},
error: function(xhr, error, status) {
if (
!Alertify.pgHandleItemError(
xhr, error, status, {item: _i, info: info}
)
) {
var contentType = xhr.getResponseHeader('Content-Type'),
jsonResp = (
contentType &&
contentType.indexOf('application/json') == 0 &&
JSON.parse(xhr.responseText)
) || {};
if (xhr.status == 410 && jsonResp.success == 0) {
var p = ctx.t.parent(ctx.i);
ctx.t.remove(ctx.i, {
success: function() {
if (p) {
// Try to refresh the parent on error
try {
pgBrowser.Events.trigger(
'pgadmin:browser:tree:refresh', p
);
} catch (e) { console.warn(e.stack || e); }
}
},
});
}
Alertify.pgNotifier(
error, xhr, gettext('Error retrieving details for the node.'),
function() { console.warn(arguments); }
);
}
},
Alertify.pgNotifier(
error, xhr, gettext('Error retrieving details for the node.'),
function() { console.warn(arguments); }
);
}
});
}.bind(this);
@ -1786,16 +1786,16 @@ define('pgadmin.browser', [
$.ajax({
url: childNodeUrl,
dataType: 'json',
success: function(res) {
if (res.success) {
arrayChildNodeData.push(res.data);
}
fetchNodeInfo(_callback);
},
error: function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
fetchNodeInfo(_callback);
},
})
.done(function(res) {
if (res.success) {
arrayChildNodeData.push(res.data);
}
fetchNodeInfo(_callback);
})
.fail(function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
fetchNodeInfo(_callback);
});
};

View File

@ -729,30 +729,30 @@ define('pgadmin.browser.node', [
$.ajax({
url: obj.generate_url(i, input.url, d, true),
type: 'DELETE',
success: function(res) {
if (res.success == 0) {
pgBrowser.report_error(res.errormsg, res.info);
} else {
pgBrowser.removeTreeNode(i, true);
})
.done(function(res) {
if (res.success == 0) {
pgBrowser.report_error(res.errormsg, res.info);
} else {
pgBrowser.removeTreeNode(i, true);
}
return true;
})
.fail(function(jqx) {
var msg = jqx.responseText;
/* Error from the server */
if (jqx.status == 417 || jqx.status == 410 || jqx.status == 500) {
try {
var data = JSON.parse(jqx.responseText);
msg = data.errormsg;
} catch (e) {
console.warn(e.stack || e);
}
return true;
},
error: function(jqx) {
var msg = jqx.responseText;
/* Error from the server */
if (jqx.status == 417 || jqx.status == 410 || jqx.status == 500) {
try {
var data = JSON.parse(jqx.responseText);
msg = data.errormsg;
} catch (e) {
console.warn(e.stack || e);
}
}
pgBrowser.report_error(
S(gettext('Error dropping %s: "%s"'))
.sprintf(obj.label, objName)
.value(), msg);
},
}
pgBrowser.report_error(
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) {
/*
* 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() {
m.trigger('pgadmin:view:fetch:error', m, self.field);
},
})
.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);
})
.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) {
/*
* 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() {
eventHandler.trigger('pgadmin:view:fetch:error', m, column);
},
})
.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);
})
.fail(function() {
eventHandler.trigger('pgadmin:view:fetch:error', m, column);
});
eventHandler.trigger('pgadmin:view:fetched', m, column);
}
@ -559,4 +559,4 @@ define([
});
return Backform;
});
});

View File

@ -80,32 +80,32 @@ _.extend(pgBrowser, {
setTimeout(function() {
$.ajax({
url: url_for('preferences.get_all'),
success: function(res) {
self.preferences_cache = res;
self.preference_version(self.generate_preference_version());
})
.done(function(res) {
self.preferences_cache = res;
self.preference_version(self.generate_preference_version());
pgBrowser.keyboardNavigation.init();
if(pgBrowser.tree) {
modifyAnimation.modifyAcitreeAnimation(self);
modifyAnimation.modifyAlertifyAnimation(self);
}
pgBrowser.keyboardNavigation.init();
if(pgBrowser.tree) {
modifyAnimation.modifyAcitreeAnimation(self);
modifyAnimation.modifyAlertifyAnimation(self);
}
/* Once the cache is loaded after changing the preferences,
* notify the modules of the change
*/
if(modulesChanged) {
if(typeof modulesChanged === 'string'){
$.event.trigger('prefchange:'+modulesChanged);
} else {
_.each(modulesChanged, (val, key)=> {
$.event.trigger('prefchange:'+key);
});
}
/* Once the cache is loaded after changing the preferences,
* notify the modules of the change
*/
if(modulesChanged) {
if(typeof modulesChanged === 'string'){
$.event.trigger('prefchange:'+modulesChanged);
} else {
_.each(modulesChanged, (val, key)=> {
$.event.trigger('prefchange:'+key);
});
}
},
error: function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, 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) {
if (res == gettext('Success')) {
Alertify.success(txtSuccess);
refresh_grid();
} else {
Alertify.error(txtError);
}
},
error: function(xhr, status, error) {
Alertify.pgRespErrorNotify(xhr, error);
},
})
.done(function(res) {
if (res == gettext('Success')) {
Alertify.success(txtSuccess);
refresh_grid();
} else {
Alertify.error(txtError);
}
})
.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) {
$(div).html(data);
},
error: function() {
$(div).html(
'<div class="alert alert-danger pg-panel-message" role="alert">' + gettext('An error occurred whilst loading the dashboard.') + '</div>'
);
},
})
.done(function(data) {
$(div).html(data);
})
.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) {
$(div).html(data);
},
error: function() {
$(div).html(
'<div class="alert alert-danger pg-panel-message" role="alert">' + gettext('An error occurred whilst loading the dashboard.') + '</div>'
);
},
})
.done(function(data) {
$(div).html(data);
})
.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,43 +431,43 @@ define('pgadmin.dashboard', [
url: path,
type: 'GET',
dataType: 'html',
success: 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) {
let err = '';
let msg = '';
let cls = 'info';
})
.done(function(resp) {
$(container).removeClass('graph-error');
data = JSON.parse(resp);
pgAdmin.Dashboard.render_chart(container, data, dataset, sid, did, url, options, counter, refresh);
})
.fail(function(xhr) {
let err = '';
let msg = '';
let cls = 'info';
if (xhr.readyState === 0) {
msg = gettext('Not connected to the server or the connection to the server has been closed.');
} else {
err = JSON.parse(xhr.responseText);
msg = err.errormsg;
if (xhr.readyState === 0) {
msg = gettext('Not connected to the server or the connection to the server has been closed.');
} else {
err = JSON.parse(xhr.responseText);
msg = err.errormsg;
// If we get a 428, it means the server isn't connected
if (xhr.status === 428) {
if (_.isUndefined(msg) || _.isNull(msg)) {
msg = gettext('Please connect to the selected server to view the graph.');
}
} else {
msg = gettext('An error occurred whilst rendering the graph.');
cls = 'danger';
// If we get a 428, it means the server isn't connected
if (xhr.status === 428) {
if (_.isUndefined(msg) || _.isNull(msg)) {
msg = gettext('Please connect to the selected server to view the graph.');
}
} else {
msg = gettext('An error occurred whilst rendering the graph.');
cls = 'danger';
}
}
$(container).addClass('graph-error');
$(container).html(
'<div class="alert alert-' + cls + ' pg-panel-message" role="alert">' + msg + '</div>'
);
$(container).addClass('graph-error');
$(container).html(
'<div class="alert alert-' + cls + ' pg-panel-message" role="alert">' + msg + '</div>'
);
// Try again...
if (container.clientHeight > 0 && container.clientWidth > 0) {
setTimeout(setTimeoutFunc, refresh * 1000);
}
},
// Try again...
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);
})
.fail(function(res) {
// Try after some time only if job id present
if (res.status != 410)
setTimeout(function() {
self.update(res);
}, 10);
},
error: function(res) {
// Try after some time only if job id present
if (res.status != 410)
setTimeout(function() {
self.update(res);
}, 10000);
},
}, 10000);
});
},
@ -429,12 +429,12 @@ define('misc.bgprocess', [
cache: false,
async: true,
contentType: 'application/json',
success: function() {
return;
},
error: function() {
console.warn(arguments);
},
})
.done(function() {
return;
})
.fail(function() {
console.warn(arguments);
});
},
});
@ -478,31 +478,31 @@ define('misc.bgprocess', [
cache: false,
async: true,
contentType: 'application/json',
success: function(res) {
if (!res || !_.isArray(res)) {
return;
}
for (var idx in res) {
var process = res[idx];
if ('id' in process) {
if (!(process.id in observer.bgprocesses)) {
observer.bgprocesses[process.id] = new BGProcess(process);
}
})
.done(function(res) {
if (!res || !_.isArray(res)) {
return;
}
for (var idx in res) {
var process = res[idx];
if ('id' in process) {
if (!(process.id in observer.bgprocesses)) {
observer.bgprocesses[process.id] = new BGProcess(process);
}
}
if (recheck && res.length == 0) {
// Recheck after some more time
setTimeout(
function() {
observer.update_process_list(false);
}, 3000
);
}
},
error: function() {
// FIXME:: What to do now?
console.warn(arguments);
},
}
if (recheck && res.length == 0) {
// Recheck after some more time
setTimeout(
function() {
observer.update_process_list(false);
}, 3000
);
}
})
.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) {
var data = resp.data.result;
if (data['Code'] === 1) {
is_exist = true;
} else {
is_exist = false;
}
},
})
.done(function(resp) {
var data = resp.data.result;
if (data['Code'] === 1) {
is_exist = true;
} else {
is_exist = false;
}
});
return is_exist;
},
@ -109,19 +109,19 @@ module.exports = Alertify.dialog('createModeDlg', function() {
dataType: 'json',
contentType: 'application/json; charset=utf-8',
async: false,
success: function(resp) {
var data = resp.data.result;
if (data.Code === 1) {
permission = true;
} else {
$('.file_manager_ok').addClass('disabled');
Alertify.error(data.Error);
}
},
error: function() {
})
.done(function(resp) {
var data = resp.data.result;
if (data.Code === 1) {
permission = true;
} else {
$('.file_manager_ok').addClass('disabled');
Alertify.error(gettext('Error occurred while checking access permission.'));
},
Alertify.error(data.Error);
}
})
.fail(function() {
$('.file_manager_ok').addClass('disabled');
Alertify.error(gettext('Error occurred while checking access permission.'));
});
return permission;
},

File diff suppressed because it is too large Load Diff

View File

@ -105,30 +105,30 @@ define('misc.sql', [
);
}, 1000);
},
success: function(res) {
if (pgAdmin.Browser.editor.getValue() != res) {
pgAdmin.Browser.editor.setValue(res);
}
clearTimeout(timer);
},
error: function(xhr, error, message) {
var _label = treeHierarchy[n_type].label;
pgBrowser.Events.trigger(
'pgadmin:node:retrieval:error', 'sql', xhr, error, message, item
})
.done(function(res) {
if (pgAdmin.Browser.editor.getValue() != res) {
pgAdmin.Browser.editor.setValue(res);
}
clearTimeout(timer);
})
.fail(function(xhr, error, message) {
var _label = treeHierarchy[n_type].label;
pgBrowser.Events.trigger(
'pgadmin:node:retrieval:error', 'sql', xhr, error, message, item
);
if (!Alertify.pgHandleItemError(xhr, error, message, {
item: item,
info: treeHierarchy,
})) {
Alertify.pgNotifier(
error, xhr,
S(gettext('Error retrieving the information - %s')).sprintf(
message || _label
).value(),
function() {}
);
if (!Alertify.pgHandleItemError(xhr, error, message, {
item: item,
info: treeHierarchy,
})) {
Alertify.pgNotifier(
error, xhr,
S(gettext('Error retrieving the information - %s')).sprintf(
message || _label
).value(),
function() {}
);
}
},
}
});
}
}

View File

@ -229,65 +229,65 @@ define('misc.statistics', [
}
}, 1000);
},
success: function(res) {
// clear timer and reset message.
clearTimeout(timer);
$msgContainer.text('');
if (res.data) {
var data = res.data;
if (node.hasCollectiveStatistics || data['rows'].length > 1) {
self.__createMultiLineStatistics.call(self, data, node.statsPrettifyFields);
} else {
self.__createSingleLineStatistics.call(self, data, node.statsPrettifyFields);
}
if (self.grid) {
delete self.grid;
self.grid = null;
}
self.grid = new Backgrid.Grid({
columns: self.columns,
collection: self.collection,
className: GRID_CLASSES,
});
self.grid.render();
$gridContainer.empty();
$gridContainer.append(self.grid.$el);
if (!$msgContainer.hasClass('hidden')) {
$msgContainer.addClass('hidden');
}
$gridContainer.removeClass('hidden');
} else if (res.info) {
if (!$gridContainer.hasClass('hidden')) {
$gridContainer.addClass('hidden');
}
$msgContainer.text(res.info);
$msgContainer.removeClass('hidden');
})
.done(function(res) {
// clear timer and reset message.
clearTimeout(timer);
$msgContainer.text('');
if (res.data) {
var data = res.data;
if (node.hasCollectiveStatistics || data['rows'].length > 1) {
self.__createMultiLineStatistics.call(self, data, node.statsPrettifyFields);
} else {
self.__createSingleLineStatistics.call(self, data, node.statsPrettifyFields);
}
},
error: function(xhr, error, message) {
var _label = treeHierarchy[n_type].label;
pgBrowser.Events.trigger(
'pgadmin:node:retrieval:error', 'statistics', xhr, error, message, item
if (self.grid) {
delete self.grid;
self.grid = null;
}
self.grid = new Backgrid.Grid({
columns: self.columns,
collection: self.collection,
className: GRID_CLASSES,
});
self.grid.render();
$gridContainer.empty();
$gridContainer.append(self.grid.$el);
if (!$msgContainer.hasClass('hidden')) {
$msgContainer.addClass('hidden');
}
$gridContainer.removeClass('hidden');
} else if (res.info) {
if (!$gridContainer.hasClass('hidden')) {
$gridContainer.addClass('hidden');
}
$msgContainer.text(res.info);
$msgContainer.removeClass('hidden');
}
})
.fail(function(xhr, error, message) {
var _label = treeHierarchy[n_type].label;
pgBrowser.Events.trigger(
'pgadmin:node:retrieval:error', 'statistics', xhr, error, message, item
);
if (!Alertify.pgHandleItemError(xhr, error, message, {
item: item,
info: treeHierarchy,
})) {
Alertify.pgNotifier(
error, xhr,
S(gettext('Error retrieving the information - %s')).sprintf(
message || _label
).value(),
function() {}
);
if (!Alertify.pgHandleItemError(xhr, error, message, {
item: item,
info: treeHierarchy,
})) {
Alertify.pgNotifier(
error, xhr,
S(gettext('Error retrieving the information - %s')).sprintf(
message || _label
).value(),
function() {}
);
}
// show failed message.
$msgContainer.text(gettext('Failed to retrieve data from the server.'));
},
}
// 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() {
// Prevent saving layout on server for next page reload.
$(window).unbind('unload');
window.onbeforeunload = null;
// Now reload page
location.reload(true);
},
error: function() {
console.warn(
'Something went wrong on server while resetting layout.'
);
},
})
.done(function() {
// Prevent saving layout on server for next page reload.
$(window).unbind('unload');
window.onbeforeunload = null;
// Now reload page
location.reload(true);
})
.fail(function() {
console.warn(
'Something went wrong on server while resetting layout.'
);
});
},

View File

@ -337,25 +337,25 @@ define([
null, 'connect', args.info.server, true, args.info
),
dataType: 'json',
success: function(res) {
if (res.success && 'connected' in res.data) {
if (res.data.connected) {
// Server is connected, but - the connection with the
// particular database has been lost.
pgBrowser.Events.trigger(
'pgadmin:database:connection:lost', args.item, jsonResp
);
return;
}
})
.done(function(res) {
if (res.success && 'connected' in res.data) {
if (res.data.connected) {
// Server is connected, but - the connection with the
// particular database has been lost.
pgBrowser.Events.trigger(
'pgadmin:database:connection:lost', args.item, jsonResp
);
return;
}
}
// Serever was not connected, we should first try to connect
// the server.
reconnectServer();
},
error: function() {
reconnectServer();
},
// Serever was not connected, we should first try to connect
// the server.
reconnectServer();
})
.fail(function() {
reconnectServer();
});
return true;
}

View File

@ -79,102 +79,102 @@ define(['jquery', 'sources/gettext', 'sources/url_for'],
$.ajax({
url: url,
method: 'GET',
success: function (res) {
if(res && res.data) {
var status = res.data.status,
msg = res.data.message,
is_status_changed = false;
})
.done(function (res) {
if(res && res.data) {
var status = res.data.status,
msg = res.data.message,
is_status_changed = false;
// Raise notify messages comes from database server.
sqleditor_obj.update_notifications(res.data.notifies);
// Raise notify messages comes from database server.
sqleditor_obj.update_notifications(res.data.notifies);
// Inject CSS as required
switch(status) {
// Busy
case 1:
// if received busy status more than once then only
if(status == sqlEditorUtils.previousStatus &&
!$status_el.hasClass('fa-hourglass-half')) {
$status_el.removeClass()
.addClass('fa fa-hourglass-half');
is_status_changed = true;
}
break;
// Idle in transaction
case 2:
if(sqlEditorUtils.previousStatus != status &&
!$status_el.hasClass('fa-clock-o')) {
$status_el.removeClass()
.addClass('fa fa-clock-o');
is_status_changed = true;
}
break;
// Failed in transaction
case 3:
if(sqlEditorUtils.previousStatus != status &&
!$status_el.hasClass('fa-exclamation-circle')) {
$status_el.removeClass()
.addClass('fa fa-exclamation-circle');
is_status_changed = true;
}
break;
// Failed in transaction with unknown server side error
case 4:
if(sqlEditorUtils.previousStatus != status &&
!$status_el.hasClass('fa-exclamation-triangle')) {
$status_el.removeClass()
.addClass('fa fa-exclamation-triangle');
is_status_changed = true;
}
break;
default:
if(sqlEditorUtils.previousStatus != status &&
!$status_el.hasClass('fa-query_tool_connected')) {
$status_el.removeClass()
.addClass('fa-custom fa-query-tool-connected');
is_status_changed = true;
}
}
sqlEditorUtils.previousStatus = status;
// Set bootstrap popover message
if(is_status_changed) {
$el.popover('hide');
$el.attr('data-content', msg);
}
} else {
// We come here means we did not receive expected response
// from server, we need to error out
sqlEditorUtils.previousStatus = -99;
msg = gettext('An unexpected error occurred - ' +
'ensure you are logged into the application.');
$el.attr('data-content', msg);
if(!$status_el.hasClass('fa-query-tool-disconnected')) {
$el.popover('hide');
// Inject CSS as required
switch(status) {
// Busy
case 1:
// if received busy status more than once then only
if(status == sqlEditorUtils.previousStatus &&
!$status_el.hasClass('fa-hourglass-half')) {
$status_el.removeClass()
.addClass('fa-custom fa-query-tool-disconnected');
.addClass('fa fa-hourglass-half');
is_status_changed = true;
}
break;
// Idle in transaction
case 2:
if(sqlEditorUtils.previousStatus != status &&
!$status_el.hasClass('fa-clock-o')) {
$status_el.removeClass()
.addClass('fa fa-clock-o');
is_status_changed = true;
}
break;
// Failed in transaction
case 3:
if(sqlEditorUtils.previousStatus != status &&
!$status_el.hasClass('fa-exclamation-circle')) {
$status_el.removeClass()
.addClass('fa fa-exclamation-circle');
is_status_changed = true;
}
break;
// Failed in transaction with unknown server side error
case 4:
if(sqlEditorUtils.previousStatus != status &&
!$status_el.hasClass('fa-exclamation-triangle')) {
$status_el.removeClass()
.addClass('fa fa-exclamation-triangle');
is_status_changed = true;
}
break;
default:
if(sqlEditorUtils.previousStatus != status &&
!$status_el.hasClass('fa-query_tool_connected')) {
$status_el.removeClass()
.addClass('fa-custom fa-query-tool-connected');
is_status_changed = true;
}
}
},
error: function (e) {
sqlEditorUtils.previousStatus = -1;
var msg = gettext('Transaction status check failed.');
if (e.readyState == 0) {
msg = gettext('Not connected to the server or the connection to ' +
'the server has been closed.');
} else if (e.responseJSON && e.responseJSON.errormsg) {
msg = e.responseJSON.errormsg;
}
// Set bootstrap popover
sqlEditorUtils.previousStatus = status;
// Set bootstrap popover message
if(is_status_changed) {
$el.popover('hide');
$el.attr('data-content', msg);
}
} else {
// We come here means we did not receive expected response
// from server, we need to error out
sqlEditorUtils.previousStatus = -99;
msg = gettext('An unexpected error occurred - ' +
'ensure you are logged into the application.');
$el.attr('data-content', msg);
// Add error class
if(!$status_el.hasClass('fa-query-tool-disconnected')) {
$el.popover('hide');
$status_el.removeClass()
.addClass('fa-custom fa-query-tool-disconnected');
}
},
}
})
.fail(function (e) {
sqlEditorUtils.previousStatus = -1;
var msg = gettext('Transaction status check failed.');
if (e.readyState == 0) {
msg = gettext('Not connected to the server or the connection to ' +
'the server has been closed.');
} else if (e.responseJSON && e.responseJSON.errormsg) {
msg = e.responseJSON.errormsg;
}
// Set bootstrap popover
$el.attr('data-content', msg);
// Add error class
if(!$status_el.hasClass('fa-query-tool-disconnected')) {
$el.popover('hide');
$status_el.removeClass()
.addClass('fa-custom fa-query-tool-disconnected');
}
});
},

View File

@ -323,24 +323,24 @@ define('pgadmin.datagrid', [
async: false,
contentType: 'application/json',
data: JSON.stringify(sql),
success: 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);
}
else {
alertify.alert(
gettext('Validation Error'),
res.data.result
);
}
},
error: function(e) {
})
.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);
}
else {
alertify.alert(
gettext('Validation Error'),
e
res.data.result
);
},
}
})
.fail(function(e) {
alertify.alert(
gettext('Validation Error'),
e
);
});
}
},
@ -376,35 +376,35 @@ define('pgadmin.datagrid', [
dataType: 'json',
data: JSON.stringify(sql_filter),
contentType: 'application/json',
success: 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) {
if (target !== self) {
if(xhr.status == 503 && xhr.responseJSON.info != undefined &&
xhr.responseJSON.info == 'CONNECTION_LOST') {
setTimeout(function() {
target.handle_connection_lost(true, xhr);
});
return;
}
})
.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);
})
.fail(function(xhr) {
if (target !== self) {
if(xhr.status == 503 && xhr.responseJSON.info != undefined &&
xhr.responseJSON.info == 'CONNECTION_LOST') {
setTimeout(function() {
target.handle_connection_lost(true, xhr);
});
return;
}
}
try {
var err = JSON.parse(xhr.responseText);
alertify.alert(gettext('Query Tool Initialize Error'),
err.errormsg
);
} catch (e) {
alertify.alert(
e.statusText, gettext('Query Tool Initialize Error')
);
}
},
try {
var err = JSON.parse(xhr.responseText);
alertify.alert(gettext('Query Tool Initialize Error'),
err.errormsg
);
} catch (e) {
alertify.alert(
e.statusText, gettext('Query Tool Initialize Error')
);
}
});
},
launch_grid: function(trans_obj) {

View File

@ -291,19 +291,19 @@ define([
$.ajax({
url: _url,
cache: false,
success: function() {
self.start_global_debugger();
},
error: function(xhr) {
try {
var err = JSON.parse(xhr.responseText);
if (err.success == 0) {
Alertify.alert(gettext('Debugger Error'), err.errormsg);
}
} catch (e) {
console.warn(e.stack || e);
})
.done(function() {
self.start_global_debugger();
})
.fail(function(xhr) {
try {
var err = JSON.parse(xhr.responseText);
if (err.success == 0) {
Alertify.alert(gettext('Debugger Error'), err.errormsg);
}
},
} catch (e) {
console.warn(e.stack || e);
}
});
},
@ -378,52 +378,52 @@ define([
$.ajax({
url: baseUrl,
method: 'GET',
success: function(res) {
var url = url_for('debugger.direct', {
'trans_id': res.data.debuggerTransId,
});
})
.done(function(res) {
var url = url_for('debugger.direct', {
'trans_id': res.data.debuggerTransId,
});
if (res.data.newBrowserTab) {
window.open(url, '_blank');
} else {
pgBrowser.Events.once(
'pgadmin-browser:frame:urlloaded:frm_debugger',
function(frame) {
frame.openURL(url);
});
// Create the debugger panel as per the data received from user input dialog.
var dashboardPanel = pgBrowser.docker.findPanels(
'properties'
),
panel = pgBrowser.docker.addPanel(
'frm_debugger', wcDocker.DOCK.STACKED, dashboardPanel[0]
);
panel.focus();
// Panel Closed event
panel.on(wcDocker.EVENT.CLOSED, function() {
var closeUrl = url_for('debugger.close', {
'trans_id': res.data.debuggerTransId,
});
$.ajax({
url: closeUrl,
method: 'DELETE',
});
if (res.data.newBrowserTab) {
window.open(url, '_blank');
} else {
pgBrowser.Events.once(
'pgadmin-browser:frame:urlloaded:frm_debugger',
function(frame) {
frame.openURL(url);
});
// Create the debugger panel as per the data received from user input dialog.
var dashboardPanel = pgBrowser.docker.findPanels(
'properties'
),
panel = pgBrowser.docker.addPanel(
'frm_debugger', wcDocker.DOCK.STACKED, dashboardPanel[0]
);
panel.focus();
// Panel Closed event
panel.on(wcDocker.EVENT.CLOSED, function() {
var closeUrl = url_for('debugger.close', {
'trans_id': res.data.debuggerTransId,
});
$.ajax({
url: closeUrl,
method: 'DELETE',
});
});
}
})
.fail(function(xhr) {
try {
var err = JSON.parse(xhr.responseText);
if (err.success == 0) {
Alertify.alert(gettext('Debugger Error'), err.errormsg);
}
},
error: function(xhr) {
try {
var err = JSON.parse(xhr.responseText);
if (err.success == 0) {
Alertify.alert(gettext('Debugger Error'), err.errormsg);
}
} catch (e) {
console.warn(e.stack || e);
}
},
} catch (e) {
console.warn(e.stack || e);
}
});
},
@ -446,107 +446,107 @@ 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']) {
get_function_arguments(res.data[0], 0);
// Open Alertify the dialog to take the input arguments from user if function having input arguments
if (res.data[0]['require_input']) {
get_function_arguments(res.data[0], 0);
} else {
// Initialize the target and create asynchronous connection and unique transaction ID
// If there is no arguments to the functions then we should not ask for for function arguments and
// Directly open the panel
var t = pgBrowser.tree,
i = t.selected(),
d = i && i.length == 1 ? t.itemData(i) : undefined,
node = d && pgBrowser.Nodes[d._type];
if (!d)
return;
var treeInfo = node.getTreeNodeHierarchy.apply(node, [i]),
baseUrl;
if (d._type == 'function') {
baseUrl = url_for(
'debugger.initialize_target_for_function', {
'debug_type': 'direct',
'sid': treeInfo.server._id,
'did': treeInfo.database._id,
'scid': treeInfo.schema._id,
'func_id': treeInfo.function._id,
}
);
} else {
// Initialize the target and create asynchronous connection and unique transaction ID
// If there is no arguments to the functions then we should not ask for for function arguments and
// Directly open the panel
var t = pgBrowser.tree,
i = t.selected(),
d = i && i.length == 1 ? t.itemData(i) : undefined,
node = d && pgBrowser.Nodes[d._type];
baseUrl = url_for(
'debugger.initialize_target_for_function', {
'debug_type': 'direct',
'sid': treeInfo.server._id,
'did': treeInfo.database._id,
'scid': treeInfo.schema._id,
'func_id': debuggerUtils.getProcedureId(treeInfo),
}
);
}
if (!d)
return;
$.ajax({
url: baseUrl,
method: 'GET',
})
.done(function(res) {
var treeInfo = node.getTreeNodeHierarchy.apply(node, [i]),
baseUrl;
var url = url_for('debugger.direct', {
'trans_id': res.data.debuggerTransId,
});
if (d._type == 'function') {
baseUrl = url_for(
'debugger.initialize_target_for_function', {
'debug_type': 'direct',
'sid': treeInfo.server._id,
'did': treeInfo.database._id,
'scid': treeInfo.schema._id,
'func_id': treeInfo.function._id,
}
);
if (res.data.newBrowserTab) {
window.open(url, '_blank');
} else {
baseUrl = url_for(
'debugger.initialize_target_for_function', {
'debug_type': 'direct',
'sid': treeInfo.server._id,
'did': treeInfo.database._id,
'scid': treeInfo.schema._id,
'func_id': debuggerUtils.getProcedureId(treeInfo),
}
);
}
$.ajax({
url: baseUrl,
method: 'GET',
success: function(res) {
var url = url_for('debugger.direct', {
'trans_id': res.data.debuggerTransId,
pgBrowser.Events.once(
'pgadmin-browser:frame:urlloaded:frm_debugger',
function(frame) {
frame.openURL(url);
});
if (res.data.newBrowserTab) {
window.open(url, '_blank');
} else {
pgBrowser.Events.once(
'pgadmin-browser:frame:urlloaded:frm_debugger',
function(frame) {
frame.openURL(url);
});
// Create the debugger panel as per the data received from user input dialog.
var dashboardPanel = pgBrowser.docker.findPanels(
'properties'
),
panel = pgBrowser.docker.addPanel(
'frm_debugger', wcDocker.DOCK.STACKED, dashboardPanel[0]
);
panel.focus();
// Register Panel Closed event
panel.on(wcDocker.EVENT.CLOSED, function() {
var closeUrl = url_for('debugger.close', {
'trans_id': res.data.debuggerTransId,
});
$.ajax({
url: closeUrl,
method: 'DELETE',
});
});
}
},
error: function(e) {
Alertify.alert(
gettext('Debugger Target Initialization Error'),
e.responseJSON.errormsg
// Create the debugger panel as per the data received from user input dialog.
var dashboardPanel = pgBrowser.docker.findPanels(
'properties'
),
panel = pgBrowser.docker.addPanel(
'frm_debugger', wcDocker.DOCK.STACKED, dashboardPanel[0]
);
},
});
}
},
error: function(xhr) {
try {
var err = JSON.parse(xhr.responseText);
if (err.success == 0) {
Alertify.alert(gettext('Debugger Error'), err.errormsg);
panel.focus();
// Register Panel Closed event
panel.on(wcDocker.EVENT.CLOSED, function() {
var closeUrl = url_for('debugger.close', {
'trans_id': res.data.debuggerTransId,
});
$.ajax({
url: closeUrl,
method: 'DELETE',
});
});
}
} catch (e) {
console.warn(e.stack || e);
})
.fail(function(e) {
Alertify.alert(
gettext('Debugger Target Initialization Error'),
e.responseJSON.errormsg
);
});
}
})
.fail(function(xhr) {
try {
var err = JSON.parse(xhr.responseText);
if (err.success == 0) {
Alertify.alert(gettext('Debugger Error'), err.errormsg);
}
},
} catch (e) {
console.warn(e.stack || e);
}
});
},
};

View File

@ -192,26 +192,26 @@ define([
url: _Url,
method: 'GET',
async: false,
success: 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
func_args_data.push({
'arg_id': res.data.result[i]['arg_id'],
'is_null': res.data.result[i]['is_null'],
'is_expression': res.data.result[i]['is_expression'],
'use_default': res.data.result[i]['use_default'],
'value': res.data.result[i]['value'],
});
}
})
.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
func_args_data.push({
'arg_id': res.data.result[i]['arg_id'],
'is_null': res.data.result[i]['is_null'],
'is_expression': res.data.result[i]['is_expression'],
'use_default': res.data.result[i]['use_default'],
'value': res.data.result[i]['value'],
});
}
},
error: function() {
Alertify.alert(
gettext('Debugger Error'),
gettext('Unable to fetch the arguments from server')
);
},
}
})
.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,97 +701,97 @@ define([
data: {
'data': JSON.stringify(args_value_list),
},
success: function(res) {
})
.done(function(res) {
var url = url_for(
'debugger.direct', {
var url = url_for(
'debugger.direct', {
'trans_id': res.data.debuggerTransId,
}
);
if (res.data.newBrowserTab) {
window.open(url, '_blank');
} else {
pgBrowser.Events.once(
'pgadmin-browser:frame:urlloaded:frm_debugger',
function(frame) {
frame.openURL(url);
});
// Create the debugger panel as per the data received from user input dialog.
var dashboardPanel = pgBrowser.docker.findPanels('properties'),
panel = pgBrowser.docker.addPanel(
'frm_debugger', wcDocker.DOCK.STACKED, dashboardPanel[0]
);
panel.focus();
// Panel Closed event
panel.on(wcDocker.EVENT.CLOSED, function() {
var closeUrl = url_for('debugger.close', {
'trans_id': res.data.debuggerTransId,
}
);
if (res.data.newBrowserTab) {
window.open(url, '_blank');
} else {
pgBrowser.Events.once(
'pgadmin-browser:frame:urlloaded:frm_debugger',
function(frame) {
frame.openURL(url);
});
// Create the debugger panel as per the data received from user input dialog.
var dashboardPanel = pgBrowser.docker.findPanels('properties'),
panel = pgBrowser.docker.addPanel(
'frm_debugger', wcDocker.DOCK.STACKED, dashboardPanel[0]
);
panel.focus();
// Panel Closed event
panel.on(wcDocker.EVENT.CLOSED, function() {
var closeUrl = url_for('debugger.close', {
'trans_id': res.data.debuggerTransId,
});
$.ajax({
url: closeUrl,
method: 'DELETE',
});
});
}
var _Url;
if (d._type == 'function') {
_Url = url_for('debugger.set_arguments', {
'sid': treeInfo.server._id,
'did': treeInfo.database._id,
'scid': treeInfo.schema._id,
'func_id': treeInfo.function._id,
$.ajax({
url: closeUrl,
method: 'DELETE',
});
} else if (d._type == 'procedure') {
_Url = url_for('debugger.set_arguments', {
'sid': treeInfo.server._id,
'did': treeInfo.database._id,
'scid': treeInfo.schema._id,
'func_id': treeInfo.procedure._id,
});
} else if (d._type == 'edbfunc') {
// Get the existing function parameters available from sqlite database
_Url = url_for('debugger.set_arguments', {
'sid': treeInfo.server._id,
'did': treeInfo.database._id,
'scid': treeInfo.schema._id,
'func_id': treeInfo.edbfunc._id,
});
} else if (d._type == 'edbproc') {
// Get the existing function parameters available from sqlite database
_Url = url_for('debugger.set_arguments', {
'sid': treeInfo.server._id,
'did': treeInfo.database._id,
'scid': treeInfo.schema._id,
'func_id': treeInfo.edbproc._id,
});
}
$.ajax({
url: _Url,
method: 'POST',
data: {
'data': JSON.stringify(sqlite_func_args_list),
},
success: function() {},
error: function() {
Alertify.alert(
gettext('Debugger Error'),
gettext('Unable to set the arguments on the server')
);
},
});
},
error: function(e) {
}
var _Url;
if (d._type == 'function') {
_Url = url_for('debugger.set_arguments', {
'sid': treeInfo.server._id,
'did': treeInfo.database._id,
'scid': treeInfo.schema._id,
'func_id': treeInfo.function._id,
});
} else if (d._type == 'procedure') {
_Url = url_for('debugger.set_arguments', {
'sid': treeInfo.server._id,
'did': treeInfo.database._id,
'scid': treeInfo.schema._id,
'func_id': treeInfo.procedure._id,
});
} else if (d._type == 'edbfunc') {
// Get the existing function parameters available from sqlite database
_Url = url_for('debugger.set_arguments', {
'sid': treeInfo.server._id,
'did': treeInfo.database._id,
'scid': treeInfo.schema._id,
'func_id': treeInfo.edbfunc._id,
});
} else if (d._type == 'edbproc') {
// Get the existing function parameters available from sqlite database
_Url = url_for('debugger.set_arguments', {
'sid': treeInfo.server._id,
'did': treeInfo.database._id,
'scid': treeInfo.schema._id,
'func_id': treeInfo.edbproc._id,
});
}
$.ajax({
url: _Url,
method: 'POST',
data: {
'data': JSON.stringify(sqlite_func_args_list),
},
})
.done(function() {})
.fail(function() {
Alertify.alert(
gettext('Debugger Target Initialization Error'),
e.responseJSON.errormsg
gettext('Debugger Error'),
gettext('Unable to set the arguments on the server')
);
},
});
})
.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) {
Alertify.alert(
gettext('Debugger Listener Startup Error'),
e.responseJSON.errormsg
);
},
})
.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() {
Alertify.alert(
gettext('Debugger Error'),
gettext('Unable to set the arguments on the server')
);
},
})
.done(function() {})
.fail(function() {
Alertify.alert(
gettext('Debugger Error'),
gettext('Unable to set the arguments on the server')
);
});
}

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -385,20 +385,20 @@ define([
data: {
'data': JSON.stringify(this.view.model.toJSON()),
},
success: 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);
pgBrowser.Events.trigger('pgadmin-bgprocess:created', self);
} else {
Alertify.error(res.data.errmsg);
}
},
error: function() {
Alertify.alert(
gettext('Maintenance job creation failed.')
);
},
})
.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);
pgBrowser.Events.trigger('pgadmin-bgprocess:created', self);
} else {
Alertify.error(res.data.errmsg);
}
})
.fail(function() {
Alertify.alert(
gettext('Maintenance job creation failed.')
);
});
}
},

File diff suppressed because it is too large Load Diff

View File

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