MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / disabled

Method disabled

web/pgadmin/static/js/helpers/Menu.js:201–232  ·  view source on GitHub ↗
(node, item)

Source from the content-addressed store, hash-verified

199 * Checks this menu enable/disable state based on the selection.
200 */
201 disabled(node, item) {
202 if (this.enable == undefined) {
203 return false;
204 }
205
206 if (this.node) {
207 if (!node) {
208 return true;
209 }
210 if (_.isArray(this.node) ? (
211 _.indexOf(this.node, node) == -1
212 ) : (this.node != node._type)) {
213 return true;
214 }
215 }
216
217 if (_.isBoolean(this.enable)) return !this.enable;
218 if (_.isFunction(this.enable) && node) {
219 return !this.enable.apply(this.module, [node, item, this.data]);
220 }
221 if (this.module && _.isBoolean(this.module[this.enable])) {
222 return !this.module[this.enable];
223 }
224 if(!node) {
225 return true;
226 }
227 if (this.module && _.isFunction(this.module[this.enable])) {
228 return !(this.module[this.enable])(node, item, this.data);
229 }
230
231 return false;
232 }
233}

Callers 1

checkAndSetDisabledMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected