mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-01-27 16:57:00 -06:00
33 lines
832 B
JavaScript
33 lines
832 B
JavaScript
/////////////////////////////////////////////////////////////
|
|
//
|
|
// pgAdmin 4 - PostgreSQL Tools
|
|
//
|
|
// Copyright (C) 2013 - 2022, The pgAdmin Development Team
|
|
// This software is released under the PostgreSQL Licence
|
|
//
|
|
//////////////////////////////////////////////////////////////
|
|
|
|
import _ from 'underscore';
|
|
|
|
function generate_url(baseUrl, treeInfo, actionType, nodeType, pickFunction, itemDataID) {
|
|
let ref = '';
|
|
_.each(
|
|
_.sortBy(
|
|
_.pick(treeInfo, pickFunction),
|
|
function (treeInfoItems) {
|
|
return treeInfoItems.priority;
|
|
}
|
|
),
|
|
function (treeInfoItems) {
|
|
ref = `${ref}/${encodeURI(treeInfoItems._id)}`;
|
|
}
|
|
);
|
|
ref = itemDataID ? `${ref}/${itemDataID}` : `${ref}/`;
|
|
|
|
return `${baseUrl}${nodeType}/${actionType}${ref}`;
|
|
}
|
|
|
|
module.exports = {
|
|
generate_url: generate_url,
|
|
};
|