@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
@@ -9,14 +9,13 @@ import {
9
9
  DEFAULT_PAGE_SIZE,
10
10
  DEFAULT_PAGE_SIZES,
11
11
  METADATA_WORKFLOWS_TABLE_LOCAL_STORAGE_KEY,
12
- WfoLoading,
13
12
  WfoProductBlockBadge,
14
13
  } from '../../components';
15
14
  import { WfoTableWithFilter } from '../../components';
16
15
  import {
17
16
  getDataSortHandler,
18
- getEsQueryStringHandler,
19
17
  getPageChangeHandler,
18
+ getQueryStringHandler,
20
19
  } from '../../components';
21
20
  import type { WfoDataSorting, WfoTableColumns } from '../../components';
22
21
  import { StoredTableConfig } from '../../components';
@@ -136,30 +135,29 @@ export const WfoWorkflowsPage = () => {
136
135
  },
137
136
  };
138
137
 
139
- const { data, isFetching } = useQueryWithGraphql(
138
+ const { pageSize, pageIndex, sortBy, queryString } = dataDisplayParams;
139
+ const { data, isLoading, isError } = useQueryWithGraphql(
140
140
  GET_WORKFLOWS_GRAPHQL_QUERY,
141
141
  {
142
- first: dataDisplayParams.pageSize,
143
- after: dataDisplayParams.pageIndex * dataDisplayParams.pageSize,
144
- sortBy: graphQlWorkflowListMapper(dataDisplayParams.sortBy),
142
+ first: pageSize,
143
+ after: pageIndex * pageSize,
144
+ sortBy: graphQlWorkflowListMapper(sortBy),
145
+ query: queryString || undefined,
145
146
  },
146
147
  'workflows',
147
148
  );
148
149
 
149
- if (!data) {
150
- return <WfoLoading />;
151
- }
152
-
153
150
  const dataSorting: WfoDataSorting<WorkflowListItem> = {
154
- field: dataDisplayParams.sortBy?.field ?? 'name',
155
- sortOrder: dataDisplayParams.sortBy?.order ?? SortOrder.ASC,
151
+ field: sortBy?.field ?? 'name',
152
+ sortOrder: sortBy?.order ?? SortOrder.ASC,
156
153
  };
157
154
 
158
- const { totalItems, sortFields, filterFields } = data.workflows.pageInfo;
155
+ const { totalItems, sortFields, filterFields } =
156
+ data?.workflows?.pageInfo || {};
159
157
 
160
158
  const pagination: Pagination = {
161
- pageSize: dataDisplayParams.pageSize,
162
- pageIndex: dataDisplayParams.pageIndex,
159
+ pageSize: pageSize,
160
+ pageIndex: pageIndex,
163
161
  pageSizeOptions: DEFAULT_PAGE_SIZES,
164
162
  totalItemCount: totalItems ? totalItems : 0,
165
163
  };
@@ -167,7 +165,7 @@ export const WfoWorkflowsPage = () => {
167
165
  return (
168
166
  <WfoMetadataPageLayout>
169
167
  <WfoTableWithFilter<WorkflowListItem>
170
- data={mapWorkflowDefinitionToWorkflowListItem(data)}
168
+ data={data ? mapWorkflowDefinitionToWorkflowListItem(data) : []}
171
169
  tableColumns={mapSortableAndFilterableValuesToTableColumnConfig(
172
170
  tableColumns,
173
171
  sortFields,
@@ -181,12 +179,13 @@ export const WfoWorkflowsPage = () => {
181
179
  onUpdatePage={getPageChangeHandler<WorkflowListItem>(
182
180
  setDataDisplayParam,
183
181
  )}
184
- onUpdateEsQueryString={getEsQueryStringHandler<WorkflowListItem>(
182
+ onUpdateQueryString={getQueryStringHandler<WorkflowListItem>(
185
183
  setDataDisplayParam,
186
184
  )}
187
185
  pagination={pagination}
188
- isLoading={isFetching}
189
- esQueryString={dataDisplayParams.esQueryString}
186
+ isLoading={isLoading}
187
+ hasError={isError}
188
+ queryString={queryString}
190
189
  localStorageKey={METADATA_WORKFLOWS_TABLE_LOCAL_STORAGE_KEY}
191
190
  />
192
191
  </WfoMetadataPageLayout>
@@ -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 '../../components';
22
- import ConfirmationDialogContext from '../../contexts/ConfirmationDialogProvider';
23
- import { useOrchestratorTheme } from '../../hooks';
24
- import { useDeleteProcess } from '../../hooks/ProcessesHooks/useDeleteProcess';
25
- import { WfoPlayFill, WfoRefresh, WfoXCircleFill } from '../../icons';
26
- import { ProcessDetail, ProcessStatus } from '../../types';
27
- import { parseDateRelativeToToday, parseIsoString } from '../../utils';
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,
@@ -75,6 +80,8 @@ interface ProcessDetailProps {
75
80
  processDetail: Partial<ProcessDetail> | undefined;
76
81
  timelineItems: TimelineItem[];
77
82
  onTimelineItemClick?: (id: string) => void;
83
+ isLoading?: boolean;
84
+ hasError?: boolean;
78
85
  }
79
86
 
80
87
  export const WfoProcessDetail = ({
@@ -85,12 +92,87 @@ export const WfoProcessDetail = ({
85
92
  buttonsAreDisabled,
86
93
  timelineItems,
87
94
  onTimelineItemClick,
95
+ isLoading = false,
96
+ hasError = false,
88
97
  }: ProcessDetailProps) => {
89
98
  const t = useTranslations('processes.detail');
90
99
  const { theme } = useOrchestratorTheme();
91
100
  const { showConfirmDialog } = useContext(ConfirmationDialogContext);
92
- const { mutate } = useDeleteProcess();
101
+ const { deleteProcess, abortProcess, retryProcess } = useMutateProcess();
93
102
  const router = useRouter();
103
+ const { isEngineRunningNow } = useCheckEngineStatus();
104
+
105
+ const listIncludesStatus = (
106
+ processStatusesForDisabledState: ProcessStatus[],
107
+ status?: string,
108
+ ): boolean =>
109
+ status
110
+ ? processStatusesForDisabledState
111
+ .map((stat) => stat.toUpperCase())
112
+ .includes(status)
113
+ : false;
114
+
115
+ const retryButtonIsDisabled =
116
+ buttonsAreDisabled ||
117
+ !listIncludesStatus([ProcessStatus.FAILED], processDetail?.lastStatus);
118
+ const abortButtonIsDisabled =
119
+ buttonsAreDisabled ||
120
+ listIncludesStatus(
121
+ [ProcessStatus.COMPLETED, ProcessStatus.ABORTED],
122
+ processDetail?.lastStatus,
123
+ );
124
+ const deleteButtonIsDisabled =
125
+ buttonsAreDisabled ||
126
+ listIncludesStatus([ProcessStatus.RUNNING], processDetail?.lastStatus);
127
+
128
+ const processIsTask = processDetail?.isTask === true;
129
+
130
+ const handleActionButtonClick = (action: () => void) => async () => {
131
+ if (await isEngineRunningNow()) {
132
+ action();
133
+ }
134
+ };
135
+
136
+ const retryAction = () =>
137
+ showConfirmDialog({
138
+ question: t(
139
+ processIsTask ? 'retryTaskQuestion' : 'retryWorkflowQuestion',
140
+ {
141
+ workflowName: processDetail?.workflowName,
142
+ },
143
+ ),
144
+ confirmAction: () => {
145
+ processDetail?.processId &&
146
+ retryProcess.mutate(processDetail.processId);
147
+ },
148
+ });
149
+
150
+ const abortAction = () =>
151
+ showConfirmDialog({
152
+ question: t(
153
+ processIsTask ? 'abortTaskQuestion' : 'abortWorkflowQuestion',
154
+ {
155
+ workflowName: processDetail?.workflowName,
156
+ },
157
+ ),
158
+ confirmAction: () => {
159
+ processDetail?.processId &&
160
+ abortProcess.mutate(processDetail.processId);
161
+ router.push(processIsTask ? PATH_TASKS : PATH_WORKFLOWS);
162
+ },
163
+ });
164
+
165
+ const deleteAction = () =>
166
+ showConfirmDialog({
167
+ question: t('deleteQuestion', {
168
+ workflowName: processDetail?.workflowName,
169
+ }),
170
+ confirmAction: () => {
171
+ processDetail?.processId &&
172
+ deleteProcess.mutate(processDetail.processId);
173
+ router.push(PATH_TASKS);
174
+ },
175
+ });
94
176
 
95
177
  return (
96
178
  <>
@@ -107,111 +189,50 @@ export const WfoProcessDetail = ({
107
189
  gutterSize="s"
108
190
  >
109
191
  <EuiButton
110
- onClick={(
111
- e: React.MouseEvent<
112
- HTMLButtonElement | HTMLElement,
113
- MouseEvent
114
- >,
115
- ) => {
116
- e.preventDefault();
117
- alert('TODO: Implement retry');
118
- }}
192
+ onClick={handleActionButtonClick(retryAction)}
119
193
  iconType={() => (
120
194
  <WfoRefresh
121
195
  color={
122
- buttonsAreDisabled
196
+ retryButtonIsDisabled
123
197
  ? theme.colors.subduedText
124
198
  : theme.colors.link
125
199
  }
126
200
  />
127
201
  )}
128
- isDisabled={buttonsAreDisabled}
202
+ isDisabled={retryButtonIsDisabled}
129
203
  >
130
204
  {t('retry')}
131
205
  </EuiButton>
132
206
  <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
- }}
207
+ onClick={handleActionButtonClick(abortAction)}
165
208
  iconType={() => (
166
209
  <WfoXCircleFill
167
210
  color={
168
- buttonsAreDisabled
211
+ abortButtonIsDisabled
169
212
  ? theme.colors.subduedText
170
213
  : theme.colors.danger
171
214
  }
172
215
  />
173
216
  )}
174
217
  color="danger"
175
- isDisabled={buttonsAreDisabled}
218
+ isDisabled={abortButtonIsDisabled}
176
219
  >
177
220
  {t('abort')}
178
221
  </EuiButton>
179
- {processDetail && processDetail.isTask === true && (
222
+ {processDetail && processIsTask && (
180
223
  <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
- }}
224
+ onClick={handleActionButtonClick(deleteAction)}
200
225
  iconType={() => (
201
226
  <WfoXCircleFill
202
227
  color={
203
- buttonsAreDisabled
228
+ deleteButtonIsDisabled
204
229
  ? theme.colors.subduedText
205
230
  : theme.colors.danger
206
231
  }
207
232
  />
208
233
  )}
209
234
  color="danger"
210
- isDisabled={
211
- buttonsAreDisabled ||
212
- processDetail.lastStatus ===
213
- ProcessStatus.RUNNING
214
- }
235
+ isDisabled={deleteButtonIsDisabled}
215
236
  >
216
237
  {t('delete')}
217
238
  </EuiButton>
@@ -226,7 +247,7 @@ export const WfoProcessDetail = ({
226
247
  color="subdued"
227
248
  element="div"
228
249
  >
229
- {(processDetail === undefined && <WfoLoading />) ||
250
+ {(isLoading && !hasError && <WfoLoading />) ||
230
251
  (processDetail !== undefined && (
231
252
  <EuiFlexGroup direction="row" gutterSize="m">
232
253
  <ProcessHeaderValue
@@ -1,14 +1,14 @@
1
- import React, { useContext, useEffect, useRef, useState } from 'react';
1
+ import React, { useEffect, useRef, useState } from 'react';
2
+
3
+ import { TimelineItem, WfoError, WfoLoading } from '@/components';
2
4
 
3
- import { TimelineItem, WfoLoading } from '../../components';
4
5
  import {
5
6
  WfoStepListRef,
6
7
  WfoWorkflowStepList,
7
8
  } from '../../components/WfoWorkflowSteps';
8
- import { OrchestratorConfigContext } from '../../contexts';
9
9
  import { GET_PROCESS_DETAIL_GRAPHQL_QUERY } from '../../graphqlQueries';
10
10
  import { useQueryWithGraphql } from '../../hooks';
11
- import { ProcessDoneStatuses, Step } from '../../types';
11
+ import { ProcessDoneStatuses, ProcessStatus, Step } from '../../types';
12
12
  import { getProductNamesFromProcess } from '../../utils';
13
13
  import { WfoProcessDetail } from './WfoProcessDetail';
14
14
  import {
@@ -20,43 +20,56 @@ export type GroupedStep = {
20
20
  steps: Step[];
21
21
  };
22
22
 
23
+ const PROCESS_DETAIL_DEFAULT_REFETCH_INTERVAL = 3000;
24
+
23
25
  interface WfoProcessDetailPageProps {
24
26
  processId: string;
27
+ processDetailRefetchInterval?: number;
25
28
  }
26
29
 
27
30
  export const WfoProcessDetailPage = ({
28
31
  processId,
32
+ processDetailRefetchInterval = PROCESS_DETAIL_DEFAULT_REFETCH_INTERVAL,
29
33
  }: WfoProcessDetailPageProps) => {
30
- const { dataRefetchInterval } = useContext(OrchestratorConfigContext);
31
34
  const stepListRef = useRef<WfoStepListRef>(null);
32
- const [fetchInterval, setFetchInterval] = useState<number | undefined>(
33
- dataRefetchInterval.processDetail,
34
- );
35
- const { data, isFetching } = useQueryWithGraphql(
35
+ const [fetchInterval, setFetchInterval] = useState<number | undefined>();
36
+ const { data, isLoading, isError } = useQueryWithGraphql(
36
37
  GET_PROCESS_DETAIL_GRAPHQL_QUERY,
37
38
  {
38
39
  processId,
39
40
  },
40
41
  'processDetail',
41
- fetchInterval,
42
+ { refetchInterval: fetchInterval, refetchOnWindowFocus: false },
42
43
  );
43
44
 
45
+ if (isError) {
46
+ if (fetchInterval) {
47
+ setFetchInterval(undefined);
48
+ }
49
+ }
50
+
44
51
  useEffect(() => {
45
- const lastStatus = data?.processes.page[0].lastStatus;
52
+ const process = data?.processes.page[0];
53
+ // We need to cast here because the backend might return the string in upperCase and
54
+ // toLowerCase() will converts the value type to string
55
+ const lastStatus =
56
+ process?.lastStatus.toLocaleLowerCase() as ProcessStatus;
57
+
46
58
  const isInProgress = !(
47
59
  lastStatus && ProcessDoneStatuses.includes(lastStatus)
48
60
  );
61
+
49
62
  setFetchInterval(
50
- isInProgress ? dataRefetchInterval.processDetail : undefined,
63
+ isInProgress ? processDetailRefetchInterval : undefined,
51
64
  );
52
- }, [data, dataRefetchInterval.processDetail]);
65
+ }, [data, processDetailRefetchInterval]);
53
66
 
54
67
  const process = data?.processes.page[0];
55
68
  const steps = process?.steps ?? [];
56
69
 
57
70
  const productNames = getProductNamesFromProcess(process);
58
71
  const pageTitle = process?.workflowName || '';
59
-
72
+ const isTask = process?.isTask ?? false;
60
73
  const groupedSteps: GroupedStep[] = convertStepsToGroupedSteps(steps);
61
74
  const timelineItems: TimelineItem[] =
62
75
  mapGroupedStepsToTimelineItems(groupedSteps);
@@ -65,14 +78,17 @@ export const WfoProcessDetailPage = ({
65
78
  <WfoProcessDetail
66
79
  pageTitle={pageTitle}
67
80
  productNames={productNames}
68
- buttonsAreDisabled={isFetching && !process}
81
+ buttonsAreDisabled={isLoading || isError}
69
82
  processDetail={process}
70
83
  timelineItems={timelineItems}
71
84
  onTimelineItemClick={(id: string) =>
72
85
  stepListRef.current?.scrollToStep(id)
73
86
  }
87
+ isLoading={isLoading}
88
+ hasError={isError}
74
89
  >
75
- {(isFetching && !process && <WfoLoading />) ||
90
+ {(isError && <WfoError />) ||
91
+ (isLoading && <WfoLoading />) ||
76
92
  (process !== undefined && (
77
93
  <WfoWorkflowStepList
78
94
  ref={stepListRef}
@@ -80,9 +96,11 @@ export const WfoProcessDetailPage = ({
80
96
  steps={groupedSteps.flatMap(
81
97
  (groupedStep) => groupedStep.steps,
82
98
  )}
99
+ userInputForm={process.form}
83
100
  startedAt={process.startedAt}
101
+ isTask={isTask}
84
102
  />
85
- ))}
103
+ )) || <h1>Invalid processId</h1>}
86
104
  </WfoProcessDetail>
87
105
  );
88
106
  };