diff --git a/frontend/src/lib/components/CompareWorkspaces.svelte b/frontend/src/lib/components/CompareWorkspaces.svelte index 6905ed6931..4f9184c93c 100644 --- a/frontend/src/lib/components/CompareWorkspaces.svelte +++ b/frontend/src/lib/components/CompareWorkspaces.svelte @@ -144,7 +144,7 @@ const app = await AppService.getAppByPath({ workspace, path }) return app.summary } else if (kind === 'folder') { - const folder = await FolderService.getFolder({ workspace, name: path.slice(2) }) + const folder = await FolderService.getFolder({ workspace, name: path.replace(/^f\//, '') }) return folder.summary } } catch (error) { @@ -361,7 +361,14 @@ const parent = parentWorkspaceId const current = currentWorkspaceId - for (const itemKey of selectedItems) { + const sortedItems = [...selectedItems].sort((a, b) => { + const aIsFolder = a.startsWith('folder:') + const bIsFolder = b.startsWith('folder:') + if (aIsFolder && !bIsFolder) return -1 + if (!aIsFolder && bIsFolder) return 1 + return 0 + }) + for (const itemKey of sortedItems) { const diff = selectableDiffs.find((d) => itemKey == getItemKey(d)) if (!diff) { diff --git a/frontend/src/lib/utils_workspace_deploy.ts b/frontend/src/lib/utils_workspace_deploy.ts index 200ef76373..502d0c5f0c 100644 --- a/frontend/src/lib/utils_workspace_deploy.ts +++ b/frontend/src/lib/utils_workspace_deploy.ts @@ -18,6 +18,11 @@ import { } from '$lib/utils_deployable' import type { TriggerKind } from './components/triggers' +/** Folder diff paths carry the `f/` prefix (e.g. `f/test`), but folder API endpoints expect just the name. */ +function folderName(path: string): string { + return path.replace(/^f\//, '') +} + export interface DeployItemParams { kind: Kind path: string @@ -254,12 +259,32 @@ export async function deployItem(params: DeployItemParams): Promise