MCPcopy Create free account
hub / github.com/bytebase/bytebase / sortNodesIfNeeded

Function sortNodesIfNeeded

frontend/src/react/stores/sqlEditor/tree-utils.ts:68–87  ·  view source on GitHub ↗
(nodes: TreeNode[], factor: Factor)

Source from the content-addressed store, hash-verified

66};
67
68const sortNodesIfNeeded = (nodes: TreeNode[], factor: Factor) => {
69 if (factor === "environment") {
70 return orderBy(
71 nodes as TreeNode<"environment">[],
72 [(node) => node.meta.target.order],
73 ["desc"]
74 );
75 }
76 if (factor.startsWith("label:")) {
77 return orderBy(
78 nodes as TreeNode<"label">[],
79 [
80 (node) => (node.meta.target.value ? -1 : 1),
81 (node) => node.meta.target.value,
82 ],
83 ["asc", "asc"]
84 );
85 }
86 return nodes;
87};
88
89export const buildTreeImpl = (
90 databaseList: Database[],

Callers 1

buildSubTreeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected