Files
windmill/frontend/src/lib/components/flows/content/FlowModuleScript.svelte
T
Ruben Fiszel 36280cffc8 feat: expose a react sdk to integrate windmill into react apps (#1605)
* expose react sdk

* expose react sdk

* iterate

* iterate

* iterate

* nit

* update example

* update example

* small fixes

* update all
2023-05-19 20:44:07 +02:00

27 lines
774 B
Svelte

<script lang="ts">
import HighlightCode from '$lib/components/HighlightCode.svelte'
import { ScriptService } from '$lib/gen'
import { getScriptByPath } from '$lib/scripts'
import { workspaceStore } from '$lib/stores'
export let path: string
export let hash: string | undefined = undefined
let code: string
let language: 'deno' | 'python3' | 'go' | 'bash'
async function loadCode(path: string, hash: string | undefined) {
const script = hash
? await ScriptService.getScriptByHash({ workspace: $workspaceStore!, hash })
: await getScriptByPath(path!)
code = script.content
language = script.language
}
$: path && loadCode(path, hash)
</script>
<div class="flex flex-col flex-1 h-full overflow-auto p-2">
<HighlightCode {language} {code} />
</div>