@orchestrator-ui/orchestrator-ui-components 6.8.0 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +8 -8
- package/.turbo/turbo-lint.log +1 -1
- package/.turbo/turbo-test.log +8 -9
- package/CHANGELOG.md +10 -0
- package/dist/index.d.ts +155 -4305
- package/dist/index.js +1636 -5688
- package/dist/index.js.map +1 -1
- package/package.json +4 -8
- package/src/components/WfoPydanticForm/RenderFormErrors.tsx +2 -1
- package/src/components/WfoPydanticForm/Row.tsx +3 -1
- package/src/components/WfoPydanticForm/fields/WfoSummary.tsx +3 -5
- package/src/components/WfoPydanticForm/fields/styles.ts +72 -0
- package/src/components/WfoWorkflowSteps/WfoStep/WfoStep.tsx +10 -27
- package/src/components/WfoWorkflowSteps/WfoStep/WfoStepForm.tsx +1 -1
- package/src/components/index.ts +0 -1
- package/src/configuration/version.ts +1 -1
- package/src/contexts/OrchestratorConfigContext.tsx +0 -1
- package/src/pages/processes/WfoStartProcessPage.tsx +5 -107
- package/src/rtk/endpoints/index.ts +0 -2
- package/src/types/index.ts +0 -1
- package/src/types/types.ts +0 -1
- package/src/components/WfoForms/AutoFieldLoader.tsx +0 -118
- package/src/components/WfoForms/AutoFields.tsx +0 -49
- package/src/components/WfoForms/CreateForm.tsx +0 -75
- package/src/components/WfoForms/UserInputForm.tsx +0 -697
- package/src/components/WfoForms/UserInputFormStyling.ts +0 -80
- package/src/components/WfoForms/UserInputFormWizard.tsx +0 -127
- package/src/components/WfoForms/formFields/AcceptField.tsx +0 -243
- package/src/components/WfoForms/formFields/AcceptFieldStyling.ts +0 -35
- package/src/components/WfoForms/formFields/BoolField.tsx +0 -77
- package/src/components/WfoForms/formFields/BoolFieldStyling.ts +0 -64
- package/src/components/WfoForms/formFields/ConnectedSelectField.tsx +0 -19
- package/src/components/WfoForms/formFields/CustomerField.tsx +0 -77
- package/src/components/WfoForms/formFields/DateField.tsx +0 -72
- package/src/components/WfoForms/formFields/DividerField.tsx +0 -29
- package/src/components/WfoForms/formFields/ErrorField.tsx +0 -40
- package/src/components/WfoForms/formFields/ErrorsField.tsx +0 -34
- package/src/components/WfoForms/formFields/LabelField.tsx +0 -43
- package/src/components/WfoForms/formFields/ListAddField.tsx +0 -95
- package/src/components/WfoForms/formFields/ListDelField.tsx +0 -95
- package/src/components/WfoForms/formFields/ListField.tsx +0 -117
- package/src/components/WfoForms/formFields/ListItemField.tsx +0 -40
- package/src/components/WfoForms/formFields/ListSelectField.tsx +0 -95
- package/src/components/WfoForms/formFields/LocationCodeField.tsx +0 -60
- package/src/components/WfoForms/formFields/LongTextField.tsx +0 -68
- package/src/components/WfoForms/formFields/NestField.tsx +0 -107
- package/src/components/WfoForms/formFields/NumField.tsx +0 -85
- package/src/components/WfoForms/formFields/OptGroupField.tsx +0 -74
- package/src/components/WfoForms/formFields/RadioField.tsx +0 -87
- package/src/components/WfoForms/formFields/SelectField/SelectField.tsx +0 -177
- package/src/components/WfoForms/formFields/SelectField/index.ts +0 -1
- package/src/components/WfoForms/formFields/SelectField/styles.ts +0 -52
- package/src/components/WfoForms/formFields/SubmitField.tsx +0 -50
- package/src/components/WfoForms/formFields/SubscriptionSummaryField.tsx +0 -74
- package/src/components/WfoForms/formFields/SummaryField.tsx +0 -104
- package/src/components/WfoForms/formFields/SummaryFieldStyling.ts +0 -44
- package/src/components/WfoForms/formFields/TextField.tsx +0 -81
- package/src/components/WfoForms/formFields/commonStyles.ts +0 -32
- package/src/components/WfoForms/formFields/deprecated/ContactPersonAutocomplete.tsx +0 -99
- package/src/components/WfoForms/formFields/deprecated/ContactPersonAutocompleteStyles.ts +0 -41
- package/src/components/WfoForms/formFields/deprecated/ContactPersonNameField.tsx +0 -263
- package/src/components/WfoForms/formFields/deprecated/FileUploadField.tsx +0 -151
- package/src/components/WfoForms/formFields/deprecated/ImsNodeIdField.tsx +0 -109
- package/src/components/WfoForms/formFields/deprecated/ImsPortIdField.tsx +0 -233
- package/src/components/WfoForms/formFields/deprecated/ImsPortIdFieldStyling.ts +0 -17
- package/src/components/WfoForms/formFields/deprecated/IpNetworkField.tsx +0 -105
- package/src/components/WfoForms/formFields/deprecated/IpPrefixTableField.tsx +0 -390
- package/src/components/WfoForms/formFields/deprecated/IpPrefixTableFieldStyling.ts +0 -117
- package/src/components/WfoForms/formFields/deprecated/SplitPrefix.tsx +0 -138
- package/src/components/WfoForms/formFields/deprecated/SplitPrefixStyling.ts +0 -11
- package/src/components/WfoForms/formFields/deprecated/SubscriptionField.tsx +0 -263
- package/src/components/WfoForms/formFields/deprecated/SubscriptionFieldStyling.ts +0 -33
- package/src/components/WfoForms/formFields/deprecated/TimestampField.tsx +0 -110
- package/src/components/WfoForms/formFields/deprecated/VlanField.tsx +0 -300
- package/src/components/WfoForms/formFields/deprecated/index.ts +0 -15
- package/src/components/WfoForms/formFields/deprecated/types.ts +0 -74
- package/src/components/WfoForms/formFields/deprecated/utils.ts +0 -1
- package/src/components/WfoForms/formFields/index.ts +0 -30
- package/src/components/WfoForms/formFields/listFieldStyling.ts +0 -86
- package/src/components/WfoForms/formFields/types.ts +0 -41
- package/src/components/WfoForms/formFields/utils.spec.ts +0 -296
- package/src/components/WfoForms/formFields/utils.ts +0 -69
- package/src/components/WfoForms/index.ts +0 -5
- package/src/components/WfoWorkflowSteps/WfoStep/WfoStepFormOld.tsx +0 -67
- package/src/hooks/deprecated/useGetSurfSubcriptionDropdownOptions.ts +0 -37
- package/src/hooks/deprecated/useIsTaggedPort.ts +0 -25
- package/src/rtk/endpoints/deprecated/index.ts +0 -1
- package/src/rtk/endpoints/deprecated/surfSubscriptionDropdownOptions.ts +0 -53
- package/src/rtk/endpoints/formFields.ts +0 -131
- package/src/rtk/endpoints/ipam.ts +0 -54
- package/src/types/deprecated/SurfSubscriptionDropdownOptionsFilterParams.ts +0 -10
- package/src/types/deprecated/index.ts +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orchestrator-ui/orchestrator-ui-components",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Library of UI Components used to display the workflow orchestrator frontend",
|
|
6
6
|
"author": {
|
|
@@ -54,16 +54,13 @@
|
|
|
54
54
|
"next-query-params": "^5.0.0",
|
|
55
55
|
"object-hash": "^3.0.0",
|
|
56
56
|
"prism-themes": "^1.9.0",
|
|
57
|
-
"pydantic-forms": "^0.
|
|
57
|
+
"pydantic-forms": "^1.0.0",
|
|
58
58
|
"react-diff-view": "^3.2.0",
|
|
59
59
|
"react-draggable": "^4.4.6",
|
|
60
60
|
"react-redux": "^9.1.2",
|
|
61
61
|
"react-select": "^5.8.0",
|
|
62
62
|
"scroll-into-view": "^1.16.2",
|
|
63
63
|
"unidiff": "^1.0.4",
|
|
64
|
-
"uniforms": "^3.8.1",
|
|
65
|
-
"uniforms-bridge-json-schema": "^3.8.1",
|
|
66
|
-
"uniforms-unstyled": "^3.8.1",
|
|
67
64
|
"use-query-params": "2.2.1"
|
|
68
65
|
},
|
|
69
66
|
"devDependencies": {
|
|
@@ -82,11 +79,10 @@
|
|
|
82
79
|
"jest-environment-jsdom": "^30.2.0",
|
|
83
80
|
"jest-watch-typeahead": "^3.0.1",
|
|
84
81
|
"tsup": "^8.5.0",
|
|
85
|
-
"typescript": "^5.5.2"
|
|
86
|
-
"uniforms-bridge-simple-schema-2": "^3.8.1"
|
|
82
|
+
"typescript": "^5.5.2"
|
|
87
83
|
},
|
|
88
84
|
"peerDependencies": {
|
|
89
|
-
"next": "^15.5.
|
|
85
|
+
"next": "^15.5.9",
|
|
90
86
|
"react": "^18.3.1",
|
|
91
87
|
"react-dom": "^18.3.1"
|
|
92
88
|
},
|
|
@@ -8,9 +8,10 @@ import React from 'react';
|
|
|
8
8
|
import { useTranslations } from 'next-intl';
|
|
9
9
|
import { useGetValidationErrors } from 'pydantic-forms';
|
|
10
10
|
|
|
11
|
-
import { getCommonFormFieldStyles } from '@/components';
|
|
12
11
|
import { useWithOrchestratorTheme } from '@/hooks';
|
|
13
12
|
|
|
13
|
+
import { getCommonFormFieldStyles } from './fields/styles';
|
|
14
|
+
|
|
14
15
|
export const RenderFormErrors = () => {
|
|
15
16
|
const { errorStyle } = useWithOrchestratorTheme(getCommonFormFieldStyles);
|
|
16
17
|
|
|
@@ -4,9 +4,11 @@ import type { RowRenderComponent } from 'pydantic-forms';
|
|
|
4
4
|
|
|
5
5
|
import { EuiFormRow, EuiText } from '@elastic/eui';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { getDataTestId } from '@/components';
|
|
8
8
|
import { useWithOrchestratorTheme } from '@/hooks';
|
|
9
9
|
|
|
10
|
+
import { getCommonFormFieldStyles } from './fields/styles';
|
|
11
|
+
|
|
10
12
|
export const Row: RowRenderComponent = ({
|
|
11
13
|
title,
|
|
12
14
|
description,
|
|
@@ -5,14 +5,12 @@ import type { PydanticFormElement } from 'pydantic-forms';
|
|
|
5
5
|
|
|
6
6
|
import { EuiFlexItem, EuiFormRow, EuiText } from '@elastic/eui';
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
getCommonFormFieldStyles,
|
|
10
|
-
getNestedSummaryLabel,
|
|
11
|
-
summaryFieldStyles,
|
|
12
|
-
} from '@/components';
|
|
13
8
|
import { useWithOrchestratorTheme } from '@/hooks';
|
|
14
9
|
import { snakeToHuman } from '@/utils';
|
|
15
10
|
|
|
11
|
+
import { getCommonFormFieldStyles, summaryFieldStyles } from './styles';
|
|
12
|
+
import { getNestedSummaryLabel } from './wfoPydanticFormUtils';
|
|
13
|
+
|
|
16
14
|
export const WfoSummary: PydanticFormElement = ({ pydanticFormField }) => {
|
|
17
15
|
const { summaryFieldStyle } = useWithOrchestratorTheme(summaryFieldStyles);
|
|
18
16
|
const { formRowStyle } = useWithOrchestratorTheme(getCommonFormFieldStyles);
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { css } from '@emotion/react';
|
|
2
2
|
|
|
3
|
+
import type { WfoTheme } from '@/hooks';
|
|
4
|
+
|
|
3
5
|
export const getWfoObjectFieldStyles = () => {
|
|
4
6
|
const wfoObjectFieldStyles = css({
|
|
5
7
|
width: '100%',
|
|
@@ -11,3 +13,73 @@ export const getWfoObjectFieldStyles = () => {
|
|
|
11
13
|
wfoObjectFieldStyles,
|
|
12
14
|
};
|
|
13
15
|
};
|
|
16
|
+
|
|
17
|
+
export const getCommonFormFieldStyles = ({ theme }: WfoTheme) => {
|
|
18
|
+
const formRowStyle = css({
|
|
19
|
+
marginBottom: theme.base * 2,
|
|
20
|
+
|
|
21
|
+
'.euiText': {
|
|
22
|
+
color: theme.colors.text,
|
|
23
|
+
},
|
|
24
|
+
'.euiFormLabel': {
|
|
25
|
+
color: theme.colors.text,
|
|
26
|
+
cursor: 'text',
|
|
27
|
+
'&.euiFormLabel-isFocused': {
|
|
28
|
+
color: theme.colors.primaryText,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
'.euiFormRow__labelWrapper': {
|
|
32
|
+
display: 'flex',
|
|
33
|
+
flexDirection: 'column',
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const errorStyle = css({
|
|
38
|
+
color: theme.colors.dangerText,
|
|
39
|
+
});
|
|
40
|
+
return {
|
|
41
|
+
errorStyle,
|
|
42
|
+
formRowStyle,
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const summaryFieldStyles = ({ theme }: WfoTheme) => {
|
|
47
|
+
const summaryFieldStyle = css({
|
|
48
|
+
'div.emailMessage': {
|
|
49
|
+
td: {
|
|
50
|
+
color: theme.colors.textParagraph,
|
|
51
|
+
},
|
|
52
|
+
p: {
|
|
53
|
+
color: theme.colors.textParagraph,
|
|
54
|
+
},
|
|
55
|
+
html: {
|
|
56
|
+
marginLeft: '-10px',
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
'section.table-summary': {
|
|
60
|
+
marginTop: '20px',
|
|
61
|
+
width: '100%',
|
|
62
|
+
td: {
|
|
63
|
+
padding: '10px',
|
|
64
|
+
verticalAlign: 'top',
|
|
65
|
+
},
|
|
66
|
+
'td:not(:first-child):not(:last-child)': {
|
|
67
|
+
borderRight: `1px solid ${theme.colors.borderBasePlain}`,
|
|
68
|
+
},
|
|
69
|
+
'.label': {
|
|
70
|
+
fontWeight: 'bold',
|
|
71
|
+
color: theme.colors.backgroundBaseSubdued,
|
|
72
|
+
backgroundColor: theme.colors.primary,
|
|
73
|
+
borderRight: `2px solid ${theme.colors.borderBasePlain}`,
|
|
74
|
+
borderBottom: `1px solid ${theme.colors.borderBasePlain}`,
|
|
75
|
+
},
|
|
76
|
+
'.value': {
|
|
77
|
+
backgroundColor: theme.colors.backgroundBasePrimary,
|
|
78
|
+
borderBottom: `1px solid ${theme.colors.borderBasePlain}`,
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
return {
|
|
83
|
+
summaryFieldStyle: summaryFieldStyle,
|
|
84
|
+
};
|
|
85
|
+
};
|
|
@@ -9,16 +9,10 @@ import {
|
|
|
9
9
|
WfoMonacoCodeBlock,
|
|
10
10
|
WfoTableCodeBlock,
|
|
11
11
|
} from '@/components';
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
useGetOrchestratorConfig,
|
|
15
|
-
useOrchestratorTheme,
|
|
16
|
-
useWithOrchestratorTheme,
|
|
17
|
-
} from '@/hooks';
|
|
12
|
+
import { useOrchestratorTheme, useWithOrchestratorTheme } from '@/hooks';
|
|
18
13
|
import { WfoChevronDown, WfoChevronUp } from '@/icons';
|
|
19
|
-
import type { EmailState } from '@/types';
|
|
14
|
+
import type { EmailState, FormUserPermissions } from '@/types';
|
|
20
15
|
import { StepStatus } from '@/types';
|
|
21
|
-
import { FormUserPermissions } from '@/types/forms';
|
|
22
16
|
import { calculateTimeDifference, formatDate } from '@/utils';
|
|
23
17
|
|
|
24
18
|
import { WfoStepStatusIcon } from '../WfoStepStatusIcon';
|
|
@@ -55,8 +49,6 @@ export const WfoStep = React.forwardRef(
|
|
|
55
49
|
}: WfoStepProps,
|
|
56
50
|
ref: LegacyRef<HTMLDivElement>,
|
|
57
51
|
) => {
|
|
58
|
-
const config = useGetOrchestratorConfig();
|
|
59
|
-
const usePydanticForms: boolean = config.activatePydanticForms ?? false;
|
|
60
52
|
const { isExpanded, step, userInputForm } = stepListItem;
|
|
61
53
|
const [codeView, setCodeView] = useState<CodeView>(CodeView.JSON);
|
|
62
54
|
|
|
@@ -213,23 +205,14 @@ export const WfoStep = React.forwardRef(
|
|
|
213
205
|
)}
|
|
214
206
|
</div>
|
|
215
207
|
)}
|
|
216
|
-
{step.status === StepStatus.SUSPEND &&
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
/>
|
|
225
|
-
) : (
|
|
226
|
-
<WfoStepFormOld
|
|
227
|
-
userInputForm={userInputForm}
|
|
228
|
-
isTask={isTask}
|
|
229
|
-
processId={processId}
|
|
230
|
-
userPermissions={userPermissions}
|
|
231
|
-
/>
|
|
232
|
-
))}
|
|
208
|
+
{step.status === StepStatus.SUSPEND && userInputForm && (
|
|
209
|
+
<WfoStepForm
|
|
210
|
+
userInputForm={userInputForm}
|
|
211
|
+
isTask={isTask}
|
|
212
|
+
processId={processId ?? ''}
|
|
213
|
+
userPermissions={userPermissions}
|
|
214
|
+
/>
|
|
215
|
+
)}
|
|
233
216
|
</EuiPanel>
|
|
234
217
|
</div>
|
|
235
218
|
);
|
|
@@ -9,7 +9,7 @@ import { StepFormFooter } from '@/components/WfoWorkflowSteps/WfoStep/WfoStepFor
|
|
|
9
9
|
import { useOrchestratorTheme } from '@/hooks';
|
|
10
10
|
import { HttpStatus } from '@/rtk';
|
|
11
11
|
import { useResumeProcessMutation } from '@/rtk/endpoints/forms';
|
|
12
|
-
import { FormUserPermissions, InputForm } from '@/types
|
|
12
|
+
import { FormUserPermissions, InputForm } from '@/types';
|
|
13
13
|
|
|
14
14
|
interface WfoStepFormProps {
|
|
15
15
|
userInputForm: InputForm;
|
package/src/components/index.ts
CHANGED
|
@@ -14,7 +14,6 @@ export * from './WfoTable';
|
|
|
14
14
|
export * from './WfoTimeline';
|
|
15
15
|
export * from './WfoLoading';
|
|
16
16
|
export * from './WfoToastsList';
|
|
17
|
-
export * from './WfoForms';
|
|
18
17
|
export * from './WfoDateTime';
|
|
19
18
|
export * from './WfoAuth';
|
|
20
19
|
export * from './WfoDropdownButton';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const ORCHESTRATOR_UI_LIBRARY_VERSION = '
|
|
1
|
+
export const ORCHESTRATOR_UI_LIBRARY_VERSION = '7.0.0';
|
|
@@ -18,7 +18,6 @@ export const emptyOrchestratorConfig: OrchestratorConfig = {
|
|
|
18
18
|
supportMenuItemUrl: '',
|
|
19
19
|
enableAoStackStatus: false,
|
|
20
20
|
aoStackStatusUrl: '',
|
|
21
|
-
activatePydanticForms: false,
|
|
22
21
|
};
|
|
23
22
|
|
|
24
23
|
export const OrchestratorConfigContext = createContext<OrchestratorConfig>(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useMemo, useState } from 'react';
|
|
2
2
|
|
|
3
3
|
import { JSONSchema6 } from 'json-schema';
|
|
4
4
|
import { useTranslations } from 'next-intl';
|
|
@@ -12,28 +12,17 @@ import {
|
|
|
12
12
|
EuiText,
|
|
13
13
|
} from '@elastic/eui';
|
|
14
14
|
|
|
15
|
-
import {
|
|
16
|
-
import { UserInputFormWizard } from '@/components/WfoForms/UserInputFormWizard';
|
|
15
|
+
import { WfoError, WfoLoading } from '@/components';
|
|
17
16
|
import { WfoPydanticForm } from '@/components/WfoPydanticForm';
|
|
18
17
|
import { WfoStepStatusIcon } from '@/components/WfoWorkflowSteps';
|
|
19
18
|
import { getWorkflowStepsStyles } from '@/components/WfoWorkflowSteps/styles';
|
|
20
19
|
import { useOrchestratorTheme, useWithOrchestratorTheme } from '@/hooks';
|
|
21
|
-
import { useGetOrchestratorConfig } from '@/hooks';
|
|
22
20
|
import {
|
|
23
|
-
HttpStatus,
|
|
24
|
-
handlePromiseErrorWithCallback,
|
|
25
21
|
useGetDescriptionForWorkflowNameQuery,
|
|
26
22
|
useGetTimeLineItemsQuery,
|
|
27
23
|
} from '@/rtk';
|
|
28
24
|
import { useGetSubscriptionDetailQuery } from '@/rtk';
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
EngineStatus,
|
|
32
|
-
ProcessDetail,
|
|
33
|
-
ProcessStatus,
|
|
34
|
-
StepStatus,
|
|
35
|
-
} from '@/types';
|
|
36
|
-
import { FormNotCompleteResponse } from '@/types/forms';
|
|
25
|
+
import { ProcessDetail, ProcessStatus, StepStatus } from '@/types';
|
|
37
26
|
|
|
38
27
|
import { WfoProcessDetail } from './WfoProcessDetail';
|
|
39
28
|
|
|
@@ -89,13 +78,10 @@ export const WfoStartProcessPage = ({
|
|
|
89
78
|
processName,
|
|
90
79
|
isTask = false,
|
|
91
80
|
}: WfoStartProcessPageProps) => {
|
|
92
|
-
const config = useGetOrchestratorConfig();
|
|
93
|
-
const usePydanticForms: boolean = config.activatePydanticForms ?? false;
|
|
94
81
|
const t = useTranslations('processes.steps');
|
|
95
82
|
const router = useRouter();
|
|
96
83
|
const [hasError, setHasError] = useState<boolean>(false);
|
|
97
84
|
const { theme } = useOrchestratorTheme();
|
|
98
|
-
const [form, setForm] = useState<UserInputForm>({});
|
|
99
85
|
const { productId, subscriptionId } = router.query as StartProcessPageQuery;
|
|
100
86
|
|
|
101
87
|
const {
|
|
@@ -114,8 +100,6 @@ export const WfoStartProcessPage = ({
|
|
|
114
100
|
workflowName: processName,
|
|
115
101
|
});
|
|
116
102
|
|
|
117
|
-
const [startProcess] = useStartProcessMutation();
|
|
118
|
-
|
|
119
103
|
const startProcessPayload = useMemo(
|
|
120
104
|
() =>
|
|
121
105
|
getInitialProcessPayload({
|
|
@@ -125,8 +109,6 @@ export const WfoStartProcessPage = ({
|
|
|
125
109
|
[productId, subscriptionId],
|
|
126
110
|
);
|
|
127
111
|
|
|
128
|
-
const { stepUserInput, hasNext } = form;
|
|
129
|
-
|
|
130
112
|
const { getStepHeaderStyle, stepListContentBoldTextStyle } =
|
|
131
113
|
useWithOrchestratorTheme(getWorkflowStepsStyles);
|
|
132
114
|
|
|
@@ -145,76 +127,6 @@ export const WfoStartProcessPage = ({
|
|
|
145
127
|
}
|
|
146
128
|
}
|
|
147
129
|
|
|
148
|
-
const submit = useCallback(
|
|
149
|
-
(processInput: object[]) => {
|
|
150
|
-
const startProcessPromise = startProcess({
|
|
151
|
-
workflowName: processName,
|
|
152
|
-
userInputs: startProcessPayload
|
|
153
|
-
? [startProcessPayload, ...processInput]
|
|
154
|
-
: [...processInput],
|
|
155
|
-
})
|
|
156
|
-
.unwrap()
|
|
157
|
-
.then(
|
|
158
|
-
(process) => {
|
|
159
|
-
if (process.id) {
|
|
160
|
-
const basePath = isTask
|
|
161
|
-
? PATH_TASKS
|
|
162
|
-
: PATH_WORKFLOWS;
|
|
163
|
-
router.replace(`${basePath}/${process.id}`);
|
|
164
|
-
}
|
|
165
|
-
},
|
|
166
|
-
// Reject handler
|
|
167
|
-
(e) => {
|
|
168
|
-
throw e;
|
|
169
|
-
},
|
|
170
|
-
)
|
|
171
|
-
.catch((error) => {
|
|
172
|
-
if (error?.status !== HttpStatus.FormNotComplete) {
|
|
173
|
-
if (error?.status === HttpStatus.BadRequest) {
|
|
174
|
-
// Rethrow the error so userInputForm can catch it and display validation errors
|
|
175
|
-
throw error;
|
|
176
|
-
}
|
|
177
|
-
console.error(error);
|
|
178
|
-
setHasError(true);
|
|
179
|
-
} else {
|
|
180
|
-
throw error;
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
// Catch a 503: Service unavailable error indicating the engine is down. This rethrows other errors
|
|
185
|
-
// if it's not 503 so we can catch the special 510 error in the catchErrorStatus call in the useEffect hook
|
|
186
|
-
return handlePromiseErrorWithCallback<EngineStatus>(
|
|
187
|
-
startProcessPromise,
|
|
188
|
-
HttpStatus.ServiceUnavailable,
|
|
189
|
-
(json) => {
|
|
190
|
-
// TODO: Use the toastMessage hook to display an engine down error message
|
|
191
|
-
console.error('engine down!!!', json);
|
|
192
|
-
router.push(PATH_WORKFLOWS);
|
|
193
|
-
},
|
|
194
|
-
);
|
|
195
|
-
},
|
|
196
|
-
[startProcess, processName, startProcessPayload, isTask, router],
|
|
197
|
-
);
|
|
198
|
-
|
|
199
|
-
useEffect(() => {
|
|
200
|
-
if (processName && !usePydanticForms) {
|
|
201
|
-
const clientResultCallback = (json: FormNotCompleteResponse) => {
|
|
202
|
-
setForm({
|
|
203
|
-
stepUserInput: json.form,
|
|
204
|
-
hasNext: json.meta?.hasNext ?? false,
|
|
205
|
-
});
|
|
206
|
-
};
|
|
207
|
-
handlePromiseErrorWithCallback<FormNotCompleteResponse>(
|
|
208
|
-
submit([]),
|
|
209
|
-
HttpStatus.FormNotComplete,
|
|
210
|
-
clientResultCallback,
|
|
211
|
-
);
|
|
212
|
-
return () => {
|
|
213
|
-
setForm({});
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
}, [submit, processName, usePydanticForms]);
|
|
217
|
-
|
|
218
130
|
const processDetail: Partial<ProcessDetail> = {
|
|
219
131
|
lastStatus: ProcessStatus.CREATE,
|
|
220
132
|
lastStep: StepStatus.FORM,
|
|
@@ -266,27 +178,13 @@ export const WfoStartProcessPage = ({
|
|
|
266
178
|
</EuiFlexItem>
|
|
267
179
|
</EuiFlexGroup>
|
|
268
180
|
<EuiHorizontalRule />
|
|
269
|
-
{(hasError && <WfoError />) ||
|
|
270
|
-
(usePydanticForms && (
|
|
181
|
+
{(hasError && <WfoError />) || (
|
|
271
182
|
<WfoPydanticForm
|
|
272
183
|
processName={processName}
|
|
273
184
|
startProcessPayload={startProcessPayload}
|
|
274
185
|
isTask={isTask}
|
|
275
186
|
/>
|
|
276
|
-
)
|
|
277
|
-
(stepUserInput && (
|
|
278
|
-
<UserInputFormWizard
|
|
279
|
-
stepUserInput={stepUserInput}
|
|
280
|
-
stepSubmit={submit}
|
|
281
|
-
cancel={() =>
|
|
282
|
-
router.push(
|
|
283
|
-
isTask ? PATH_TASKS : PATH_WORKFLOWS,
|
|
284
|
-
)
|
|
285
|
-
}
|
|
286
|
-
hasNext={hasNext}
|
|
287
|
-
isTask={isTask}
|
|
288
|
-
/>
|
|
289
|
-
)) || <WfoLoading />}
|
|
187
|
+
) || <WfoLoading />}
|
|
290
188
|
</EuiPanel>
|
|
291
189
|
</WfoProcessDetail>
|
|
292
190
|
);
|
|
@@ -17,8 +17,6 @@ export * from './subscriptionInUseByRelationsList';
|
|
|
17
17
|
export * from './subscriptionList';
|
|
18
18
|
export * from './subscriptionListSummary';
|
|
19
19
|
export * from './forms';
|
|
20
|
-
export * from './deprecated';
|
|
21
|
-
export * from './formFields';
|
|
22
20
|
export * from './fileUpload';
|
|
23
21
|
export * from './search';
|
|
24
22
|
export * from './availability';
|
package/src/types/index.ts
CHANGED
package/src/types/types.ts
CHANGED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { Context, GuaranteedProps } from 'uniforms';
|
|
2
|
-
import { AutoField } from 'uniforms-unstyled';
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
AcceptField,
|
|
6
|
-
BoolField,
|
|
7
|
-
ConnectedSelectField,
|
|
8
|
-
ContactPersonNameField,
|
|
9
|
-
CustomerField,
|
|
10
|
-
DateField,
|
|
11
|
-
DividerField,
|
|
12
|
-
FileUploadField,
|
|
13
|
-
ImsNodeIdField,
|
|
14
|
-
ImsPortIdField,
|
|
15
|
-
IpNetworkField,
|
|
16
|
-
LabelField,
|
|
17
|
-
ListField,
|
|
18
|
-
LocationCodeField,
|
|
19
|
-
LongTextField,
|
|
20
|
-
NestField,
|
|
21
|
-
NumField,
|
|
22
|
-
OptGroupField,
|
|
23
|
-
RadioField,
|
|
24
|
-
SubscriptionField,
|
|
25
|
-
SubscriptionSummaryField,
|
|
26
|
-
SummaryField,
|
|
27
|
-
TextField,
|
|
28
|
-
TimestampField,
|
|
29
|
-
VlanField,
|
|
30
|
-
} from './formFields';
|
|
31
|
-
|
|
32
|
-
export function autoFieldFunction(
|
|
33
|
-
props: GuaranteedProps<unknown> & Record<string, unknown>,
|
|
34
|
-
uniforms: Context<Record<string, unknown>>,
|
|
35
|
-
) {
|
|
36
|
-
const { allowedValues, checkboxes, fieldType, field } = props;
|
|
37
|
-
const { format } = field;
|
|
38
|
-
|
|
39
|
-
/*
|
|
40
|
-
Note, uniforms adds the fieldType property with one of the primitive types (Number, String..) based on the value of "type" in
|
|
41
|
-
node_modules/uniforms-bridge-json-schema/src/JSONSchemaBridge.ts. The only exception being dateFields where it matches on the
|
|
42
|
-
"format" field being "date-time" to populate fieldType with a Date constructor
|
|
43
|
-
*/
|
|
44
|
-
switch (fieldType) {
|
|
45
|
-
case Number:
|
|
46
|
-
switch (format) {
|
|
47
|
-
case 'imsPortId': // Deprecated
|
|
48
|
-
return ImsPortIdField;
|
|
49
|
-
case 'imsNodeId': // Deprecated
|
|
50
|
-
return ImsNodeIdField;
|
|
51
|
-
case 'timestamp':
|
|
52
|
-
return TimestampField; // Deprecated
|
|
53
|
-
}
|
|
54
|
-
break;
|
|
55
|
-
case Object:
|
|
56
|
-
switch (format) {
|
|
57
|
-
case 'optGroup':
|
|
58
|
-
return OptGroupField;
|
|
59
|
-
case 'summary':
|
|
60
|
-
return SummaryField;
|
|
61
|
-
}
|
|
62
|
-
break;
|
|
63
|
-
case String:
|
|
64
|
-
switch (format) {
|
|
65
|
-
case 'subscriptionId':
|
|
66
|
-
return SubscriptionField;
|
|
67
|
-
case 'long':
|
|
68
|
-
return LongTextField;
|
|
69
|
-
case 'label':
|
|
70
|
-
return LabelField;
|
|
71
|
-
case 'divider':
|
|
72
|
-
return DividerField;
|
|
73
|
-
case 'summary':
|
|
74
|
-
return SummaryField;
|
|
75
|
-
case 'subscription':
|
|
76
|
-
return SubscriptionSummaryField;
|
|
77
|
-
case 'customerId':
|
|
78
|
-
return CustomerField;
|
|
79
|
-
case 'locationCode':
|
|
80
|
-
return LocationCodeField;
|
|
81
|
-
case 'contactPersonName': // Deprecated
|
|
82
|
-
return ContactPersonNameField;
|
|
83
|
-
case 'vlan': // Deprecated
|
|
84
|
-
return VlanField;
|
|
85
|
-
case 'accept':
|
|
86
|
-
return AcceptField;
|
|
87
|
-
case 'ipvanynetwork': // Deprecated
|
|
88
|
-
return IpNetworkField;
|
|
89
|
-
case 'file': // Deprecated
|
|
90
|
-
return FileUploadField;
|
|
91
|
-
}
|
|
92
|
-
break;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
if (allowedValues && format !== 'accept') {
|
|
96
|
-
return checkboxes && fieldType !== Array
|
|
97
|
-
? RadioField
|
|
98
|
-
: ConnectedSelectField;
|
|
99
|
-
} else {
|
|
100
|
-
switch (fieldType) {
|
|
101
|
-
case Array:
|
|
102
|
-
return ListField;
|
|
103
|
-
case Boolean:
|
|
104
|
-
return BoolField;
|
|
105
|
-
case Number:
|
|
106
|
-
return NumField;
|
|
107
|
-
case Object:
|
|
108
|
-
return NestField;
|
|
109
|
-
case String:
|
|
110
|
-
return TextField;
|
|
111
|
-
case Date:
|
|
112
|
-
// See the note at line above about how Date fields are matched on the "format" field instead of "type" like other fields
|
|
113
|
-
return DateField;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
return AutoField.defaultComponentDetector(props, uniforms);
|
|
118
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2019-2023 SURF.
|
|
3
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
* you may not use this file except in compliance with the License.
|
|
5
|
-
* You may obtain a copy of the License at
|
|
6
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
*
|
|
8
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
* See the License for the specific language governing permissions and
|
|
12
|
-
* limitations under the License.
|
|
13
|
-
*
|
|
14
|
-
*/
|
|
15
|
-
import { ComponentType, createElement } from 'react';
|
|
16
|
-
|
|
17
|
-
import { useForm } from 'uniforms';
|
|
18
|
-
import { AutoField } from 'uniforms-unstyled';
|
|
19
|
-
|
|
20
|
-
export type AutoFieldsProps = {
|
|
21
|
-
autoField?: ComponentType<{ className: string; name: string }>;
|
|
22
|
-
element?: ComponentType<object> | string;
|
|
23
|
-
fields?: string[];
|
|
24
|
-
omitFields?: string[];
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export default function AutoFields({
|
|
28
|
-
autoField = AutoField,
|
|
29
|
-
element = 'section',
|
|
30
|
-
fields,
|
|
31
|
-
omitFields = [],
|
|
32
|
-
...props
|
|
33
|
-
}: AutoFieldsProps) {
|
|
34
|
-
const { schema } = useForm();
|
|
35
|
-
|
|
36
|
-
return createElement(
|
|
37
|
-
element,
|
|
38
|
-
{ ...props },
|
|
39
|
-
(fields ?? schema.getSubfields())
|
|
40
|
-
.filter((field) => !omitFields.includes(field))
|
|
41
|
-
.map((field) =>
|
|
42
|
-
createElement(autoField, {
|
|
43
|
-
key: field,
|
|
44
|
-
name: field,
|
|
45
|
-
className: 'form-input',
|
|
46
|
-
}),
|
|
47
|
-
),
|
|
48
|
-
);
|
|
49
|
-
}
|