Skip to content

Commit

Permalink
fix: remove hash tags from queue name to display, closes #884
Browse files Browse the repository at this point in the history
  • Loading branch information
felixmosh committed Jan 29, 2025
1 parent 42e4127 commit 75cbe62
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/ui/src/utils/toTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,21 @@ export function toTree(queues: AppQueue[]): AppQueueTreeNode {
return;
}

const parts = queue.name.split(queue.delimiter);
const nameToSplit =
queue.name.startsWith('{') && queue.name.endsWith('}') ? queue.name.slice(1, -1) : queue.name;
const parts = nameToSplit.split(queue.delimiter);
let currentLevel = root.children;

parts.forEach((part, index) => {
let node = currentLevel.find((n) => n.name === part);

if (!node) {
const isLeafNode = index === parts.length - 1;
node = {
name: part,
children: [],
// Only set queue data if we're at the leaf node
...(index === parts.length - 1 ? { queue } : {}),
...(isLeafNode ? { queue } : {}),
};
currentLevel.push(node);
}
Expand Down

0 comments on commit 75cbe62

Please sign in to comment.