mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-23 16:00:38 +00:00
nits
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
ScheduleService,
|
||||
type Script
|
||||
} from '$lib/gen'
|
||||
import { page } from '$app/stores'
|
||||
import { inferArgs } from '$lib/infer'
|
||||
import { initialCode } from '$lib/script_helpers'
|
||||
import { defaultScripts, enterpriseLicense, userStore, workspaceStore } from '$lib/stores'
|
||||
@@ -42,7 +41,6 @@
|
||||
Settings,
|
||||
X
|
||||
} from 'lucide-svelte'
|
||||
import UnsavedConfirmationModal from './common/confirmationModal/UnsavedConfirmationModal.svelte'
|
||||
import { sendUserToast } from '$lib/toast'
|
||||
import { isCloudHosted } from '$lib/cloud'
|
||||
import Awareness from './Awareness.svelte'
|
||||
@@ -71,12 +69,14 @@
|
||||
export let showMeta: boolean = false
|
||||
export let diffDrawer: DiffDrawer | undefined = undefined
|
||||
export let savedScript: NewScriptWithDraft | undefined = undefined
|
||||
export let searchParams: URLSearchParams = new URLSearchParams()
|
||||
export let disableHistoryChange = false
|
||||
|
||||
let metadataOpen =
|
||||
showMeta ||
|
||||
(initialPath == '' &&
|
||||
$page.url.searchParams.get('state') == undefined &&
|
||||
$page.url.searchParams.get('collab') == undefined)
|
||||
searchParams.get('state') == undefined &&
|
||||
searchParams.get('collab') == undefined)
|
||||
|
||||
let editor: Editor | undefined = undefined
|
||||
let scriptEditor: ScriptEditor | undefined = undefined
|
||||
@@ -157,13 +157,13 @@
|
||||
|
||||
$: {
|
||||
;['collab', 'path'].forEach((x) => {
|
||||
if ($page.url.searchParams.get(x)) {
|
||||
$page.url.searchParams.delete(x)
|
||||
if (searchParams.get(x)) {
|
||||
searchParams.delete(x)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
$: window.history.replaceState(null, '', '#' + encodeState(script))
|
||||
$: !disableHistoryChange && window.history.replaceState(null, '', '#' + encodeState(script))
|
||||
|
||||
if (script.content == '') {
|
||||
initContent(script.language, script.kind, template)
|
||||
@@ -289,7 +289,9 @@
|
||||
}
|
||||
|
||||
savedScript = cloneDeep(script) as NewScriptWithDraft
|
||||
history.replaceState(history.state, '', `/scripts/edit/${script.path}`)
|
||||
if (!disableHistoryChange) {
|
||||
history.replaceState(history.state, '', `/scripts/edit/${script.path}`)
|
||||
}
|
||||
if (stay) {
|
||||
script.parent_hash = newHash
|
||||
} else {
|
||||
@@ -454,7 +456,7 @@
|
||||
</script>
|
||||
|
||||
<svelte:window on:keydown={onKeyDown} />
|
||||
<UnsavedConfirmationModal {diffDrawer} savedValue={savedScript} modifiedValue={script} />
|
||||
<slot />
|
||||
|
||||
{#if !$userStore?.operator}
|
||||
<Drawer placement="right" bind:open={metadataOpen} size="800px">
|
||||
|
||||
@@ -328,7 +328,6 @@
|
||||
filePath: 'windmill.d.ts'
|
||||
})
|
||||
}
|
||||
console.log(libs)
|
||||
languages.typescript.javascriptDefaults.setExtraLibs(libs)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
result: [] as any[],
|
||||
loading: false,
|
||||
page: 0,
|
||||
newChange: { row: 0, column: '', value: undefined },
|
||||
newChange: { row: 0, column: '', value: undefined, old: undefined },
|
||||
ready: undefined as boolean | undefined,
|
||||
inputs: {},
|
||||
filters: {},
|
||||
@@ -153,7 +153,8 @@
|
||||
outputs?.newChange?.set({
|
||||
row: event.node.rowIndex,
|
||||
column: event.colDef.field,
|
||||
value: dataCell
|
||||
value: dataCell,
|
||||
old: result[Number(event.node.data['__index'])][event.colDef.field]
|
||||
})
|
||||
result[Number(event.node.data['__index'])][event.colDef.field] = dataCell
|
||||
let data = { ...result[event.node.rowIndex] }
|
||||
|
||||
@@ -264,12 +264,12 @@
|
||||
true
|
||||
)
|
||||
|
||||
await setResult(r, job, setRunnableJobEditorPanel)
|
||||
await setResult(r, job)
|
||||
$state = $state
|
||||
} catch (e) {
|
||||
sendUserToast(`Error running frontend script ${id}: ` + e.message, true)
|
||||
r = { error: { message: e.body ?? e.message } }
|
||||
await setResult(r, job, setRunnableJobEditorPanel)
|
||||
await setResult(r, job)
|
||||
}
|
||||
loading = false
|
||||
donePromise?.(r)
|
||||
@@ -483,11 +483,7 @@
|
||||
result = res
|
||||
}
|
||||
|
||||
async function setResult(
|
||||
res: any,
|
||||
jobId: string | undefined,
|
||||
setRunnableJobEditorPanel?: boolean
|
||||
) {
|
||||
async function setResult(res: any, jobId: string | undefined) {
|
||||
dispatch('resultSet')
|
||||
const errors = getResultErrors(res)
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
import type { Schema } from '$lib/common'
|
||||
import { decodeState, emptySchema } from '$lib/utils'
|
||||
import { goto } from '$app/navigation'
|
||||
import UnsavedConfirmationModal from '$lib/components/common/confirmationModal/UnsavedConfirmationModal.svelte'
|
||||
|
||||
// Default
|
||||
let schema: Schema = emptySchema()
|
||||
@@ -85,6 +86,7 @@
|
||||
loadTemplate()
|
||||
}
|
||||
}
|
||||
let savedScript: Script | undefined = undefined
|
||||
</script>
|
||||
|
||||
<ScriptBuilder
|
||||
@@ -98,6 +100,10 @@
|
||||
let path = e.detail
|
||||
goto(`/scripts/edit/${path}`)
|
||||
}}
|
||||
bind:savedScript
|
||||
searchParams={$page.url.searchParams}
|
||||
{script}
|
||||
{showMeta}
|
||||
/>
|
||||
>
|
||||
<UnsavedConfirmationModal savedValue={savedScript} modifiedValue={script} />
|
||||
</ScriptBuilder>
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
import { sendUserToast } from '$lib/toast'
|
||||
import DiffDrawer from '$lib/components/DiffDrawer.svelte'
|
||||
import { cloneDeep } from 'lodash'
|
||||
import UnsavedConfirmationModal from '$lib/components/common/confirmationModal/UnsavedConfirmationModal.svelte'
|
||||
|
||||
const initialState = $page.url.hash != '' ? $page.url.hash.slice(1) : undefined
|
||||
let initialArgs = {}
|
||||
@@ -193,6 +194,7 @@
|
||||
bind:savedScript
|
||||
{initialArgs}
|
||||
{diffDrawer}
|
||||
searchParams={$page.url.searchParams}
|
||||
on:deploy={(e) => {
|
||||
let newHash = e.detail
|
||||
goto(`/scripts/get/${newHash}?workspace=${$workspaceStore}`)
|
||||
@@ -205,5 +207,10 @@
|
||||
let path = e.detail
|
||||
goto(`/scripts/get/${path}?workspace=${$workspaceStore}`)
|
||||
}}
|
||||
/>
|
||||
><UnsavedConfirmationModal
|
||||
{diffDrawer}
|
||||
savedValue={savedScript}
|
||||
modifiedValue={script}
|
||||
/></ScriptBuilder
|
||||
>
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user