From 5e40b3105c85429c43f0da0273f263ef030f0eb1 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 22 Oct 2025 19:38:42 +0000 Subject: [PATCH 1/2] Update --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 78a8db3..e8177c7 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ Ziel: -
+
๐Ÿ”ฎ Geplante Features (v0.5+) - Notifications (z. B. via Webhooks oder Mail) From 9133928401a67e23a9e2959a4d310d07606192f4 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 23 Oct 2025 06:52:10 +0000 Subject: [PATCH 2/2] Minor Fix --- frontend/src/pages/dashboard/stacks.jsx | 91 +++++++++++++------------ 1 file changed, 47 insertions(+), 44 deletions(-) diff --git a/frontend/src/pages/dashboard/stacks.jsx b/frontend/src/pages/dashboard/stacks.jsx index a9f5b52..305c12b 100644 --- a/frontend/src/pages/dashboard/stacks.jsx +++ b/frontend/src/pages/dashboard/stacks.jsx @@ -150,8 +150,16 @@ export function Stacks() { console.log("๐Ÿ”Œ Socket connected"); socket.on("redeployStatus", async (payload = {}) => { - const { stackId } = payload; - if (!stackId) return; + const { stackId: rawStackId } = payload; + if (!rawStackId) return; + + let stackId = rawStackId; + if (typeof rawStackId === 'string') { + const numericId = Number(rawStackId); + if (!Number.isNaN(numericId)) { + stackId = numericId; + } + } const resolvedPhaseRaw = payload.redeployPhase ?? payload.phase; let resolvedPhase = resolvedPhaseRaw; @@ -173,7 +181,9 @@ export function Stacks() { resolvedPhase = REDEPLOY_PHASES.INFO; } - const stackSnapshot = stacksByIdRef.current.get(stackId); + const stackSnapshot = + stacksByIdRef.current.get(stackId) ?? + stacksByIdRef.current.get(String(stackId)); const stackName = payload.stackName ?? stackSnapshot?.Name; const stackLabel = stackName ? `${stackName} (ID: ${stackId})` : `Stack ${stackId}`; @@ -202,7 +212,7 @@ export function Stacks() { setStacks(prev => prev.map(stack => { - if (stack.Id !== stackId) return stack; + if (String(stack.Id) !== String(stackId)) return stack; const nextPhase = resolvedPhase ?? stack.redeployPhase ?? null; const isQueued = nextPhase === REDEPLOY_PHASES.QUEUED; @@ -361,7 +371,12 @@ export function Stacks() { }, [stacks]); useEffect(() => { - stacksByIdRef.current = new Map(stacks.map((stack) => [stack.Id, stack])); + const nextMap = new Map(); + stacks.forEach((stack) => { + nextMap.set(stack.Id, stack); + nextMap.set(String(stack.Id), stack); + }); + stacksByIdRef.current = nextMap; }, [stacks]); const normalizedSearch = searchQuery.trim().toLowerCase(); @@ -414,19 +429,6 @@ export function Stacks() { setTotals(filteredStacks.length, paginatedStacks.length); }, [filteredStacks.length, paginatedStacks.length, setTotals]); - const visiblePageStackIds = useMemo(() => new Set(paginatedStacks.map((stack) => stack.Id)), [paginatedStacks]); - - const eligiblePageStacks = useMemo( - () => paginatedStacks.filter((stack) => { - if (stack.updateStatus === 'โœ…') return false; - if (stack.redeployDisabled) return false; - const phase = stack.redeployPhase; - if (phase === REDEPLOY_PHASES.STARTED || phase === REDEPLOY_PHASES.QUEUED) return false; - return true; - }), - [paginatedStacks] - ); - const selectionPreferenceRef = useRef({ action: 'keep', remember: false }); const previousFiltersRef = useRef({ status: statusFilter, search: normalizedSearch }); const didMountRef = useRef(false); @@ -634,44 +636,45 @@ export function Stacks() { }; const handleRedeployAll = async () => { - if (!eligiblePageStacks.length) return; + if (!eligibleFilteredStacks.length) return; - const targetIds = new Set(eligiblePageStacks.map((stack) => stack.Id)); + const targetIdList = eligibleFilteredStacks.map((stack) => stack.Id); + const targetIdSet = new Set(targetIdList.map((id) => String(id))); setStacks(prev => - prev.map(stack => - targetIds.has(stack.Id) - ? { - ...stack, - redeployPhase: REDEPLOY_PHASES.QUEUED, - redeploying: true, - redeployQueued: true - } - : stack - ) + prev.map(stack => { + const key = String(stack.Id); + if (!targetIdSet.has(key)) return stack; + return { + ...stack, + redeployPhase: REDEPLOY_PHASES.QUEUED, + redeploying: true, + redeployQueued: true + }; + }) ); try { - if (targetIds.size === eligibleFilteredStacks.length) { + if (!hasActiveFilters) { await axios.put("/api/stacks/redeploy-all"); } else { - await axios.put("/api/stacks/redeploy-selection", { stackIds: Array.from(targetIds) }); + await axios.put("/api/stacks/redeploy-selection", { stackIds: targetIdList }); } - setSelectedStackIds((prev) => prev.filter((id) => !targetIds.has(id))); + setSelectedStackIds((prev) => prev.filter((id) => !targetIdSet.has(String(id)))); // Statusupdates kommen รผber Socket.IO } catch (err) { console.error("โŒ Fehler beim Redeploy ALL:", err); setStacks(prev => - prev.map(stack => - targetIds.has(stack.Id) - ? { - ...stack, - redeployPhase: null, - redeploying: false, - redeployQueued: false - } - : stack - ) + prev.map(stack => { + const key = String(stack.Id); + if (!targetIdSet.has(key)) return stack; + return { + ...stack, + redeployPhase: null, + redeploying: false, + redeployQueued: false + }; + }) ); const errorText = err.response?.data?.error || err.message || 'Unbekannter Fehler'; @@ -745,7 +748,7 @@ export function Stacks() { }; const hasSelection = selectedStackIds.length > 0; - const hasOutdatedStacks = eligiblePageStacks.length > 0; + const hasOutdatedStacks = eligibleFilteredStacks.length > 0; const bulkButtonLabel = hasSelection ? `Redeploy Auswahl (${selectedStackIds.length})` : 'Redeploy Alle';