Files
windmill/frontend/src/lib/components/CompareModeToggle.svelte
T
Ruben FiszelandClaude Opus 5 61f2d8dc6a feat: let the merge UI target an arbitrary workspace (#10417)
* feat: let the merge UI target an arbitrary workspace

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: keep the target picker reachable when a comparison fails

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: address review findings on the arbitrary merge target

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: collapse app/raw-app conversions and offer a comparison retry

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: make a re-scan replace the candidate set and keep retry reachable

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: drop destructive rows from the selection when a recompute flips them

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: keep bulk selection and refreshes out of the removal opt-in

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: serialize a full scan against dev attachment on the same pair

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: keep the compare view reachable from drafts and prune stale selections

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: make the destination badge the target picker and reorder the settings

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: render the destination trigger as the same badge as the source

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 23:46:59 +02:00

69 lines
2.0 KiB
Svelte

<script lang="ts" module>
// The merged compare control: fork direction (deploy_to / update) and the
// deployed↔draft comparison live in one toggle. `deploy_to`/`update` only
// apply in a fork; a non-fork workspace has draft as the sole option (the
// caller hides the toggle entirely in that case).
export type CompareMode = 'deploy_to' | 'update' | 'draft'
</script>
<script lang="ts">
import ToggleButtonGroup from './common/toggleButton-v2/ToggleButtonGroup.svelte'
import ToggleButton from './common/toggleButton-v2/ToggleButton.svelte'
import { ArrowUp, ArrowDown, Pencil } from 'lucide-svelte'
interface Props {
selected: CompareMode
isFork: boolean
/** Drop the `update` direction: a target outside the fork lineage has no
* tally saying which side a change came from, so only the deploy direction
* is meaningful. */
oneWay?: boolean
parentWorkspaceId?: string
deployCount?: number
updateCount?: number
draftCount?: number
disabled?: boolean
onSelected: (v: CompareMode) => void
}
let {
selected,
isFork,
oneWay = false,
parentWorkspaceId,
deployCount = 0,
updateCount = 0,
draftCount = 0,
disabled = false,
onSelected
}: Props = $props()
// Append a count suffix only when there is something to act on, mirroring the
// draft toggle (no "(0)" noise).
function withCount(label: string, count: number): string {
return count > 0 ? `${label} (${count})` : label
}
</script>
<ToggleButtonGroup {disabled} {selected} onSelected={(v) => onSelected(v as CompareMode)} noWFull>
{#snippet children({ item })}
{#if isFork}
<ToggleButton
value="deploy_to"
label={withCount(`Deploy to ${parentWorkspaceId}`, deployCount)}
icon={ArrowUp}
{item}
/>
{#if !oneWay}
<ToggleButton
value="update"
label={withCount('Update current', updateCount)}
icon={ArrowDown}
{item}
/>
{/if}
{/if}
<ToggleButton value="draft" label={`Deploy draft (${draftCount})`} icon={Pencil} {item} />
{/snippet}
</ToggleButtonGroup>