2017-05-12 06:10:46 -05:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// pgAdmin 4 - PostgreSQL Tools
|
|
|
|
//
|
2022-01-04 02:24:25 -06:00
|
|
|
// Copyright (C) 2013 - 2022, The pgAdmin Development Team
|
2017-05-12 06:10:46 -05:00
|
|
|
// This software is released under the PostgreSQL Licence
|
|
|
|
//
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
2022-09-08 04:46:48 -05:00
|
|
|
import _ from 'lodash';
|
2017-05-12 06:10:46 -05:00
|
|
|
|
2022-09-08 04:46:48 -05:00
|
|
|
define([],
|
|
|
|
function () {
|
2017-05-12 06:10:46 -05:00
|
|
|
|
2022-01-18 03:19:54 -06:00
|
|
|
return function (pgBrowser, node_type) {
|
2017-05-12 06:10:46 -05:00
|
|
|
if(_.isUndefined(node_type) || _.isNull(node_type)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Target actual node instead of collection.
|
|
|
|
// If node is disabled then there is no meaning of
|
|
|
|
// adding collection node menu
|
2019-10-10 01:35:28 -05:00
|
|
|
if(node_type.startsWith('coll-')) {
|
2018-01-12 01:29:51 -06:00
|
|
|
node_type = node_type.replace('coll-', '');
|
2017-05-12 06:10:46 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// Exclude non-applicable nodes
|
2022-09-08 07:38:58 -05:00
|
|
|
let nodes_not_supported = [
|
2018-01-12 01:29:51 -06:00
|
|
|
'server_group', 'server', 'catalog_object_column',
|
2017-05-12 06:10:46 -05:00
|
|
|
];
|
|
|
|
if(_.indexOf(nodes_not_supported, node_type) >= 0) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2022-09-08 07:38:58 -05:00
|
|
|
let preference = pgBrowser.get_preference('browser', 'show_node_'+node_type);
|
2017-05-12 06:10:46 -05:00
|
|
|
|
2017-06-21 11:09:59 -05:00
|
|
|
if (preference) {
|
2018-01-12 01:29:51 -06:00
|
|
|
return preference.value;
|
2017-06-21 11:09:59 -05:00
|
|
|
}
|
|
|
|
else {
|
2017-05-12 06:10:46 -05:00
|
|
|
return true;
|
|
|
|
}
|
2018-01-12 01:29:51 -06:00
|
|
|
};
|
|
|
|
});
|