@orchestrator-ui/orchestrator-ui-components 0.2.6 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +6 -6
- package/.turbo/turbo-lint.log +0 -6
- package/.turbo/turbo-test.log +9 -8
- package/CHANGELOG.md +12 -0
- package/dist/index.d.ts +1005 -123
- package/dist/index.js +33996 -6348
- package/package.json +14 -12
- package/src/api/index.ts +55 -3
- package/src/components/WfoDiff/WfoDiff.tsx +119 -0
- package/src/components/WfoDiff/index.ts +1 -0
- package/src/components/WfoDiff/unidiff.d.ts +1 -0
- package/src/components/WfoForms/AutoFieldLoader.tsx +5 -1
- package/src/components/WfoForms/CreateForm.tsx +1 -1
- package/src/components/WfoForms/UserInputForm.tsx +75 -43
- package/src/components/WfoForms/UserInputFormWizard.tsx +11 -4
- package/src/components/WfoForms/formFields/AcceptField.tsx +8 -5
- package/src/components/WfoForms/formFields/BoolField.tsx +1 -1
- package/src/components/WfoForms/formFields/ImsNodeIdField.tsx +2 -2
- package/src/components/WfoForms/formFields/ImsPortIdField.tsx +238 -0
- package/src/components/WfoForms/formFields/ImsPortIdFieldStyling.ts +17 -0
- package/src/components/WfoForms/formFields/IpPrefixTableField.tsx +1 -1
- package/src/components/WfoForms/formFields/ListAddField.tsx +1 -1
- package/src/components/WfoForms/formFields/ListDelField.tsx +1 -1
- package/src/components/WfoForms/formFields/OptGroupField.tsx +1 -1
- package/src/components/WfoForms/formFields/SubscriptionField.tsx +2 -1
- package/src/components/WfoForms/formFields/SummaryField.tsx +103 -0
- package/src/components/WfoForms/formFields/SummaryFieldStyling.ts +46 -0
- package/src/components/WfoForms/formFields/VlanField.tsx +10 -10
- package/src/components/WfoForms/formFields/index.ts +2 -0
- package/src/components/WfoForms/formFields/surf/types.ts +26 -0
- package/src/components/WfoForms/formFields/utils.spec.ts +1 -0
- package/src/components/WfoJsonCodeBlock/index.ts +1 -0
- package/src/components/WfoPageTemplate/WfoPageHeader/WfoPageHeader.tsx +4 -3
- package/src/components/WfoPageTemplate/WfoSidebar/WfoSidebar.tsx +14 -14
- package/src/components/WfoPageTemplate/WfoSidebar/WfoStartCreateWorkflowButtonComboBox.tsx +15 -9
- package/src/components/WfoPageTemplate/paths.ts +3 -2
- package/src/components/{WfoProcessesList → WfoProcessList}/WfoProcessList.tsx +18 -14
- package/src/components/WfoProcessList/index.ts +1 -0
- package/src/components/{WfoProcessesList → WfoProcessList}/processListObjectMappers.ts +4 -2
- package/src/components/WfoSearchBar/WfoSearchField.tsx +27 -37
- package/src/components/{WfoSettingsPage → WfoSettings}/WfoEngineStatusButton.tsx +7 -4
- package/src/components/{WfoSettingsPage → WfoSettings}/WfoFlushSettings.tsx +13 -12
- package/src/components/WfoSettings/WfoModifySettings.tsx +38 -0
- package/src/components/WfoSettings/WfoSettings.tsx +40 -0
- package/src/components/{WfoSettingsPage → WfoSettings}/WfoStatus.tsx +21 -14
- package/src/components/WfoStartPage/WfoListStartPage.tsx +3 -3
- package/src/components/WfoStartTaskButtonComboBox/WfoStartTaskButtonComboBox.tsx +14 -8
- package/src/components/WfoSubscription/WfoProcessesTimeline.tsx +11 -18
- package/src/components/WfoSubscription/WfoSubscription.tsx +1 -1
- package/src/components/WfoSubscription/WfoSubscriptionActions.tsx +41 -33
- package/src/components/WfoSubscription/WfoSubscriptionDetailTree.tsx +32 -22
- package/src/components/WfoSubscription/WfoSubscriptionProductBlock.tsx +94 -90
- package/src/components/WfoSubscription/WfoTargetTypeIcon.tsx +26 -0
- package/src/components/WfoSubscription/utils/utils.spec.ts +24 -0
- package/src/components/WfoSubscription/utils/utils.ts +16 -0
- package/src/components/WfoSubscriptionsList/WfoSubscriptionsList.tsx +17 -37
- package/src/components/WfoTable/WfoTableWithFilter/WfoTableWithFilter.tsx +20 -19
- package/src/components/WfoTable/WfoTableWithFilter/updateQueryString.spec.ts +95 -0
- package/src/components/WfoTable/WfoTableWithFilter/updateQueryString.ts +60 -0
- package/src/components/WfoTable/utils/tableUtils.ts +3 -3
- package/src/components/WfoTextAnchor/WfoTextAnchor.stories.tsx +18 -0
- package/src/components/WfoTextAnchor/WfoTextAnchor.tsx +22 -0
- package/src/components/WfoTextAnchor/index.ts +1 -0
- package/src/components/WfoTextAnchor/styles.ts +17 -0
- package/src/components/WfoTimeline/styles.ts +10 -4
- package/src/components/WfoWorkflowSteps/WfoStep/WfoStep.tsx +39 -24
- package/src/components/WfoWorkflowSteps/WfoStep/WfoStepForm.tsx +48 -0
- package/src/components/WfoWorkflowSteps/WfoStepList/WfoStepList.tsx +14 -11
- package/src/components/WfoWorkflowSteps/WfoWorkflowStepList/WfoStepListHeader.tsx +22 -23
- package/src/components/WfoWorkflowSteps/WfoWorkflowStepList/WfoWorkflowStepList.tsx +97 -17
- package/src/components/WfoWorkflowSteps/stepListUtils.ts +1 -28
- package/src/components/confirmationDialog/WfoConfirmationDialog.tsx +3 -3
- package/src/components/index.ts +6 -1
- package/src/contexts/ConfirmationDialogProvider.tsx +2 -2
- package/src/contexts/TreeContext.tsx +5 -0
- package/src/graphqlQueries/index.ts +1 -0
- package/src/graphqlQueries/processDetailQuery.ts +8 -0
- package/src/graphqlQueries/processListQuery.ts +7 -6
- package/src/graphqlQueries/processStepsQuery.ts +22 -0
- package/src/graphqlQueries/productBlocksQuery.ts +9 -5
- package/src/graphqlQueries/productsQuery.ts +7 -3
- package/src/graphqlQueries/relatedSubscriptionsQuery.ts +2 -2
- package/src/graphqlQueries/resourceTypesQuery.ts +8 -4
- package/src/graphqlQueries/subscriptionDetailQuery.ts +1 -0
- package/src/graphqlQueries/subscriptionsListQuery.ts +5 -3
- package/src/graphqlQueries/workflows/workflowsQuery.ts +8 -4
- package/src/graphqlQueries/workflows/workflowsQueryForDropdownList.ts +2 -2
- package/src/hooks/DataFetchHooks.ts +9 -4
- package/src/hooks/index.ts +3 -0
- package/src/hooks/useCheckEngineStatus.ts +30 -0
- package/src/hooks/useDataDisplayParams.ts +3 -3
- package/src/hooks/useEngineStatusQuery.ts +9 -7
- package/src/hooks/useMutateProcess.ts +96 -0
- package/src/messages/{en-US.json → en-GB.json} +85 -37
- package/src/messages/getTranslationMessages.spec.ts +25 -40
- package/src/messages/index.ts +1 -1
- package/src/messages/nl-NL.json +95 -48
- package/src/messages/useGetTranslationMessages.ts +51 -0
- package/src/pages/metadata/WfoProductBlocksPage.tsx +12 -10
- package/src/pages/metadata/WfoProductsPage.tsx +24 -25
- package/src/pages/metadata/WfoResourceTypesPage.tsx +12 -10
- package/src/pages/metadata/WfoWorkflowsPage.tsx +12 -10
- package/src/pages/processes/WfoProcessDetail.tsx +96 -79
- package/src/pages/processes/WfoProcessDetailPage.tsx +5 -3
- package/src/pages/{workflow/WfoStartWorkflowPage.tsx → processes/WfoStartProcessPage.tsx} +102 -51
- package/src/pages/processes/index.ts +1 -3
- package/src/pages/settings/WfoSettingsPage.tsx +30 -0
- package/src/pages/settings/index.ts +1 -0
- package/src/pages/tasks/WfoTaskListPage.tsx +35 -9
- package/src/pages/{processes/WfoProcessListPage.tsx → workflow/WfoWorkflowListPage.tsx} +22 -23
- package/src/pages/workflow/getWorkflowListTabTypeFromString.ts +19 -0
- package/src/pages/workflow/index.ts +1 -1
- package/src/pages/{processes → workflow}/tabConfig.ts +6 -6
- package/src/types/types.ts +33 -3
- package/src/utils/getDefaultTableConfig.ts +1 -1
- package/src/components/WfoSettingsPage/WfoModifySettings.tsx +0 -33
- package/src/components/WfoSettingsPage/WfoSettings.tsx +0 -40
- package/src/hooks/ProcessesHooks/useDeleteProcess.ts +0 -37
- package/src/messages/getTranslationMessages.ts +0 -26
- package/src/pages/processes/getProcessListTabTypeFromString.ts +0 -19
- /package/src/components/{WfoSettingsPage → WfoSettings}/index.ts +0 -0
|
@@ -15,16 +15,21 @@ import {
|
|
|
15
15
|
|
|
16
16
|
import {
|
|
17
17
|
PATH_TASKS,
|
|
18
|
+
PATH_WORKFLOWS,
|
|
18
19
|
TimelineItem,
|
|
19
20
|
WfoLoading,
|
|
20
21
|
WfoTimeline,
|
|
21
|
-
} from '
|
|
22
|
-
import ConfirmationDialogContext from '
|
|
23
|
-
import {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
} from '@/components';
|
|
23
|
+
import { ConfirmationDialogContext } from '@/contexts';
|
|
24
|
+
import {
|
|
25
|
+
useCheckEngineStatus,
|
|
26
|
+
useMutateProcess,
|
|
27
|
+
useOrchestratorTheme,
|
|
28
|
+
} from '@/hooks';
|
|
29
|
+
import { WfoRefresh, WfoXCircleFill } from '@/icons';
|
|
30
|
+
import { ProcessDetail, ProcessStatus } from '@/types';
|
|
31
|
+
import { parseDateRelativeToToday, parseIsoString } from '@/utils';
|
|
32
|
+
|
|
28
33
|
import {
|
|
29
34
|
RenderDirection,
|
|
30
35
|
WfoProcessListSubscriptionsCell,
|
|
@@ -89,8 +94,81 @@ export const WfoProcessDetail = ({
|
|
|
89
94
|
const t = useTranslations('processes.detail');
|
|
90
95
|
const { theme } = useOrchestratorTheme();
|
|
91
96
|
const { showConfirmDialog } = useContext(ConfirmationDialogContext);
|
|
92
|
-
const {
|
|
97
|
+
const { deleteProcess, abortProcess, retryProcess } = useMutateProcess();
|
|
93
98
|
const router = useRouter();
|
|
99
|
+
const { isEngineRunningNow } = useCheckEngineStatus();
|
|
100
|
+
|
|
101
|
+
const listIncludesStatus = (
|
|
102
|
+
processStatusesForDisabledState: ProcessStatus[],
|
|
103
|
+
status?: string,
|
|
104
|
+
): boolean =>
|
|
105
|
+
status
|
|
106
|
+
? processStatusesForDisabledState
|
|
107
|
+
.map((stat) => stat.toUpperCase())
|
|
108
|
+
.includes(status)
|
|
109
|
+
: false;
|
|
110
|
+
|
|
111
|
+
const retryButtonIsDisabled =
|
|
112
|
+
buttonsAreDisabled ||
|
|
113
|
+
!listIncludesStatus([ProcessStatus.FAILED], processDetail?.lastStatus);
|
|
114
|
+
const abortButtonIsDisabled =
|
|
115
|
+
buttonsAreDisabled ||
|
|
116
|
+
listIncludesStatus(
|
|
117
|
+
[ProcessStatus.COMPLETED, ProcessStatus.ABORTED],
|
|
118
|
+
processDetail?.lastStatus,
|
|
119
|
+
);
|
|
120
|
+
const deleteButtonIsDisabled =
|
|
121
|
+
buttonsAreDisabled ||
|
|
122
|
+
listIncludesStatus([ProcessStatus.RUNNING], processDetail?.lastStatus);
|
|
123
|
+
|
|
124
|
+
const processIsTask = processDetail?.isTask === true;
|
|
125
|
+
|
|
126
|
+
const handleActionButtonClick = (action: () => void) => async () => {
|
|
127
|
+
if (await isEngineRunningNow()) {
|
|
128
|
+
action();
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
const retryAction = () =>
|
|
133
|
+
showConfirmDialog({
|
|
134
|
+
question: t(
|
|
135
|
+
processIsTask ? 'retryTaskQuestion' : 'retryWorkflowQuestion',
|
|
136
|
+
{
|
|
137
|
+
workflowName: processDetail?.workflowName,
|
|
138
|
+
},
|
|
139
|
+
),
|
|
140
|
+
confirmAction: () => {
|
|
141
|
+
processDetail?.processId &&
|
|
142
|
+
retryProcess.mutate(processDetail.processId);
|
|
143
|
+
},
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
const abortAction = () =>
|
|
147
|
+
showConfirmDialog({
|
|
148
|
+
question: t(
|
|
149
|
+
processIsTask ? 'abortTaskQuestion' : 'abortWorkflowQuestion',
|
|
150
|
+
{
|
|
151
|
+
workflowName: processDetail?.workflowName,
|
|
152
|
+
},
|
|
153
|
+
),
|
|
154
|
+
confirmAction: () => {
|
|
155
|
+
processDetail?.processId &&
|
|
156
|
+
abortProcess.mutate(processDetail.processId);
|
|
157
|
+
router.push(processIsTask ? PATH_TASKS : PATH_WORKFLOWS);
|
|
158
|
+
},
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
const deleteAction = () =>
|
|
162
|
+
showConfirmDialog({
|
|
163
|
+
question: t('deleteQuestion', {
|
|
164
|
+
workflowName: processDetail?.workflowName,
|
|
165
|
+
}),
|
|
166
|
+
confirmAction: () => {
|
|
167
|
+
processDetail?.processId &&
|
|
168
|
+
deleteProcess.mutate(processDetail.processId);
|
|
169
|
+
router.push(PATH_TASKS);
|
|
170
|
+
},
|
|
171
|
+
});
|
|
94
172
|
|
|
95
173
|
return (
|
|
96
174
|
<>
|
|
@@ -107,111 +185,50 @@ export const WfoProcessDetail = ({
|
|
|
107
185
|
gutterSize="s"
|
|
108
186
|
>
|
|
109
187
|
<EuiButton
|
|
110
|
-
onClick={(
|
|
111
|
-
e: React.MouseEvent<
|
|
112
|
-
HTMLButtonElement | HTMLElement,
|
|
113
|
-
MouseEvent
|
|
114
|
-
>,
|
|
115
|
-
) => {
|
|
116
|
-
e.preventDefault();
|
|
117
|
-
alert('TODO: Implement retry');
|
|
118
|
-
}}
|
|
188
|
+
onClick={handleActionButtonClick(retryAction)}
|
|
119
189
|
iconType={() => (
|
|
120
190
|
<WfoRefresh
|
|
121
191
|
color={
|
|
122
|
-
|
|
192
|
+
retryButtonIsDisabled
|
|
123
193
|
? theme.colors.subduedText
|
|
124
194
|
: theme.colors.link
|
|
125
195
|
}
|
|
126
196
|
/>
|
|
127
197
|
)}
|
|
128
|
-
isDisabled={
|
|
198
|
+
isDisabled={retryButtonIsDisabled}
|
|
129
199
|
>
|
|
130
200
|
{t('retry')}
|
|
131
201
|
</EuiButton>
|
|
132
202
|
<EuiButton
|
|
133
|
-
onClick={(
|
|
134
|
-
e: React.MouseEvent<
|
|
135
|
-
HTMLButtonElement | HTMLElement,
|
|
136
|
-
MouseEvent
|
|
137
|
-
>,
|
|
138
|
-
) => {
|
|
139
|
-
e.preventDefault();
|
|
140
|
-
alert('TODO: Implement resume');
|
|
141
|
-
}}
|
|
142
|
-
iconType={() => (
|
|
143
|
-
<WfoPlayFill
|
|
144
|
-
color={
|
|
145
|
-
buttonsAreDisabled
|
|
146
|
-
? theme.colors.subduedText
|
|
147
|
-
: theme.colors.link
|
|
148
|
-
}
|
|
149
|
-
/>
|
|
150
|
-
)}
|
|
151
|
-
isDisabled={buttonsAreDisabled}
|
|
152
|
-
>
|
|
153
|
-
{t('resume')}
|
|
154
|
-
</EuiButton>
|
|
155
|
-
<EuiButton
|
|
156
|
-
onClick={(
|
|
157
|
-
e: React.MouseEvent<
|
|
158
|
-
HTMLButtonElement | HTMLElement,
|
|
159
|
-
MouseEvent
|
|
160
|
-
>,
|
|
161
|
-
) => {
|
|
162
|
-
e.preventDefault();
|
|
163
|
-
alert('TODO: Implement abort');
|
|
164
|
-
}}
|
|
203
|
+
onClick={handleActionButtonClick(abortAction)}
|
|
165
204
|
iconType={() => (
|
|
166
205
|
<WfoXCircleFill
|
|
167
206
|
color={
|
|
168
|
-
|
|
207
|
+
abortButtonIsDisabled
|
|
169
208
|
? theme.colors.subduedText
|
|
170
209
|
: theme.colors.danger
|
|
171
210
|
}
|
|
172
211
|
/>
|
|
173
212
|
)}
|
|
174
213
|
color="danger"
|
|
175
|
-
isDisabled={
|
|
214
|
+
isDisabled={abortButtonIsDisabled}
|
|
176
215
|
>
|
|
177
216
|
{t('abort')}
|
|
178
217
|
</EuiButton>
|
|
179
|
-
{processDetail &&
|
|
218
|
+
{processDetail && processIsTask && (
|
|
180
219
|
<EuiButton
|
|
181
|
-
onClick={(
|
|
182
|
-
e: React.MouseEvent<
|
|
183
|
-
HTMLButtonElement | HTMLElement,
|
|
184
|
-
MouseEvent
|
|
185
|
-
>,
|
|
186
|
-
) => {
|
|
187
|
-
e.preventDefault();
|
|
188
|
-
showConfirmDialog({
|
|
189
|
-
question: t('deleteQuestion', {
|
|
190
|
-
workflowName:
|
|
191
|
-
processDetail?.workflowName,
|
|
192
|
-
}),
|
|
193
|
-
confirmAction: () => {
|
|
194
|
-
processDetail.processId &&
|
|
195
|
-
mutate(processDetail.processId);
|
|
196
|
-
router.push(PATH_TASKS);
|
|
197
|
-
},
|
|
198
|
-
});
|
|
199
|
-
}}
|
|
220
|
+
onClick={handleActionButtonClick(deleteAction)}
|
|
200
221
|
iconType={() => (
|
|
201
222
|
<WfoXCircleFill
|
|
202
223
|
color={
|
|
203
|
-
|
|
224
|
+
deleteButtonIsDisabled
|
|
204
225
|
? theme.colors.subduedText
|
|
205
226
|
: theme.colors.danger
|
|
206
227
|
}
|
|
207
228
|
/>
|
|
208
229
|
)}
|
|
209
230
|
color="danger"
|
|
210
|
-
isDisabled={
|
|
211
|
-
buttonsAreDisabled ||
|
|
212
|
-
processDetail.lastStatus ===
|
|
213
|
-
ProcessStatus.RUNNING
|
|
214
|
-
}
|
|
231
|
+
isDisabled={deleteButtonIsDisabled}
|
|
215
232
|
>
|
|
216
233
|
{t('delete')}
|
|
217
234
|
</EuiButton>
|
|
@@ -42,7 +42,7 @@ export const WfoProcessDetailPage = ({
|
|
|
42
42
|
);
|
|
43
43
|
|
|
44
44
|
useEffect(() => {
|
|
45
|
-
const lastStatus = data?.processes
|
|
45
|
+
const lastStatus = data?.processes?.page[0]?.lastStatus;
|
|
46
46
|
const isInProgress = !(
|
|
47
47
|
lastStatus && ProcessDoneStatuses.includes(lastStatus)
|
|
48
48
|
);
|
|
@@ -56,7 +56,7 @@ export const WfoProcessDetailPage = ({
|
|
|
56
56
|
|
|
57
57
|
const productNames = getProductNamesFromProcess(process);
|
|
58
58
|
const pageTitle = process?.workflowName || '';
|
|
59
|
-
|
|
59
|
+
const isTask = process?.isTask ?? false;
|
|
60
60
|
const groupedSteps: GroupedStep[] = convertStepsToGroupedSteps(steps);
|
|
61
61
|
const timelineItems: TimelineItem[] =
|
|
62
62
|
mapGroupedStepsToTimelineItems(groupedSteps);
|
|
@@ -80,9 +80,11 @@ export const WfoProcessDetailPage = ({
|
|
|
80
80
|
steps={groupedSteps.flatMap(
|
|
81
81
|
(groupedStep) => groupedStep.steps,
|
|
82
82
|
)}
|
|
83
|
+
userInputForm={process.form}
|
|
83
84
|
startedAt={process.startedAt}
|
|
85
|
+
isTask={isTask}
|
|
84
86
|
/>
|
|
85
|
-
))}
|
|
87
|
+
)) || <h1>Invalid processId</h1>}
|
|
86
88
|
</WfoProcessDetail>
|
|
87
89
|
);
|
|
88
90
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import React, { useCallback, useEffect, useState } from 'react';
|
|
1
|
+
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
2
2
|
|
|
3
3
|
import { JSONSchema6 } from 'json-schema';
|
|
4
4
|
import { useTranslations } from 'next-intl';
|
|
5
5
|
import { useRouter } from 'next/router';
|
|
6
|
+
import { ParsedUrlQuery } from 'querystring';
|
|
6
7
|
|
|
7
8
|
import {
|
|
8
9
|
EuiFlexGroup,
|
|
@@ -12,16 +13,24 @@ import {
|
|
|
12
13
|
EuiText,
|
|
13
14
|
} from '@elastic/eui';
|
|
14
15
|
|
|
15
|
-
import { TimelineItem, WfoLoading } from '
|
|
16
|
-
import {
|
|
16
|
+
import { PATH_TASKS, TimelineItem, WfoLoading } from '@/components';
|
|
17
|
+
import { PATH_WORKFLOWS } from '@/components';
|
|
18
|
+
import { useAxiosApiClient } from '@/components/WfoForms/useAxiosApiClient';
|
|
19
|
+
import { WfoStepStatusIcon } from '@/components/WfoWorkflowSteps';
|
|
20
|
+
import { getStyles } from '@/components/WfoWorkflowSteps/styles';
|
|
21
|
+
import { GET_PROCESS_STEPS_GRAPHQL_QUERY } from '@/graphqlQueries';
|
|
22
|
+
import { useOrchestratorTheme, useQueryWithGraphql } from '@/hooks';
|
|
23
|
+
import {
|
|
24
|
+
EngineStatus,
|
|
25
|
+
ProcessDetail,
|
|
26
|
+
ProcessStatus,
|
|
27
|
+
StartProcessStep,
|
|
28
|
+
StepStatus,
|
|
29
|
+
} from '@/types';
|
|
30
|
+
import { FormNotCompleteResponse } from '@/types/forms';
|
|
31
|
+
|
|
17
32
|
import UserInputFormWizard from '../../components/WfoForms/UserInputFormWizard';
|
|
18
|
-
import {
|
|
19
|
-
import { WfoStepStatusIcon } from '../../components/WfoWorkflowSteps/WfoStepStatusIcon';
|
|
20
|
-
import { getStyles } from '../../components/WfoWorkflowSteps/styles';
|
|
21
|
-
import { EngineStatus, useOrchestratorTheme } from '../../hooks';
|
|
22
|
-
import { ProcessDetail, ProcessStatus, StepStatus } from '../../types';
|
|
23
|
-
import { FormNotCompleteResponse } from '../../types/forms';
|
|
24
|
-
import { WfoProcessDetail } from '../processes/WfoProcessDetail';
|
|
33
|
+
import { WfoProcessDetail } from './WfoProcessDetail';
|
|
25
34
|
|
|
26
35
|
type StartCreateWorkflowPayload = {
|
|
27
36
|
product: string;
|
|
@@ -34,9 +43,14 @@ type StartWorkflowPayload =
|
|
|
34
43
|
| StartCreateWorkflowPayload
|
|
35
44
|
| StartModifyWorkflowPayload;
|
|
36
45
|
|
|
37
|
-
interface
|
|
38
|
-
|
|
39
|
-
|
|
46
|
+
interface StartProcessPageQuery extends ParsedUrlQuery {
|
|
47
|
+
productId?: string;
|
|
48
|
+
subscriptionId?: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
interface WfoStartProcessPageProps {
|
|
52
|
+
processName: string;
|
|
53
|
+
isTask?: boolean;
|
|
40
54
|
}
|
|
41
55
|
|
|
42
56
|
export interface UserInputForm {
|
|
@@ -44,26 +58,68 @@ export interface UserInputForm {
|
|
|
44
58
|
hasNext?: boolean;
|
|
45
59
|
}
|
|
46
60
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}:
|
|
61
|
+
const getInitialProcessPayload = ({
|
|
62
|
+
productId,
|
|
63
|
+
subscriptionId,
|
|
64
|
+
}: StartProcessPageQuery): StartWorkflowPayload | undefined => {
|
|
65
|
+
if (productId) {
|
|
66
|
+
return {
|
|
67
|
+
product: productId,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
if (subscriptionId) {
|
|
71
|
+
return {
|
|
72
|
+
subscription_id: subscriptionId,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
return undefined;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export const WfoStartProcessPage = ({
|
|
79
|
+
processName,
|
|
80
|
+
isTask = false,
|
|
81
|
+
}: WfoStartProcessPageProps) => {
|
|
51
82
|
const apiClient = useAxiosApiClient();
|
|
52
83
|
const t = useTranslations('processes.steps');
|
|
53
84
|
const router = useRouter();
|
|
54
85
|
const { theme } = useOrchestratorTheme();
|
|
55
86
|
const [form, setForm] = useState<UserInputForm>({});
|
|
87
|
+
const { productId, subscriptionId } = router.query as StartProcessPageQuery;
|
|
88
|
+
|
|
89
|
+
const startProcessPayload = useMemo(
|
|
90
|
+
() => getInitialProcessPayload({ productId, subscriptionId }),
|
|
91
|
+
[productId, subscriptionId],
|
|
92
|
+
);
|
|
93
|
+
|
|
56
94
|
const { stepUserInput, hasNext } = form;
|
|
57
95
|
const { getStepHeaderStyle, stepListContentBoldTextStyle } =
|
|
58
96
|
getStyles(theme);
|
|
59
97
|
|
|
98
|
+
const { data, isFetched } = useQueryWithGraphql(
|
|
99
|
+
GET_PROCESS_STEPS_GRAPHQL_QUERY,
|
|
100
|
+
{
|
|
101
|
+
processName,
|
|
102
|
+
},
|
|
103
|
+
`processSteps={processName}`,
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
const timeLineItems: TimelineItem[] =
|
|
107
|
+
data?.workflows?.page[0]?.steps && isFetched
|
|
108
|
+
? data.workflows.page[0].steps.map(({ name }: StartProcessStep) => {
|
|
109
|
+
return {
|
|
110
|
+
processStepStatus: StepStatus.PENDING,
|
|
111
|
+
stepDetail: name,
|
|
112
|
+
};
|
|
113
|
+
})
|
|
114
|
+
: [];
|
|
115
|
+
|
|
60
116
|
const submit = useCallback(
|
|
61
117
|
(processInput: object[]) => {
|
|
62
|
-
const
|
|
118
|
+
const startProcessPromise = apiClient
|
|
63
119
|
.startProcess(
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
? [
|
|
120
|
+
processName,
|
|
121
|
+
startProcessPayload
|
|
122
|
+
? [startProcessPayload, ...processInput]
|
|
67
123
|
: [...processInput],
|
|
68
124
|
)
|
|
69
125
|
.then(
|
|
@@ -72,11 +128,15 @@ export const WfoStartWorkflowPage = ({
|
|
|
72
128
|
const process = result as { id: string };
|
|
73
129
|
// TODO: Use toast hook to display success message
|
|
74
130
|
if (process.id) {
|
|
131
|
+
// eslint-disable-next-line no-console
|
|
75
132
|
console.log(
|
|
76
133
|
'resolver successfullly!: ',
|
|
77
134
|
process.id,
|
|
78
135
|
);
|
|
79
|
-
|
|
136
|
+
const basePath = isTask
|
|
137
|
+
? PATH_TASKS
|
|
138
|
+
: PATH_WORKFLOWS;
|
|
139
|
+
router.push(`${basePath}/${process.id}`);
|
|
80
140
|
}
|
|
81
141
|
},
|
|
82
142
|
// Reject handler
|
|
@@ -88,20 +148,20 @@ export const WfoStartWorkflowPage = ({
|
|
|
88
148
|
// Catch a 503: Service unavailable error indicating the engine is down. This rethrows other errors
|
|
89
149
|
// if it's not 503 so we can catch the special 510 error in the catchErrorStatus call in the useEffect hook
|
|
90
150
|
return apiClient.catchErrorStatus<EngineStatus>(
|
|
91
|
-
|
|
151
|
+
startProcessPromise,
|
|
92
152
|
503,
|
|
93
153
|
(json) => {
|
|
94
154
|
// TODO: Use the toastMessage hook to display an engine down error message
|
|
95
|
-
console.
|
|
96
|
-
router.push(
|
|
155
|
+
console.error('engine down!!!', json);
|
|
156
|
+
router.push(PATH_WORKFLOWS);
|
|
97
157
|
},
|
|
98
158
|
);
|
|
99
159
|
},
|
|
100
|
-
[apiClient,
|
|
160
|
+
[apiClient, processName, startProcessPayload, isTask, router],
|
|
101
161
|
);
|
|
102
162
|
|
|
103
163
|
useEffect(() => {
|
|
104
|
-
if (
|
|
164
|
+
if (processName) {
|
|
105
165
|
const clientResultCallback = (json: FormNotCompleteResponse) => {
|
|
106
166
|
setForm({
|
|
107
167
|
stepUserInput: json.form,
|
|
@@ -115,40 +175,22 @@ export const WfoStartWorkflowPage = ({
|
|
|
115
175
|
clientResultCallback,
|
|
116
176
|
);
|
|
117
177
|
}
|
|
118
|
-
}, [submit,
|
|
178
|
+
}, [submit, processName, apiClient]);
|
|
119
179
|
|
|
120
180
|
const processDetail: Partial<ProcessDetail> = {
|
|
121
181
|
lastStatus: ProcessStatus.CREATE,
|
|
122
182
|
lastStep: StepStatus.FORM,
|
|
123
|
-
workflowName:
|
|
183
|
+
workflowName: processName,
|
|
124
184
|
createdBy: '-',
|
|
125
185
|
};
|
|
126
186
|
|
|
127
|
-
const fakeTimeLineItems: TimelineItem[] = [
|
|
128
|
-
{
|
|
129
|
-
processStepStatus: StepStatus.FORM,
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
processStepStatus: StepStatus.PENDING,
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
processStepStatus: StepStatus.PENDING,
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
processStepStatus: StepStatus.PENDING,
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
processStepStatus: StepStatus.PENDING,
|
|
142
|
-
},
|
|
143
|
-
];
|
|
144
|
-
|
|
145
187
|
return (
|
|
146
188
|
<WfoProcessDetail
|
|
147
|
-
pageTitle={
|
|
189
|
+
pageTitle={processName}
|
|
148
190
|
productNames={''}
|
|
149
191
|
buttonsAreDisabled={true}
|
|
150
192
|
processDetail={processDetail}
|
|
151
|
-
timelineItems={
|
|
193
|
+
timelineItems={timeLineItems}
|
|
152
194
|
>
|
|
153
195
|
<EuiPanel css={{ marginTop: theme.base * 3 }}>
|
|
154
196
|
<EuiFlexGroup css={getStepHeaderStyle(false)}>
|
|
@@ -158,7 +200,13 @@ export const WfoStartWorkflowPage = ({
|
|
|
158
200
|
<EuiText css={stepListContentBoldTextStyle}>
|
|
159
201
|
{t('userInput')}
|
|
160
202
|
</EuiText>
|
|
161
|
-
<EuiText>
|
|
203
|
+
<EuiText>
|
|
204
|
+
{t(
|
|
205
|
+
isTask
|
|
206
|
+
? 'submitTaskFormLabel'
|
|
207
|
+
: 'submitWorkflowFormLabel',
|
|
208
|
+
)}
|
|
209
|
+
</EuiText>
|
|
162
210
|
</EuiFlexItem>
|
|
163
211
|
</EuiFlexGroup>
|
|
164
212
|
<EuiHorizontalRule />
|
|
@@ -166,8 +214,11 @@ export const WfoStartWorkflowPage = ({
|
|
|
166
214
|
<UserInputFormWizard
|
|
167
215
|
stepUserInput={stepUserInput}
|
|
168
216
|
validSubmit={submit}
|
|
169
|
-
cancel={() =>
|
|
217
|
+
cancel={() =>
|
|
218
|
+
router.push(isTask ? PATH_TASKS : PATH_WORKFLOWS)
|
|
219
|
+
}
|
|
170
220
|
hasNext={hasNext}
|
|
221
|
+
isTask={isTask}
|
|
171
222
|
/>
|
|
172
223
|
)) || <WfoLoading />}
|
|
173
224
|
</EuiPanel>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { WfoSettings } from '@/components';
|
|
4
|
+
import { useEngineStatusMutation, useEngineStatusQuery } from '@/hooks';
|
|
5
|
+
import { EngineStatus } from '@/types';
|
|
6
|
+
|
|
7
|
+
export const WfoSettingsPage = () => {
|
|
8
|
+
const { data: engineStatus } = useEngineStatusQuery();
|
|
9
|
+
const { mutate, data: newEngineStatus } = useEngineStatusMutation();
|
|
10
|
+
|
|
11
|
+
const isRunning =
|
|
12
|
+
newEngineStatus?.global_status === EngineStatus.RUNNING ||
|
|
13
|
+
engineStatus?.global_status === EngineStatus.RUNNING;
|
|
14
|
+
const currentEngineStatus =
|
|
15
|
+
newEngineStatus?.global_status || engineStatus?.global_status;
|
|
16
|
+
const currentRunningProcesses =
|
|
17
|
+
newEngineStatus?.running_processes || engineStatus?.running_processes;
|
|
18
|
+
|
|
19
|
+
const changeEngineStatus = () => {
|
|
20
|
+
mutate({ global_lock: isRunning });
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<WfoSettings
|
|
25
|
+
currentEngineStatus={currentEngineStatus}
|
|
26
|
+
currentRunningProcesses={currentRunningProcesses}
|
|
27
|
+
changeEngineStatus={changeEngineStatus}
|
|
28
|
+
/>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './WfoSettingsPage';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
|
1
|
+
import React, { useContext, useEffect, useState } from 'react';
|
|
2
2
|
|
|
3
3
|
import { useTranslations } from 'next-intl';
|
|
4
|
+
import Link from 'next/link';
|
|
4
5
|
|
|
5
6
|
import { EuiButton, EuiHorizontalRule, EuiSpacer } from '@elastic/eui';
|
|
6
7
|
|
|
@@ -9,25 +10,32 @@ import {
|
|
|
9
10
|
FilterQuery,
|
|
10
11
|
StoredTableConfig,
|
|
11
12
|
TASK_LIST_TABLE_LOCAL_STORAGE_KEY,
|
|
13
|
+
WfoStartTaskButtonComboBox,
|
|
12
14
|
WfoTableColumns,
|
|
13
|
-
} from '
|
|
14
|
-
import {
|
|
15
|
-
import { WfoPageHeader } from '
|
|
15
|
+
} from '@/components';
|
|
16
|
+
import { PATH_TASKS } from '@/components';
|
|
17
|
+
import { WfoPageHeader } from '@/components/WfoPageHeader/WfoPageHeader';
|
|
16
18
|
import {
|
|
17
19
|
ProcessListItem,
|
|
18
20
|
WfoProcessList,
|
|
19
|
-
} from '
|
|
21
|
+
} from '@/components/WfoProcessList/WfoProcessList';
|
|
22
|
+
import { ConfirmationDialogContext } from '@/contexts';
|
|
20
23
|
import {
|
|
24
|
+
useCheckEngineStatus,
|
|
21
25
|
useDataDisplayParams,
|
|
26
|
+
useMutateProcess,
|
|
22
27
|
useOrchestratorTheme,
|
|
23
28
|
useStoredTableConfig,
|
|
24
|
-
} from '
|
|
25
|
-
import { WfoRefresh } from '
|
|
26
|
-
import { SortOrder } from '
|
|
29
|
+
} from '@/hooks';
|
|
30
|
+
import { WfoRefresh } from '@/icons';
|
|
31
|
+
import { SortOrder } from '@/types';
|
|
27
32
|
|
|
28
33
|
export const WfoTaskListPage = () => {
|
|
29
34
|
const { theme } = useOrchestratorTheme();
|
|
30
35
|
const t = useTranslations('tasks.page');
|
|
36
|
+
const { showConfirmDialog } = useContext(ConfirmationDialogContext);
|
|
37
|
+
const { retryAllProcesses } = useMutateProcess();
|
|
38
|
+
const { isEngineRunningNow } = useCheckEngineStatus();
|
|
31
39
|
|
|
32
40
|
const [tableDefaults, setTableDefaults] =
|
|
33
41
|
useState<StoredTableConfig<ProcessListItem>>();
|
|
@@ -73,7 +81,13 @@ export const WfoTaskListPage = () => {
|
|
|
73
81
|
const handleOverrideTableColumns: (
|
|
74
82
|
defaultTableColumns: WfoTableColumns<ProcessListItem>,
|
|
75
83
|
) => WfoTableColumns<ProcessListItem> = (defaultTableColumns) => ({
|
|
76
|
-
workflowName:
|
|
84
|
+
workflowName: {
|
|
85
|
+
field: 'workflowName',
|
|
86
|
+
name: t('taskName'),
|
|
87
|
+
render: (value, { processId }) => (
|
|
88
|
+
<Link href={`${PATH_TASKS}/${processId}`}>{value}</Link>
|
|
89
|
+
),
|
|
90
|
+
},
|
|
77
91
|
lastStep: defaultTableColumns.lastStep,
|
|
78
92
|
lastStatus: defaultTableColumns.lastStatus,
|
|
79
93
|
workflowTarget: defaultTableColumns.workflowTarget,
|
|
@@ -89,12 +103,24 @@ export const WfoTaskListPage = () => {
|
|
|
89
103
|
lastModifiedAt: defaultTableColumns.lastModifiedAt,
|
|
90
104
|
});
|
|
91
105
|
|
|
106
|
+
const handleRerunAllButtonClick = async () => {
|
|
107
|
+
if (await isEngineRunningNow()) {
|
|
108
|
+
showConfirmDialog({
|
|
109
|
+
question: t('rerunAllQuestion'),
|
|
110
|
+
confirmAction: () => {
|
|
111
|
+
retryAllProcesses.mutate();
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
|
|
92
117
|
return (
|
|
93
118
|
<>
|
|
94
119
|
<EuiSpacer />
|
|
95
120
|
|
|
96
121
|
<WfoPageHeader pageTitle="Tasks">
|
|
97
122
|
<EuiButton
|
|
123
|
+
onClick={handleRerunAllButtonClick}
|
|
98
124
|
iconType={() => (
|
|
99
125
|
<WfoRefresh color={theme.colors.primaryText} />
|
|
100
126
|
)}
|