mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Resolving few issues with the drop/drop cascade object function at front-end.
Also, modified the translation messages as per Dave (Thanks Akshay Joshi for the patch). Modified the way, we show the error message dialog.
This commit is contained in:
parent
1945872e3f
commit
7beaefd1c6
@ -4,7 +4,7 @@ function(_, alertify, pgAdmin) {
|
|||||||
pgAdmin.Browser = pgAdmin.Browser || {};
|
pgAdmin.Browser = pgAdmin.Browser || {};
|
||||||
|
|
||||||
_.extend(pgAdmin.Browser, {
|
_.extend(pgAdmin.Browser, {
|
||||||
report_error: function(message, info) {
|
report_error: function(title, message, info) {
|
||||||
text = '<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">\
|
text = '<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">\
|
||||||
<div class="panel panel-default">\
|
<div class="panel panel-default">\
|
||||||
<div class="panel-heading" role="tab" id="headingOne">\
|
<div class="panel-heading" role="tab" id="headingOne">\
|
||||||
@ -34,9 +34,9 @@ function(_, alertify, pgAdmin) {
|
|||||||
</div>'
|
</div>'
|
||||||
}
|
}
|
||||||
|
|
||||||
text += '</div>'
|
text += '</div>';
|
||||||
alertify.alert(
|
alertify.alert(
|
||||||
"{{ _('An error has occurred') }}",
|
title,
|
||||||
text
|
text
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
@ -388,16 +388,22 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, Backform) {
|
|||||||
p.focus();
|
p.focus();
|
||||||
},
|
},
|
||||||
// Delete the selected object
|
// Delete the selected object
|
||||||
delete_obj: function(args) {
|
delete_obj: function(args, item) {
|
||||||
var input = args || {};
|
var input = args || {};
|
||||||
obj = this,
|
obj = this,
|
||||||
t = pgBrowser.tree,
|
t = pgBrowser.tree,
|
||||||
i = input.item || t.selected(),
|
i = input.item || 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;
|
return;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Make sure - we're using the correct version of node
|
||||||
|
*/
|
||||||
|
obj = pgBrowser.Nodes[d._type];
|
||||||
|
var objName = d.label;
|
||||||
|
|
||||||
var msg, title;
|
var msg, title;
|
||||||
if (input.url == 'delete') {
|
if (input.url == 'delete') {
|
||||||
|
|
||||||
@ -405,27 +411,28 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, Backform) {
|
|||||||
.sprintf(obj.label, d.label).value();
|
.sprintf(obj.label, d.label).value();
|
||||||
title = S('{{ _('Drop CASACDE %%s?') }}').sprintf(obj.label).value();
|
title = S('{{ _('Drop CASACDE %%s?') }}').sprintf(obj.label).value();
|
||||||
|
|
||||||
if (!pgBrowser.Nodes[d._type].canDropCascade(d, i)) {
|
if (!(_.isFunction(obj.canDropCascade) ?
|
||||||
|
obj.canDropCascade.apply(obj, [d, i]) : obj.canDropCascade)) {
|
||||||
Alertify.notify(
|
Alertify.notify(
|
||||||
S('The %s - "%s" can not be deleted!')
|
S('The %s - "%s" can not be deleted!')
|
||||||
.sprintf(obj.label, d.label).value(),
|
.sprintf(obj.label, d.label).value(),
|
||||||
'error',
|
'error',
|
||||||
10
|
10
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
msg = S('{{ _('Are you sure you wish to drop the %%s - "%%s"?') }}')
|
msg = S('{{ _('Are you sure you want to drop %%s "%%s"?') }}')
|
||||||
.sprintf(obj.label, d.label).value();
|
.sprintf(obj.label, d.label).value();
|
||||||
title = S('{{ _('Drop %%s?') }}').sprintf(obj.label).value();
|
title = S('{{ _('Drop %%s?') }}').sprintf(obj.label).value();
|
||||||
|
|
||||||
if (!pgBrowser.Nodes[d._type].canDropCascade(d, i)) {
|
if (!(_.isFunction(obj.canDrop) ?
|
||||||
|
obj.canDrop.apply(obj, [d, i]) : obj.canDrop)) {
|
||||||
Alertify.notify(
|
Alertify.notify(
|
||||||
S('The %s - "%s" can not be deleted!')
|
S('The %s - "%s" can not be deleted!')
|
||||||
.sprintf(obj.label, d.label).value(),
|
.sprintf(obj.label, d.label).value(),
|
||||||
'error',
|
'error', 10
|
||||||
10
|
);
|
||||||
);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -451,16 +458,15 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, Backform) {
|
|||||||
error: function(jqx) {
|
error: function(jqx) {
|
||||||
var msg = jqx.responseText;
|
var msg = jqx.responseText;
|
||||||
/* Error from the server */
|
/* Error from the server */
|
||||||
if (jqx.status == 410) {
|
if (jqx.status == 410 || jqx.status == 500) {
|
||||||
try {
|
try {
|
||||||
var data = $.parseJSON(
|
var data = $.parseJSON(jqx.responseText);
|
||||||
jqx.responseText);
|
|
||||||
msg = data.errormsg;
|
msg = data.errormsg;
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
pgBrowser.report_error(
|
pgBrowser.report_error(
|
||||||
S('{{ _('Error droping the %%s - "%%s"') }}')
|
S('{{ _('Error dropping %%s: "%%s"') }}')
|
||||||
.sprintf(obj.label, d.label)
|
.sprintf(obj.label, objName)
|
||||||
.value(), msg);
|
.value(), msg);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -78,7 +78,7 @@
|
|||||||
pgadmin: "{{ url_for('static', filename='js/pgadmin') }}",
|
pgadmin: "{{ url_for('static', filename='js/pgadmin') }}",
|
||||||
modernizr: "{{ url_for('static', filename='js/modernizr-2.6.2-respond-1.1.0.min') }}",
|
modernizr: "{{ url_for('static', filename='js/modernizr-2.6.2-respond-1.1.0.min') }}",
|
||||||
jquery: "{{ url_for('static', filename='js/' + ('jquery-1.11.2' if config.DEBUG else 'jquery-1.11.2.min')) }}",
|
jquery: "{{ url_for('static', filename='js/' + ('jquery-1.11.2' if config.DEBUG else 'jquery-1.11.2.min')) }}",
|
||||||
select2: "{{ url_for('static', filename='js/select2/' + ('select2.full' if config.DEBUG else 'select2.min.full')) }}",
|
select2: "{{ url_for('static', filename='js/select2/' + ('select2.full' if config.DEBUG else 'select2.full.min')) }}",
|
||||||
underscore: "{{ url_for('static', filename='js/' + ('underscore' if config.DEBUG else 'underscore-min')) }}",
|
underscore: "{{ url_for('static', filename='js/' + ('underscore' if config.DEBUG else 'underscore-min')) }}",
|
||||||
"underscore.string": "{{ url_for('static', filename='js/' + ('underscore.string' if config.DEBUG else 'underscore.string.min')) }}",
|
"underscore.string": "{{ url_for('static', filename='js/' + ('underscore.string' if config.DEBUG else 'underscore.string.min')) }}",
|
||||||
bootstrap: "{{ url_for('static', filename='js/' + ('bootstrap' if config.DEBUG else 'bootstrap.min')) }}",
|
bootstrap: "{{ url_for('static', filename='js/' + ('bootstrap' if config.DEBUG else 'bootstrap.min')) }}",
|
||||||
|
Loading…
Reference in New Issue
Block a user