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

@@ -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]);
}