(node_type)
| 10 | import usePreferences from '../../preferences/static/js/store'; |
| 11 | |
| 12 | export 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 | } |
no outgoing calls
no test coverage detected