From 7cc5267763afd80691869b0d088bbc4d9ca3896c Mon Sep 17 00:00:00 2001 From: tristantr Date: Tue, 26 May 2026 12:16:23 +0200 Subject: [PATCH] Add diff button once approved by admins --- .../workspaceSettings/DeployToHub.svelte | 70 ++++++++++++++----- 1 file changed, 54 insertions(+), 16 deletions(-) diff --git a/frontend/src/lib/components/workspaceSettings/DeployToHub.svelte b/frontend/src/lib/components/workspaceSettings/DeployToHub.svelte index 799c714623..5f5e6a0f3a 100644 --- a/frontend/src/lib/components/workspaceSettings/DeployToHub.svelte +++ b/frontend/src/lib/components/workspaceSettings/DeployToHub.svelte @@ -29,6 +29,7 @@ Cloud, Copy, ExternalLink, + GitCompare, Globe, Loader2, Play, @@ -296,18 +297,38 @@ submitting = false } } - async function withdrawSubmission() { - // MOCK - await delay(200) - phase = 'draft' - sendUserToast('Submission withdrawn. Draft is editable again.') + let syncing = $state(false) + async function showDiff() { + // MOCK: would diff the live workspace against the submitted bundle and open a viewer. + const workspace = $workspaceStore + if (!workspace) return + await loadWorkspace(workspace) + const draftKeys = new Set(draftItems.map((i) => i.key)) + const workspaceKeys = new Set(workspaceItems.map((i) => i.key)) + const added = workspaceItems.filter((i) => !draftKeys.has(i.key)).length + const removed = draftItems.filter((i) => !workspaceKeys.has(i.key)).length + sendUserToast(`Diff: +${added} added, -${removed} removed (vs submitted bundle).`) } - async function approve() { - // MOCK: dev-only shortcut to simulate Windmill team approval. - await delay(200) - hubVersion += 1 - phase = 'live' - sendUserToast(`Approved — published as v${hubVersion} on the Hub.`) + async function syncWithHub() { + // MOCK: would also pull the latest Hub-side state. For now, refresh the workspace + // items list and merge into the current draft (keeping recordings where the item path + // still exists). + const workspace = $workspaceStore + if (!workspace) return + syncing = true + try { + await loadWorkspace(workspace) + if (phase === 'draft') { + const prev = new Map(draftItems.map((i) => [i.key, { rec: i.rec }])) + draftItems = workspaceItems + .filter((i) => prev.has(i.key)) + .map((i) => ({ ...i, rec: prev.get(i.key)?.rec ?? 'none' })) + } + } catch (e: any) { + sendUserToast(`Sync failed: ${e?.message ?? e}`, true) + } finally { + syncing = false + } } async function startNewDraft() { // MOCK: re-snapshot from the live workspace and start a fresh draft cycle. @@ -536,6 +557,18 @@ Open in Hub {/if} + {#if phase === 'live'} +
+ +
+ {/if} {#if phase === 'predeploy' && availableFolders.length > 0}
@@ -725,12 +758,17 @@ {:else if phase === 'under_review'} - Withdraw to keep editing, or wait for the team to approve. + Waiting for the Windmill team to review the submission. - - +