mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-10-30 08:16:49 +00:00
* fix(frontend): add table * fix(frontend): Rework the context panel * fix(frontend): WIP * fix(frontend): hide script selector when selected * fix(frontend): Fix preview mode + remove errors * fix(frontend): Fix table search * fix(frontend): temporary fix
35 lines
873 B
Svelte
35 lines
873 B
Svelte
<script lang="ts">
|
|
import { Button } from '$lib/components/common'
|
|
import { Preview } from '$lib/gen'
|
|
import { DENO_INIT_CODE_CLEAR } from '$lib/script_helpers'
|
|
import { emptySchema } from '$lib/utils'
|
|
import { getContext } from 'svelte'
|
|
import type { AppEditorContext } from '../../types'
|
|
|
|
const { app } = getContext<AppEditorContext>('AppEditorContext')
|
|
|
|
export let appPath: string
|
|
|
|
function createScript() {
|
|
const scriptPath = 'name'
|
|
const path = `${appPath}/inline-script/${scriptPath}`
|
|
const inlineScript = {
|
|
content: DENO_INIT_CODE_CLEAR,
|
|
language: Preview.language.DENO,
|
|
path,
|
|
schema: emptySchema()
|
|
}
|
|
|
|
if ($app.inlineScripts) {
|
|
$app.inlineScripts[scriptPath] = inlineScript
|
|
} else {
|
|
$app.inlineScripts = {
|
|
[scriptPath]: inlineScript
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<input value="" />
|
|
<Button on:click={createScript}>Create</Button>
|