mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-09 16:05:42 +00:00
feat: add overridable tag directly from run page
This commit is contained in:
@@ -2231,7 +2231,8 @@ paths:
|
||||
|
||||
/w/{workspace}/resources/get_value_interpolated/{path}:
|
||||
get:
|
||||
summary: get resource interpolated (variables and resources are fully unrolled)
|
||||
summary:
|
||||
get resource interpolated (variables and resources are fully unrolled)
|
||||
operationId: getResourceValueInterpolated
|
||||
tags:
|
||||
- resource
|
||||
@@ -2919,7 +2920,8 @@ paths:
|
||||
schema:
|
||||
type: string
|
||||
- name: first_parent_hash
|
||||
description: mask to filter scripts whom first direct parent has exact hash
|
||||
description:
|
||||
mask to filter scripts whom first direct parent has exact hash
|
||||
in: query
|
||||
schema:
|
||||
type: string
|
||||
@@ -3114,7 +3116,8 @@ paths:
|
||||
|
||||
/workers/custom_tags:
|
||||
get:
|
||||
summary: get all instance custom tags (tags are used to dispatch jobs to
|
||||
summary:
|
||||
get all instance custom tags (tags are used to dispatch jobs to
|
||||
different worker groups)
|
||||
operationId: getCustomTags
|
||||
tags:
|
||||
@@ -3165,7 +3168,8 @@ paths:
|
||||
|
||||
/w/{workspace}/scripts/delete/h/{hash}:
|
||||
post:
|
||||
summary: delete script by hash (erase content but keep hash, require admin)
|
||||
summary:
|
||||
delete script by hash (erase content but keep hash, require admin)
|
||||
operationId: deleteScriptByHash
|
||||
tags:
|
||||
- script
|
||||
@@ -3404,14 +3408,17 @@ paths:
|
||||
type: string
|
||||
format: date-time
|
||||
- name: scheduled_in_secs
|
||||
description: schedule the script to execute in the number of seconds starting now
|
||||
description:
|
||||
schedule the script to execute in the number of seconds starting now
|
||||
in: query
|
||||
schema:
|
||||
type: integer
|
||||
- $ref: "#/components/parameters/ParentJob"
|
||||
- $ref: "#/components/parameters/WorkerTag"
|
||||
- $ref: "#/components/parameters/NewJobId"
|
||||
- name: invisible_to_owner
|
||||
description: make the run invisible to the the script owner (default false)
|
||||
description:
|
||||
make the run invisible to the the script owner (default false)
|
||||
in: query
|
||||
schema:
|
||||
type: boolean
|
||||
@@ -3471,6 +3478,7 @@ paths:
|
||||
- $ref: "#/components/parameters/WorkspaceId"
|
||||
- $ref: "#/components/parameters/ScriptPath"
|
||||
- $ref: "#/components/parameters/ParentJob"
|
||||
- $ref: "#/components/parameters/WorkerTag"
|
||||
- $ref: "#/components/parameters/NewJobId"
|
||||
- $ref: "#/components/parameters/IncludeHeader"
|
||||
- $ref: "#/components/parameters/QueueLimit"
|
||||
@@ -3499,6 +3507,7 @@ paths:
|
||||
- $ref: "#/components/parameters/WorkspaceId"
|
||||
- $ref: "#/components/parameters/ScriptPath"
|
||||
- $ref: "#/components/parameters/ParentJob"
|
||||
- $ref: "#/components/parameters/WorkerTag"
|
||||
- $ref: "#/components/parameters/NewJobId"
|
||||
- $ref: "#/components/parameters/IncludeHeader"
|
||||
- $ref: "#/components/parameters/QueueLimit"
|
||||
@@ -4442,15 +4451,18 @@ paths:
|
||||
type: string
|
||||
format: date-time
|
||||
- name: scheduled_in_secs
|
||||
description: schedule the script to execute in the number of seconds starting now
|
||||
description:
|
||||
schedule the script to execute in the number of seconds starting now
|
||||
in: query
|
||||
schema:
|
||||
type: integer
|
||||
- $ref: "#/components/parameters/ParentJob"
|
||||
- $ref: "#/components/parameters/WorkerTag"
|
||||
- $ref: "#/components/parameters/NewJobId"
|
||||
- $ref: "#/components/parameters/IncludeHeader"
|
||||
- name: invisible_to_owner
|
||||
description: make the run invisible to the the flow owner (default false)
|
||||
description:
|
||||
make the run invisible to the the flow owner (default false)
|
||||
in: query
|
||||
schema:
|
||||
type: boolean
|
||||
@@ -4502,15 +4514,18 @@ paths:
|
||||
type: string
|
||||
format: date-time
|
||||
- name: scheduled_in_secs
|
||||
description: schedule the script to execute in the number of seconds starting now
|
||||
description:
|
||||
schedule the script to execute in the number of seconds starting now
|
||||
in: query
|
||||
schema:
|
||||
type: integer
|
||||
- $ref: "#/components/parameters/ParentJob"
|
||||
- $ref: "#/components/parameters/WorkerTag"
|
||||
- $ref: "#/components/parameters/NewJobId"
|
||||
- $ref: "#/components/parameters/IncludeHeader"
|
||||
- name: invisible_to_owner
|
||||
description: make the run invisible to the the flow owner (default false)
|
||||
description:
|
||||
make the run invisible to the the flow owner (default false)
|
||||
in: query
|
||||
schema:
|
||||
type: boolean
|
||||
@@ -4548,15 +4563,18 @@ paths:
|
||||
type: string
|
||||
format: date-time
|
||||
- name: scheduled_in_secs
|
||||
description: schedule the script to execute in the number of seconds starting now
|
||||
description:
|
||||
schedule the script to execute in the number of seconds starting now
|
||||
in: query
|
||||
schema:
|
||||
type: integer
|
||||
- $ref: "#/components/parameters/ParentJob"
|
||||
- $ref: "#/components/parameters/WorkerTag"
|
||||
- $ref: "#/components/parameters/NewJobId"
|
||||
- $ref: "#/components/parameters/IncludeHeader"
|
||||
- name: invisible_to_owner
|
||||
description: make the run invisible to the the script owner (default false)
|
||||
description:
|
||||
make the run invisible to the the script owner (default false)
|
||||
in: query
|
||||
schema:
|
||||
type: boolean
|
||||
@@ -4587,7 +4605,8 @@ paths:
|
||||
- $ref: "#/components/parameters/WorkspaceId"
|
||||
- $ref: "#/components/parameters/IncludeHeader"
|
||||
- name: invisible_to_owner
|
||||
description: make the run invisible to the the script owner (default false)
|
||||
description:
|
||||
make the run invisible to the the script owner (default false)
|
||||
in: query
|
||||
schema:
|
||||
type: boolean
|
||||
@@ -4620,7 +4639,8 @@ paths:
|
||||
- $ref: "#/components/parameters/WorkspaceId"
|
||||
- $ref: "#/components/parameters/IncludeHeader"
|
||||
- name: invisible_to_owner
|
||||
description: make the run invisible to the the script owner (default false)
|
||||
description:
|
||||
make the run invisible to the the script owner (default false)
|
||||
in: query
|
||||
schema:
|
||||
type: boolean
|
||||
@@ -4661,6 +4681,7 @@ paths:
|
||||
- $ref: "#/components/parameters/StartedBefore"
|
||||
- $ref: "#/components/parameters/StartedAfter"
|
||||
- $ref: "#/components/parameters/Success"
|
||||
- $ref: "#/components/parameters/ScheduledForBeforeNow"
|
||||
- $ref: "#/components/parameters/JobKinds"
|
||||
- $ref: "#/components/parameters/Suspended"
|
||||
- $ref: "#/components/parameters/Running"
|
||||
@@ -4797,6 +4818,7 @@ paths:
|
||||
- $ref: "#/components/parameters/StartedAfter"
|
||||
- $ref: "#/components/parameters/CreatedOrStartedBefore"
|
||||
- $ref: "#/components/parameters/Running"
|
||||
- $ref: "#/components/parameters/ScheduledForBeforeNow"
|
||||
- $ref: "#/components/parameters/CreatedOrStartedAfter"
|
||||
- $ref: "#/components/parameters/JobKinds"
|
||||
- $ref: "#/components/parameters/ArgsFilter"
|
||||
@@ -4835,7 +4857,8 @@ paths:
|
||||
- job
|
||||
responses:
|
||||
"200":
|
||||
description: the timestamp of the db that can be used to compute the drift
|
||||
description:
|
||||
the timestamp of the db that can be used to compute the drift
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
@@ -5099,7 +5122,8 @@ paths:
|
||||
|
||||
/w/{workspace}/jobs/resume_urls/{id}/{resume_id}:
|
||||
get:
|
||||
summary: get resume urls given a job_id, resume_id and a nonce to resume a flow
|
||||
summary:
|
||||
get resume urls given a job_id, resume_id and a nonce to resume a flow
|
||||
operationId: getResumeUrls
|
||||
tags:
|
||||
- job
|
||||
@@ -5650,7 +5674,8 @@ paths:
|
||||
- $ref: "#/components/parameters/WorkspaceId"
|
||||
- name: only_member_of
|
||||
in: query
|
||||
description: only list the groups the user is member of (default false)
|
||||
description:
|
||||
only list the groups the user is member of (default false)
|
||||
schema:
|
||||
type: boolean
|
||||
responses:
|
||||
@@ -5838,7 +5863,8 @@ paths:
|
||||
- $ref: "#/components/parameters/WorkspaceId"
|
||||
- name: only_member_of
|
||||
in: query
|
||||
description: only list the folders the user is member of (default false)
|
||||
description:
|
||||
only list the folders the user is member of (default false)
|
||||
schema:
|
||||
type: boolean
|
||||
responses:
|
||||
@@ -6667,8 +6693,8 @@ paths:
|
||||
/w/{workspace}/job_helpers/v2/boto3_connection_settings:
|
||||
post:
|
||||
summary:
|
||||
Converts an S3 resource to the set of arguments necessary to connect
|
||||
to an S3 bucket using boto3 in Python
|
||||
Converts an S3 resource to the set of arguments necessary to connect to
|
||||
an S3 bucket using boto3 in Python
|
||||
operationId: boto3ConnectionSettingsV2
|
||||
tags:
|
||||
- helpers
|
||||
@@ -6922,7 +6948,8 @@ components:
|
||||
type: integer
|
||||
PerPage:
|
||||
name: per_page
|
||||
description: number of items to return for a given page (default 30, max 100)
|
||||
description:
|
||||
number of items to return for a given page (default 30, max 100)
|
||||
in: query
|
||||
schema:
|
||||
type: integer
|
||||
@@ -6947,6 +6974,12 @@ components:
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
WorkerTag:
|
||||
name: tag
|
||||
description: Override the tag to use
|
||||
in: query
|
||||
schema:
|
||||
type: string
|
||||
NewJobId:
|
||||
name: job_id
|
||||
description:
|
||||
@@ -7042,6 +7075,13 @@ components:
|
||||
in: query
|
||||
schema:
|
||||
type: boolean
|
||||
ScheduledForBeforeNow:
|
||||
name: scheduled_for_before_now
|
||||
description:
|
||||
filter on jobs scheduled_for before now (hence waitinf for a worker)
|
||||
in: query
|
||||
schema:
|
||||
type: boolean
|
||||
Suspended:
|
||||
name: suspended
|
||||
description: filter on suspended jobs
|
||||
@@ -7056,7 +7096,8 @@ components:
|
||||
type: boolean
|
||||
ArgsFilter:
|
||||
name: args
|
||||
description: filter on jobs containing those args as a json subset (@> in postgres)
|
||||
description:
|
||||
filter on jobs containing those args as a json subset (@> in postgres)
|
||||
in: query
|
||||
schema:
|
||||
type: string
|
||||
@@ -7068,7 +7109,8 @@ components:
|
||||
type: string
|
||||
ResultFilter:
|
||||
name: result
|
||||
description: filter on jobs containing those result as a json subset (@> in postgres)
|
||||
description:
|
||||
filter on jobs containing those result as a json subset (@> in postgres)
|
||||
in: query
|
||||
schema:
|
||||
type: string
|
||||
|
||||
@@ -519,6 +519,7 @@ pub struct RunJobQuery {
|
||||
queue_limit: Option<i64>,
|
||||
payload: Option<String>,
|
||||
job_id: Option<Uuid>,
|
||||
tag: Option<String>,
|
||||
}
|
||||
|
||||
impl RunJobQuery {
|
||||
@@ -558,6 +559,7 @@ pub struct ListQueueQuery {
|
||||
// filter by matching a subset of the args using base64 encoded json subset
|
||||
pub args: Option<String>,
|
||||
pub tag: Option<String>,
|
||||
pub scheduled_for_before_now: Option<bool>,
|
||||
}
|
||||
|
||||
fn list_queue_jobs_query(w_id: &str, lq: &ListQueueQuery, fields: &[&str]) -> SqlBuilder {
|
||||
@@ -620,7 +622,7 @@ fn list_queue_jobs_query(w_id: &str, lq: &ListQueueQuery, fields: &[&str]) -> Sq
|
||||
if *s {
|
||||
sqlb.and_where_gt("suspend", 0);
|
||||
} else {
|
||||
sqlb.and_where_eq("suspend", 0);
|
||||
sqlb.and_where_is_null("suspend_until");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -635,6 +637,10 @@ fn list_queue_jobs_query(w_id: &str, lq: &ListQueueQuery, fields: &[&str]) -> Sq
|
||||
sqlb.and_where("args @> ?".bind(&args.replace("'", "''")));
|
||||
}
|
||||
|
||||
if lq.scheduled_for_before_now.is_some_and(|x| x) {
|
||||
sqlb.and_where_le("scheduled_for", "now()");
|
||||
}
|
||||
|
||||
sqlb
|
||||
}
|
||||
|
||||
@@ -704,7 +710,7 @@ async fn cancel_all(
|
||||
require_admin(authed.is_admin, &authed.username)?;
|
||||
|
||||
let mut jobs = sqlx::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",
|
||||
"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",
|
||||
w_id,
|
||||
authed.username
|
||||
)
|
||||
@@ -863,6 +869,7 @@ async fn list_jobs(
|
||||
args: lq.args,
|
||||
tag: lq.tag,
|
||||
schedule_path: lq.schedule_path,
|
||||
scheduled_for_before_now: lq.scheduled_for_before_now,
|
||||
},
|
||||
&[
|
||||
"'QueuedJob' as typ",
|
||||
@@ -1743,6 +1750,8 @@ pub async fn run_flow_by_path(
|
||||
.map(|x| (x.tag, x.dedicated_worker))
|
||||
.unwrap_or_else(|| (None, None));
|
||||
|
||||
let tag = run_query.tag.clone().or(tag);
|
||||
|
||||
check_tag_available_for_workspace(&w_id, &tag).await?;
|
||||
let scheduled_for = run_query.get_scheduled_for(&db).await?;
|
||||
let tx = PushIsolationLevel::Isolated(user_db.clone(), authed.clone().into(), rsmq);
|
||||
@@ -1870,6 +1879,7 @@ pub async fn run_job_by_path(
|
||||
script_path_to_payload(script_path, &db, &w_id).await?;
|
||||
let scheduled_for = run_query.get_scheduled_for(&db).await?;
|
||||
|
||||
let tag = run_query.tag.clone().or(tag);
|
||||
check_tag_available_for_workspace(&w_id, &tag).await?;
|
||||
let tx = PushIsolationLevel::Isolated(user_db.clone(), authed.clone().into(), rsmq);
|
||||
|
||||
@@ -2142,6 +2152,8 @@ pub async fn run_wait_result_job_by_path_get(
|
||||
|
||||
let (job_payload, tag, delete_after_use, timeout) =
|
||||
script_path_to_payload(script_path, &db, &w_id).await?;
|
||||
|
||||
let tag = run_query.tag.clone().or(tag);
|
||||
check_tag_available_for_workspace(&w_id, &tag).await?;
|
||||
let tx = PushIsolationLevel::Isolated(user_db.clone(), authed.clone().into(), rsmq);
|
||||
|
||||
@@ -2260,6 +2272,7 @@ async fn run_wait_result_script_by_path_internal(
|
||||
let (job_payload, tag, delete_after_use, timeout) =
|
||||
script_path_to_payload(script_path, &db, &w_id).await?;
|
||||
|
||||
let tag = run_query.tag.clone().or(tag);
|
||||
check_tag_available_for_workspace(&w_id, &tag).await?;
|
||||
let tx = PushIsolationLevel::Isolated(user_db.clone(), authed.clone().into(), rsmq);
|
||||
|
||||
@@ -2325,6 +2338,7 @@ pub async fn run_wait_result_script_by_hash(
|
||||
) = get_path_tag_limits_cache_for_hash(&db, &w_id, hash).await?;
|
||||
check_scopes(&authed, || format!("run:script/{path}"))?;
|
||||
|
||||
let tag = run_query.tag.clone().or(tag);
|
||||
check_tag_available_for_workspace(&w_id, &tag).await?;
|
||||
let tx = PushIsolationLevel::Isolated(user_db.clone(), authed.clone().into(), rsmq);
|
||||
|
||||
@@ -2415,6 +2429,7 @@ async fn run_wait_result_flow_by_path_internal(
|
||||
.map(|x| (x.tag, x.dedicated_worker, x.early_return))
|
||||
.unwrap_or_else(|| (None, None, None));
|
||||
|
||||
let tag = run_query.tag.clone().or(tag);
|
||||
check_tag_available_for_workspace(&w_id, &tag).await?;
|
||||
let tx = PushIsolationLevel::Isolated(user_db.clone(), authed.clone().into(), rsmq);
|
||||
|
||||
@@ -2466,7 +2481,8 @@ async fn run_preview_job(
|
||||
));
|
||||
}
|
||||
let scheduled_for = run_query.get_scheduled_for(&db).await?;
|
||||
check_tag_available_for_workspace(&w_id, &preview.tag).await?;
|
||||
let tag = run_query.tag.clone().or(preview.tag.clone());
|
||||
check_tag_available_for_workspace(&w_id, &tag).await?;
|
||||
let tx = PushIsolationLevel::Isolated(user_db.clone(), authed.clone().into(), rsmq);
|
||||
|
||||
let (uuid, tx) = push(
|
||||
@@ -2500,7 +2516,7 @@ async fn run_preview_job(
|
||||
false,
|
||||
None,
|
||||
true,
|
||||
preview.tag,
|
||||
tag,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
@@ -2685,7 +2701,8 @@ async fn run_preview_flow_job(
|
||||
));
|
||||
}
|
||||
let scheduled_for = run_query.get_scheduled_for(&db).await?;
|
||||
check_tag_available_for_workspace(&w_id, &raw_flow.tag).await?;
|
||||
let tag = run_query.tag.clone().or(raw_flow.tag.clone());
|
||||
check_tag_available_for_workspace(&w_id, &tag).await?;
|
||||
let tx = PushIsolationLevel::Isolated(user_db.clone(), authed.clone().into(), rsmq);
|
||||
|
||||
let (uuid, tx) = push(
|
||||
@@ -2710,7 +2727,7 @@ async fn run_preview_flow_job(
|
||||
false,
|
||||
None,
|
||||
true,
|
||||
raw_flow.tag,
|
||||
tag,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
@@ -2750,6 +2767,7 @@ pub async fn run_job_by_hash(
|
||||
check_scopes(&authed, || format!("run:script/{path}"))?;
|
||||
|
||||
let scheduled_for = run_query.get_scheduled_for(&db).await?;
|
||||
let tag = run_query.tag.clone().or(tag);
|
||||
|
||||
check_tag_available_for_workspace(&w_id, &tag).await?;
|
||||
let tx = PushIsolationLevel::Isolated(user_db.clone(), authed.clone().into(), rsmq);
|
||||
@@ -2954,6 +2972,7 @@ pub struct ListCompletedQuery {
|
||||
// filter by matching a subset of the result using base64 encoded json subset
|
||||
pub result: Option<String>,
|
||||
pub tag: Option<String>,
|
||||
pub scheduled_for_before_now: Option<bool>,
|
||||
}
|
||||
|
||||
async fn list_completed_jobs(
|
||||
|
||||
@@ -1,29 +1,20 @@
|
||||
<script lang="ts">
|
||||
import {
|
||||
defaultIfEmptyString,
|
||||
emptyString,
|
||||
getModifierKey,
|
||||
getToday,
|
||||
truncateHash
|
||||
} from '$lib/utils'
|
||||
import { defaultIfEmptyString, emptyString, getModifierKey, truncateHash } from '$lib/utils'
|
||||
|
||||
import type { Schema } from '$lib/common'
|
||||
import { userStore } from '$lib/stores'
|
||||
import CliHelpBox from './CliHelpBox.svelte'
|
||||
import { Badge, Button, Kbd } from './common'
|
||||
import SchemaForm from './SchemaForm.svelte'
|
||||
import SharedBadge from './SharedBadge.svelte'
|
||||
import Toggle from './Toggle.svelte'
|
||||
import Tooltip from './Tooltip.svelte'
|
||||
|
||||
import CollapseLink from './CollapseLink.svelte'
|
||||
import { SCRIPT_VIEW_SHOW_RUN_FROM_CLI, SCRIPT_VIEW_SHOW_SCHEDULE_RUN_LATER } from '$lib/consts'
|
||||
import { SCRIPT_VIEW_SHOW_RUN_FROM_CLI } from '$lib/consts'
|
||||
import TimeAgo from './TimeAgo.svelte'
|
||||
import ClipboardPanel from './details/ClipboardPanel.svelte'
|
||||
import Popup from './common/popup/Popup.svelte'
|
||||
import { autoPlacement } from '@floating-ui/core'
|
||||
import { Calendar } from 'lucide-svelte'
|
||||
import CloseButton from './common/CloseButton.svelte'
|
||||
import Label from './Label.svelte'
|
||||
import RunFormAdvancedPopup from './RunFormAdvancedPopup.svelte'
|
||||
|
||||
export let runnable:
|
||||
| {
|
||||
@@ -43,7 +34,8 @@
|
||||
export let runAction: (
|
||||
scheduledForStr: string | undefined,
|
||||
args: Record<string, any>,
|
||||
invisible_to_owner?: boolean
|
||||
invisible_to_owner: boolean | undefined,
|
||||
overrideTag: string | undefined
|
||||
) => void
|
||||
export let buttonText = 'Run'
|
||||
export let schedulable = true
|
||||
@@ -56,6 +48,10 @@
|
||||
export let isFlow: boolean
|
||||
export let viewKeybinding = false
|
||||
|
||||
export let scheduledForStr: string | undefined
|
||||
export let invisible_to_owner: false | undefined
|
||||
export let overrideTag: string | undefined
|
||||
|
||||
export let args: Record<string, any> = {}
|
||||
|
||||
let reloadArgs = 0
|
||||
@@ -67,14 +63,11 @@
|
||||
}
|
||||
|
||||
export function run() {
|
||||
runAction(scheduledForStr, args, invisible_to_owner)
|
||||
runAction(scheduledForStr, args, invisible_to_owner, overrideTag)
|
||||
}
|
||||
|
||||
export let isValid = true
|
||||
|
||||
let scheduledForStr: string | undefined
|
||||
let invisible_to_owner: false
|
||||
|
||||
$: cliCommand = `wmill ${isFlow ? 'flow' : 'script'} run ${runnable?.path} -d '${JSON.stringify(
|
||||
args
|
||||
)}'`
|
||||
@@ -127,7 +120,7 @@
|
||||
<Button
|
||||
btnClasses="!px-6 !py-1 w-full"
|
||||
disabled={!isValid}
|
||||
on:click={() => runAction(undefined, args)}
|
||||
on:click={() => runAction(undefined, args, invisible_to_owner, overrideTag)}
|
||||
>
|
||||
{buttonText}
|
||||
</Button>
|
||||
@@ -160,7 +153,7 @@
|
||||
color="dark"
|
||||
btnClasses="!px-6 !py-1 !h-8 inline-flex gap-2"
|
||||
disabled={!isValid}
|
||||
on:click={() => runAction(scheduledForStr, args, invisible_to_owner)}
|
||||
on:click={() => runAction(scheduledForStr, args, invisible_to_owner, overrideTag)}
|
||||
>
|
||||
{#if viewKeybinding}
|
||||
<div class="inline-flex gap-0 items-center">
|
||||
@@ -194,67 +187,32 @@
|
||||
>Advanced</Button
|
||||
>
|
||||
</svelte:fragment>
|
||||
<div class="flex flex-col gap-4 p-2">
|
||||
<div class="flex flex-col gap-2">
|
||||
{#if SCRIPT_VIEW_SHOW_SCHEDULE_RUN_LATER}
|
||||
<div class="">
|
||||
<Label label="Schedule to run later">
|
||||
<svelte:fragment slot="action">
|
||||
<CloseButton on:close={() => close(null)} noBg />
|
||||
</svelte:fragment>
|
||||
</Label>
|
||||
|
||||
<div class="flex flex-row items-end">
|
||||
<div class="w-max md:w-2/3 mt-2 mb-1">
|
||||
<label for="run-time" />
|
||||
<input
|
||||
class="inline-block"
|
||||
type="datetime-local"
|
||||
id="run-time"
|
||||
name="run-scheduled-time"
|
||||
bind:value={scheduledForStr}
|
||||
min={getToday().toISOString().slice(0, 16)}
|
||||
/>
|
||||
</div>
|
||||
<Button
|
||||
variant="border"
|
||||
color="light"
|
||||
size="sm"
|
||||
btnClasses="mx-2 mb-1"
|
||||
on:click={() => {
|
||||
scheduledForStr = undefined
|
||||
}}
|
||||
>
|
||||
Clear
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{#if runnable?.path?.startsWith(`u/${$userStore?.username}`) != true && (runnable?.path?.split('/')?.length ?? 0) > 2}
|
||||
<div class="flex items-center gap-1">
|
||||
<Toggle
|
||||
options={{
|
||||
right: `make run invisible to others`
|
||||
}}
|
||||
bind:checked={invisible_to_owner}
|
||||
/>
|
||||
<Tooltip
|
||||
>By default, runs are visible to the owner(s) of the script or flow being
|
||||
triggered</Tooltip
|
||||
>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<RunFormAdvancedPopup
|
||||
bind:scheduledForStr
|
||||
bind:invisible_to_owner
|
||||
bind:overrideTag
|
||||
bind:runnable
|
||||
on:close={() => close(null)}
|
||||
/>
|
||||
</Popup>
|
||||
</div>
|
||||
</div>
|
||||
{#if overrideTag}
|
||||
<div class="flex-row-reverse flex w-full text-primary text-sm">
|
||||
tag override: {overrideTag}
|
||||
</div>
|
||||
{/if}
|
||||
{#if invisible_to_owner}
|
||||
<div class="flex-row-reverse flex w-full text-primary text-sm">
|
||||
Job will be invisible to owner
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{:else if !topButton}
|
||||
<Button
|
||||
btnClasses="!px-6 !py-1 w-full"
|
||||
disabled={!isValid}
|
||||
on:click={() => runAction(undefined, args, invisible_to_owner)}
|
||||
on:click={() => runAction(undefined, args, invisible_to_owner, overrideTag)}
|
||||
>
|
||||
{#if viewKeybinding}
|
||||
<div>
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
<script lang="ts">
|
||||
import { SCRIPT_VIEW_SHOW_SCHEDULE_RUN_LATER } from '$lib/consts'
|
||||
import Label from './Label.svelte'
|
||||
import CloseButton from './common/CloseButton.svelte'
|
||||
import Toggle from './Toggle.svelte'
|
||||
import Tooltip from './Tooltip.svelte'
|
||||
import { userStore, workerTags } from '$lib/stores'
|
||||
import { Button } from './common'
|
||||
import { getToday } from '$lib/utils'
|
||||
import { WorkerService } from '$lib/gen'
|
||||
|
||||
export let runnable:
|
||||
| {
|
||||
summary?: string
|
||||
description?: string
|
||||
path?: string
|
||||
is_template?: boolean
|
||||
hash?: string
|
||||
kind?: string
|
||||
can_write?: boolean
|
||||
created_at?: string
|
||||
created_by?: string
|
||||
extra_perms?: Record<string, boolean>
|
||||
}
|
||||
| undefined
|
||||
|
||||
export let scheduledForStr: string | undefined
|
||||
export let invisible_to_owner: false | undefined
|
||||
export let overrideTag: string | undefined
|
||||
|
||||
loadWorkerGroups()
|
||||
|
||||
async function loadWorkerGroups() {
|
||||
if (!$workerTags) {
|
||||
$workerTags = await WorkerService.getCustomTags()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="flex flex-col gap-4 p-2">
|
||||
<div class="flex flex-col gap-2">
|
||||
{#if SCRIPT_VIEW_SHOW_SCHEDULE_RUN_LATER}
|
||||
<div class="">
|
||||
<Label label="Schedule to run later">
|
||||
<svelte:fragment slot="action">
|
||||
<CloseButton on:close noBg />
|
||||
</svelte:fragment>
|
||||
</Label>
|
||||
|
||||
<div class="flex flex-row items-end">
|
||||
<div class="w-max md:w-2/3 mt-2 mb-1">
|
||||
<label for="run-time" />
|
||||
<input
|
||||
class="inline-block"
|
||||
type="datetime-local"
|
||||
id="run-time"
|
||||
name="run-scheduled-time"
|
||||
bind:value={scheduledForStr}
|
||||
min={getToday().toISOString().slice(0, 16)}
|
||||
/>
|
||||
</div>
|
||||
<Button
|
||||
variant="border"
|
||||
color="light"
|
||||
size="sm"
|
||||
btnClasses="mx-2 mb-1"
|
||||
on:click={() => {
|
||||
scheduledForStr = undefined
|
||||
}}
|
||||
>
|
||||
Clear
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{#if !$userStore?.operator}
|
||||
{#if $workerTags && $workerTags?.length > 0}
|
||||
<div class="w-full">
|
||||
<select placeholder="Worker group" bind:value={overrideTag}>
|
||||
{#if overrideTag}
|
||||
<option value="">reset to default</option>
|
||||
{:else}
|
||||
<option value="" disabled selected>Override Wourker Group</option>
|
||||
{/if}
|
||||
{#each $workerTags ?? [] as tag (tag)}
|
||||
<option value={tag}>{tag}</option>
|
||||
{/each}
|
||||
</select>
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{#if runnable?.path?.startsWith(`u/${$userStore?.username}`) != true && (runnable?.path?.split('/')?.length ?? 0) > 2}
|
||||
<div class="flex items-center gap-1">
|
||||
<Toggle
|
||||
options={{
|
||||
right: `make run invisible to others`
|
||||
}}
|
||||
bind:checked={invisible_to_owner}
|
||||
/>
|
||||
<Tooltip
|
||||
>By default, runs are visible to the owner(s) of the script or flow being triggered</Tooltip
|
||||
>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -578,7 +578,7 @@
|
||||
</Label>
|
||||
</div>
|
||||
</Section>
|
||||
<Section label="Worker group tag">
|
||||
<Section label="Worker Group Tag">
|
||||
<svelte:fragment slot="header">
|
||||
<Tooltip
|
||||
documentationLink="https://www.windmill.dev/docs/core_concepts/worker_groups"
|
||||
|
||||
@@ -150,7 +150,7 @@
|
||||
<div class="w-40">
|
||||
{#if $flowStore.tag == undefined}
|
||||
<select
|
||||
placeholder="Worker group"
|
||||
placeholder="Tag"
|
||||
bind:value={module.value.tag}
|
||||
on:change={(e) => {
|
||||
if (module.value.type === 'rawscript') {
|
||||
@@ -163,7 +163,7 @@
|
||||
{#if module.value.tag}
|
||||
<option value="">reset to default</option>
|
||||
{:else}
|
||||
<option value="" disabled selected>Worker Group</option>
|
||||
<option value="" disabled selected>Tag</option>
|
||||
{/if}
|
||||
{#each $workerTags ?? [] as tag (tag)}
|
||||
<option value={tag}>{tag}</option>
|
||||
|
||||
@@ -9,7 +9,12 @@
|
||||
|
||||
getQueuedJobs()
|
||||
async function getQueuedJobs() {
|
||||
jobs = await JobService.listQueue({ workspace: $workspaceStore ?? '' })
|
||||
jobs = await JobService.listQueue({
|
||||
workspace: $workspaceStore ?? '',
|
||||
scheduledForBeforeNow: true,
|
||||
suspended: false,
|
||||
running: false
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -48,6 +48,10 @@
|
||||
let shareModal: ShareModal
|
||||
let deploymentInProgress = false
|
||||
|
||||
let scheduledForStr: string | undefined = undefined
|
||||
let invisible_to_owner: false | undefined = undefined
|
||||
let overrideTag: string | undefined = undefined
|
||||
|
||||
$: cliCommand = `wmill flow run ${flow?.path} -d '${JSON.stringify(args)}'`
|
||||
|
||||
$: {
|
||||
@@ -85,7 +89,8 @@
|
||||
async function runFlow(
|
||||
scheduledForStr: string | undefined,
|
||||
args: Record<string, any>,
|
||||
invisibleToOwner?: boolean
|
||||
invisibleToOwner: boolean | undefined,
|
||||
overrideTag: string | undefined
|
||||
) {
|
||||
loading = true
|
||||
const scheduledFor = scheduledForStr ? new Date(scheduledForStr).toISOString() : undefined
|
||||
@@ -94,7 +99,8 @@
|
||||
path,
|
||||
invisibleToOwner,
|
||||
requestBody: args,
|
||||
scheduledFor
|
||||
scheduledFor,
|
||||
tag: overrideTag
|
||||
})
|
||||
await goto('/run/' + run + '?workspace=' + $workspaceStore)
|
||||
}
|
||||
@@ -308,6 +314,9 @@
|
||||
{/if}
|
||||
|
||||
<RunForm
|
||||
bind:scheduledForStr
|
||||
bind:invisible_to_owner
|
||||
bind:overrideTag
|
||||
viewKeybinding
|
||||
{loading}
|
||||
autofocus
|
||||
|
||||
@@ -71,6 +71,10 @@
|
||||
let shareModal: ShareModal
|
||||
let runForm: RunForm
|
||||
|
||||
let scheduledForStr: string | undefined = undefined
|
||||
let invisible_to_owner: false | undefined = undefined
|
||||
let overrideTag: string | undefined = undefined
|
||||
|
||||
$: cliCommand = `wmill script run ${script?.path} -d '${JSON.stringify(args)}'`
|
||||
|
||||
$: loading = !script
|
||||
@@ -172,7 +176,8 @@
|
||||
async function runScript(
|
||||
scheduledForStr: string | undefined,
|
||||
args: Record<string, any>,
|
||||
invisibleToOwner?: boolean
|
||||
invisibleToOwner: boolean | undefined,
|
||||
overrideTag: string | undefined
|
||||
) {
|
||||
try {
|
||||
runLoading = true
|
||||
@@ -182,7 +187,8 @@
|
||||
hash: script?.hash ?? '',
|
||||
requestBody: args,
|
||||
scheduledFor,
|
||||
invisibleToOwner
|
||||
invisibleToOwner,
|
||||
tag: overrideTag
|
||||
})
|
||||
await goto('/run/' + run + '?workspace=' + $workspaceStore)
|
||||
} catch (err) {
|
||||
@@ -515,6 +521,9 @@
|
||||
{/if}
|
||||
|
||||
<RunForm
|
||||
bind:scheduledForStr
|
||||
bind:invisible_to_owner
|
||||
bind:overrideTag
|
||||
viewKeybinding
|
||||
loading={runLoading}
|
||||
autofocus
|
||||
|
||||
Reference in New Issue
Block a user