Ensure that the view/edit data panel should not be opened for unsupported nodes using the keyboard shortcut. Fixes #6206

This commit is contained in:
Akshay Joshi 2021-03-19 15:38:40 +05:30
parent 24dc7f4a91
commit 3f63f65674
3 changed files with 10 additions and 14 deletions

View File

@ -38,6 +38,7 @@ Bug fixes
| `Issue #5810 <https://redmine.postgresql.org/issues/5810>`_ - Ensure that cell content being auto selected when editing the cell data.
| `Issue #6018 <https://redmine.postgresql.org/issues/6018>`_ - Fixed encoding issue when database encoding set to SQL_ASCII and name of the column is in ASCII character.
| `Issue #6159 <https://redmine.postgresql.org/issues/6159>`_ - Ensure that the user should be able to kill the session from Dashboard if the user has a 'pg_signal_backend' role.
| `Issue #6206 <https://redmine.postgresql.org/issues/6206>`_ - Ensure that the view/edit data panel should not be opened for unsupported nodes using the keyboard shortcut.
| `Issue #6227 <https://redmine.postgresql.org/issues/6227>`_ - Ensure PGADMIN_DEFAULT_EMAIL looks sane when initialising a container deployment.
| `Issue #6228 <https://redmine.postgresql.org/issues/6228>`_ - Improve the web setup script for Linux to make the platform detection more robust and overrideable.
| `Issue #6253 <https://redmine.postgresql.org/issues/6253>`_ - Fixed an issue where the user is unable to create a subscription if the host/IP address for connection is 127.0.0.1.

View File

@ -43,6 +43,12 @@ export function showDataGrid(
return;
}
let applicable_nodes = ['table', 'view', 'mview', 'foreign_table'];
if (applicable_nodes.indexOf(node.getData()._type) === -1) {
alertify.error(gettext('This feature is not applicable to the selected object.'));
return;
}
const gridUrl = generateUrl(transId, connectionData, node.getData(), parentData);
const queryToolTitle = generateDatagridTitle(pgBrowser, aciTreeIdentifier);
if(filter) {

View File

@ -30,7 +30,7 @@ describe('#show_data', () => {
let transId = 98765432;
beforeEach(() => {
pgBrowser.preferences_cache = dummy_cache;
alertify = jasmine.createSpyObj('alertify', ['alert']);
alertify = jasmine.createSpyObj('alertify', ['alert', 'error']);
datagrid = {
launch_grid: jasmine.createSpy('launch_grid'),
};
@ -138,13 +138,7 @@ describe('#show_data', () => {
context('current node is underneath a schema', () => {
it('does not create a transaction', () => {
showDataGrid(datagrid, pgBrowser, alertify, {mnuid: 11}, [{id: 'schema1'}], transId);
expect(datagrid.launch_grid).toHaveBeenCalledWith(
98765432,
'/panel/98765432?is_query_tool=false&cmd_type=11&obj_type=schema&obj_id=4&sgid=1&sid=2&did=3&server_type=pg',
false,
'schema1.schema1/database1/someuser@server1'
);
expect(datagrid.launch_grid).not.toHaveBeenCalled();
});
});
@ -164,12 +158,7 @@ describe('#show_data', () => {
context('current node is underneath a catalog', () => {
it('does not create a transaction', () => {
showDataGrid(datagrid, pgBrowser, alertify, {mnuid: 11}, [{id: 'catalog1'}], transId);
expect(datagrid.launch_grid).toHaveBeenCalledWith(
98765432,
'/panel/98765432?is_query_tool=false&cmd_type=11&obj_type=catalog&obj_id=6&sgid=1&sid=2&did=3&server_type=pg',
false,
'catalog1.catalog1/database1/someuser@server1'
);
expect(datagrid.launch_grid).not.toHaveBeenCalled();
});
});
});