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

Function transform

web/pgadmin/browser/static/js/node_ajax.js:142–163  ·  view source on GitHub ↗
(rows)

Source from the content-addressed store, hash-verified

140 nodeObj = typeof(nodeObj) == 'string' ? pgAdmin.Browser.Nodes[nodeObj] : nodeObj;
141 /* Transform the result to add image details */
142 const transform = (rows) => {
143 let res = [];
144
145 _.each(rows, function(r) {
146 if (filter(r)) {
147 let l = (_.isFunction(nodeObj['node_label']) ?
148 nodeObj['node_label'](r) :
149 r.label),
150 image = (_.isFunction(nodeObj['node_image']) ?
151 nodeObj['node_image'](r) :
152 (nodeObj['node_image'] || ('icon-' + nodeObj.type)));
153
154 res.push({
155 'value': r._id,
156 'image': image,
157 'label': l,
158 });
159 }
160 });
161
162 return postTransform(res);
163 };
164
165 return getNodeAjaxOptions('nodes', nodeObj, treeNodeInfo, itemNodeData, params, transform);
166}

Callers 1

getNodeAjaxOptionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected