mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-20 00:02:19 +00:00
refactor(editors): drop UnsavedConfirmationModal mount + Show diff button
This commit is contained in:
@@ -2,8 +2,6 @@
|
||||
import ConfirmationModal from './ConfirmationModal.svelte'
|
||||
import { beforeNavigate } from '$app/navigation'
|
||||
import { goto as gotoUrl } from '$app/navigation'
|
||||
import Button from '../button/Button.svelte'
|
||||
import type DiffDrawer from '$lib/components/DiffDrawer.svelte'
|
||||
import {
|
||||
cleanValueProperties,
|
||||
orderedJsonStringify,
|
||||
@@ -16,7 +14,6 @@
|
||||
|
||||
interface Props {
|
||||
getInitialAndModifiedValues?: GetInitialAndModifiedValues
|
||||
diffDrawer?: DiffDrawer | undefined
|
||||
additionalExitAction?: () => void
|
||||
triggerOnSearchParamsChange?: boolean
|
||||
onDiscardChanges?: () => void
|
||||
@@ -25,7 +22,6 @@
|
||||
|
||||
let {
|
||||
getInitialAndModifiedValues = undefined,
|
||||
diffDrawer = undefined,
|
||||
additionalExitAction = () => {},
|
||||
triggerOnSearchParamsChange = false,
|
||||
onDiscardChanges = undefined,
|
||||
@@ -111,37 +107,5 @@
|
||||
>
|
||||
<div class="flex flex-col w-full space-y-4">
|
||||
<span>Are you sure you want to discard the changes you have made? </span>
|
||||
{#if savedValue && modifiedValue && diffDrawer}
|
||||
<Button
|
||||
wrapperClasses="self-start"
|
||||
variant="default"
|
||||
size="xs"
|
||||
on:click={() => {
|
||||
if (!savedValue || !modifiedValue) {
|
||||
return
|
||||
}
|
||||
open = false
|
||||
diffDrawer?.openDrawer()
|
||||
diffDrawer?.setDiff({
|
||||
mode: 'normal',
|
||||
deployed: savedValue,
|
||||
draft: savedValue.draft,
|
||||
current: modifiedValue,
|
||||
defaultDiffType: 'draft',
|
||||
button: {
|
||||
text: 'Leave anyway',
|
||||
onClick: () => {
|
||||
if (goingTo) {
|
||||
bypassBeforeNavigate = true
|
||||
additionalExitAction?.()
|
||||
gotoUrl(goingTo)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}}
|
||||
>Show diff
|
||||
</Button>
|
||||
{/if}
|
||||
</div>
|
||||
</ConfirmationModal>
|
||||
|
||||
@@ -71,8 +71,6 @@
|
||||
import { isRuleActive } from '$lib/workspaceProtectionRules.svelte'
|
||||
import { buildForkEditUrl } from '$lib/utils/editInFork'
|
||||
import { isCloudHosted } from '$lib/cloud'
|
||||
import UnsavedConfirmationModal from '../common/confirmationModal/UnsavedConfirmationModal.svelte'
|
||||
import type { SavedAndModifiedValue } from '../common/confirmationModal/unsavedTypes'
|
||||
|
||||
// async function hash(message) {
|
||||
// try {
|
||||
@@ -525,18 +523,6 @@
|
||||
|
||||
let jobsDrawerOpen = $state(false)
|
||||
|
||||
function getInitialAndModifiedValues(): SavedAndModifiedValue {
|
||||
return {
|
||||
savedValue: savedApp,
|
||||
modifiedValue: {
|
||||
summary: summary,
|
||||
value: app,
|
||||
path: newEditedPath || savedApp?.path,
|
||||
policy,
|
||||
custom_path: customPath
|
||||
}
|
||||
}
|
||||
}
|
||||
let app = $derived(files ? { runnables: runnables, files, data } : undefined)
|
||||
|
||||
$effect(() => {
|
||||
@@ -544,14 +530,6 @@
|
||||
})
|
||||
</script>
|
||||
|
||||
<!-- Inside a session pane the editor's content is continuously persisted to the
|
||||
UserDraft (localStorage), so tearing the editor down on navigation loses
|
||||
nothing — skip the unsaved-changes prompt. The standalone /apps_raw editor
|
||||
keeps it. -->
|
||||
{#if !inSessionPane}
|
||||
<UnsavedConfirmationModal {diffDrawer} {getInitialAndModifiedValues} />
|
||||
{/if}
|
||||
|
||||
<DeployOverrideConfirmationModal
|
||||
{deployedBy}
|
||||
{confirmCallback}
|
||||
|
||||
Reference in New Issue
Block a user