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}