@orchestrator-ui/orchestrator-ui-components 0.2.7 → 0.3.1

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.
Files changed (210) hide show
  1. package/.turbo/turbo-build.log +10 -9
  2. package/.turbo/turbo-lint.log +2 -5
  3. package/.turbo/turbo-test.log +15 -10
  4. package/CHANGELOG.md +17 -0
  5. package/dist/index.d.ts +1464 -337
  6. package/dist/index.js +37266 -8348
  7. package/package.json +38 -31
  8. package/src/api/axios.ts +2 -8
  9. package/src/api/index.ts +59 -4
  10. package/src/components/WfoBadges/WfoBadge/WfoBadge.tsx +4 -1
  11. package/src/components/WfoBadges/index.ts +1 -0
  12. package/src/components/WfoDiff/WfoDiff.tsx +119 -0
  13. package/src/components/WfoDiff/index.ts +1 -0
  14. package/src/components/WfoDiff/unidiff.d.ts +1 -0
  15. package/src/components/WfoError/WfoError.stories.tsx +26 -0
  16. package/src/components/WfoError/WfoError.tsx +19 -0
  17. package/src/components/WfoError/index.ts +1 -0
  18. package/src/components/WfoFilterTabs/WfoFilterTabs.tsx +4 -2
  19. package/src/components/WfoForms/AutoFieldLoader.tsx +5 -1
  20. package/src/components/WfoForms/CreateForm.tsx +1 -0
  21. package/src/components/WfoForms/UserInputForm.tsx +88 -45
  22. package/src/components/WfoForms/UserInputFormWizard.tsx +11 -4
  23. package/src/components/WfoForms/formFields/AcceptField.tsx +8 -5
  24. package/src/components/WfoForms/formFields/BoolField.tsx +1 -1
  25. package/src/components/WfoForms/formFields/ImsNodeIdField.tsx +2 -2
  26. package/src/components/WfoForms/formFields/ImsPortIdField.tsx +238 -0
  27. package/src/components/WfoForms/formFields/ImsPortIdFieldStyling.ts +17 -0
  28. package/src/components/WfoForms/formFields/ListAddField.tsx +1 -1
  29. package/src/components/WfoForms/formFields/ListDelField.tsx +1 -1
  30. package/src/components/WfoForms/formFields/OptGroupField.tsx +1 -1
  31. package/src/components/WfoForms/formFields/SplitPrefix.tsx +2 -1
  32. package/src/components/WfoForms/formFields/SubscriptionField.tsx +10 -4
  33. package/src/components/WfoForms/formFields/SummaryField.tsx +103 -0
  34. package/src/components/WfoForms/formFields/SummaryFieldStyling.ts +46 -0
  35. package/src/components/WfoForms/formFields/VlanField.tsx +10 -10
  36. package/src/components/WfoForms/formFields/index.ts +2 -0
  37. package/src/components/WfoForms/formFields/surf/types.ts +26 -0
  38. package/src/components/WfoForms/formFields/utils.spec.ts +89 -9
  39. package/src/components/WfoJsonCodeBlock/index.ts +1 -0
  40. package/src/components/WfoKeyValueTable/WfoValueCell.tsx +2 -2
  41. package/src/components/WfoOptionalLink/WfoOptionalLink.tsx +20 -0
  42. package/src/components/WfoOptionalLink/index.ts +1 -0
  43. package/src/components/WfoPageTemplate/WfoBreadcrumbs/WfoBreadcrumbs.tsx +5 -2
  44. package/src/components/WfoPageTemplate/WfoPageHeader/WfoAppLogo.tsx +28 -0
  45. package/src/components/WfoPageTemplate/WfoPageHeader/WfoPageHeader.tsx +23 -19
  46. package/src/components/WfoPageTemplate/WfoPageHeader/styles.ts +29 -0
  47. package/src/components/WfoPageTemplate/WfoPageHeader/utils/toHexColorWithOpacity.spec.ts +12 -0
  48. package/src/components/WfoPageTemplate/WfoPageHeader/utils/toHexColorWithOpacity.ts +5 -0
  49. package/src/components/WfoPageTemplate/WfoSidebar/WfoSidebar.tsx +14 -14
  50. package/src/components/WfoPageTemplate/WfoSidebar/WfoStartCreateWorkflowButtonComboBox.tsx +15 -12
  51. package/src/components/WfoPageTemplate/paths.ts +3 -2
  52. package/src/components/{WfoProcessesList/WfoProcessList.tsx → WfoProcessList/WfoProcessesList.tsx} +46 -38
  53. package/src/components/WfoProcessList/index.ts +1 -0
  54. package/src/components/{WfoProcessesList → WfoProcessList}/processListObjectMappers.ts +5 -3
  55. package/src/components/WfoSearchBar/WfoSearchField.tsx +27 -37
  56. package/src/components/{WfoSettingsPage → WfoSettings}/WfoEngineStatusButton.tsx +7 -4
  57. package/src/components/{WfoSettingsPage → WfoSettings}/WfoFlushSettings.tsx +29 -18
  58. package/src/components/WfoSettings/WfoModifySettings.tsx +38 -0
  59. package/src/components/WfoSettings/WfoSettings.tsx +40 -0
  60. package/src/components/{WfoSettingsPage → WfoSettings}/WfoStatus.tsx +21 -14
  61. package/src/components/WfoSettingsModal/WfoSubmitModal.tsx +61 -0
  62. package/src/components/WfoSettingsModal/index.tsx +1 -0
  63. package/src/components/WfoStartTaskButtonComboBox/WfoStartTaskButtonComboBox.tsx +14 -11
  64. package/src/components/WfoSubscription/WfoProcessesTimeline.tsx +11 -18
  65. package/src/components/WfoSubscription/WfoRelatedSubscriptions.tsx +4 -1
  66. package/src/components/WfoSubscription/WfoSubscription.tsx +38 -66
  67. package/src/components/WfoSubscription/WfoSubscriptionActions.tsx +41 -33
  68. package/src/components/WfoSubscription/WfoSubscriptionDetailTree.tsx +34 -28
  69. package/src/components/WfoSubscription/WfoSubscriptionProductBlock.tsx +96 -91
  70. package/src/components/WfoSubscription/WfoTargetTypeIcon.tsx +26 -0
  71. package/src/components/WfoSubscription/subscriptionDetailTabs.tsx +29 -0
  72. package/src/components/WfoSubscription/utils/utils.spec.ts +24 -0
  73. package/src/components/WfoSubscription/utils/utils.ts +21 -5
  74. package/src/components/WfoSubscriptionsList/WfoSubscriptionsList.tsx +42 -48
  75. package/src/components/WfoSubscriptionsList/index.ts +1 -1
  76. package/src/components/WfoSubscriptionsList/{mapGrapghQlSubscriptionsResultToSubscriptionListItems.ts → mapGraphQlSubscriptionsResultToSubscriptionListItems.ts} +8 -1
  77. package/src/components/WfoSubscriptionsList/subscriptionListTabs.ts +8 -30
  78. package/src/components/WfoSummary/WfoSummaryCardHeader/WfoSummaryCardHeader.tsx +55 -0
  79. package/src/components/WfoSummary/WfoSummaryCardHeader/index.ts +1 -0
  80. package/src/components/WfoSummary/WfoSummaryCardHeader/styles.ts +26 -0
  81. package/src/components/WfoSummary/WfoSummaryCardList/WfoSummaryCardList.tsx +86 -0
  82. package/src/components/WfoSummary/WfoSummaryCardList/WfoSummaryCardListItem.tsx +59 -0
  83. package/src/components/WfoSummary/WfoSummaryCardList/index.ts +2 -0
  84. package/src/components/WfoSummary/WfoSummaryCardList/styles.ts +52 -0
  85. package/src/components/WfoSummary/WfoSummaryCards.tsx +111 -0
  86. package/src/components/WfoSummary/getNumberOfColumns.ts +14 -0
  87. package/src/components/WfoSummary/index.ts +4 -0
  88. package/src/components/WfoSummary/styles.ts +13 -0
  89. package/src/components/WfoTable/WfoBasicTable/WfoBasicTable.tsx +18 -16
  90. package/src/components/WfoTable/WfoBasicTable/WfoTableHeaderCell.tsx +2 -2
  91. package/src/components/WfoTable/WfoBasicTable/index.ts +1 -0
  92. package/src/components/WfoTable/WfoBasicTable/styles.ts +28 -2
  93. package/src/components/WfoTable/WfoFirstPartUUID/WfoFirstPartUUID.tsx +12 -3
  94. package/src/components/WfoTable/WfoFirstPartUUID/styles.ts +12 -0
  95. package/src/components/WfoTable/WfoTableWithFilter/WfoTableWithFilter.tsx +32 -23
  96. package/src/components/WfoTable/WfoTableWithFilter/updateQueryString.spec.ts +95 -0
  97. package/src/components/WfoTable/WfoTableWithFilter/updateQueryString.ts +60 -0
  98. package/src/components/WfoTable/index.ts +2 -0
  99. package/src/components/WfoTable/utils/columns.ts +21 -15
  100. package/src/components/WfoTable/utils/constants.ts +4 -2
  101. package/src/components/WfoTable/utils/mapSortableAndFilterableValuesToTableColumnConfig.ts +5 -3
  102. package/src/components/WfoTable/utils/tableUtils.ts +3 -3
  103. package/src/components/WfoTextAnchor/WfoTextAnchor.stories.tsx +18 -0
  104. package/src/components/WfoTextAnchor/WfoTextAnchor.tsx +22 -0
  105. package/src/components/WfoTextAnchor/index.ts +1 -0
  106. package/src/components/WfoTextAnchor/styles.ts +17 -0
  107. package/src/components/WfoTimeline/styles.ts +10 -4
  108. package/src/components/WfoTree/WfoTreeNode.tsx +1 -4
  109. package/src/components/WfoWorkflowSteps/WfoStep/WfoStep.tsx +42 -26
  110. package/src/components/WfoWorkflowSteps/WfoStep/WfoStepForm.tsx +48 -0
  111. package/src/components/WfoWorkflowSteps/WfoStepList/WfoStepList.tsx +10 -10
  112. package/src/components/WfoWorkflowSteps/WfoWorkflowStepList/WfoStepListHeader.tsx +22 -23
  113. package/src/components/WfoWorkflowSteps/WfoWorkflowStepList/WfoWorkflowStepList.tsx +97 -17
  114. package/src/components/WfoWorkflowSteps/index.ts +1 -0
  115. package/src/components/WfoWorkflowSteps/stepListUtils.ts +1 -28
  116. package/src/components/confirmationDialog/WfoConfirmationDialog.tsx +3 -3
  117. package/src/components/index.ts +9 -2
  118. package/src/contexts/ApiClientContext.tsx +5 -1
  119. package/src/contexts/ConfirmationDialogProvider.tsx +2 -2
  120. package/src/contexts/OrchestratorConfigContext.tsx +0 -3
  121. package/src/contexts/ToastContext.tsx +1 -1
  122. package/src/contexts/TreeContext.tsx +6 -1
  123. package/src/graphqlQueries/customersQuery.ts +2 -1
  124. package/src/graphqlQueries/index.ts +1 -0
  125. package/src/graphqlQueries/processDetailQuery.ts +8 -0
  126. package/src/graphqlQueries/processListQuery.ts +48 -7
  127. package/src/graphqlQueries/processStepsQuery.ts +22 -0
  128. package/src/graphqlQueries/productBlocksQuery.ts +11 -5
  129. package/src/graphqlQueries/productsQuery.ts +42 -7
  130. package/src/graphqlQueries/relatedSubscriptionsQuery.ts +2 -2
  131. package/src/graphqlQueries/resourceTypesQuery.ts +10 -4
  132. package/src/graphqlQueries/subscriptionDetailQuery.ts +5 -1
  133. package/src/graphqlQueries/subscriptionsDropdownOptionsQuery.ts +2 -1
  134. package/src/graphqlQueries/subscriptionsListQuery.ts +46 -7
  135. package/src/graphqlQueries/workflows/workflowsQuery.ts +10 -4
  136. package/src/graphqlQueries/workflows/workflowsQueryForDropdownList.ts +3 -6
  137. package/src/hooks/DataFetchHooks.ts +20 -61
  138. package/src/hooks/index.ts +3 -0
  139. package/src/hooks/surf/useGetSubscriptionDropdownOptions.ts +1 -0
  140. package/src/hooks/surf/useIsTaggedPort.ts +1 -2
  141. package/src/hooks/useCheckEngineStatus.ts +30 -0
  142. package/src/hooks/useDataDisplayParams.ts +3 -3
  143. package/src/hooks/useEngineStatusQuery.ts +9 -7
  144. package/src/hooks/useMutateProcess.ts +96 -0
  145. package/src/hooks/useOrchestratorConfig.ts +0 -3
  146. package/src/hooks/useQueryWithGraphql.ts +25 -13
  147. package/src/hooks/useSessionWithToken.ts +3 -5
  148. package/src/hooks/useSubscriptionActions.ts +8 -2
  149. package/src/icons/WfoBell.tsx +34 -0
  150. package/src/icons/WfoContactEnvelopeFill.tsx +29 -0
  151. package/src/icons/WfoPencil.tsx +21 -0
  152. package/src/icons/WfoSideMenu.stories.tsx +13 -0
  153. package/src/icons/WfoSideMenu.tsx +39 -0
  154. package/src/icons/WfoStatistic.tsx +3 -3
  155. package/src/icons/WfoViewList.tsx +24 -0
  156. package/src/icons/index.ts +6 -0
  157. package/src/messages/{en-US.json → en-GB.json} +117 -39
  158. package/src/messages/getTranslationMessages.spec.ts +25 -40
  159. package/src/messages/index.ts +1 -1
  160. package/src/messages/nl-NL.json +126 -49
  161. package/src/messages/useGetTranslationMessages.ts +51 -0
  162. package/src/pages/index.ts +2 -1
  163. package/src/pages/metadata/WfoProductBlocksPage.tsx +17 -19
  164. package/src/pages/metadata/WfoProductsPage.tsx +30 -34
  165. package/src/pages/metadata/WfoResourceTypesPage.tsx +16 -18
  166. package/src/pages/metadata/WfoWorkflowsPage.tsx +18 -19
  167. package/src/pages/processes/WfoProcessDetail.tsx +101 -80
  168. package/src/pages/processes/WfoProcessDetailPage.tsx +35 -17
  169. package/src/pages/processes/WfoStartProcessPage.tsx +251 -0
  170. package/src/pages/processes/index.ts +1 -3
  171. package/src/pages/settings/WfoSettingsPage.tsx +30 -0
  172. package/src/pages/settings/index.ts +1 -0
  173. package/src/pages/startPage/WfoStartPage.tsx +239 -0
  174. package/src/pages/startPage/index.ts +1 -0
  175. package/src/pages/subscriptions/WfoSubscriptionsListPage.tsx +22 -26
  176. package/src/pages/tasks/WfoTasksListPage.tsx +169 -0
  177. package/src/pages/tasks/getTasksListTabTypeFromString.ts +19 -0
  178. package/src/pages/tasks/index.ts +3 -1
  179. package/src/pages/tasks/tabConfig.ts +51 -0
  180. package/src/pages/{processes/WfoProcessListPage.tsx → workflows/WfoWorkflowsListPage.tsx} +30 -32
  181. package/src/pages/workflows/getWorkflowsListTabTypeFromString.ts +19 -0
  182. package/src/pages/workflows/index.ts +1 -0
  183. package/src/pages/{processes → workflows}/tabConfig.ts +9 -9
  184. package/src/theme/defaultOrchestratorTheme.ts +8 -0
  185. package/src/types/types.ts +38 -53
  186. package/src/utils/date.ts +39 -0
  187. package/src/utils/getDefaultTableConfig.ts +19 -9
  188. package/tsconfig.json +4 -4
  189. package/src/components/WfoSettingsPage/WfoModifySettings.tsx +0 -33
  190. package/src/components/WfoSettingsPage/WfoSettings.tsx +0 -40
  191. package/src/components/WfoStartPage/WfoFrequentlyUsed.stories.tsx +0 -16
  192. package/src/components/WfoStartPage/WfoFrequentlyUsed.tsx +0 -21
  193. package/src/components/WfoStartPage/WfoListItemStartPage.stories.tsx +0 -40
  194. package/src/components/WfoStartPage/WfoListItemStartPage.tsx +0 -95
  195. package/src/components/WfoStartPage/WfoListStartPage.stories.tsx +0 -98
  196. package/src/components/WfoStartPage/WfoListStartPage.tsx +0 -45
  197. package/src/components/WfoStartPage/WfoMultiListSection.stories.tsx +0 -90
  198. package/src/components/WfoStartPage/WfoMultiListSection.tsx +0 -25
  199. package/src/components/WfoStartPage/WfoNewProcessPanel.stories.tsx +0 -13
  200. package/src/components/WfoStartPage/WfoNewProcessPanel.tsx +0 -45
  201. package/src/components/WfoStartPage/WfoStatCards.stories.tsx +0 -13
  202. package/src/components/WfoStartPage/WfoStatCards.tsx +0 -75
  203. package/src/components/WfoStartPage/index.ts +0 -6
  204. package/src/hooks/ProcessesHooks/useDeleteProcess.ts +0 -37
  205. package/src/messages/getTranslationMessages.ts +0 -26
  206. package/src/pages/processes/getProcessListTabTypeFromString.ts +0 -19
  207. package/src/pages/tasks/WfoTaskListPage.tsx +0 -120
  208. package/src/pages/workflow/WfoStartWorkflowPage.tsx +0 -177
  209. package/src/pages/workflow/index.ts +0 -1
  210. /package/src/components/{WfoSettingsPage → WfoSettings}/index.ts +0 -0
@@ -0,0 +1,251 @@
1
+ import React, { useCallback, useEffect, useMemo, useState } from 'react';
2
+
3
+ import { AxiosError } from 'axios';
4
+ import { JSONSchema6 } from 'json-schema';
5
+ import { useTranslations } from 'next-intl';
6
+ import { useRouter } from 'next/router';
7
+
8
+ import {
9
+ EuiFlexGroup,
10
+ EuiFlexItem,
11
+ EuiHorizontalRule,
12
+ EuiPanel,
13
+ EuiText,
14
+ } from '@elastic/eui';
15
+
16
+ import { PATH_TASKS, TimelineItem, WfoError, 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
+
32
+ import UserInputFormWizard from '../../components/WfoForms/UserInputFormWizard';
33
+ import { WfoProcessDetail } from './WfoProcessDetail';
34
+
35
+ type StartCreateWorkflowPayload = {
36
+ product: string;
37
+ };
38
+ type StartModifyWorkflowPayload = {
39
+ subscription_id: string;
40
+ };
41
+
42
+ type StartWorkflowPayload =
43
+ | StartCreateWorkflowPayload
44
+ | StartModifyWorkflowPayload;
45
+
46
+ interface StartProcessPageQuery {
47
+ productId?: string;
48
+ subscriptionId?: string;
49
+ }
50
+
51
+ interface WfoStartProcessPageProps {
52
+ processName: string;
53
+ isTask?: boolean;
54
+ }
55
+
56
+ export interface UserInputForm {
57
+ stepUserInput?: JSONSchema6;
58
+ hasNext?: boolean;
59
+ }
60
+
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) => {
82
+ const apiClient = useAxiosApiClient();
83
+ const t = useTranslations('processes.steps');
84
+ const router = useRouter();
85
+ const [hasError, setHasError] = useState<boolean>(false);
86
+ const { theme } = useOrchestratorTheme();
87
+ const [form, setForm] = useState<UserInputForm>({});
88
+ const { productId, subscriptionId } = router.query as StartProcessPageQuery;
89
+
90
+ const startProcessPayload = useMemo(
91
+ () => getInitialProcessPayload({ productId, subscriptionId }),
92
+ [productId, subscriptionId],
93
+ );
94
+
95
+ const { stepUserInput, hasNext } = form;
96
+
97
+ const { getStepHeaderStyle, stepListContentBoldTextStyle } =
98
+ getStyles(theme);
99
+
100
+ const { data, isLoading, isError } = useQueryWithGraphql(
101
+ GET_PROCESS_STEPS_GRAPHQL_QUERY,
102
+ {
103
+ processName,
104
+ },
105
+ `processSteps={processName}`,
106
+ );
107
+
108
+ if (isError) {
109
+ if (!hasError) {
110
+ setHasError(true);
111
+ }
112
+ }
113
+
114
+ const timeLineItems: TimelineItem[] =
115
+ data?.workflows?.page[0]?.steps && !isLoading
116
+ ? data.workflows.page[0].steps.map(({ name }: StartProcessStep) => {
117
+ return {
118
+ processStepStatus: StepStatus.PENDING,
119
+ stepDetail: name,
120
+ };
121
+ })
122
+ : [];
123
+
124
+ const submit = useCallback(
125
+ (processInput: object[]) => {
126
+ const startProcessPromise = apiClient
127
+ .startProcess(
128
+ processName,
129
+ startProcessPayload
130
+ ? [startProcessPayload, ...processInput]
131
+ : [...processInput],
132
+ )
133
+ .then(
134
+ // Resolve handler
135
+ (result) => {
136
+ const process = result as { id: string };
137
+ // TODO: Use toast hook to display success message
138
+ if (process.id) {
139
+ // eslint-disable-next-line no-console
140
+ console.log(
141
+ 'resolver successfullly!: ',
142
+ process.id,
143
+ );
144
+ const basePath = isTask
145
+ ? PATH_TASKS
146
+ : PATH_WORKFLOWS;
147
+ router.push(`${basePath}/${process.id}`);
148
+ }
149
+ },
150
+ // Reject handler
151
+ (e) => {
152
+ throw e;
153
+ },
154
+ )
155
+ .catch((error: AxiosError) => {
156
+ if (error?.response?.status !== 510) {
157
+ if (error?.response?.status === 400) {
158
+ // Rethrow the error so userInputForm can catch it and display validation errors
159
+ throw error;
160
+ }
161
+
162
+ console.error(error);
163
+ setHasError(true);
164
+ } else {
165
+ throw error;
166
+ }
167
+ });
168
+
169
+ // Catch a 503: Service unavailable error indicating the engine is down. This rethrows other errors
170
+ // if it's not 503 so we can catch the special 510 error in the catchErrorStatus call in the useEffect hook
171
+ return apiClient.catchErrorStatus<EngineStatus>(
172
+ startProcessPromise,
173
+ 503,
174
+ (json) => {
175
+ // TODO: Use the toastMessage hook to display an engine down error message
176
+ console.error('engine down!!!', json);
177
+ router.push(PATH_WORKFLOWS);
178
+ },
179
+ );
180
+ },
181
+ [apiClient, processName, startProcessPayload, isTask, router],
182
+ );
183
+
184
+ useEffect(() => {
185
+ if (processName) {
186
+ const clientResultCallback = (json: FormNotCompleteResponse) => {
187
+ setForm({
188
+ stepUserInput: json.form,
189
+ hasNext: json.hasNext ?? false,
190
+ });
191
+ };
192
+
193
+ apiClient.catchErrorStatus<FormNotCompleteResponse>(
194
+ submit([]),
195
+ 510,
196
+ clientResultCallback,
197
+ );
198
+ }
199
+ }, [submit, processName, apiClient]);
200
+
201
+ const processDetail: Partial<ProcessDetail> = {
202
+ lastStatus: ProcessStatus.CREATE,
203
+ lastStep: StepStatus.FORM,
204
+ workflowName: processName,
205
+ createdBy: '-',
206
+ };
207
+
208
+ return (
209
+ <WfoProcessDetail
210
+ pageTitle={processName}
211
+ productNames={''}
212
+ buttonsAreDisabled={true}
213
+ processDetail={processDetail}
214
+ timelineItems={timeLineItems}
215
+ >
216
+ <EuiPanel css={{ marginTop: theme.base * 3 }}>
217
+ <EuiFlexGroup css={getStepHeaderStyle(false)}>
218
+ <WfoStepStatusIcon stepStatus={StepStatus.FORM} />
219
+
220
+ <EuiFlexItem grow={0}>
221
+ <EuiText css={stepListContentBoldTextStyle}>
222
+ {t('userInput')}
223
+ </EuiText>
224
+ <EuiText>
225
+ {t(
226
+ isTask
227
+ ? 'submitTaskFormLabel'
228
+ : 'submitWorkflowFormLabel',
229
+ )}
230
+ </EuiText>
231
+ </EuiFlexItem>
232
+ </EuiFlexGroup>
233
+ <EuiHorizontalRule />
234
+ {(hasError && <WfoError />) ||
235
+ (stepUserInput && (
236
+ <UserInputFormWizard
237
+ stepUserInput={stepUserInput}
238
+ validSubmit={submit}
239
+ cancel={() =>
240
+ router.push(
241
+ isTask ? PATH_TASKS : PATH_WORKFLOWS,
242
+ )
243
+ }
244
+ hasNext={hasNext}
245
+ isTask={isTask}
246
+ />
247
+ )) || <WfoLoading />}
248
+ </EuiPanel>
249
+ </WfoProcessDetail>
250
+ );
251
+ };
@@ -1,5 +1,3 @@
1
- export * from './getProcessListTabTypeFromString';
2
- export * from './tabConfig';
3
- export * from './WfoProcessListPage';
4
1
  export * from './WfoProcessListSubscriptionsCell';
5
2
  export * from './WfoProcessDetailPage';
3
+ export * from './WfoStartProcessPage';
@@ -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';
@@ -0,0 +1,239 @@
1
+ import React from 'react';
2
+
3
+ import { useTranslations } from 'next-intl';
4
+
5
+ import { EuiFlexItem } from '@elastic/eui';
6
+
7
+ import { PATH_SUBSCRIPTIONS, PATH_TASKS, PATH_WORKFLOWS } from '@/components';
8
+ import {
9
+ SummaryCard,
10
+ SummaryCardStatus,
11
+ WfoSummaryCards,
12
+ } from '@/components/WfoSummary/WfoSummaryCards';
13
+ import {
14
+ getProductsSummaryQuery,
15
+ getSubscriptionsListSummaryGraphQlQuery,
16
+ } from '@/graphqlQueries';
17
+ import { getProcessListSummaryGraphQlQuery } from '@/graphqlQueries/processListQuery';
18
+ import { useQueryWithGraphql } from '@/hooks';
19
+ import {
20
+ GraphqlQueryVariables,
21
+ Process,
22
+ ProductDefinition,
23
+ SortOrder,
24
+ Subscription,
25
+ } from '@/types';
26
+ import { getFirstUuidPart } from '@/utils';
27
+
28
+ export const WfoStartPage = () => {
29
+ const t = useTranslations('startPage');
30
+
31
+ const {
32
+ data: subscriptionsSummaryResult,
33
+ isLoading: subscriptionsSummaryIsFetching,
34
+ } = useQueryWithGraphql(
35
+ getSubscriptionsListSummaryGraphQlQuery(),
36
+ subscriptionsListSummaryQueryVariables,
37
+ ['subscriptions', 'startPage'],
38
+ );
39
+ const {
40
+ data: processesSummaryResult,
41
+ isLoading: processesSummaryIsFetching,
42
+ } = useQueryWithGraphql(
43
+ getProcessListSummaryGraphQlQuery(),
44
+ processListSummaryQueryVariables,
45
+ ['workflows', 'startPage'],
46
+ );
47
+ const {
48
+ data: failedTasksSummaryResult,
49
+ isLoading: failedTasksSummaryIsFetching,
50
+ } = useQueryWithGraphql(
51
+ getProcessListSummaryGraphQlQuery(),
52
+ taskListSummaryQueryVariables,
53
+ ['tasks', 'startPage'],
54
+ );
55
+ const {
56
+ data: productsSummaryResult,
57
+ isLoading: productsSummaryIsFetching,
58
+ } = useQueryWithGraphql(
59
+ getProductsSummaryQuery(),
60
+ productsSummaryQueryVariables,
61
+ 'productSummary',
62
+ );
63
+
64
+ const latestActiveSubscriptionsSummaryCard: SummaryCard = {
65
+ headerTitle: t('activeSubscriptions.headerTitle'),
66
+ headerValue:
67
+ subscriptionsSummaryResult?.subscriptions.pageInfo.totalItems ?? 0,
68
+ headerStatus: SummaryCardStatus.Neutral,
69
+ listTitle: t('activeSubscriptions.listTitle'),
70
+ listItems:
71
+ subscriptionsSummaryResult?.subscriptions.page.map(
72
+ (subscription) => ({
73
+ title: subscription.description,
74
+ value: getFirstUuidPart(subscription.subscriptionId),
75
+ url: `${PATH_SUBSCRIPTIONS}/${subscription.subscriptionId}`,
76
+ }),
77
+ ) ?? [],
78
+ button: {
79
+ name: t('activeSubscriptions.buttonText'),
80
+ url: PATH_SUBSCRIPTIONS,
81
+ },
82
+ isLoading: subscriptionsSummaryIsFetching,
83
+ };
84
+
85
+ const latestWorkflowsSummaryCard: SummaryCard = {
86
+ headerTitle: t('activeWorkflows.headerTitle'),
87
+ headerValue: processesSummaryResult?.processes.pageInfo.totalItems ?? 0,
88
+ headerStatus: SummaryCardStatus.Success,
89
+ listTitle: t('activeWorkflows.listTitle'),
90
+ listItems:
91
+ processesSummaryResult?.processes.page.map((workflow) => ({
92
+ title: workflow.workflowName,
93
+ value: workflow.startedAt,
94
+ url: `${PATH_WORKFLOWS}/${workflow.processId}`,
95
+ })) ?? [],
96
+ button: {
97
+ name: t('activeWorkflows.buttonText'),
98
+ url: PATH_WORKFLOWS,
99
+ },
100
+ isLoading: processesSummaryIsFetching,
101
+ };
102
+
103
+ const failedTasksSummaryCard: SummaryCard = {
104
+ headerTitle: t('failedTasks.headerTitle'),
105
+ headerValue:
106
+ failedTasksSummaryResult?.processes.pageInfo.totalItems ?? 0,
107
+ headerStatus: SummaryCardStatus.Error,
108
+ listTitle: t('failedTasks.listTitle'),
109
+ listItems:
110
+ failedTasksSummaryResult?.processes.page.map((task) => ({
111
+ title: task.workflowName,
112
+ value: task.startedAt,
113
+ url: `${PATH_TASKS}/${task.processId}`,
114
+ })) ?? [],
115
+ button: {
116
+ name: t('failedTasks.buttonText'),
117
+ url: PATH_TASKS,
118
+ },
119
+ isLoading: failedTasksSummaryIsFetching,
120
+ };
121
+
122
+ const productsSummaryCard: SummaryCard = {
123
+ headerTitle: t('products.headerTitle'),
124
+ headerValue: productsSummaryResult?.products.pageInfo.totalItems ?? 0,
125
+ headerStatus: SummaryCardStatus.Neutral,
126
+ listTitle: t('products.listTitle'),
127
+ listItems:
128
+ productsSummaryResult?.products.page
129
+ .sort(
130
+ (left, right) =>
131
+ (right.subscriptions.pageInfo.totalItems ?? 0) -
132
+ (left.subscriptions.pageInfo.totalItems ?? 0),
133
+ )
134
+ .map((product) => ({
135
+ title: '',
136
+ value: (
137
+ <div
138
+ css={{
139
+ display: 'flex',
140
+ justifyContent: 'space-between',
141
+ }}
142
+ >
143
+ <div>{product.name}</div>
144
+ <div>
145
+ {product.subscriptions.pageInfo.totalItems || 0}
146
+ </div>
147
+ </div>
148
+ ),
149
+ })) ?? [],
150
+ isLoading: productsSummaryIsFetching,
151
+ };
152
+
153
+ return (
154
+ <EuiFlexItem>
155
+ <WfoSummaryCards
156
+ summaryCards={[
157
+ latestActiveSubscriptionsSummaryCard,
158
+ latestWorkflowsSummaryCard,
159
+ failedTasksSummaryCard,
160
+ productsSummaryCard,
161
+ ]}
162
+ />
163
+ </EuiFlexItem>
164
+ );
165
+ };
166
+
167
+ const subscriptionsListSummaryQueryVariables: GraphqlQueryVariables<Subscription> =
168
+ {
169
+ first: 5,
170
+ after: 0,
171
+ sortBy: {
172
+ field: 'startDate',
173
+ order: SortOrder.DESC,
174
+ },
175
+ filterBy: [
176
+ {
177
+ field: 'status',
178
+ value: 'Active',
179
+ },
180
+ ],
181
+ };
182
+
183
+ const processListSummaryQueryVariables: GraphqlQueryVariables<Process> = {
184
+ first: 5,
185
+ after: 0,
186
+ sortBy: {
187
+ field: 'startedAt',
188
+ order: SortOrder.DESC,
189
+ },
190
+ filterBy: [
191
+ {
192
+ // Todo: isTask is not a key of Process
193
+ // However, backend still supports it. Field should not be a keyof ProcessListItem (or process)
194
+ // https://github.com/workfloworchestrator/orchestrator-ui/issues/290
195
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
196
+ // @ts-ignore waiting for fix in backend
197
+ field: 'isTask',
198
+ value: 'false',
199
+ },
200
+ {
201
+ field: 'lastStatus',
202
+ value: 'created-running-suspended-waiting-failed-resumed-inconsistent_data-api_unavailable-awaiting_callback',
203
+ },
204
+ ],
205
+ };
206
+
207
+ const taskListSummaryQueryVariables: GraphqlQueryVariables<Process> = {
208
+ first: 5,
209
+ after: 0,
210
+ sortBy: {
211
+ field: 'startedAt',
212
+ order: SortOrder.DESC,
213
+ },
214
+ filterBy: [
215
+ {
216
+ // Todo: isTask is not a key of Process
217
+ // However, backend still supports it. Field should not be a keyof ProcessListItem (or process)
218
+ // https://github.com/workfloworchestrator/orchestrator-ui/issues/290
219
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
220
+ // @ts-ignore waiting for fix in backend
221
+ field: 'isTask',
222
+ value: 'true',
223
+ },
224
+ {
225
+ field: 'lastStatus',
226
+ value: 'failed-inconsistent_data-api_unavailable',
227
+ },
228
+ ],
229
+ };
230
+
231
+ const productsSummaryQueryVariables: GraphqlQueryVariables<ProductDefinition> =
232
+ {
233
+ first: 1000,
234
+ after: 0,
235
+ sortBy: {
236
+ field: 'name',
237
+ order: SortOrder.ASC,
238
+ },
239
+ };
@@ -0,0 +1 @@
1
+ export * from './WfoStartPage';
@@ -1,29 +1,28 @@
1
1
  import React, { useEffect, useState } from 'react';
2
2
 
3
- import { useRouter } from 'next/router';
3
+ import { useTranslations } from 'next-intl';
4
4
  import { StringParam, useQueryParam, withDefault } from 'use-query-params';
5
5
 
6
6
  import { EuiPageHeader, EuiSpacer } from '@elastic/eui';
7
7
 
8
+ import {
9
+ DEFAULT_PAGE_SIZE,
10
+ SUBSCRIPTIONS_TABLE_LOCAL_STORAGE_KEY,
11
+ } from '@/components';
12
+
8
13
  import { WfoFilterTabs } from '../../components';
9
14
  import {
15
+ WfoSubscriptionListTab,
10
16
  WfoSubscriptionsList,
11
- WfoSubscriptionsTabType,
12
- defaultSubscriptionsTabs,
13
- getSubscriptionsTabTypeFromString,
17
+ subscriptionListTabs,
14
18
  } from '../../components/WfoSubscriptionsList';
15
19
  import { SubscriptionListItem } from '../../components/WfoSubscriptionsList';
16
20
  import { StoredTableConfig } from '../../components/WfoTable';
17
- import { SUBSCRIPTIONS_TABLE_LOCAL_STORAGE_KEY } from '../../components/WfoTable';
18
- import {
19
- DEFAULT_PAGE_SIZE,
20
- getSortDirectionFromString,
21
- } from '../../components/WfoTable';
22
21
  import { useDataDisplayParams, useStoredTableConfig } from '../../hooks';
23
22
  import { SortOrder } from '../../types';
24
23
 
25
24
  export const WfoSubscriptionsListPage = () => {
26
- const router = useRouter();
25
+ const t = useTranslations('subscriptions.detail');
27
26
 
28
27
  const [tableDefaults, setTableDefaults] =
29
28
  useState<StoredTableConfig<SubscriptionListItem>>();
@@ -55,40 +54,37 @@ export const WfoSubscriptionsListPage = () => {
55
54
 
56
55
  const [activeTab, setActiveTab] = useQueryParam(
57
56
  'activeTab',
58
- withDefault(StringParam, WfoSubscriptionsTabType.ACTIVE),
57
+ withDefault(StringParam, WfoSubscriptionListTab.ACTIVE),
59
58
  );
60
59
 
61
- const sortOrder = getSortDirectionFromString(
62
- dataDisplayParams.sortBy?.order,
63
- );
64
- const selectedSubscriptionsTab =
65
- getSubscriptionsTabTypeFromString(activeTab);
66
- if (!sortOrder || !selectedSubscriptionsTab) {
67
- router.replace('/subscriptions');
68
- return null;
69
- }
60
+ const selectedTab = ((): WfoSubscriptionListTab => {
61
+ return (
62
+ subscriptionListTabs.find(({ id }) => id === activeTab)?.id ||
63
+ WfoSubscriptionListTab.ACTIVE
64
+ );
65
+ })();
70
66
 
71
67
  const handleChangeSubscriptionsTab = (
72
- updatedSubscriptionsTab: WfoSubscriptionsTabType,
68
+ updatedSubscriptionsTab: WfoSubscriptionListTab,
73
69
  ) => {
74
70
  setActiveTab(updatedSubscriptionsTab);
75
71
  setDataDisplayParam('pageIndex', 0);
76
72
  };
77
73
 
78
- const alwaysOnFilters = defaultSubscriptionsTabs.find(
79
- ({ id }) => id === selectedSubscriptionsTab,
74
+ const alwaysOnFilters = subscriptionListTabs.find(
75
+ ({ id }) => id === activeTab,
80
76
  )?.alwaysOnFilters;
81
77
 
82
78
  return (
83
79
  <>
84
80
  <EuiSpacer />
85
81
 
86
- <EuiPageHeader pageTitle="Subscriptions" />
82
+ <EuiPageHeader pageTitle={t('title')} />
87
83
  <EuiSpacer size="m" />
88
84
 
89
85
  <WfoFilterTabs
90
- tabs={defaultSubscriptionsTabs}
91
- selectedTab={selectedSubscriptionsTab}
86
+ tabs={subscriptionListTabs}
87
+ selectedTab={selectedTab}
92
88
  translationNamespace="subscriptions.tabs"
93
89
  onChangeTab={handleChangeSubscriptionsTab}
94
90
  />