Skip to content

Commit 26b8696

Browse files
authored
add ability to toggle off cancel (#963)
* add ability to toggle off cancel * fix typo * flip logic on feature guard * fix default prop * v2.1.87
1 parent 6db4be9 commit 26b8696

File tree

4 files changed

+36
-13
lines changed

4 files changed

+36
-13
lines changed

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@temporalio/ui",
3-
"version": "2.1.86",
3+
"version": "2.1.87",
44
"type": "module",
55
"description": "Temporal.io UI",
66
"keywords": [

Diff for: src/lib/components/workflow-actions.svelte

+25-11
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,13 @@
1414
import { cancelWorkflow } from '$lib/services/workflow-service';
1515
import { toaster } from '$lib/holocene/toaster.svelte';
1616
import Input from '$lib/holocene/input/input.svelte';
17+
import FeatureGuard from './feature-guard.svelte';
18+
import Button from '$lib/holocene/button.svelte';
1719
1820
export let workflow: WorkflowExecution;
1921
export let namespace: string;
2022
export let cancelInProgress: boolean;
23+
export let cancelEnabled: boolean;
2124
2225
let reason = '';
2326
let showTerminationConfirmation = false;
@@ -92,22 +95,33 @@
9295
width={200}
9396
text="You do not have permission to edit this workflow. Contact your admin for assistance."
9497
>
95-
<SplitButton
96-
primaryActionDisabled={cancelInProgress}
97-
disabled={actionsDisabled}
98-
label="Request Cancellation"
99-
on:click={showCancellationModal}
100-
id="workflow-actions"
101-
>
102-
<MenuItem
103-
destructive
98+
<FeatureGuard enabled={cancelEnabled}>
99+
<SplitButton
100+
primaryActionDisabled={cancelInProgress}
101+
disabled={actionsDisabled}
102+
label="Request Cancellation"
103+
on:click={showCancellationModal}
104+
id="workflow-actions"
105+
>
106+
<MenuItem
107+
destructive
108+
on:click={showTerminationModal}
109+
disabled={actionsDisabled}
110+
dataCy="terminate-button"
111+
>
112+
Terminate
113+
</MenuItem>
114+
</SplitButton>
115+
<Button
116+
slot="fallback"
117+
variant="destructive"
104118
on:click={showTerminationModal}
105119
disabled={actionsDisabled}
106120
dataCy="terminate-button"
107121
>
108122
Terminate
109-
</MenuItem>
110-
</SplitButton>
123+
</Button>
124+
</FeatureGuard>
111125
</Tooltip>
112126

113127
{#if !actionsDisabled}

Diff for: src/lib/layouts/workflow-header.svelte

+7-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
export let namespace: string;
3232
export let workflow: WorkflowExecution;
3333
export let workers: GetPollersResponse;
34+
export let cancelEnabled: boolean = true;
3435
3536
let refreshInterval;
3637
const refreshRate = 15000;
@@ -118,7 +119,12 @@
118119
class="flex flex-col items-center justify-center gap-4 whitespace-nowrap sm:flex-row lg:justify-end"
119120
>
120121
<AutoRefreshWorkflow onChange={onRefreshChange} />
121-
<WorkflowActions {cancelInProgress} {workflow} {namespace} />
122+
<WorkflowActions
123+
{cancelEnabled}
124+
{cancelInProgress}
125+
{workflow}
126+
{namespace}
127+
/>
122128
</div>
123129
{/if}
124130
</div>

Diff for: src/lib/layouts/workflow-run-layout.svelte

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import { onDestroy, onMount } from 'svelte';
1010
import { eventFilterSort, EventSortOrder } from '$lib/stores/event-view';
1111
12+
export let cancelEnabled: boolean = true;
13+
1214
onMount(() => {
1315
const sort = $page.url.searchParams.get('sort');
1416
if (sort) $eventFilterSort = sort as EventSortOrder;
@@ -28,6 +30,7 @@
2830
namespace={$page.params.namespace}
2931
workflow={$workflowRun.workflow}
3032
workers={$workflowRun.workers}
33+
{cancelEnabled}
3134
/>
3235
<slot />
3336
</PageTransition>

0 commit comments

Comments
 (0)