mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fix Reset Statistics operation for which the popup messages weren't displaying correctly. Fixes #2091
This commit is contained in:
committed by
Dave Page
parent
801c7688a3
commit
29a6f2e124
@@ -198,51 +198,54 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
reset_table_stats: function(args) {
|
reset_table_stats: function(args) {
|
||||||
var input = args || {};
|
var input = args || {},
|
||||||
obj = this,
|
obj = this,
|
||||||
t = pgBrowser.tree,
|
t = pgBrowser.tree,
|
||||||
i = input.item || t.selected(),
|
i = input.item || t.selected(),
|
||||||
d = i && i.length == 1 ? t.itemData(i) : undefined;
|
d = i && i.length == 1 ? t.itemData(i) : undefined;
|
||||||
|
|
||||||
if (!d)
|
if (!d)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
alertify.confirm(
|
alertify.confirm(
|
||||||
S('{{ _('Are you sure you want to reset table statistics for %s?') }}').sprintf(d.label).value(),
|
'{{ _('Reset statistics') }}',
|
||||||
|
S('{{ _('Are you sure you want to reset the statistics for table %%s?') }}').sprintf(d._label).value(),
|
||||||
function (e) {
|
function (e) {
|
||||||
if (e) {
|
if (e) {
|
||||||
var data = d;
|
var data = d;
|
||||||
$.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) {
|
success: function(res) {
|
||||||
if (res.success == 1) {
|
if (res.success == 1) {
|
||||||
alertify.success("{{ _('" + res.info + "') }}");
|
alertify.success("{{ _('" + res.info + "') }}");
|
||||||
t.removeIcon(i);
|
t.removeIcon(i);
|
||||||
data.icon = 'icon-table';
|
data.icon = 'icon-table';
|
||||||
t.addIcon(i, {icon: data.icon});
|
t.addIcon(i, {icon: data.icon});
|
||||||
t.unload(i);
|
t.unload(i);
|
||||||
t.setInode(i);
|
t.setInode(i);
|
||||||
t.deselect(i);
|
t.deselect(i);
|
||||||
// Fetch updated data from server
|
// Fetch updated data from server
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
t.select(i);
|
t.select(i);
|
||||||
}, 10);
|
}, 10);
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function(xhr, status, error) {
|
|
||||||
try {
|
|
||||||
var err = $.parseJSON(xhr.responseText);
|
|
||||||
if (err.success == 0) {
|
|
||||||
msg = S('{{ _(' + err.errormsg + ')}}').value();
|
|
||||||
alertify.error("{{ _('" + err.errormsg + "') }}");
|
|
||||||
}
|
}
|
||||||
} catch (e) {}
|
},
|
||||||
t.unload(i);
|
error: function(xhr, status, error) {
|
||||||
}
|
try {
|
||||||
});
|
var err = $.parseJSON(xhr.responseText);
|
||||||
}
|
if (err.success == 0) {
|
||||||
});
|
msg = S('{{ _(' + err.errormsg + ')}}').value();
|
||||||
|
alertify.error("{{ _('" + err.errormsg + "') }}");
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
|
t.unload(i);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
function() {}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
model: pgBrowser.Node.Model.extend({
|
model: pgBrowser.Node.Model.extend({
|
||||||
|
|||||||
Reference in New Issue
Block a user