Prevent the user attempting to run external commands if the bin path is not configured. Fixes #1177

This commit is contained in:
Harshal Dhumal
2016-08-08 11:59:37 +01:00
committed by Dave Page
parent 8e099e29c3
commit f78024808e
7 changed files with 265 additions and 12 deletions

View File

@@ -187,8 +187,51 @@ define(
Open the dialog for the maintenance functionality
*/
callback_maintenace: function(args, item) {
var self = this;
var input = args || {},
var i = item || pgBrowser.tree.selected(),
server_data = null;
while (i) {
var node_data = pgBrowser.tree.itemData(i);
if (node_data._type == 'server') {
server_data = node_data;
break;
}
if (pgBrowser.tree.hasParent(i)) {
i = $(pgBrowser.tree.parent(i));
} else {
Alertify.alert("{{ _("Please select server or child node from tree.") }}");
break;
}
}
if (!server_data) {
return;
}
var module = 'paths',
preference_name = 'pg_bin_dir',
msg = '{{ _('Please configure the PostgreSQL Binary Path in the Preferences dialog.') }}';
if (server_data.server_type == 'ppas') {
preference_name = 'ppas_bin_dir';
msg = '{{ _('Please configure the EDB Advanced Server Binary Path in the Preferences dialog.') }}';
}
var preference = pgBrowser.get_preference(module, preference_name);
if(preference) {
if (!preference.value) {
Alertify.alert('{{ _("Configuration required") }}', msg);
return;
}
} else {
Alertify.alert(S('{{ _('Failed to load preference %s of module %s') }}').sprintf(preference_name, module).value());
return;
}
var self = this,
input = args || {},
t = pgBrowser.tree,
i = item || t.selected(),
d = i && i.length == 1 ? t.itemData(i) : undefined,