@orchestrator-ui/orchestrator-ui-components 6.8.0 → 7.0.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 +8 -8
- package/.turbo/turbo-lint.log +5 -2
- package/.turbo/turbo-test.log +9 -10
- package/CHANGELOG.md +19 -0
- package/dist/index.d.ts +164 -4306
- package/dist/index.js +1739 -5747
- package/dist/index.js.map +1 -1
- package/package.json +4 -8
- package/src/components/WfoPydanticForm/Footer.tsx +33 -6
- package/src/components/WfoPydanticForm/RenderFormErrors.tsx +2 -1
- package/src/components/WfoPydanticForm/Row.tsx +3 -1
- package/src/components/WfoPydanticForm/fields/WfoInteger.tsx +5 -1
- package/src/components/WfoPydanticForm/fields/WfoSummary.tsx +3 -5
- package/src/components/WfoPydanticForm/fields/styles.ts +72 -0
- package/src/components/WfoSearchPage/WfoSearch/WfoSearch.tsx +42 -54
- package/src/components/WfoSearchPage/utils.ts +9 -1
- 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/hooks/useSearch.ts +12 -2
- package/src/hooks/useSearchPagination.ts +4 -0
- package/src/messages/en-GB.json +5 -3
- package/src/pages/processes/WfoStartProcessPage.tsx +5 -107
- package/src/rtk/endpoints/index.ts +0 -2
- package/src/rtk/endpoints/search.ts +13 -4
- package/src/types/index.ts +0 -1
- package/src/types/search.ts +7 -0
- 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
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export * from './ContactPersonAutocomplete';
|
|
2
|
-
export * from './ContactPersonAutocompleteStyles';
|
|
3
|
-
export * from './ContactPersonNameField';
|
|
4
|
-
export * from './ImsNodeIdField';
|
|
5
|
-
export * from './ImsPortIdField';
|
|
6
|
-
export * from './ImsPortIdFieldStyling';
|
|
7
|
-
export * from './IpNetworkField';
|
|
8
|
-
export * from './IpPrefixTableFieldStyling';
|
|
9
|
-
export * from './SplitPrefixStyling';
|
|
10
|
-
export * from './TimestampField';
|
|
11
|
-
export * from './VlanField';
|
|
12
|
-
export * from './FileUploadField';
|
|
13
|
-
export * from './types';
|
|
14
|
-
export * from './utils';
|
|
15
|
-
export * from './SubscriptionField';
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { GraphQlSinglePage, Subscription } from '@/types';
|
|
2
|
-
|
|
3
|
-
export interface ServicePort {
|
|
4
|
-
subscription_id?: string;
|
|
5
|
-
vlan?: string;
|
|
6
|
-
bandwidth?: number;
|
|
7
|
-
nonremovable?: boolean;
|
|
8
|
-
modifiable?: boolean;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export enum PortMode {
|
|
12
|
-
TAGGED = 'tagged',
|
|
13
|
-
UNTAGGED = 'untagged',
|
|
14
|
-
LINK_MEMBER = 'link_member',
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export enum ProductTag {
|
|
18
|
-
MSC = 'MSC',
|
|
19
|
-
MSCNL = 'MSCNL',
|
|
20
|
-
IRBSP = 'IRBSP',
|
|
21
|
-
SP = 'SP',
|
|
22
|
-
SPNL = 'SPNL',
|
|
23
|
-
AGGSP = 'AGGSP',
|
|
24
|
-
AGGSPNL = 'AGGSPNL',
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface ImsPort {
|
|
28
|
-
id: number;
|
|
29
|
-
line_name: string;
|
|
30
|
-
node: string;
|
|
31
|
-
port: string;
|
|
32
|
-
iface_type: string;
|
|
33
|
-
patchposition: string;
|
|
34
|
-
status: string;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface ImsNode {
|
|
38
|
-
id: number;
|
|
39
|
-
name: string;
|
|
40
|
-
status: string;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export interface SortOption<nameStrings = string> {
|
|
44
|
-
name: nameStrings;
|
|
45
|
-
descending: boolean;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export interface IpPrefix {
|
|
49
|
-
id: number;
|
|
50
|
-
prefix: string;
|
|
51
|
-
version: number;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export interface IpBlock {
|
|
55
|
-
id: number;
|
|
56
|
-
prefix: string;
|
|
57
|
-
ip_network: string;
|
|
58
|
-
description: string;
|
|
59
|
-
state: number;
|
|
60
|
-
parent: number;
|
|
61
|
-
version: number;
|
|
62
|
-
parent_ipam_id: number;
|
|
63
|
-
is_subnet: boolean;
|
|
64
|
-
state_repr: string;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export type NodeSubscriptionOption = Pick<
|
|
68
|
-
Subscription,
|
|
69
|
-
'subscriptionId' | 'description'
|
|
70
|
-
>;
|
|
71
|
-
|
|
72
|
-
export interface NodeSubscriptionOptionsResult {
|
|
73
|
-
subscriptions: GraphQlSinglePage<NodeSubscriptionOption>;
|
|
74
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const ipamStates = ['Free', 'Allocated', null, 'Planned', null, null];
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export * from './AcceptField';
|
|
2
|
-
export * from './BoolField';
|
|
3
|
-
export * from './DividerField';
|
|
4
|
-
export * from './ErrorField';
|
|
5
|
-
export * from './ErrorsField';
|
|
6
|
-
export * from './LabelField';
|
|
7
|
-
export * from './ListAddField';
|
|
8
|
-
export * from './ListDelField';
|
|
9
|
-
export * from './ListField';
|
|
10
|
-
export * from './ListSelectField';
|
|
11
|
-
export * from './LongTextField';
|
|
12
|
-
export * from './NumField';
|
|
13
|
-
export * from './RadioField';
|
|
14
|
-
export * from './SelectField';
|
|
15
|
-
export * from './SubmitField';
|
|
16
|
-
export * from './SubscriptionSummaryField';
|
|
17
|
-
export * from './TextField';
|
|
18
|
-
export * from './DateField';
|
|
19
|
-
export * from './LocationCodeField';
|
|
20
|
-
export * from './deprecated';
|
|
21
|
-
export * from './NestField';
|
|
22
|
-
export * from './OptGroupField';
|
|
23
|
-
export * from './SummaryField';
|
|
24
|
-
export * from './CustomerField';
|
|
25
|
-
export * from './ConnectedSelectField';
|
|
26
|
-
export * from './deprecated/FileUploadField';
|
|
27
|
-
export * from './commonStyles';
|
|
28
|
-
export * from './types';
|
|
29
|
-
export * from './SummaryFieldStyling';
|
|
30
|
-
export * from './AcceptFieldStyling';
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { css } from '@emotion/react';
|
|
2
|
-
|
|
3
|
-
export const listFieldStyling = css`
|
|
4
|
-
.list-field {
|
|
5
|
-
ul {
|
|
6
|
-
display: flex;
|
|
7
|
-
flex-direction: column;
|
|
8
|
-
flex-wrap: wrap;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
li {
|
|
12
|
-
margin-top: -15px;
|
|
13
|
-
list-style: none;
|
|
14
|
-
width: 100%;
|
|
15
|
-
display: flex;
|
|
16
|
-
flex-wrap: wrap;
|
|
17
|
-
margin-left: 8px;
|
|
18
|
-
|
|
19
|
-
// We use '>' because we don't want the outer list to influence the inner list
|
|
20
|
-
> section {
|
|
21
|
-
display: flex;
|
|
22
|
-
flex-grow: 20;
|
|
23
|
-
flex-direction: column;
|
|
24
|
-
|
|
25
|
-
// We use '>' because we don't want the outer list to influence the inner list
|
|
26
|
-
& > * {
|
|
27
|
-
display: flex;
|
|
28
|
-
flex-direction: column;
|
|
29
|
-
width: 99%;
|
|
30
|
-
margin-left: 5px;
|
|
31
|
-
&:first-of-type {
|
|
32
|
-
margin-left: 0;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
div.add-item,
|
|
38
|
-
div.del-item {
|
|
39
|
-
display: flex;
|
|
40
|
-
align-items: center;
|
|
41
|
-
align-self: baseline;
|
|
42
|
-
margin: 5px;
|
|
43
|
-
margin-bottom: 30px;
|
|
44
|
-
cursor: pointer;
|
|
45
|
-
|
|
46
|
-
&[id$='0.remove'] {
|
|
47
|
-
margin-top: 15px;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
label {
|
|
51
|
-
display: block;
|
|
52
|
-
margin-left: 5px;
|
|
53
|
-
cursor: pointer;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
.nest-field + div.del-item[id$='0.remove'] {
|
|
57
|
-
margin-top: 33px;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
div.del-item {
|
|
61
|
-
margin-top: 13px;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
div.add-item {
|
|
65
|
-
align-self: flex-end;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// Used for nested lists (L2VPN)
|
|
69
|
-
&.outer-list {
|
|
70
|
-
// We use '>' because we don't want the outer list to influence the inner list
|
|
71
|
-
> ul > div.add-item {
|
|
72
|
-
align-self: flex-start;
|
|
73
|
-
padding: 0 2px 0 0;
|
|
74
|
-
align-items: center;
|
|
75
|
-
}
|
|
76
|
-
// We use '>' because we don't want the outer list to influence the inner list
|
|
77
|
-
> ul > li > div.del-item {
|
|
78
|
-
align-self: flex-start;
|
|
79
|
-
}
|
|
80
|
-
// We use '>' because we don't want the outer list to influence the inner list
|
|
81
|
-
> ul > li {
|
|
82
|
-
flex-direction: column;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
`;
|
|
@@ -1,41 +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 { Ref } from 'react';
|
|
16
|
-
|
|
17
|
-
import { HTMLFieldProps } from 'uniforms';
|
|
18
|
-
|
|
19
|
-
export type FieldProps<
|
|
20
|
-
Value,
|
|
21
|
-
Extra = object,
|
|
22
|
-
InputElementType = HTMLInputElement,
|
|
23
|
-
ElementType = HTMLDivElement,
|
|
24
|
-
> = HTMLFieldProps<
|
|
25
|
-
Value,
|
|
26
|
-
ElementType,
|
|
27
|
-
{
|
|
28
|
-
inputRef?: Ref<InputElementType>;
|
|
29
|
-
description?: string;
|
|
30
|
-
} & Extra
|
|
31
|
-
>;
|
|
32
|
-
|
|
33
|
-
export interface ContactPerson {
|
|
34
|
-
name: string;
|
|
35
|
-
email: string;
|
|
36
|
-
phone?: string;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export function prop<T, K extends keyof T>(obj: T, key: K): T[K] {
|
|
40
|
-
return obj[key];
|
|
41
|
-
}
|
|
@@ -1,296 +0,0 @@
|
|
|
1
|
-
import type { ProductBlockInstance, SubscriptionDetail } from '@/types';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
ProcessStatus,
|
|
5
|
-
ProductLifecycleStatus,
|
|
6
|
-
SubscriptionStatus,
|
|
7
|
-
WorkflowTarget,
|
|
8
|
-
} from '../../../types';
|
|
9
|
-
import { ProductTag } from './deprecated/types';
|
|
10
|
-
import {
|
|
11
|
-
getPortMode,
|
|
12
|
-
subscriptionHasTaggedPortModeInstanceValue,
|
|
13
|
-
subscriptionHasTaggedProduct,
|
|
14
|
-
} from './utils';
|
|
15
|
-
|
|
16
|
-
const getProductBlockInstance = (
|
|
17
|
-
instanceProperties: Partial<ProductBlockInstance> = {},
|
|
18
|
-
): ProductBlockInstance => ({
|
|
19
|
-
id: 1,
|
|
20
|
-
parent: 0,
|
|
21
|
-
productBlockInstanceValues: [],
|
|
22
|
-
subscriptionInstanceId: 'testId',
|
|
23
|
-
inUseByRelations: [],
|
|
24
|
-
subscription: {
|
|
25
|
-
subscriptionId: 'OwnerSubscriptionId',
|
|
26
|
-
description: 'OwnerSubscription description',
|
|
27
|
-
},
|
|
28
|
-
...instanceProperties,
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
const testProductBlockInstances: ProductBlockInstance[] = [
|
|
32
|
-
getProductBlockInstance(),
|
|
33
|
-
];
|
|
34
|
-
|
|
35
|
-
const testSubscriptionDetail: SubscriptionDetail = {
|
|
36
|
-
subscriptionId: 'testId',
|
|
37
|
-
description: 'test description',
|
|
38
|
-
insync: false,
|
|
39
|
-
note: 'test note',
|
|
40
|
-
fixedInputs: [],
|
|
41
|
-
product: {
|
|
42
|
-
productId: 'testId',
|
|
43
|
-
createdAt: '999-09-09',
|
|
44
|
-
name: 'Test product name',
|
|
45
|
-
status: ProductLifecycleStatus.ACTIVE,
|
|
46
|
-
description: 'Test product description',
|
|
47
|
-
tag: '',
|
|
48
|
-
productType: 'testType',
|
|
49
|
-
endDate: '2222-02-02',
|
|
50
|
-
},
|
|
51
|
-
endDate: '2222-02-02',
|
|
52
|
-
startDate: '1111-01-01',
|
|
53
|
-
status: SubscriptionStatus.ACTIVE,
|
|
54
|
-
productBlockInstances: testProductBlockInstances,
|
|
55
|
-
metadata: {},
|
|
56
|
-
customerDescriptions: [],
|
|
57
|
-
processes: {
|
|
58
|
-
page: [
|
|
59
|
-
{
|
|
60
|
-
processId: 'Test process id',
|
|
61
|
-
lastStatus: ProcessStatus.ABORTED,
|
|
62
|
-
startedAt: '1111-01-01',
|
|
63
|
-
createdBy: 'Test',
|
|
64
|
-
workflowTarget: WorkflowTarget.CREATE,
|
|
65
|
-
workflowName: 'Test workflow name',
|
|
66
|
-
isTask: false,
|
|
67
|
-
},
|
|
68
|
-
],
|
|
69
|
-
},
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
describe('formField utils', () => {
|
|
73
|
-
describe('getPortMode()', () => {
|
|
74
|
-
it('returns undefined if the productBlockInstances is an empty array', () => {
|
|
75
|
-
const result = getPortMode([]);
|
|
76
|
-
expect(result).toEqual(undefined);
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
it('returns undefined if the productBlockInstances dont contain a productBlockInstanceValues', () => {
|
|
80
|
-
const result = getPortMode([
|
|
81
|
-
getProductBlockInstance({
|
|
82
|
-
productBlockInstanceValues: [
|
|
83
|
-
{
|
|
84
|
-
field: 'key1',
|
|
85
|
-
value: 'value1',
|
|
86
|
-
},
|
|
87
|
-
],
|
|
88
|
-
}),
|
|
89
|
-
]);
|
|
90
|
-
expect(result).toEqual(undefined);
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
it('returns undefined if the productBlockInstances dont contain productBlockInstanceValues but none with portMode', () => {
|
|
94
|
-
const result = getPortMode([
|
|
95
|
-
getProductBlockInstance({
|
|
96
|
-
productBlockInstanceValues: [
|
|
97
|
-
{
|
|
98
|
-
field: 'portMode',
|
|
99
|
-
value: 'NOTTAGGED',
|
|
100
|
-
},
|
|
101
|
-
],
|
|
102
|
-
}),
|
|
103
|
-
]);
|
|
104
|
-
expect(result).toEqual('NOTTAGGED');
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
it('returns the first portMode if there are more than one productBlockInstanceValue with portmode', () => {
|
|
108
|
-
const result = getPortMode([
|
|
109
|
-
getProductBlockInstance({
|
|
110
|
-
productBlockInstanceValues: [
|
|
111
|
-
{
|
|
112
|
-
field: 'portMode',
|
|
113
|
-
value: 'FIRST',
|
|
114
|
-
},
|
|
115
|
-
],
|
|
116
|
-
}),
|
|
117
|
-
getProductBlockInstance({
|
|
118
|
-
productBlockInstanceValues: [
|
|
119
|
-
{
|
|
120
|
-
field: 'portMode',
|
|
121
|
-
value: 'SECOND',
|
|
122
|
-
},
|
|
123
|
-
],
|
|
124
|
-
}),
|
|
125
|
-
]);
|
|
126
|
-
expect(result).toEqual('FIRST');
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
it('returns undefined if the productBlockInstances dont contain a portMode field', () => {
|
|
130
|
-
const result = getPortMode([
|
|
131
|
-
...testProductBlockInstances,
|
|
132
|
-
{
|
|
133
|
-
id: 1,
|
|
134
|
-
parent: 0,
|
|
135
|
-
productBlockInstanceValues: [],
|
|
136
|
-
subscriptionInstanceId: 'testId',
|
|
137
|
-
inUseByRelations: [],
|
|
138
|
-
subscription: {
|
|
139
|
-
subscriptionId: 'OwnerSubscriptionId',
|
|
140
|
-
description: 'OwnerSubscription description',
|
|
141
|
-
},
|
|
142
|
-
},
|
|
143
|
-
]);
|
|
144
|
-
expect(result).toEqual(undefined);
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
describe('subscriptionHasPortModeInstanceValue()', () => {
|
|
149
|
-
it('returns false if the subscriptionDetail has no productBlockInstances', () => {
|
|
150
|
-
const result = subscriptionHasTaggedPortModeInstanceValue(
|
|
151
|
-
testSubscriptionDetail,
|
|
152
|
-
);
|
|
153
|
-
expect(result).toEqual(false);
|
|
154
|
-
});
|
|
155
|
-
it('returns false if the subscriptionDetail has no productBlockInstances with no productBlockInstanceValues', () => {
|
|
156
|
-
const subscriptionDetail: SubscriptionDetail = {
|
|
157
|
-
...testSubscriptionDetail,
|
|
158
|
-
productBlockInstances: [
|
|
159
|
-
{
|
|
160
|
-
id: 1,
|
|
161
|
-
parent: 0,
|
|
162
|
-
productBlockInstanceValues: [],
|
|
163
|
-
subscriptionInstanceId: 'testId',
|
|
164
|
-
inUseByRelations: [],
|
|
165
|
-
subscription: {
|
|
166
|
-
subscriptionId: 'OwnerSubscriptionId 1',
|
|
167
|
-
description: 'OwnerSubscriptionId description',
|
|
168
|
-
},
|
|
169
|
-
},
|
|
170
|
-
],
|
|
171
|
-
};
|
|
172
|
-
const result =
|
|
173
|
-
subscriptionHasTaggedPortModeInstanceValue(subscriptionDetail);
|
|
174
|
-
expect(result).toEqual(false);
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
it('returns false if the subscriptionDetail has no productBlockInstances with productBlockInstanceValues but not with portMode', () => {
|
|
178
|
-
const subscriptionDetail: SubscriptionDetail = {
|
|
179
|
-
...testSubscriptionDetail,
|
|
180
|
-
productBlockInstances: [
|
|
181
|
-
{
|
|
182
|
-
id: 1,
|
|
183
|
-
parent: 0,
|
|
184
|
-
subscriptionInstanceId: 'testId',
|
|
185
|
-
inUseByRelations: [],
|
|
186
|
-
subscription: {
|
|
187
|
-
subscriptionId: 'OwnerSubscriptionId 1',
|
|
188
|
-
description: 'OwnerSubscriptionId description',
|
|
189
|
-
},
|
|
190
|
-
productBlockInstanceValues: [
|
|
191
|
-
{
|
|
192
|
-
field: 'key1',
|
|
193
|
-
value: 'value1',
|
|
194
|
-
},
|
|
195
|
-
{
|
|
196
|
-
field: 'key2',
|
|
197
|
-
value: 'value2',
|
|
198
|
-
},
|
|
199
|
-
],
|
|
200
|
-
},
|
|
201
|
-
],
|
|
202
|
-
};
|
|
203
|
-
const result =
|
|
204
|
-
subscriptionHasTaggedPortModeInstanceValue(subscriptionDetail);
|
|
205
|
-
expect(result).toEqual(false);
|
|
206
|
-
});
|
|
207
|
-
it('returns false if the subscriptionDetail has no productBlockInstances with productBlockInstanceValues with portMode and value not tagged', () => {
|
|
208
|
-
const subscriptionDetail: SubscriptionDetail = {
|
|
209
|
-
...testSubscriptionDetail,
|
|
210
|
-
productBlockInstances: [
|
|
211
|
-
{
|
|
212
|
-
id: 1,
|
|
213
|
-
parent: 0,
|
|
214
|
-
subscriptionInstanceId: 'testId',
|
|
215
|
-
inUseByRelations: [],
|
|
216
|
-
subscription: {
|
|
217
|
-
subscriptionId: 'OwnerSubscriptionId 1',
|
|
218
|
-
description: 'OwnerSubscriptionId description',
|
|
219
|
-
},
|
|
220
|
-
productBlockInstanceValues: [
|
|
221
|
-
{
|
|
222
|
-
field: 'key1',
|
|
223
|
-
value: 'value1',
|
|
224
|
-
},
|
|
225
|
-
{
|
|
226
|
-
field: 'portMode',
|
|
227
|
-
value: 'NOTTAGGED',
|
|
228
|
-
},
|
|
229
|
-
],
|
|
230
|
-
},
|
|
231
|
-
],
|
|
232
|
-
};
|
|
233
|
-
const result =
|
|
234
|
-
subscriptionHasTaggedPortModeInstanceValue(subscriptionDetail);
|
|
235
|
-
expect(result).toEqual(false);
|
|
236
|
-
});
|
|
237
|
-
it('returns true if the subscriptionDetail has productBlockInstances with productBlockInstanceValues with field portMode and value = tagged', () => {
|
|
238
|
-
const subscriptionDetail: SubscriptionDetail = {
|
|
239
|
-
...testSubscriptionDetail,
|
|
240
|
-
productBlockInstances: [
|
|
241
|
-
{
|
|
242
|
-
id: 1,
|
|
243
|
-
parent: 0,
|
|
244
|
-
subscriptionInstanceId: 'testId',
|
|
245
|
-
inUseByRelations: [],
|
|
246
|
-
subscription: {
|
|
247
|
-
subscriptionId: 'OwnerSubscriptionId 1',
|
|
248
|
-
description: 'OwnerSubscriptionId description',
|
|
249
|
-
},
|
|
250
|
-
productBlockInstanceValues: [
|
|
251
|
-
{
|
|
252
|
-
field: 'key1',
|
|
253
|
-
value: 'value1',
|
|
254
|
-
},
|
|
255
|
-
{
|
|
256
|
-
field: 'portMode',
|
|
257
|
-
value: 'tagged',
|
|
258
|
-
},
|
|
259
|
-
],
|
|
260
|
-
},
|
|
261
|
-
],
|
|
262
|
-
};
|
|
263
|
-
const result =
|
|
264
|
-
subscriptionHasTaggedPortModeInstanceValue(subscriptionDetail);
|
|
265
|
-
expect(result).toEqual(true);
|
|
266
|
-
});
|
|
267
|
-
});
|
|
268
|
-
describe('subscriptionHasTaggedProduct()', () => {
|
|
269
|
-
it('returns false if the subscriptionDetail.product.tag is undefined', () => {
|
|
270
|
-
const result = subscriptionHasTaggedProduct(testSubscriptionDetail);
|
|
271
|
-
expect(result).toEqual(false);
|
|
272
|
-
});
|
|
273
|
-
it('returns false if the subscriptionDetail.product.tag is not a tagged product', () => {
|
|
274
|
-
const subscriptionDetailTest: SubscriptionDetail = {
|
|
275
|
-
...testSubscriptionDetail,
|
|
276
|
-
product: {
|
|
277
|
-
...testSubscriptionDetail.product,
|
|
278
|
-
tag: 'RANDOMTAG',
|
|
279
|
-
},
|
|
280
|
-
};
|
|
281
|
-
const result = subscriptionHasTaggedProduct(subscriptionDetailTest);
|
|
282
|
-
expect(result).toEqual(false);
|
|
283
|
-
});
|
|
284
|
-
it('returns true if the subscriptionDetail.product.tag is a tagged product', () => {
|
|
285
|
-
const subscriptionDetailTest: SubscriptionDetail = {
|
|
286
|
-
...testSubscriptionDetail,
|
|
287
|
-
product: {
|
|
288
|
-
...testSubscriptionDetail.product,
|
|
289
|
-
tag: ProductTag.MSC,
|
|
290
|
-
},
|
|
291
|
-
};
|
|
292
|
-
const result = subscriptionHasTaggedProduct(subscriptionDetailTest);
|
|
293
|
-
expect(result).toEqual(true);
|
|
294
|
-
});
|
|
295
|
-
});
|
|
296
|
-
});
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { isDate } from 'moment/moment';
|
|
2
|
-
|
|
3
|
-
import { PortMode, ProductTag } from '@/components';
|
|
4
|
-
import {
|
|
5
|
-
ProductBlockInstance,
|
|
6
|
-
ProductBlockInstanceForDropdown,
|
|
7
|
-
SubscriptionDetail,
|
|
8
|
-
} from '@/types';
|
|
9
|
-
|
|
10
|
-
// NOTE: There might potentially (?) be more productBlockInstances with portMod but we get the last one here
|
|
11
|
-
export const getPortMode = (
|
|
12
|
-
productBlockInstances:
|
|
13
|
-
| ProductBlockInstance[]
|
|
14
|
-
| ProductBlockInstanceForDropdown[],
|
|
15
|
-
): PortMode | undefined => {
|
|
16
|
-
return productBlockInstances?.reduce(
|
|
17
|
-
(portMode: PortMode | undefined, productBlockInstance) => {
|
|
18
|
-
const portModeField =
|
|
19
|
-
productBlockInstance.productBlockInstanceValues.find(
|
|
20
|
-
(productBlockInstanceValue) =>
|
|
21
|
-
productBlockInstanceValue.field === 'portMode',
|
|
22
|
-
);
|
|
23
|
-
if (!portMode && portModeField) {
|
|
24
|
-
return portModeField.value as PortMode;
|
|
25
|
-
}
|
|
26
|
-
return portMode;
|
|
27
|
-
},
|
|
28
|
-
undefined,
|
|
29
|
-
);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export const isEmpty = (obj: unknown) => {
|
|
33
|
-
if (obj === undefined || obj === null) {
|
|
34
|
-
return true;
|
|
35
|
-
}
|
|
36
|
-
if (isDate(obj)) {
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
if (Array.isArray(obj)) {
|
|
40
|
-
return obj.length === 0;
|
|
41
|
-
}
|
|
42
|
-
if (typeof obj === 'string') {
|
|
43
|
-
return obj.trim().length === 0;
|
|
44
|
-
}
|
|
45
|
-
if (typeof obj === 'object') {
|
|
46
|
-
return Object.keys(obj).length === 0;
|
|
47
|
-
}
|
|
48
|
-
return false;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export const subscriptionHasTaggedPortModeInstanceValue = (
|
|
52
|
-
subscriptionDetail: SubscriptionDetail,
|
|
53
|
-
): boolean => {
|
|
54
|
-
const portMode = getPortMode(subscriptionDetail.productBlockInstances);
|
|
55
|
-
return portMode && portMode === PortMode.TAGGED ? true : false;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export const subscriptionHasTaggedProduct = (
|
|
59
|
-
subscriptionDetail: SubscriptionDetail,
|
|
60
|
-
): boolean => {
|
|
61
|
-
const productsWithTaggedPorts: string[] = [
|
|
62
|
-
ProductTag.MSC,
|
|
63
|
-
ProductTag.MSCNL,
|
|
64
|
-
ProductTag.IRBSP,
|
|
65
|
-
];
|
|
66
|
-
return productsWithTaggedPorts.includes(subscriptionDetail.product.tag)
|
|
67
|
-
? true
|
|
68
|
-
: false;
|
|
69
|
-
};
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
|
|
3
|
-
import { EuiFlexItem } from '@elastic/eui';
|
|
4
|
-
|
|
5
|
-
import { UserInputFormWizard, WfoError, WfoLoading } from '@/components';
|
|
6
|
-
import { useOrchestratorTheme } from '@/hooks';
|
|
7
|
-
import { HttpStatus } from '@/rtk';
|
|
8
|
-
import { useResumeProcessMutation } from '@/rtk/endpoints/forms';
|
|
9
|
-
import { FormUserPermissions, InputForm } from '@/types/forms';
|
|
10
|
-
|
|
11
|
-
interface WfoStepFormProps {
|
|
12
|
-
userInputForm: InputForm;
|
|
13
|
-
isTask: boolean;
|
|
14
|
-
processId?: string;
|
|
15
|
-
userPermissions: FormUserPermissions;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const WfoStepFormOld = ({
|
|
19
|
-
userInputForm,
|
|
20
|
-
isTask,
|
|
21
|
-
processId,
|
|
22
|
-
userPermissions,
|
|
23
|
-
}: WfoStepFormProps) => {
|
|
24
|
-
const [isProcessing, setIsProcessing] = useState<boolean>(false);
|
|
25
|
-
const [hasError, setHasError] = useState<boolean>(false);
|
|
26
|
-
const { theme } = useOrchestratorTheme();
|
|
27
|
-
const [resumeProcess] = useResumeProcessMutation();
|
|
28
|
-
|
|
29
|
-
const submitForm = (processInput: object[]) => {
|
|
30
|
-
if (!processId) {
|
|
31
|
-
return Promise.reject();
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return resumeProcess({ processId, userInputs: processInput })
|
|
35
|
-
.unwrap()
|
|
36
|
-
.then(() => {
|
|
37
|
-
setIsProcessing(true);
|
|
38
|
-
})
|
|
39
|
-
.catch((error) => {
|
|
40
|
-
if (error?.status !== HttpStatus.FormNotComplete) {
|
|
41
|
-
if (error?.status === HttpStatus.BadRequest) {
|
|
42
|
-
// Rethrow the error so userInputForm can catch it and display validation errors
|
|
43
|
-
throw error;
|
|
44
|
-
}
|
|
45
|
-
console.error(error);
|
|
46
|
-
setHasError(true);
|
|
47
|
-
} else {
|
|
48
|
-
throw error;
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
return (
|
|
54
|
-
<EuiFlexItem css={{ margin: theme.size.m }}>
|
|
55
|
-
{(hasError && <WfoError />) || (isProcessing && <WfoLoading />) || (
|
|
56
|
-
<UserInputFormWizard
|
|
57
|
-
stepUserInput={userInputForm}
|
|
58
|
-
stepSubmit={submitForm}
|
|
59
|
-
hasNext={false}
|
|
60
|
-
isTask={isTask}
|
|
61
|
-
isResuming={true}
|
|
62
|
-
allowSubmit={userPermissions.resumeAllowed}
|
|
63
|
-
/>
|
|
64
|
-
)}
|
|
65
|
-
</EuiFlexItem>
|
|
66
|
-
);
|
|
67
|
-
};
|