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

Function checkNodeVisibility

web/pgadmin/static/js/check_node_visibility.js:12–40  ·  view source on GitHub ↗
(node_type)

Source from the content-addressed store, hash-verified

10import usePreferences from '../../preferences/static/js/store';
11
12export default function checkNodeVisibility(node_type) {
13 if(_.isUndefined(node_type) || _.isNull(node_type)) {
14 return true;
15 }
16
17 // Target actual node instead of collection.
18 // If node is disabled then there is no meaning of
19 // adding collection node menu
20 if(node_type.startsWith('coll-')) {
21 node_type = node_type.replace('coll-', '');
22 }
23
24 // Exclude non-applicable nodes
25 let nodes_not_supported = [
26 'server_group', 'server', 'catalog_object_column',
27 ];
28 if(_.indexOf(nodes_not_supported, node_type) >= 0) {
29 return true;
30 }
31
32 let preference = usePreferences.getState().getPreferences('browser', 'show_node_'+node_type);
33
34 if (preference) {
35 return preference.value;
36 }
37 else {
38 return true;
39 }
40}

Callers 2

browser.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected