Skip to content

Commit e8710d0

Browse files
Activity Commands - Pause, Update Options, Reset (#2795)
* Add function to determine billableAction count * Make the event history table better * Add date to pending activity * Add line-dot visualization back * Remove borders, more table stuff * Event Card * Table changes * Initial build of operator commands * Add unpause modal * Add pause icon in Timeline, correctly set updateMask to all fields, update portal * Add toasts on update, use Input, add TODO for reset * Remove key * WIP: icon placeholder and isCloud check * Add dollar-invoice icon * Show row details on Timeline to make them consistent * Change grid if no payloads * Fix timestamp and copyable button * Fix type, comment out visibility store * Use h-9 for the table header cell height to prevent shift on bulk actions * Make title text bigger * Update Card styles, add event links * Include workflow rejected action * Flip visibility to test * Clean up cards * Hide redudent fields * Pending Activities fixes * Update signal count on id * UI improvements * Add PendingNexusOperationCard * Add check for WorkflowTaskFailedEvent due to reset and update billable actions accordingly * Refactor to add shouldNotAddBillableAction check instead of resetBillableActionsBeforeEvent * Add stripes for retried activities * Better lines * Fix backdrop issue with key * add pausing badge * Use Freeze/Unfreeze * Add activity commands enabled check * Refresh on update * Add descriptions and update drawer spacing * Reset original values based on scheduled event * Show original values * Don't show next retry if negative time * Update original value UI in update drawer * Use NumberInputs for original values * Remove original values from update drawer * Disable activity commands for Cloud * Fix isCloud check * More pending activity fixes * Skip coreUser test for now * Move flex fixes for pending cards * Small UI fixes * remove target prop * Add preventDefault * Add toast notification for update error * Fix types to strings, only show retried stripes on completed activities. * Fix all the shady types * Fix compact logic, better opacity * Better hasPendingActivity logic * Fix heartbeat label, remove accordion * Add accordion if over 20 pending activities, remove accordion from nexus failures, make retry line thinner * Disable activity commands if not running * Add isRunning check to show activity commands * Reset values on close of update drawer --------- Co-authored-by: Laura Whitaker <laura.whitaker@temporal.io>
1 parent 0f6be9f commit e8710d0

52 files changed

Lines changed: 1358 additions & 201 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

server/config/development.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ batchActionsDisabled: false
2222
startWorkflowDisabled: false
2323
hideWorkflowQueryErrors: false
2424
refreshWorkflowCountsDisabled: false
25+
activityCommandsDisabled: false
2526
auth:
2627
enabled: false
2728
providers:

server/config/docker.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ batchActionsDisabled: {{ env "TEMPORAL_BATCH_ACTIONS_DISABLED" | default "false"
2323
startWorkflowDisabled: {{ env "TEMPORAL_START_WORKFLOW_DISABLED" | default "false" }}
2424
hideWorkflowQueryErrors: {{ env "TEMPORAL_HIDE_WORKFLOW_QUERY_ERRORS" | default "false" }}
2525
refreshWorkflowCountsDisabled: {{ env "TEMPORAL_REFRESH_WORKFLOW_COUNTS_DISABLED" | default "false" }}
26+
activityCommandsDisabled: {{ env "TEMPORAL_ACTIVITY_COMMANDS_DISABLED" | default "false" }}
2627
cors:
2728
cookieInsecure: {{ env "TEMPORAL_CSRF_COOKIE_INSECURE" | default "false" }}
2829
unsafeAllowAllOrigins: {{ env "TEMPORAL_CORS_UNSAFE_ALLOW_ALL_ORIGINS" | default "false" }}

server/server/api/handler.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ type SettingsResponse struct {
7676
StartWorkflowDisabled bool
7777
HideWorkflowQueryErrors bool
7878
RefreshWorkflowCountsDisabled bool
79+
ActivityCommandsDisabled bool
7980
}
8081

8182
func TemporalAPIHandler(cfgProvider *config.ConfigProviderWithRefresh, apiMiddleware []Middleware, conn *grpc.ClientConn) echo.HandlerFunc {
@@ -153,6 +154,7 @@ func GetSettings(cfgProvider *config.ConfigProviderWithRefresh) func(echo.Contex
153154
StartWorkflowDisabled: cfg.StartWorkflowDisabled,
154155
HideWorkflowQueryErrors: cfg.HideWorkflowQueryErrors,
155156
RefreshWorkflowCountsDisabled: cfg.RefreshWorkflowCountsDisabled,
157+
ActivityCommandsDisabled: cfg.ActivityCommandsDisabled,
156158
}
157159

158160
return c.JSON(http.StatusOK, settings)

server/server/config/config.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ type (
6666
HideWorkflowQueryErrors bool `yaml:"hideWorkflowQueryErrors"`
6767
// Whether to disable refreshing workflow counts in UI
6868
RefreshWorkflowCountsDisabled bool `yaml:"refreshWorkflowCountsDisabled"`
69+
// Whether to disable activity commands in the UI
70+
ActivityCommandsDisabled bool `yaml:"activityCommandsDisabled"`
6971
// Forward specified HTTP headers from HTTP API requests to Temporal gRPC backend
7072
ForwardHeaders []string `yaml:"forwardHeaders"`
7173
HideLogs bool `yaml:"hideLogs"`
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
<script lang="ts">
2+
import type { WorkflowExecution } from '@temporalio/client';
3+
4+
import { page } from '$app/state';
5+
6+
import Button from '$lib/holocene/button.svelte';
7+
import Tooltip from '$lib/holocene/tooltip.svelte';
8+
import { translate } from '$lib/i18n/translate';
9+
import type { PendingActivity } from '$lib/types/events';
10+
11+
import ActivityOptionsUpdateDrawer from './activity-options-update-drawer.svelte';
12+
import ActivityPauseConfirmationModal from './activity-pause-confirmation-modal.svelte';
13+
import ActivityResetConfirmationModal from './activity-reset-confirmation-modal.svelte';
14+
import ActivityUnpauseConfirmationModal from './activity-unpause-confirmation-modal.svelte';
15+
16+
type Props = {
17+
activity: PendingActivity;
18+
class?: string;
19+
};
20+
21+
let { activity, class: className = '' }: Props = $props();
22+
const { namespace, workflow, run } = $derived(page.params);
23+
const execution: WorkflowExecution = $derived({
24+
workflowId: workflow,
25+
runId: run,
26+
});
27+
28+
let pauseConfirmationModalOpen = $state(false);
29+
let unpauseConfirmationModalOpen = $state(false);
30+
let resetConfirmationModalOpen = $state(false);
31+
let optionsUpdateDrawerOpen = $state(false);
32+
33+
const onPause = async () => {
34+
if (activity.paused) {
35+
unpauseConfirmationModalOpen = true;
36+
} else {
37+
pauseConfirmationModalOpen = true;
38+
}
39+
};
40+
41+
const onReset = () => {
42+
resetConfirmationModalOpen = true;
43+
};
44+
45+
const onUpdate = () => {
46+
optionsUpdateDrawerOpen = true;
47+
};
48+
</script>
49+
50+
<div class="flex items-center gap-2 {className}">
51+
<Tooltip
52+
bottomLeft
53+
width={200}
54+
text={activity.paused
55+
? 'Resume this Activity'
56+
: 'Pauses this Activity, starting before it retries or the next time it heartbeats. It won’t time out while it’s paused.'}
57+
>
58+
<Button
59+
variant="secondary"
60+
size="sm"
61+
leadingIcon={activity.paused ? 'play' : 'pause'}
62+
on:click={onPause}
63+
>
64+
{activity.paused
65+
? translate('workflows.unpause')
66+
: translate('workflows.pause')}
67+
</Button>
68+
</Tooltip>
69+
<Tooltip bottomLeft width={200} text="Update this Activity Options.">
70+
<Button
71+
variant="secondary"
72+
size="sm"
73+
leadingIcon="pencil"
74+
on:click={onUpdate}
75+
>
76+
{translate('common.update')}
77+
</Button>
78+
</Tooltip>
79+
<Tooltip bottom width={200} text="Reset this Activity.">
80+
<Button
81+
variant="secondary"
82+
size="sm"
83+
leadingIcon="retry"
84+
on:click={onReset}
85+
>
86+
{translate('workflows.reset')}
87+
</Button>
88+
</Tooltip>
89+
</div>
90+
91+
<ActivityPauseConfirmationModal
92+
bind:open={pauseConfirmationModalOpen}
93+
{namespace}
94+
{execution}
95+
{activity}
96+
/>
97+
98+
<ActivityUnpauseConfirmationModal
99+
bind:open={unpauseConfirmationModalOpen}
100+
{namespace}
101+
{execution}
102+
{activity}
103+
/>
104+
105+
<ActivityResetConfirmationModal
106+
bind:open={resetConfirmationModalOpen}
107+
{namespace}
108+
{execution}
109+
{activity}
110+
/>
111+
112+
{#key optionsUpdateDrawerOpen}
113+
<ActivityOptionsUpdateDrawer
114+
bind:open={optionsUpdateDrawerOpen}
115+
{namespace}
116+
{execution}
117+
{activity}
118+
/>
119+
{/key}

0 commit comments

Comments
 (0)