This commit is contained in:
Ruben Fiszel
2024-04-18 16:05:57 +02:00
parent 2459a5dfed
commit 7e76d419f5
7 changed files with 45 additions and 7 deletions
+9 -1
View File
@@ -1,6 +1,6 @@
{
"name": "windmill-components",
"version": "1.309.2",
"version": "1.309.3",
"scripts": {
"dev": "vite dev",
"build": "vite build",
@@ -225,6 +225,11 @@
"svelte": "./package/components/FlowBuilder.svelte",
"default": "./package/components/FlowBuilder.svelte"
},
"./components/ScriptBuilder.svelte": {
"types": "./package/components/ScriptBuilder.svelte.d.ts",
"svelte": "./package/components/ScriptBuilder.svelte",
"default": "./package/components/ScriptBuilder.svelte"
},
"./components/FlowEditor.svelte": {
"types": "./package/components/flows/FlowEditor.svelte.d.ts",
"svelte": "./package/components/flows/FlowEditor.svelte",
@@ -360,6 +365,9 @@
"components/FlowBuilder.svelte": [
"./package/components/FlowBuilder.svelte.d.ts"
],
"components/ScriptBuilder.svelte": [
"./package/components/ScriptBuilder.svelte.d.ts"
],
"components/FlowEditor.svelte": [
"./package/components/flows/FlowEditor.svelte.d.ts"
],
@@ -7,7 +7,6 @@
ScheduleService,
type Script
} from '$lib/gen'
import { goto } from '$app/navigation'
import { page } from '$app/stores'
import { inferArgs } from '$lib/infer'
import { initialCode } from '$lib/script_helpers'
@@ -62,6 +61,7 @@
import { writable } from 'svelte/store'
import { type ScriptSchedule, loadScriptSchedule, defaultScriptLanguages } from '$lib/scripts'
import DefaultScripts from './DefaultScripts.svelte'
import { createEventDispatcher } from 'svelte'
export let script: NewScript
export let initialPath: string = ''
@@ -88,6 +88,7 @@
args: {},
enabled: false
})
async function loadSchedule() {
const scheduleRes = await loadScriptSchedule(initialPath, $workspaceStore!)
if (scheduleRes) {
@@ -95,6 +96,8 @@
}
}
const dispatch = createEventDispatcher()
$: {
if (initialPath != '') {
loadSchedule()
@@ -290,7 +293,7 @@
if (stay) {
script.parent_hash = newHash
} else {
goto(`/scripts/get/${newHash}?workspace=${$workspaceStore}`)
dispatch('deploy', newHash)
}
} catch (error) {
sendUserToast(`Error while saving the script: ${error.body || error.message}`, true)
@@ -389,7 +392,7 @@
if (initialPath == '' || (savedScript?.draft_only && script.path !== initialPath)) {
initialPath = script.path
goto(`/scripts/edit/${script.path}`)
dispatch('saveInitial', script.path)
}
sendUserToast('Saved as draft')
} catch (error) {
@@ -422,7 +425,7 @@
{
label: 'Exit & See details',
onClick: () => {
goto(`/scripts/get/${initialPath}?workspace=${$workspaceStore}`)
dispatch('seeDetails', initialPath)
}
}
]
@@ -18,6 +18,8 @@
import 'monaco-editor/esm/vs/basic-languages/sql/sql.contribution'
import 'monaco-editor/esm/vs/basic-languages/yaml/yaml.contribution'
import 'monaco-editor/esm/vs/basic-languages/javascript/javascript.contribution'
import 'monaco-editor/esm/vs/basic-languages/typescript/typescript.contribution'
import 'monaco-editor/esm/vs/language/typescript/monaco.contribution'
import 'monaco-editor/esm/vs/language/json/monaco.contribution'
import 'monaco-editor/esm/vs/basic-languages/css/css.contribution'
import 'monaco-editor/esm/vs/language/css/monaco.contribution'
@@ -84,7 +84,10 @@
let renderer: (props: CCProps<number>) => void =
globalThis.windmill[customComponent?.name ?? 'no_name']
if (!renderer) {
sendUserToast('Custom Component seem to be ill-defined (renderer missing)', true)
sendUserToast(
'Custom Component seem to be ill-defined (renderer missing). is COMPONENT_NAME in vite.config.ts matching the name of the custom component?',
true
)
return
}
renderer?.(ccProps)
@@ -52,7 +52,8 @@
dispatch('reload')
} catch (e) {
sendUserToast(
'Component creation failed. You need write privilege on folder app_custom: ' + e.body ?? e,
'Component creation failed. Is the file uploaded, did you give it a name ? Do you have write privilege on folder app_custom: ' +
e.body ?? e,
true
)
}
@@ -6,6 +6,7 @@
import ScriptBuilder from '$lib/components/ScriptBuilder.svelte'
import type { Schema } from '$lib/common'
import { decodeState, emptySchema } from '$lib/utils'
import { goto } from '$app/navigation'
// Default
let schema: Schema = emptySchema()
@@ -89,6 +90,14 @@
<ScriptBuilder
bind:this={scriptBuilder}
lockedLanguage={templatePath != null || hubPath != null}
on:deploy={(e) => {
let newHash = e.detail
goto(`/scripts/get/${newHash}?workspace=${$workspaceStore}`)
}}
on:saveInitial={(e) => {
let path = e.detail
goto(`/scripts/edit/${path}`)
}}
{script}
{showMeta}
/>
@@ -193,5 +193,17 @@
bind:savedScript
{initialArgs}
{diffDrawer}
on:deploy={(e) => {
let newHash = e.detail
goto(`/scripts/get/${newHash}?workspace=${$workspaceStore}`)
}}
on:saveInitial={(e) => {
let path = e.detail
goto(`/scripts/edit/${path}`)
}}
on:seeDetails={(e) => {
let path = e.detail
goto(`/scripts/get/${path}?workspace=${$workspaceStore}`)
}}
/>
{/if}