@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
|
@@ -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
|
+
};
|
|
@@ -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 {
|
|
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
|
-
|
|
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
|
|
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,
|
|
57
|
+
withDefault(StringParam, WfoSubscriptionListTab.ACTIVE),
|
|
59
58
|
);
|
|
60
59
|
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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:
|
|
68
|
+
updatedSubscriptionsTab: WfoSubscriptionListTab,
|
|
73
69
|
) => {
|
|
74
70
|
setActiveTab(updatedSubscriptionsTab);
|
|
75
71
|
setDataDisplayParam('pageIndex', 0);
|
|
76
72
|
};
|
|
77
73
|
|
|
78
|
-
const alwaysOnFilters =
|
|
79
|
-
({ id }) => id ===
|
|
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=
|
|
82
|
+
<EuiPageHeader pageTitle={t('title')} />
|
|
87
83
|
<EuiSpacer size="m" />
|
|
88
84
|
|
|
89
85
|
<WfoFilterTabs
|
|
90
|
-
tabs={
|
|
91
|
-
selectedTab={
|
|
86
|
+
tabs={subscriptionListTabs}
|
|
87
|
+
selectedTab={selectedTab}
|
|
92
88
|
translationNamespace="subscriptions.tabs"
|
|
93
89
|
onChangeTab={handleChangeSubscriptionsTab}
|
|
94
90
|
/>
|