This commit is contained in:
Ruben Fiszel
2023-12-17 17:29:25 +01:00
parent ceb294c0aa
commit c8ef65aae1
6 changed files with 38 additions and 41 deletions
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
"query": "UPDATE queue SET canceled = true, canceled_by = $2, scheduled_for = now(), suspend = 0 WHERE workspace_id = $1 AND schedule_path IS NULL RETURNING id, running",
"query": "UPDATE queue SET canceled = true, canceled_by = $2, scheduled_for = now(), suspend = 0 WHERE scheduled_for < now() AND workspace_id = $1 AND schedule_path IS NULL RETURNING id, running",
"describe": {
"columns": [
{
@@ -25,5 +25,5 @@
false
]
},
"hash": "ce4733a0460cbef39fb50f4ca9746944d4cd5057d27d09de9c5dc494e3123ab4"
"hash": "917afc04613a7d4373c9152b8ecaa946a2abfb3e5be437ee3b0aa05b3bd39702"
}
@@ -1,15 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "UPDATE script SET restart_unless_cancelled = NULL WHERE hash = ANY($1) AND workspace_id = $2",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Int8Array",
"Text"
]
},
"nullable": []
},
"hash": "da4525f02e83bdd0e2d9eb9c6a9b29a6bff4a32f3a4ac5581a0ce6eb465c97e9"
}
@@ -1,15 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "UPDATE script SET restart_unless_cancelled = true WHERE hash = ANY($1) AND workspace_id = $2",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Int8Array",
"Text"
]
},
"nullable": []
},
"hash": "f179cefbceadc8c3dc6442c74dd1d9d57bee47919592d8c75cdeb38ba1c971cb"
}
@@ -95,7 +95,7 @@
{#if schedule}
<div class="p-2 flex flex-col gap-2">
<div class="flex flex-row justify-between h-8">
<div class="flex flex-row gap-2">
<div class="flex flex-row gap-2 items-center">
<input
class="inline-block !w-32"
type="text"
@@ -105,14 +105,16 @@
value={schedule.schedule}
disabled={true}
/>
<Badge color="indigo" small
>Primary schedule&nbsp;<Tooltip
>Share the same path as the script or flow it is attached to and its path get renamed
whenever the source path is renamed</Tooltip
></Badge
>
<div>
<Badge color="indigo" small
>Primary&nbsp;<Tooltip light
>Share the same path as the script or flow it is attached to and its path get renamed
whenever the source path is renamed</Tooltip
></Badge
>
</div>
</div>
<div class="flex flex-row gap-2">
<div class="flex flex-row gap-2 items-center">
<Toggle
checked={schedule.enabled}
on:change={(e) => {
@@ -435,7 +435,13 @@
<div class="mt-6">
{#if runnable}
{#if runnable?.schema && runnable.schema.properties && Object.keys(runnable.schema.properties).length > 0}
<SchemaForm disabled={!can_write} schema={runnable.schema} bind:isValid bind:args />
<SchemaForm
showReset
disabled={!can_write}
schema={runnable.schema}
bind:isValid
bind:args
/>
{:else}
<div class="text-xs texg-gray-700">
This {is_flow ? 'flow' : 'script'} takes no argument
@@ -33,6 +33,7 @@
export let prettifyHeader = false
export let disablePortal = false
export let showSchemaExplorer = false
export let showReset = false
let clazz: string = ''
export { clazz as class }
@@ -43,6 +44,17 @@
args = {}
}
export function setDefaults() {
const nargs = {}
Object.keys(schema?.properties ?? {}).forEach((key) => {
if (schema?.properties[key].default != undefined && args[key] == undefined) {
nargs[key] = schema?.properties[key].default
}
})
args = nargs
}
function removeExtraKey() {
const nargs = {}
Object.keys(args ?? {}).forEach((key) => {
@@ -79,6 +91,13 @@
loadResourceTypes()
</script>
{#if showReset}
<div class="flex flex-row-reverse w-full">
<Button size="xs" color="light" on:click={() => setDefaults()}
>Reset args to runnable's defaults</Button
>
</div>
{/if}
<div class="w-full {clazz} {flexWrap ? 'flex flex-row flex-wrap gap-x-6 gap-y-2' : ''}">
{#if keys.length > 0}
{#each keys as argName, i (argName)}