Skip to content

Commit ae68533

Browse files
authored
Workflow pause updates (#3196)
* Update logic where isRunning to include isPaused * Pause live updates when pausing workflow * Show activity commands when workflow is paused * Show event attribute details for workflow pause and unpause * Keep auto refresh enabled on pause
1 parent 2d1e0a0 commit ae68533

20 files changed

Lines changed: 61 additions & 50 deletions

src/lib/components/activity/activity-options-update-drawer.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import NumberInput from '$lib/holocene/input/number-input.svelte';
1010
import Label from '$lib/holocene/label.svelte';
1111
import { translate } from '$lib/i18n/translate';
12+
import { Action } from '$lib/models/activity-actions';
1213
import { updateActivityOptions } from '$lib/services/workflow-activities-service';
1314
import { toaster } from '$lib/stores/toaster';
1415
import { triggerRefresh } from '$lib/stores/workflow-run';
@@ -99,7 +100,7 @@
99100
activityOptions,
100101
identity,
101102
});
102-
triggerRefresh();
103+
triggerRefresh(Action.Update);
103104
toaster.push({
104105
variant: 'success',
105106
message: `Options for Activity ${id} have been updated.`,

src/lib/components/activity/activity-pause-confirmation-modal.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import Input from '$lib/holocene/input/input.svelte';
66
import Modal from '$lib/holocene/modal.svelte';
77
import { translate } from '$lib/i18n/translate';
8+
import { Action } from '$lib/models/workflow-actions';
89
import { pauseActivity } from '$lib/services/workflow-activities-service';
910
import { triggerRefresh } from '$lib/stores/workflow-run';
1011
import type { PendingActivity } from '$lib/types/events';
@@ -42,7 +43,7 @@
4243
type: includeType ? type : undefined,
4344
identity,
4445
});
45-
triggerRefresh();
46+
triggerRefresh(Action.Pause);
4647
hideModal();
4748
};
4849
</script>

src/lib/components/activity/activity-reset-confirmation-modal.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import Checkbox from '$lib/holocene/checkbox.svelte';
55
import Modal from '$lib/holocene/modal.svelte';
66
import { translate } from '$lib/i18n/translate';
7+
import { Action } from '$lib/models/workflow-actions';
78
import { resetActivity } from '$lib/services/workflow-activities-service';
89
import { toaster } from '$lib/stores/toaster';
910
import { triggerRefresh } from '$lib/stores/workflow-run';
@@ -42,7 +43,7 @@
4243
type: includeType ? type : undefined,
4344
identity,
4445
});
45-
triggerRefresh();
46+
triggerRefresh(Action.Reset);
4647
toaster.push({
4748
variant: 'success',
4849
message: translate('activities.reset-success', { activityId: id }),

src/lib/components/activity/activity-unpause-confirmation-modal.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import Checkbox from '$lib/holocene/checkbox.svelte';
55
import Modal from '$lib/holocene/modal.svelte';
66
import { translate } from '$lib/i18n/translate';
7+
import { Action } from '$lib/models/activity-actions';
78
import { unpauseActivity } from '$lib/services/workflow-activities-service';
89
import { triggerRefresh } from '$lib/stores/workflow-run';
910
import type { PendingActivity } from '$lib/types/events';
@@ -38,7 +39,7 @@
3839
type: includeType ? type : undefined,
3940
identity,
4041
});
41-
triggerRefresh();
42+
triggerRefresh(Action.Unpause);
4243
hideModal();
4344
};
4445
</script>

src/lib/components/lines-and-dots/end-time-interval.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
if (pauseLiveUpdates) {
3636
clearInterval(endTimeInterval);
3737
endTimeInterval = null;
38-
} else if (!endTimeInterval && workflow.isRunning) {
38+
} else if (!endTimeInterval && (workflow.isRunning || workflow.isPaused)) {
3939
endTimeInterval = setInterval(() => {
4040
endTime = rightNow();
4141
}, 1000);

src/lib/components/workflow-actions.svelte

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,14 @@
3636
workflow: WorkflowExecution;
3737
namespace: string;
3838
cancelInProgress: boolean;
39-
isRunning: boolean;
40-
isPaused: boolean;
4139
first?: string;
4240
next?: string;
4341
}
4442
45-
let {
46-
workflow,
47-
namespace,
48-
cancelInProgress,
49-
isRunning,
50-
isPaused,
51-
first,
52-
next,
53-
}: Props = $props();
43+
let { workflow, namespace, cancelInProgress, first, next }: Props = $props();
44+
45+
const isRunning = $derived(workflow?.isRunning);
46+
const isPaused = $derived(workflow?.isPaused);
5447
5548
let cancelConfirmationModalOpen = $state(false);
5649
let terminateConfirmationModalOpen = $state(false);

src/lib/components/workflow/client-actions/pause-confirmation-modal.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import { translate } from '$lib/i18n/translate';
55
import { Action } from '$lib/models/workflow-actions';
66
import { pauseWorkflow } from '$lib/services/workflow-service';
7+
import { pauseLiveUpdates } from '$lib/stores/events';
78
import { toaster } from '$lib/stores/toaster';
89
import { triggerRefresh } from '$lib/stores/workflow-run';
910
import type { WorkflowExecution } from '$lib/types/workflows';

src/lib/components/workflow/input-and-results-payload.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
1414
export let title: string;
1515
export let content: string = '';
16-
export let isRunning: boolean = false;
16+
export let isPending: boolean = false;
1717
1818
const parseContent = (c: string): PotentiallyDecodable | undefined => {
1919
try {
@@ -93,7 +93,7 @@
9393
{/key}
9494
{:else}
9595
<CodeBlock
96-
content={isRunning ? 'Results will appear upon completion.' : 'null'}
96+
content={isPending ? 'Results will appear upon completion.' : 'null'}
9797
language="text"
9898
copyable={false}
9999
maxHeight={300}

src/lib/components/workflow/input-and-results.svelte

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,19 @@
88
99
$: workflowEvents =
1010
getWorkflowStartedCompletedAndTaskFailedEvents($fullEventHistory);
11-
$: isRunning = $workflowRun.workflow.isRunning;
11+
$: isPending =
12+
$workflowRun.workflow.isRunning || $workflowRun.workflow.isPaused;
1213
</script>
1314

1415
<div class="flex flex-col gap-4 lg:flex-row" data-testid="input-and-result">
1516
<InputAndResultsPayload
1617
title={translate('workflows.input')}
1718
content={workflowEvents.input}
18-
{isRunning}
19+
{isPending}
1920
/>
2021
<InputAndResultsPayload
2122
title={translate('workflows.result')}
2223
content={workflowEvents.results}
23-
{isRunning}
24+
{isPending}
2425
/>
2526
</div>

src/lib/components/workflow/pending-activity/pending-activity-card.svelte

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,16 @@
3131
}: { activity: PendingActivity; totalPending?: number } = $props();
3232
const failed = $derived(activity.attempt > 1 && !!activity.lastFailure);
3333
const isRunning = $derived($workflowRun?.workflow?.isRunning);
34+
const isPaused = $derived($workflowRun?.workflow?.isPaused);
3435
3536
let coreUser = coreUserStore();
3637
let showActivityCommands = $derived(
3738
activityCommandsEnabled(
3839
page.data.settings,
3940
$coreUser,
4041
page.params.namespace,
41-
) && isRunning,
42+
) &&
43+
(isRunning || isPaused),
4244
);
4345
</script>
4446

0 commit comments

Comments
 (0)