2017-05-12 12:10:46 +01:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// pgAdmin 4 - PostgreSQL Tools
|
|
|
|
|
//
|
2022-01-04 13:54:25 +05:30
|
|
|
// Copyright (C) 2013 - 2022, The pgAdmin Development Team
|
2017-05-12 12:10:46 +01:00
|
|
|
// This software is released under the PostgreSQL Licence
|
|
|
|
|
//
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
2022-09-08 15:16:48 +05:30
|
|
|
import _ from 'lodash';
|
2017-05-12 12:10:46 +01:00
|
|
|
|
2022-09-08 15:16:48 +05:30
|
|
|
define([],
|
|
|
|
|
function () {
|
2017-05-12 12:10:46 +01:00
|
|
|
|
2022-01-18 14:49:54 +05:30
|
|
|
return function (pgBrowser, node_type) {
|
2017-05-12 12:10:46 +01: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 12:05:28 +05:30
|
|
|
if(node_type.startsWith('coll-')) {
|
2018-01-12 12:59:51 +05:30
|
|
|
node_type = node_type.replace('coll-', '');
|
2017-05-12 12:10:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Exclude non-applicable nodes
|
2022-09-08 18:08:58 +05:30
|
|
|
let nodes_not_supported = [
|
2018-01-12 12:59:51 +05:30
|
|
|
'server_group', 'server', 'catalog_object_column',
|
2017-05-12 12:10:46 +01:00
|
|
|
];
|
|
|
|
|
if(_.indexOf(nodes_not_supported, node_type) >= 0) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-08 18:08:58 +05:30
|
|
|
let preference = pgBrowser.get_preference('browser', 'show_node_'+node_type);
|
2017-05-12 12:10:46 +01:00
|
|
|
|
2017-06-21 17:09:59 +01:00
|
|
|
if (preference) {
|
2018-01-12 12:59:51 +05:30
|
|
|
return preference.value;
|
2017-06-21 17:09:59 +01:00
|
|
|
}
|
|
|
|
|
else {
|
2017-05-12 12:10:46 +01:00
|
|
|
return true;
|
|
|
|
|
}
|
2018-01-12 12:59:51 +05:30
|
|
|
};
|
|
|
|
|
});
|