@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.
- package/.turbo/turbo-build.log +10 -9
- package/.turbo/turbo-lint.log +2 -5
- package/.turbo/turbo-test.log +15 -10
- package/CHANGELOG.md +17 -0
- package/dist/index.d.ts +1464 -337
- package/dist/index.js +37266 -8348
- package/package.json +38 -31
- package/src/api/axios.ts +2 -8
- package/src/api/index.ts +59 -4
- package/src/components/WfoBadges/WfoBadge/WfoBadge.tsx +4 -1
- package/src/components/WfoBadges/index.ts +1 -0
- 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/WfoError/WfoError.stories.tsx +26 -0
- package/src/components/WfoError/WfoError.tsx +19 -0
- package/src/components/WfoError/index.ts +1 -0
- package/src/components/WfoFilterTabs/WfoFilterTabs.tsx +4 -2
- package/src/components/WfoForms/AutoFieldLoader.tsx +5 -1
- package/src/components/WfoForms/CreateForm.tsx +1 -0
- package/src/components/WfoForms/UserInputForm.tsx +88 -45
- 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/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/SplitPrefix.tsx +2 -1
- package/src/components/WfoForms/formFields/SubscriptionField.tsx +10 -4
- 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 +89 -9
- package/src/components/WfoJsonCodeBlock/index.ts +1 -0
- package/src/components/WfoKeyValueTable/WfoValueCell.tsx +2 -2
- package/src/components/WfoOptionalLink/WfoOptionalLink.tsx +20 -0
- package/src/components/WfoOptionalLink/index.ts +1 -0
- package/src/components/WfoPageTemplate/WfoBreadcrumbs/WfoBreadcrumbs.tsx +5 -2
- package/src/components/WfoPageTemplate/WfoPageHeader/WfoAppLogo.tsx +28 -0
- package/src/components/WfoPageTemplate/WfoPageHeader/WfoPageHeader.tsx +23 -19
- package/src/components/WfoPageTemplate/WfoPageHeader/styles.ts +29 -0
- package/src/components/WfoPageTemplate/WfoPageHeader/utils/toHexColorWithOpacity.spec.ts +12 -0
- package/src/components/WfoPageTemplate/WfoPageHeader/utils/toHexColorWithOpacity.ts +5 -0
- package/src/components/WfoPageTemplate/WfoSidebar/WfoSidebar.tsx +14 -14
- package/src/components/WfoPageTemplate/WfoSidebar/WfoStartCreateWorkflowButtonComboBox.tsx +15 -12
- package/src/components/WfoPageTemplate/paths.ts +3 -2
- package/src/components/{WfoProcessesList/WfoProcessList.tsx → WfoProcessList/WfoProcessesList.tsx} +46 -38
- package/src/components/WfoProcessList/index.ts +1 -0
- package/src/components/{WfoProcessesList → WfoProcessList}/processListObjectMappers.ts +5 -3
- package/src/components/WfoSearchBar/WfoSearchField.tsx +27 -37
- package/src/components/{WfoSettingsPage → WfoSettings}/WfoEngineStatusButton.tsx +7 -4
- package/src/components/{WfoSettingsPage → WfoSettings}/WfoFlushSettings.tsx +29 -18
- 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/WfoSettingsModal/WfoSubmitModal.tsx +61 -0
- package/src/components/WfoSettingsModal/index.tsx +1 -0
- package/src/components/WfoStartTaskButtonComboBox/WfoStartTaskButtonComboBox.tsx +14 -11
- package/src/components/WfoSubscription/WfoProcessesTimeline.tsx +11 -18
- package/src/components/WfoSubscription/WfoRelatedSubscriptions.tsx +4 -1
- package/src/components/WfoSubscription/WfoSubscription.tsx +38 -66
- package/src/components/WfoSubscription/WfoSubscriptionActions.tsx +41 -33
- package/src/components/WfoSubscription/WfoSubscriptionDetailTree.tsx +34 -28
- package/src/components/WfoSubscription/WfoSubscriptionProductBlock.tsx +96 -91
- package/src/components/WfoSubscription/WfoTargetTypeIcon.tsx +26 -0
- package/src/components/WfoSubscription/subscriptionDetailTabs.tsx +29 -0
- package/src/components/WfoSubscription/utils/utils.spec.ts +24 -0
- package/src/components/WfoSubscription/utils/utils.ts +21 -5
- package/src/components/WfoSubscriptionsList/WfoSubscriptionsList.tsx +42 -48
- package/src/components/WfoSubscriptionsList/index.ts +1 -1
- package/src/components/WfoSubscriptionsList/{mapGrapghQlSubscriptionsResultToSubscriptionListItems.ts → mapGraphQlSubscriptionsResultToSubscriptionListItems.ts} +8 -1
- package/src/components/WfoSubscriptionsList/subscriptionListTabs.ts +8 -30
- package/src/components/WfoSummary/WfoSummaryCardHeader/WfoSummaryCardHeader.tsx +55 -0
- package/src/components/WfoSummary/WfoSummaryCardHeader/index.ts +1 -0
- package/src/components/WfoSummary/WfoSummaryCardHeader/styles.ts +26 -0
- package/src/components/WfoSummary/WfoSummaryCardList/WfoSummaryCardList.tsx +86 -0
- package/src/components/WfoSummary/WfoSummaryCardList/WfoSummaryCardListItem.tsx +59 -0
- package/src/components/WfoSummary/WfoSummaryCardList/index.ts +2 -0
- package/src/components/WfoSummary/WfoSummaryCardList/styles.ts +52 -0
- package/src/components/WfoSummary/WfoSummaryCards.tsx +111 -0
- package/src/components/WfoSummary/getNumberOfColumns.ts +14 -0
- package/src/components/WfoSummary/index.ts +4 -0
- package/src/components/WfoSummary/styles.ts +13 -0
- package/src/components/WfoTable/WfoBasicTable/WfoBasicTable.tsx +18 -16
- package/src/components/WfoTable/WfoBasicTable/WfoTableHeaderCell.tsx +2 -2
- package/src/components/WfoTable/WfoBasicTable/index.ts +1 -0
- package/src/components/WfoTable/WfoBasicTable/styles.ts +28 -2
- package/src/components/WfoTable/WfoFirstPartUUID/WfoFirstPartUUID.tsx +12 -3
- package/src/components/WfoTable/WfoFirstPartUUID/styles.ts +12 -0
- package/src/components/WfoTable/WfoTableWithFilter/WfoTableWithFilter.tsx +32 -23
- package/src/components/WfoTable/WfoTableWithFilter/updateQueryString.spec.ts +95 -0
- package/src/components/WfoTable/WfoTableWithFilter/updateQueryString.ts +60 -0
- package/src/components/WfoTable/index.ts +2 -0
- package/src/components/WfoTable/utils/columns.ts +21 -15
- package/src/components/WfoTable/utils/constants.ts +4 -2
- package/src/components/WfoTable/utils/mapSortableAndFilterableValuesToTableColumnConfig.ts +5 -3
- 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/WfoTree/WfoTreeNode.tsx +1 -4
- package/src/components/WfoWorkflowSteps/WfoStep/WfoStep.tsx +42 -26
- package/src/components/WfoWorkflowSteps/WfoStep/WfoStepForm.tsx +48 -0
- package/src/components/WfoWorkflowSteps/WfoStepList/WfoStepList.tsx +10 -10
- package/src/components/WfoWorkflowSteps/WfoWorkflowStepList/WfoStepListHeader.tsx +22 -23
- package/src/components/WfoWorkflowSteps/WfoWorkflowStepList/WfoWorkflowStepList.tsx +97 -17
- package/src/components/WfoWorkflowSteps/index.ts +1 -0
- package/src/components/WfoWorkflowSteps/stepListUtils.ts +1 -28
- package/src/components/confirmationDialog/WfoConfirmationDialog.tsx +3 -3
- package/src/components/index.ts +9 -2
- package/src/contexts/ApiClientContext.tsx +5 -1
- package/src/contexts/ConfirmationDialogProvider.tsx +2 -2
- package/src/contexts/OrchestratorConfigContext.tsx +0 -3
- package/src/contexts/ToastContext.tsx +1 -1
- package/src/contexts/TreeContext.tsx +6 -1
- package/src/graphqlQueries/customersQuery.ts +2 -1
- package/src/graphqlQueries/index.ts +1 -0
- package/src/graphqlQueries/processDetailQuery.ts +8 -0
- package/src/graphqlQueries/processListQuery.ts +48 -7
- package/src/graphqlQueries/processStepsQuery.ts +22 -0
- package/src/graphqlQueries/productBlocksQuery.ts +11 -5
- package/src/graphqlQueries/productsQuery.ts +42 -7
- package/src/graphqlQueries/relatedSubscriptionsQuery.ts +2 -2
- package/src/graphqlQueries/resourceTypesQuery.ts +10 -4
- package/src/graphqlQueries/subscriptionDetailQuery.ts +5 -1
- package/src/graphqlQueries/subscriptionsDropdownOptionsQuery.ts +2 -1
- package/src/graphqlQueries/subscriptionsListQuery.ts +46 -7
- package/src/graphqlQueries/workflows/workflowsQuery.ts +10 -4
- package/src/graphqlQueries/workflows/workflowsQueryForDropdownList.ts +3 -6
- package/src/hooks/DataFetchHooks.ts +20 -61
- package/src/hooks/index.ts +3 -0
- package/src/hooks/surf/useGetSubscriptionDropdownOptions.ts +1 -0
- package/src/hooks/surf/useIsTaggedPort.ts +1 -2
- 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/hooks/useOrchestratorConfig.ts +0 -3
- package/src/hooks/useQueryWithGraphql.ts +25 -13
- package/src/hooks/useSessionWithToken.ts +3 -5
- package/src/hooks/useSubscriptionActions.ts +8 -2
- package/src/icons/WfoBell.tsx +34 -0
- package/src/icons/WfoContactEnvelopeFill.tsx +29 -0
- package/src/icons/WfoPencil.tsx +21 -0
- package/src/icons/WfoSideMenu.stories.tsx +13 -0
- package/src/icons/WfoSideMenu.tsx +39 -0
- package/src/icons/WfoStatistic.tsx +3 -3
- package/src/icons/WfoViewList.tsx +24 -0
- package/src/icons/index.ts +6 -0
- package/src/messages/{en-US.json → en-GB.json} +117 -39
- package/src/messages/getTranslationMessages.spec.ts +25 -40
- package/src/messages/index.ts +1 -1
- package/src/messages/nl-NL.json +126 -49
- package/src/messages/useGetTranslationMessages.ts +51 -0
- package/src/pages/index.ts +2 -1
- package/src/pages/metadata/WfoProductBlocksPage.tsx +17 -19
- package/src/pages/metadata/WfoProductsPage.tsx +30 -34
- package/src/pages/metadata/WfoResourceTypesPage.tsx +16 -18
- package/src/pages/metadata/WfoWorkflowsPage.tsx +18 -19
- package/src/pages/processes/WfoProcessDetail.tsx +101 -80
- package/src/pages/processes/WfoProcessDetailPage.tsx +35 -17
- package/src/pages/processes/WfoStartProcessPage.tsx +251 -0
- 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/startPage/WfoStartPage.tsx +239 -0
- package/src/pages/startPage/index.ts +1 -0
- package/src/pages/subscriptions/WfoSubscriptionsListPage.tsx +22 -26
- package/src/pages/tasks/WfoTasksListPage.tsx +169 -0
- package/src/pages/tasks/getTasksListTabTypeFromString.ts +19 -0
- package/src/pages/tasks/index.ts +3 -1
- package/src/pages/tasks/tabConfig.ts +51 -0
- package/src/pages/{processes/WfoProcessListPage.tsx → workflows/WfoWorkflowsListPage.tsx} +30 -32
- package/src/pages/workflows/getWorkflowsListTabTypeFromString.ts +19 -0
- package/src/pages/workflows/index.ts +1 -0
- package/src/pages/{processes → workflows}/tabConfig.ts +9 -9
- package/src/theme/defaultOrchestratorTheme.ts +8 -0
- package/src/types/types.ts +38 -53
- package/src/utils/date.ts +39 -0
- package/src/utils/getDefaultTableConfig.ts +19 -9
- package/tsconfig.json +4 -4
- package/src/components/WfoSettingsPage/WfoModifySettings.tsx +0 -33
- package/src/components/WfoSettingsPage/WfoSettings.tsx +0 -40
- package/src/components/WfoStartPage/WfoFrequentlyUsed.stories.tsx +0 -16
- package/src/components/WfoStartPage/WfoFrequentlyUsed.tsx +0 -21
- package/src/components/WfoStartPage/WfoListItemStartPage.stories.tsx +0 -40
- package/src/components/WfoStartPage/WfoListItemStartPage.tsx +0 -95
- package/src/components/WfoStartPage/WfoListStartPage.stories.tsx +0 -98
- package/src/components/WfoStartPage/WfoListStartPage.tsx +0 -45
- package/src/components/WfoStartPage/WfoMultiListSection.stories.tsx +0 -90
- package/src/components/WfoStartPage/WfoMultiListSection.tsx +0 -25
- package/src/components/WfoStartPage/WfoNewProcessPanel.stories.tsx +0 -13
- package/src/components/WfoStartPage/WfoNewProcessPanel.tsx +0 -45
- package/src/components/WfoStartPage/WfoStatCards.stories.tsx +0 -13
- package/src/components/WfoStartPage/WfoStatCards.tsx +0 -75
- package/src/components/WfoStartPage/index.ts +0 -6
- 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/pages/tasks/WfoTaskListPage.tsx +0 -120
- package/src/pages/workflow/WfoStartWorkflowPage.tsx +0 -177
- package/src/pages/workflow/index.ts +0 -1
- /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 {
|
|
138
|
+
const { pageSize, pageIndex, sortBy, queryString } = dataDisplayParams;
|
|
139
|
+
const { data, isLoading, isError } = useQueryWithGraphql(
|
|
140
140
|
GET_WORKFLOWS_GRAPHQL_QUERY,
|
|
141
141
|
{
|
|
142
|
-
first:
|
|
143
|
-
after:
|
|
144
|
-
sortBy: graphQlWorkflowListMapper(
|
|
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:
|
|
155
|
-
sortOrder:
|
|
151
|
+
field: sortBy?.field ?? 'name',
|
|
152
|
+
sortOrder: sortBy?.order ?? SortOrder.ASC,
|
|
156
153
|
};
|
|
157
154
|
|
|
158
|
-
const { totalItems, sortFields, filterFields } =
|
|
155
|
+
const { totalItems, sortFields, filterFields } =
|
|
156
|
+
data?.workflows?.pageInfo || {};
|
|
159
157
|
|
|
160
158
|
const pagination: Pagination = {
|
|
161
|
-
pageSize:
|
|
162
|
-
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
|
-
|
|
182
|
+
onUpdateQueryString={getQueryStringHandler<WorkflowListItem>(
|
|
185
183
|
setDataDisplayParam,
|
|
186
184
|
)}
|
|
187
185
|
pagination={pagination}
|
|
188
|
-
isLoading={
|
|
189
|
-
|
|
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 '
|
|
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,
|
|
@@ -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 {
|
|
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
|
-
|
|
196
|
+
retryButtonIsDisabled
|
|
123
197
|
? theme.colors.subduedText
|
|
124
198
|
: theme.colors.link
|
|
125
199
|
}
|
|
126
200
|
/>
|
|
127
201
|
)}
|
|
128
|
-
isDisabled={
|
|
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
|
-
|
|
211
|
+
abortButtonIsDisabled
|
|
169
212
|
? theme.colors.subduedText
|
|
170
213
|
: theme.colors.danger
|
|
171
214
|
}
|
|
172
215
|
/>
|
|
173
216
|
)}
|
|
174
217
|
color="danger"
|
|
175
|
-
isDisabled={
|
|
218
|
+
isDisabled={abortButtonIsDisabled}
|
|
176
219
|
>
|
|
177
220
|
{t('abort')}
|
|
178
221
|
</EuiButton>
|
|
179
|
-
{processDetail &&
|
|
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
|
-
|
|
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
|
-
{(
|
|
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, {
|
|
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
|
-
|
|
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
|
|
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 ?
|
|
63
|
+
isInProgress ? processDetailRefetchInterval : undefined,
|
|
51
64
|
);
|
|
52
|
-
}, [data,
|
|
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={
|
|
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
|
-
{(
|
|
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
|
};
|