mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-10-20 00:03:21 +00:00
fix: fork deploy override and selection out of step with the item list (#11871)
* fix: keep the fork deploy override across selection changes * fix: drop selected rows that leave the fork comparison
This commit is contained in:
@@ -813,7 +813,19 @@
|
||||
}
|
||||
|
||||
let deploymentErrorMessage = $state('')
|
||||
let allowBehindChangesOverride = $state(false)
|
||||
// The override acknowledges the outdated items listed next to it, not the
|
||||
// selection, so it holds while every outdated item is one the user ticked it
|
||||
// for: a refresh bringing in a new one asks again, one leaving the list does not.
|
||||
let acknowledgedBehindKeys = $state<Set<string> | undefined>()
|
||||
let allowBehindChangesOverride = $derived(
|
||||
acknowledgedBehindKeys != undefined &&
|
||||
itemsWithBehindChanges.every((d) => acknowledgedBehindKeys!.has(getItemKey(d)))
|
||||
)
|
||||
function setBehindChangesOverride(allow: boolean) {
|
||||
acknowledgedBehindKeys = allow
|
||||
? new Set(itemsWithBehindChanges.map((d) => getItemKey(d)))
|
||||
: undefined
|
||||
}
|
||||
|
||||
async function isComparisonUpToDate(): Promise<boolean> {
|
||||
if (!comparison) {
|
||||
@@ -1122,18 +1134,17 @@
|
||||
const current = new Set(diffs.filter(removesInTarget).map((d) => getItemKey(d)))
|
||||
const flipped = [...current].filter((k) => !removalKeys.has(k))
|
||||
removalKeys = current
|
||||
if (flipped.some((k) => selectedItems.includes(k))) {
|
||||
selectedItems = selectedItems.filter((k) => !flipped.includes(k))
|
||||
// A row that left the list (made workspace specific, synced elsewhere) takes its
|
||||
// tick with it: the deploy button counts the selection, and a key with no row
|
||||
// would be reported as undeployable.
|
||||
const listed = new Set(selectableDiffs.map((d) => getItemKey(d)))
|
||||
const kept = selectedItems.filter((k) => listed.has(k) && !flipped.includes(k))
|
||||
if (kept.length !== selectedItems.length) {
|
||||
selectedItems = kept
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
// Reset override when selection or direction changes
|
||||
$effect(() => {
|
||||
;[selectedItems, mergeIntoParent]
|
||||
allowBehindChangesOverride = false
|
||||
})
|
||||
|
||||
// Trigger and schedule rows now flow through `comparison.diffs` like every
|
||||
// other deployable kind — the backend's `compareWorkspaces` populates them
|
||||
// from `workspace_diff`, with runtime fields ignored by `compare_two_*`.
|
||||
@@ -1582,7 +1593,8 @@
|
||||
<span class="font-medium flex flex-row gap-1 text-red-500">
|
||||
<input
|
||||
type="checkbox"
|
||||
bind:checked={allowBehindChangesOverride}
|
||||
checked={allowBehindChangesOverride}
|
||||
onchange={(e) => setBehindChangesOverride(e.currentTarget.checked)}
|
||||
class="rounded max-w-4"
|
||||
/>
|
||||
Override: Deploy despite {itemsWithBehindChanges.length} outdated item{itemsWithBehindChanges.length !==
|
||||
|
||||
Reference in New Issue
Block a user