1) Fixed issue where Drop and Disconnect connection menu points are too close to each other. Fixes #3279

2) Rename the context menu from 'Drop Server' to 'Remove Server'. Fixes #3859
This commit is contained in:
Rahul Shirsat 2019-11-07 13:11:24 +05:30 committed by Akshay Joshi
parent 091d2cd0d2
commit 62d55cabd9
4 changed files with 53 additions and 11 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

After

Width:  |  Height:  |  Size: 88 KiB

View File

@ -57,7 +57,7 @@ following options (in alphabetical order):
+-----------------------------+--------------------------------------------------------------------------------------------------------------------------+
| *Delete/Drop* | Click to delete the currently selected object from the server. |
+-----------------------------+--------------------------------------------------------------------------------------------------------------------------+
| *Disconnect Server...* | Click to refresh the currently selected object. |
| *Disconnect Server...* | Click to disconnect the currently selected server. |
+-----------------------------+--------------------------------------------------------------------------------------------------------------------------+
| *Drop Cascade* | Click to delete the currently selected object and all dependent objects from the server. |
+-----------------------------+--------------------------------------------------------------------------------------------------------------------------+
@ -65,6 +65,8 @@ following options (in alphabetical order):
+-----------------------------+--------------------------------------------------------------------------------------------------------------------------+
| *Refresh...* | Click to refresh the currently selected object. |
+-----------------------------+--------------------------------------------------------------------------------------------------------------------------+
| *Remove Server* | Click to remove the currently selected server. |
+-----------------------------+--------------------------------------------------------------------------------------------------------------------------+
| *Scripts* | Click to open the :ref:`Query tool <query_tool>` to edit or view the selected script from the flyout menu. |
+-----------------------------+--------------------------------------------------------------------------------------------------------------------------+
| *Trigger(s)* | Click to *Disable* or *Enable* trigger(s) for the currently selected table. Options are displayed on the flyout menu. |

View File

@ -21,7 +21,9 @@ Bug fixes
*********
| `Issue #3130 <https://redmine.postgresql.org/issues/3130>`_ - Ensure create new object dialog should be opened when alt+shift+n key is pressed on the collection node.
| `Issue #3279 <https://redmine.postgresql.org/issues/3279>`_ - Fixed issue where Drop and Disconnect connection menu points are too close to each other.
| `Issue #3789 <https://redmine.postgresql.org/issues/3789>`_ - Ensure context menus never get hidden below the menu bar.
| `Issue #3859 <https://redmine.postgresql.org/issues/3859>`_ - Rename the context menu from 'Drop Server' to 'Remove Server'.
| `Issue #3913 <https://redmine.postgresql.org/issues/3913>`_ - Ensure the correct "running at" agent is shown when a pgAgent job is executing.
| `Issue #3915 <https://redmine.postgresql.org/issues/3915>`_ - Fix an issue in the Query Tool where shortcut keys could be ignored following a query error.
| `Issue #3999 <https://redmine.postgresql.org/issues/3999>`_ - Fix the toggle case shortcut key combination.

View File

@ -28,6 +28,10 @@ define('pgadmin.browser.node', [
F1: 112,
};
const REMOVE_SERVER_PRIORITY = 5;
const REMOVE_SERVER_LABEL = 'Remove Server';
const SERVER = 'server';
// It has already been defined.
// Avoid running this script again.
if (pgBrowser.Node)
@ -142,8 +146,8 @@ define('pgadmin.browser.node', [
module: self,
applies: ['object', 'context'],
callback: 'delete_obj',
priority: 2,
label: gettext('Delete/Drop'),
priority: self.get_menu_item_priority(self.type, 2),
label: self.change_menu_label(self.type, gettext('Delete/Drop')),
data: {
'url': 'drop',
},
@ -755,15 +759,31 @@ define('pgadmin.browser.node', [
return;
}
} else {
msg = gettext('Are you sure you want to drop %s "%s"?', obj.label.toLowerCase(), d.label);
title = gettext('DROP %s?', obj.label);
var remove_drop_text;
if(obj.type === SERVER) {
remove_drop_text = 'Remove';
}
else {
remove_drop_text = 'DROP';
}
msg = gettext('Are you sure you want to %s %s "%s"?', remove_drop_text.toLowerCase(), obj.label.toLowerCase(), d.label);
title = gettext('%s %s?', remove_drop_text, obj.label);
if (!(_.isFunction(obj.canDrop) ?
obj.canDrop.apply(obj, [d, i]) : obj.canDrop)) {
Alertify.error(
gettext('The %s "%s" cannot be dropped.', obj.label, d.label),
10
);
if(obj.type === SERVER) {
Alertify.error(
gettext('The %s "%s" cannot be removed.', obj.label, d.label),
10
);
}
else {
Alertify.error(
gettext('The %s "%s" cannot be dropped.', obj.label, d.label),
10
);
}
return;
}
}
@ -792,8 +812,14 @@ define('pgadmin.browser.node', [
console.warn(e.stack || e);
}
}
pgBrowser.report_error(
gettext('Error dropping %s: "%s"', obj.label, objName), msg);
if(obj.type === SERVER) {
pgBrowser.report_error(
gettext('Error removing %s: "%s"', obj.label, objName), msg);
}
else {
pgBrowser.report_error(
gettext('Error dropping %s: "%s"', obj.label, objName), msg);
}
});
},
null).show();
@ -1757,6 +1783,18 @@ define('pgadmin.browser.node', [
return this.parent_type;
}
},
get_menu_item_priority: function(type, default_priority) { //downgrade Remove Server priority in menus only for Servers
if(type && type === SERVER) {
return REMOVE_SERVER_PRIORITY;
}
return default_priority;
},
change_menu_label: function(type, default_label) { //change Delete/Drop menu option to Remove Server
if(type && type === SERVER) {
return gettext(REMOVE_SERVER_LABEL);
}
return default_label;
},
});
return pgAdmin.Browser.Node;