mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-21 00:02:23 +00:00
feat(backend): default parameters are used in python if missing from args
This commit is contained in:
@@ -289,7 +289,18 @@ pub async fn handle_python_job(
|
||||
} else {
|
||||
sig.args
|
||||
.into_iter()
|
||||
.map(|x| format!("args[\"{}\"] = kwargs.get(\"{}\")", x.name, x.name))
|
||||
.map(|x| {
|
||||
let name = &x.name;
|
||||
if x.default.is_none() {
|
||||
format!("args[\"{name}\"] = kwargs.get(\"{name}\")")
|
||||
} else {
|
||||
format!(
|
||||
r#"args["{name}"] = kwargs.get("{name}")
|
||||
if not args["{name}"]:
|
||||
del args["{name}"]"#
|
||||
)
|
||||
}
|
||||
})
|
||||
.join("\n")
|
||||
};
|
||||
|
||||
|
||||
@@ -302,8 +302,8 @@
|
||||
</div>
|
||||
|
||||
<div class="mt-4">
|
||||
<Button variant="border" color="dark" size="xs" on:click={() => (schedule = nschedule)}
|
||||
>Set Schedule</Button
|
||||
<Button color="dark" size="xs" on:click={() => (schedule = nschedule)}
|
||||
>Set Cron Schedule</Button
|
||||
>
|
||||
</div>
|
||||
</CollapseLink>
|
||||
|
||||
@@ -1,11 +1,3 @@
|
||||
<script context="module">
|
||||
export function load() {
|
||||
return {
|
||||
stuff: { title: 'New Schedule' }
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import { Alert, Button } from '$lib/components/common'
|
||||
import Drawer from '$lib/components/common/drawer/Drawer.svelte'
|
||||
@@ -20,7 +12,7 @@
|
||||
import { FlowService, ScheduleService, Script, ScriptService, type Flow } from '$lib/gen'
|
||||
import { userStore, workspaceStore } from '$lib/stores'
|
||||
import { canWrite, emptyString, formatCron, sendUserToast } from '$lib/utils'
|
||||
import { faSave } from '@fortawesome/free-solid-svg-icons'
|
||||
import { faList, faSave } from '@fortawesome/free-solid-svg-icons'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
|
||||
let initialPath = ''
|
||||
@@ -150,12 +142,23 @@
|
||||
|
||||
<Drawer size="900px" bind:this={drawer}>
|
||||
<DrawerContent
|
||||
title={edit ? `Edit ${initialPath}` : 'New schedule'}
|
||||
title={edit ? `Edit schedule ${initialPath}` : 'New schedule'}
|
||||
on:close={drawer.closeDrawer}
|
||||
>
|
||||
<svelte:fragment slot="actions">
|
||||
{#if edit}
|
||||
<div class="mr-8">
|
||||
<Button
|
||||
size="sm"
|
||||
variant="border"
|
||||
startIcon={{ icon: faList }}
|
||||
disabled={!allowSchedule || pathError != '' || emptyString(script_path)}
|
||||
href={`/runs/${script_path}`}
|
||||
>
|
||||
View Runs
|
||||
</Button>
|
||||
</div>
|
||||
<div class="mr-8 center-center -mt-2">
|
||||
<Toggle
|
||||
disabled={!can_write}
|
||||
checked={enabled}
|
||||
|
||||
@@ -213,7 +213,7 @@
|
||||
<Button
|
||||
on:click|once={() => {
|
||||
$runFormStore = job?.args
|
||||
goto(`${stem}/edit/${route}${isScript ? `` : `?nodraft=true`}`)
|
||||
goto(`${stem}/edit/${job?.script_path}${isScript ? `` : `?nodraft=true`}`)
|
||||
}}
|
||||
color="blue"
|
||||
size="md"
|
||||
|
||||
Reference in New Issue
Block a user