@@ -22,102 +22,117 @@ import {
22
22
} from '../workflow-action-reset-form/workflow-action-reset-form.types' ;
23
23
import { type WorkflowAction } from '../workflow-actions.types' ;
24
24
25
- const workflowActionsConfig : [
26
- WorkflowAction < any , any , CancelWorkflowResponse > ,
27
- WorkflowAction < any , any , TerminateWorkflowResponse > ,
28
- WorkflowAction < any , any , RestartWorkflowResponse > ,
29
- WorkflowAction <
30
- ResetWorkflowFormData ,
31
- ResetWorkflowSubmissionData ,
32
- ResetWorkflowResponse
33
- > ,
34
- ] = [
35
- {
36
- id : 'cancel' ,
37
- label : 'Cancel' ,
38
- subtitle : 'Cancel a workflow execution' ,
39
- modal : {
40
- text : "Cancels a running workflow by scheduling a cancellation request in the workflow's history, giving it a chance to clean up." ,
41
- docsLink : {
42
- text : 'Read more about cancelling workflows' ,
43
- href : 'https://cadenceworkflow.io/docs/cli#signal-cancel-terminate-workflow' ,
44
- } ,
25
+ const cancelWorkflowActionConfig : WorkflowAction <
26
+ any ,
27
+ any ,
28
+ CancelWorkflowResponse
29
+ > = {
30
+ id : 'cancel' ,
31
+ label : 'Cancel' ,
32
+ subtitle : 'Cancel a workflow execution' ,
33
+ modal : {
34
+ text : "Cancels a running workflow by scheduling a cancellation request in the workflow's history, giving it a chance to clean up." ,
35
+ docsLink : {
36
+ text : 'Read more about cancelling workflows' ,
37
+ href : 'https://cadenceworkflow.io/docs/cli#signal-cancel-terminate-workflow' ,
45
38
} ,
46
- icon : MdHighlightOff ,
47
- getRunnableStatus : ( workflow ) =>
48
- getWorkflowIsCompleted (
49
- workflow . workflowExecutionInfo ?. closeEvent ?. attributes ?? ''
50
- )
51
- ? 'NOT_RUNNABLE_WORKFLOW_CLOSED'
52
- : 'RUNNABLE' ,
53
- apiRoute : 'cancel' ,
54
- renderSuccessMessage : ( ) => 'Workflow cancellation has been requested.' ,
55
39
} ,
56
- {
57
- id : 'terminate' ,
58
- label : 'Terminate' ,
59
- subtitle : 'Terminate a workflow execution' ,
60
- modal : {
61
- text : 'Terminates a running workflow immediately. Please terminate a workflow only if you know what you are doing.' ,
62
- docsLink : {
63
- text : 'Read more about terminating workflows' ,
64
- href : 'https://cadenceworkflow.io/docs/cli#signal-cancel-terminate-workflow' ,
65
- } ,
40
+ icon : MdHighlightOff ,
41
+ getRunnableStatus : ( workflow ) =>
42
+ getWorkflowIsCompleted (
43
+ workflow . workflowExecutionInfo ?. closeEvent ?. attributes ?? ''
44
+ )
45
+ ? 'NOT_RUNNABLE_WORKFLOW_CLOSED'
46
+ : 'RUNNABLE' ,
47
+ apiRoute : 'cancel' ,
48
+ renderSuccessMessage : ( ) => 'Workflow cancellation has been requested.' ,
49
+ } ;
50
+
51
+ const terminateWorkflowActionConfig : WorkflowAction <
52
+ any ,
53
+ any ,
54
+ TerminateWorkflowResponse
55
+ > = {
56
+ id : 'terminate' ,
57
+ label : 'Terminate' ,
58
+ subtitle : 'Terminate a workflow execution' ,
59
+ modal : {
60
+ text : 'Terminates a running workflow immediately. Please terminate a workflow only if you know what you are doing.' ,
61
+ docsLink : {
62
+ text : 'Read more about terminating workflows' ,
63
+ href : 'https://cadenceworkflow.io/docs/cli#signal-cancel-terminate-workflow' ,
66
64
} ,
67
- icon : MdPowerSettingsNew ,
68
- getRunnableStatus : ( workflow ) =>
69
- getWorkflowIsCompleted (
70
- workflow . workflowExecutionInfo ?. closeEvent ?. attributes ?? ''
71
- )
72
- ? 'NOT_RUNNABLE_WORKFLOW_CLOSED'
73
- : 'RUNNABLE' ,
74
- apiRoute : 'terminate' ,
75
- renderSuccessMessage : ( ) => 'Workflow has been terminated.' ,
76
65
} ,
77
- {
78
- id : 'restart' ,
79
- label : 'Restart' ,
80
- subtitle : 'Restart a workflow execution' ,
81
- modal : {
82
- text : [
83
- 'Restarts a workflow by creating a new execution with a fresh Run ID while using the existing input. If the previous execution is still running, it will be terminated.' ,
84
- 'What differentiates Restart from Reset is that the restarted workflow is not aware of the previous workflow execution.' ,
85
- ] ,
86
- } ,
87
- icon : MdOutlineRestartAlt ,
88
- getRunnableStatus : ( ) => 'RUNNABLE' ,
89
- apiRoute : 'restart' ,
90
- renderSuccessMessage : ( props ) =>
91
- createElement ( WorkflowActionNewRunSuccessMsg , {
92
- ...props ,
93
- successMessage : 'Workflow has been restarted.' ,
94
- } ) ,
66
+ icon : MdPowerSettingsNew ,
67
+ getRunnableStatus : ( workflow ) =>
68
+ getWorkflowIsCompleted (
69
+ workflow . workflowExecutionInfo ?. closeEvent ?. attributes ?? ''
70
+ )
71
+ ? 'NOT_RUNNABLE_WORKFLOW_CLOSED'
72
+ : 'RUNNABLE' ,
73
+ apiRoute : 'terminate' ,
74
+ renderSuccessMessage : ( ) => 'Workflow has been terminated.' ,
75
+ } ;
76
+
77
+ const restartWorkflowActionConfig : WorkflowAction <
78
+ any ,
79
+ any ,
80
+ RestartWorkflowResponse
81
+ > = {
82
+ id : 'restart' ,
83
+ label : 'Restart' ,
84
+ subtitle : 'Restart a workflow execution' ,
85
+ modal : {
86
+ text : [
87
+ 'Restarts a workflow by creating a new execution with a fresh Run ID while using the existing input. If the previous execution is still running, it will be terminated.' ,
88
+ 'What differentiates Restart from Reset is that the restarted workflow is not aware of the previous workflow execution.' ,
89
+ ] ,
95
90
} ,
96
- {
97
- id : 'reset' ,
98
- label : 'Reset' ,
99
- subtitle : 'Reset a workflow execution' ,
100
- modal : {
101
- text : [
102
- 'Resets a workflow by creating a new execution with a fresh Run ID starting from a specific decision completion event.' ,
103
- ] ,
104
- docsLink : {
105
- text : 'Read more about resetting workflows' ,
106
- href : 'https://cadenceworkflow.io/docs/cli#workflow-reset' ,
107
- } ,
108
- form : WorkflowActionResetForm ,
109
- formSchema : resetWorkflowFormSchema ,
110
- transformFormDataToSubmission : ( v ) => v ,
91
+ icon : MdOutlineRestartAlt ,
92
+ getRunnableStatus : ( ) => 'RUNNABLE' ,
93
+ apiRoute : 'restart' ,
94
+ renderSuccessMessage : ( props ) =>
95
+ createElement ( WorkflowActionNewRunSuccessMsg , {
96
+ ...props ,
97
+ successMessage : 'Workflow has been restarted.' ,
98
+ } ) ,
99
+ } ;
100
+
101
+ export const resetWorkflowActionConfig : WorkflowAction <
102
+ ResetWorkflowFormData ,
103
+ ResetWorkflowSubmissionData ,
104
+ ResetWorkflowResponse
105
+ > = {
106
+ id : 'reset' ,
107
+ label : 'Reset' ,
108
+ subtitle : 'Reset a workflow execution' ,
109
+ modal : {
110
+ text : [
111
+ 'Resets a workflow by creating a new execution with a fresh Run ID starting from a specific decision completion event.' ,
112
+ ] ,
113
+ docsLink : {
114
+ text : 'Read more about resetting workflows' ,
115
+ href : 'https://cadenceworkflow.io/docs/cli#workflow-reset' ,
111
116
} ,
112
- icon : MdRefresh ,
113
- getRunnableStatus : ( ) => 'RUNNABLE' ,
114
- apiRoute : 'reset' ,
115
- renderSuccessMessage : ( props ) =>
116
- createElement ( WorkflowActionNewRunSuccessMsg , {
117
- ...props ,
118
- successMessage : 'Workflow has been reset.' ,
119
- } ) ,
117
+ form : WorkflowActionResetForm ,
118
+ formSchema : resetWorkflowFormSchema ,
119
+ transformFormDataToSubmission : ( v ) => v ,
120
120
} ,
121
+ icon : MdRefresh ,
122
+ getRunnableStatus : ( ) => 'RUNNABLE' ,
123
+ apiRoute : 'reset' ,
124
+ renderSuccessMessage : ( props ) =>
125
+ createElement ( WorkflowActionNewRunSuccessMsg , {
126
+ ...props ,
127
+ successMessage : 'Workflow has been reset.' ,
128
+ } ) ,
129
+ } ;
130
+
131
+ const workflowActionsConfig = [
132
+ cancelWorkflowActionConfig ,
133
+ terminateWorkflowActionConfig ,
134
+ restartWorkflowActionConfig ,
135
+ resetWorkflowActionConfig ,
121
136
] as const ;
122
137
123
138
export default workflowActionsConfig ;
0 commit comments