mirror of
https://github.com/bunny-lab-io/Borealis.git
synced 2025-10-27 15:41:57 -06:00
Sort assembly trees alphabetically
This commit is contained in:
@@ -60,6 +60,16 @@ const Island = ({ title, description, icon, actions, children, sx }) => (
|
|||||||
);
|
);
|
||||||
|
|
||||||
// ---------------- Workflows Island -----------------
|
// ---------------- Workflows Island -----------------
|
||||||
|
const sortTree = (node) => {
|
||||||
|
if (!node || !Array.isArray(node.children)) return;
|
||||||
|
node.children.sort((a, b) =>
|
||||||
|
String(a.label || "").localeCompare(String(b.label || ""), undefined, {
|
||||||
|
sensitivity: "base"
|
||||||
|
})
|
||||||
|
);
|
||||||
|
node.children.forEach(sortTree);
|
||||||
|
};
|
||||||
|
|
||||||
function buildWorkflowTree(workflows, folders) {
|
function buildWorkflowTree(workflows, folders) {
|
||||||
const map = {};
|
const map = {};
|
||||||
const rootNode = { id: "root", label: "Workflows", path: "", isFolder: true, children: [] };
|
const rootNode = { id: "root", label: "Workflows", path: "", isFolder: true, children: [] };
|
||||||
@@ -107,6 +117,7 @@ function buildWorkflowTree(workflows, folders) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
sortTree(rootNode);
|
||||||
return { root: [rootNode], map };
|
return { root: [rootNode], map };
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -439,6 +450,7 @@ function buildFileTree(rootLabel, items, folders) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
sortTree(rootNode);
|
||||||
return { root: [rootNode], map };
|
return { root: [rootNode], map };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user