mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-21 16:02:28 +00:00
fix copy first step schema + import buttons
This commit is contained in:
@@ -173,6 +173,6 @@
|
||||
|
||||
.few-lines-editor {
|
||||
/* stylelint-disable-next-line unit-allowed-list */
|
||||
height: 150px;
|
||||
height: 100px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -108,10 +108,19 @@ export async function initFlow(flow: Flow) {
|
||||
export async function copyFirstStepSchema() {
|
||||
const flowState = get(flowStateStore)
|
||||
flowStore.update((flow) => {
|
||||
const firstModuleId = flow.value.modules[0].id
|
||||
const firstModuleId = flow.value.modules[0]?.id
|
||||
|
||||
if (flowState[firstModuleId]) {
|
||||
if (flowState[firstModuleId] && firstModuleId) {
|
||||
flow.schema = flowState[firstModuleId].schema
|
||||
const v = flow.value.modules[0].value
|
||||
if (v.type == 'rawscript' || v.type == 'script') {
|
||||
Object.keys(v.input_transforms ?? {}).forEach((key) => {
|
||||
v.input_transforms[key] = {
|
||||
type: 'javascript',
|
||||
expr: `flow_input.${key}`
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
return flow
|
||||
})
|
||||
|
||||
@@ -26,26 +26,20 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<Menu placement="bottom-end">
|
||||
<div slot="trigger">
|
||||
<Button nonCaptureEvent={true} color="light" size="sm" variant="border">Import/Export</Button>
|
||||
</div>
|
||||
|
||||
<div class="divide-y divide-gray-200">
|
||||
<MenuItem on:click={() => jsonSetterDrawer.toggleDrawer()}>
|
||||
<Icon data={faFileImport} scale={0.6} class="inline mr-2" />
|
||||
Import from a JSON OpenFlow
|
||||
</MenuItem>
|
||||
<MenuItem on:click={() => jsonViewerDrawer.toggleDrawer()}>
|
||||
<Icon data={faFileExport} scale={0.6} class="inline mr-2" />
|
||||
Export to a JSON OpenFlow
|
||||
</MenuItem>
|
||||
</div>
|
||||
</Menu>
|
||||
<div class="flex-row gap-x-2 hidden sm:flex">
|
||||
<Button size="sm" variant="border" color="light" on:click={() => jsonSetterDrawer.toggleDrawer()}>
|
||||
<Icon data={faFileImport} scale={0.6} class="inline mr-2" />
|
||||
Import JSON
|
||||
</Button>
|
||||
<Button size="sm" variant="border" color="light" on:click={() => jsonViewerDrawer.toggleDrawer()}>
|
||||
<Icon data={faFileExport} scale={0.6} class="inline mr-2" />
|
||||
Export JSON
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<Drawer bind:this={jsonSetterDrawer} size="800px">
|
||||
<DrawerContent title="Import JSON" on:close={() => jsonSetterDrawer.toggleDrawer()}>
|
||||
<Button size="sm" on:click={importJson}>Import</Button>
|
||||
<Button slot="submission" size="sm" on:click={importJson}>Import</Button>
|
||||
<SimpleEditor bind:code={pendingJson} lang="json" class="h-full" />
|
||||
</DrawerContent>
|
||||
</Drawer>
|
||||
|
||||
@@ -120,7 +120,7 @@
|
||||
<!-- Raw JSON -->
|
||||
<Drawer bind:this={drawers.json} size="800px">
|
||||
<DrawerContent title="Import JSON" on:close={() => drawers.json?.toggleDrawer()}>
|
||||
<div class="p-2"><Button size="sm" on:click={importJson}>Import</Button></div>
|
||||
<SimpleEditor bind:code={pendingJson} lang="json" class="h-full" />
|
||||
<span slot="submission"><Button size="sm" on:click={importJson}>Import</Button></span>
|
||||
</DrawerContent>
|
||||
</Drawer>
|
||||
|
||||
@@ -3,8 +3,7 @@ const plugin = require('tailwindcss/plugin');
|
||||
/** @type {import('tailwindcss').Config} */
|
||||
const config = {
|
||||
content: [
|
||||
'./src/**/*.{html,js,svelte,ts}',
|
||||
"./node_modules/flowbite-svelte/**/*.{html,js,svelte,ts}",
|
||||
'./src/**/*.{html,js,svelte,ts}'
|
||||
],
|
||||
safelist: [
|
||||
'hljs',
|
||||
|
||||
Reference in New Issue
Block a user