From bd4a012404ae7127ac53ae24e48ae83f2447f289 Mon Sep 17 00:00:00 2001 From: ESPGranEdu Date: Fri, 16 Aug 2024 22:53:23 +0200 Subject: [PATCH] Group stacks by agent --- frontend/src/components/StackList.vue | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/frontend/src/components/StackList.vue b/frontend/src/components/StackList.vue index 6b00cb2..35ccff5 100644 --- a/frontend/src/components/StackList.vue +++ b/frontend/src/components/StackList.vue @@ -189,7 +189,29 @@ export default { return result; }, + stackListByAgent() { + const stacksByAgent = new Map(); + const stacks = this.$root.completeStackList; + + for (const key of Object.keys(stacks)) { + // Handle stacks with no suffix (from the current endpoint) + let [stackName, agent] = key.split("_"); + const stackHasEndpoint = agent !== ""; + agent = stackHasEndpoint ? agent: this.$t("currentEndpoint"); + + if (!stacksByAgent.has(agent)) { + stacksByAgent.set(agent, []); + } + const stack = stacks[!stackHasEndpoint ? `${stackName}_` : `${stackName}_${agent}`] + stacksByAgent.get(agent).push(stack); + } + + // console.log(stacksByAgent); + // console.log(stacks); + return stacksByAgent; + + }, isDarkTheme() { return document.body.classList.contains("dark"); },