Skip to content

Commit

Permalink
Add custom input selection if signal definitions exist to allow for m…
Browse files Browse the repository at this point in the history
…anual input
  • Loading branch information
Alex-Tideman committed Nov 18, 2024
1 parent 87603ad commit 17d3fb7
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/lib/components/lines-and-dots/workflow-details.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,13 @@

<div class="flex flex-col gap-2">
<div
class="grid w-full grid-flow-row grid-cols-1 gap-2 rounded-xl p-2 text-sm lg:grid-cols-3 xl:grid-cols-4"
class="grid w-full grid-flow-row grid-cols-1 gap-x-4 gap-y-2 text-sm lg:grid-cols-3 lg:gap-y-1 xl:grid-cols-4"
>
<WorkflowDetail
content={elapsedTime}
class="order-1 font-mono text-xl"
icon="clock"
/>

<WorkflowDetail
title={translate('common.start')}
tooltip={$relativeTime
Expand All @@ -44,6 +43,7 @@
content={formatDate(workflow?.startTime, $timeFormat, {
relative: $relativeTime,
})}
badge
class="order-2"
/>

Expand All @@ -63,6 +63,7 @@
relative: $relativeTime,
})
: '-'}
badge
class="order-3 lg:order-5 xl:order-6"
/>
<WorkflowDetail
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
let error: string = '';
let loading = false;
let name = '';
let customSignal = false;
let encoding: Writable<PayloadInputEncoding> = writable(defaultEncoding);
let input = '';
Expand All @@ -36,6 +37,7 @@
open = false;
name = '';
input = '';
customSignal = false;
$encoding = defaultEncoding;
};
Expand Down Expand Up @@ -64,6 +66,11 @@
loading = false;
}
};
const handleCustom = () => {
customSignal = true;
name = '';
};
</script>

<Modal
Expand All @@ -80,18 +87,24 @@
>
<h3 slot="title">{translate('workflows.signal-modal-title')}</h3>
<div slot="content" class="flex flex-col gap-4">
{#if signalDefinitions?.length > 0}
{#if signalDefinitions?.length > 0 && !customSignal}
<Select
id="signal-select"
label={translate('workflows.signal-name-label')}
class="min-w-fit"
bind:value={name}
data-testid="signal-select"
placeholder="Select a signal"
required
>
{#each signalDefinitions as { name: value, description = '' }}
<Option {value} {description}>{value}</Option>
{/each}
<Option
on:click={handleCustom}
value="custom"
description="Input signal name">Custom</Option
>
</Select>
{:else}
<Input
Expand Down
2 changes: 1 addition & 1 deletion src/lib/layouts/workflow-header.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
{/if}
<WorkflowDetails />
<Tabs>
<TabList class="flex flex-wrap gap-6 p-4 pl-0" label="workflow detail">
<TabList class="flex flex-wrap gap-6 pb-1 pt-4" label="workflow detail">
<Tab
label={translate('workflows.history-tab')}
id="history-tab"
Expand Down
2 changes: 0 additions & 2 deletions src/lib/pages/workflow-metadata.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
<h3>
{translate('events.attribute-group.search-attributes')}
</h3>
<div class="h-0.5 rounded-full bg-inverse" />
<PayloadDecoder
value={{ searchAttributes: workflow.searchAttributes }}
key="searchAttributes"
Expand All @@ -31,7 +30,6 @@
{#if workflow?.memo}
<div class="mt-4 flex flex-col gap-2">
<h3>{translate('common.memo')}</h3>
<div class="h-0.5 rounded-full bg-inverse" />
<PayloadDecoder
value={{ memo: workflow.memo }}
key="memo"
Expand Down

0 comments on commit 17d3fb7

Please sign in to comment.