diff --git a/frontend/src/routes/(root)/(logged)/workspace_settings/+page.svelte b/frontend/src/routes/(root)/(logged)/workspace_settings/+page.svelte index c6171b96e7..308d46d89a 100644 --- a/frontend/src/routes/(root)/(logged)/workspace_settings/+page.svelte +++ b/frontend/src/routes/(root)/(logged)/workspace_settings/+page.svelte @@ -111,6 +111,7 @@ reconcileAfterWorkspaceChange } from '$lib/components/sessions/sessionState.svelte' import TextInput from '$lib/components/text_input/TextInput.svelte' + import { workspaceIsFork } from '$lib/utils/workspaceHierarchy' import CollapseLink from '$lib/components/CollapseLink.svelte' import SlackAppSetup from '$lib/components/common/slack/SlackAppSetup.svelte' import { validateWebhookUrl, validateEncryptionKey } from '$lib/validators/workspaceSettings' @@ -139,13 +140,18 @@ let archiveConfirmOpen = $state(false) let deleteConfirmOpen = $state(false) let affectedSessionCount = $state(0) + // A root workspace has no parent to fall back on, so archiving or deleting it asks for its + // ID typed out; a fork is disposable and keeps the one-click confirm. + let typedWorkspaceId = $state('') async function openArchiveConfirm() { affectedSessionCount = await countSessionsForWorkspace($workspaceStore ?? '') + typedWorkspaceId = '' archiveConfirmOpen = true } async function openDeleteConfirm() { affectedSessionCount = await countSessionsForWorkspace($workspaceStore ?? '') + typedWorkspaceId = '' deleteConfirmOpen = true } async function doArchiveWorkspace() { @@ -503,6 +509,14 @@ } }) const currentWorkspace = $derived($userWorkspaces.find((w) => w.id === $workspaceStore)) + // A dev workspace has a parent too but is long-lived, so only a plain fork skips typing the ID. + const requiresTypedWorkspaceId = $derived( + !workspaceIsFork($workspaceStore, $userWorkspaces) || !!currentWorkspace?.is_dev_workspace + ) + const typedWorkspaceIdMatches = $derived( + !requiresTypedWorkspaceId || typedWorkspaceId.trim() === ($workspaceStore ?? '') + ) + const isSpecialWorkspace = $derived($workspaceStore === 'admins' || $workspaceStore === 'starter') // The deploy filters configure what may be promoted into the parent, so they only mean // something for a fork. A root workspace deploys nowhere by lineage. @@ -2145,46 +2159,84 @@
- Delete workspace - {#if !$superadmin} -- Only instance superadmins can delete a workspace. -
- {/if} - {#if $workspaceStore === 'admins' || $workspaceStore === 'starter'} -- This workspace cannot be deleted as it has a special function. Consult the - documentation for more information. -
- {/if} -