From 2d9e5e12d69872cf81510d765b0e5d2e4568f2a7 Mon Sep 17 00:00:00 2001 From: Jarek Krochmalski Date: Mon, 14 Sep 2026 05:25:04 +0200 Subject: [PATCH] stack action buttons show for stopped and freshly created stacks, regression --- src/lib/utils/stack-actions.ts | 11 +++++++++++ src/routes/stacks/+page.svelte | 3 ++- tests/stack-actions.test.ts | 27 +++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 src/lib/utils/stack-actions.ts create mode 100644 tests/stack-actions.test.ts diff --git a/src/lib/utils/stack-actions.ts b/src/lib/utils/stack-actions.ts new file mode 100644 index 0000000..4c3cfe7 --- /dev/null +++ b/src/lib/utils/stack-actions.ts @@ -0,0 +1,11 @@ +// Whether the stack row's management actions (edit / logs / start / restart / +// stop) should render. They show for a stack in ANY state EXCEPT a git stack that +// has not been deployed yet - that one shows only its dedicated deploy button, so +// the management actions would be redundant. A non-git stack that is stopped or +// freshly created still needs its Start button, so deploy status must not hide the +// management actions. `status` is the raw stack status; a git stack that has never +// deployed is raw "created" (shown as "not deployed" elsewhere). + +export function showsManagementActions(sourceType: string | undefined, status: string): boolean { + return !(sourceType === 'git' && status === 'created'); +} diff --git a/src/routes/stacks/+page.svelte b/src/routes/stacks/+page.svelte index c384b1f..940e179 100644 --- a/src/routes/stacks/+page.svelte +++ b/src/routes/stacks/+page.svelte @@ -28,6 +28,7 @@ import ContainerIcon from '$lib/components/ContainerIcon.svelte'; import BatchOperationModal from '$lib/components/BatchOperationModal.svelte'; import type { ComposeStackInfo, ContainerStats, StackContainer } from '$lib/types'; + import { showsManagementActions } from '$lib/utils/stack-actions'; import StackModal from './StackModal.svelte'; import DeleteStackModal from './DeleteStackModal.svelte'; import ComposeOutputModal from './ComposeOutputModal.svelte'; @@ -2180,7 +2181,7 @@ {/snippet} {/if} - {#if stack.status !== 'not deployed' && stack.status !== 'created'} + {#if showsManagementActions(source.sourceType, stack.status)} {#if $canAccess('stacks', 'edit')} {#if source.sourceType === 'git' && source.gitStack}