(feature)(webapp) modify model to view (#719)

This commit is contained in:
williamhliu
2024-02-04 20:58:33 +08:00
committed by GitHub
parent da5e7b9b75
commit e801c448be
17 changed files with 67 additions and 145 deletions

View File

@@ -371,7 +371,7 @@ function getLeafNodes(treeNodes: any[]): any[] {
return leafNodes;
}
function buildTree(nodes: any[]): any[] {
export function buildTree(nodes: any[]): any[] {
const map: Record<number, any> = {};
const roots: any[] = [];
@@ -400,6 +400,16 @@ export function getLeafList(flatNodes: any[]): any[] {
return leafNodes;
}
export function traverseTree(treeData: any[], callback: (node: any) => void) {
treeData.forEach((node) => {
callback(node);
if (node.children?.length > 0) {
traverseTree(node.children, callback);
}
});
return treeData;
}
export function traverseRoutes(routes, env: string, result: any[] = []) {
if (!Array.isArray(routes)) {
return result;