(node, treeNodeInfo, itemNodeData, params={}, filter=()=>true, postTransform=(res)=>res)
| 167 | |
| 168 | /* Get the nodes list based on node name passed */ |
| 169 | export function getNodeListByName(node, treeNodeInfo, itemNodeData, params={}, filter=()=>true, postTransform=(res)=>res) { |
| 170 | let nodeObj = pgAdmin.Browser.Nodes[node]; |
| 171 | let {includeItemKeys} = params; |
| 172 | /* Transform the result to add image details */ |
| 173 | const transform = (rows) => { |
| 174 | let res = []; |
| 175 | |
| 176 | _.each(rows, function(r) { |
| 177 | if (filter(r)) { |
| 178 | let l = (_.isFunction(nodeObj['node_label']) ? |
| 179 | nodeObj['node_label'](r) : |
| 180 | r.label), |
| 181 | image = (_.isFunction(nodeObj['node_image']) ? |
| 182 | nodeObj['node_image'](r) : |
| 183 | (nodeObj['node_image'] || ('icon-' + nodeObj.type))); |
| 184 | |
| 185 | res.push({ |
| 186 | 'value': r.label, |
| 187 | 'image': image, |
| 188 | 'label': l, |
| 189 | ..._.pick(r, includeItemKeys), |
| 190 | }); |
| 191 | } |
| 192 | }); |
| 193 | |
| 194 | return postTransform(res); |
| 195 | }; |
| 196 | |
| 197 | return getNodeAjaxOptions('nodes', nodeObj, treeNodeInfo, itemNodeData, params, transform); |
| 198 | } |
no test coverage detected