Fix an issue where all the menus are enabled when pgAdmin is opened and no object is selected in the object explorer. #6435

This commit is contained in:
Aditya Toshniwal 2023-06-22 13:51:40 +05:30
parent 5a701b7c61
commit f7bc826262
2 changed files with 6 additions and 2 deletions

View File

@ -43,4 +43,5 @@ Bug fixes
| `Issue #6363 <https://github.com/pgadmin-org/pgadmin4/issues/6363>`_ - Fixed an issue where preview images for themes were not loading.
| `Issue #6420 <https://github.com/pgadmin-org/pgadmin4/issues/6420>`_ - Fix raise notice from func/proc or code blocks are no longer displayed live.
| `Issue #6431 <https://github.com/pgadmin-org/pgadmin4/issues/6431>`_ - Fix an issue where PSQL is not working if the database name have quotes or double quotes.
| `Issue #6431 <https://github.com/pgadmin-org/pgadmin4/issues/6435>`_ - Fix an issue where all the menus are enabled when pgAdmin is opened and no object is selected in the object explorer.

View File

@ -176,7 +176,7 @@ export class MenuItem {
* Checks this menu enable/disable state based on the selection.
*/
disabled(node, item) {
if (this.enable == undefined || !node) {
if (this.enable == undefined) {
return false;
}
@ -192,12 +192,15 @@ export class MenuItem {
}
if (_.isBoolean(this.enable)) return !this.enable;
if (_.isFunction(this.enable)) {
if (_.isFunction(this.enable) && node) {
return !this.enable.apply(this.module, [node, item, this.data]);
}
if (this.module && _.isBoolean(this.module[this.enable])) {
return !this.module[this.enable];
}
if(!node) {
return true;
}
if (this.module && _.isFunction(this.module[this.enable])) {
return !(this.module[this.enable]).apply(this.module, [node, item, this.data]);
}