@orchestrator-ui/orchestrator-ui-components 6.7.8 → 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.
Files changed (97) hide show
  1. package/.turbo/turbo-build.log +8 -8
  2. package/.turbo/turbo-lint.log +1 -1
  3. package/.turbo/turbo-test.log +10 -11
  4. package/CHANGELOG.md +16 -0
  5. package/dist/index.d.ts +180 -4325
  6. package/dist/index.js +1774 -5741
  7. package/dist/index.js.map +1 -1
  8. package/package.json +4 -8
  9. package/src/components/WfoPageTemplate/WfoPageTemplate/WfoPageTemplate.tsx +9 -1
  10. package/src/components/WfoPageTemplate/WfoSidebar/WfoSidebar.tsx +9 -2
  11. package/src/components/WfoPydanticForm/RenderFormErrors.tsx +2 -1
  12. package/src/components/WfoPydanticForm/Row.tsx +3 -1
  13. package/src/components/WfoPydanticForm/fields/WfoSummary.tsx +3 -5
  14. package/src/components/WfoPydanticForm/fields/styles.ts +72 -0
  15. package/src/components/WfoStartButton/WfoStartButtonComboBox.tsx +73 -3
  16. package/src/components/WfoStartButton/WfoStartWorkflowComboBox.tsx +15 -3
  17. package/src/components/WfoWorkflowSteps/WfoStep/WfoStep.tsx +10 -27
  18. package/src/components/WfoWorkflowSteps/WfoStep/WfoStepForm.tsx +1 -1
  19. package/src/components/index.ts +0 -1
  20. package/src/configuration/version.ts +1 -1
  21. package/src/contexts/OrchestratorConfigContext.tsx +0 -1
  22. package/src/pages/processes/WfoStartProcessPage.tsx +5 -107
  23. package/src/rtk/endpoints/index.ts +0 -2
  24. package/src/rtk/endpoints/startOptions.ts +23 -10
  25. package/src/types/index.ts +0 -1
  26. package/src/types/types.ts +0 -1
  27. package/src/components/WfoForms/AutoFieldLoader.tsx +0 -118
  28. package/src/components/WfoForms/AutoFields.tsx +0 -49
  29. package/src/components/WfoForms/CreateForm.tsx +0 -75
  30. package/src/components/WfoForms/UserInputForm.tsx +0 -697
  31. package/src/components/WfoForms/UserInputFormStyling.ts +0 -80
  32. package/src/components/WfoForms/UserInputFormWizard.tsx +0 -127
  33. package/src/components/WfoForms/formFields/AcceptField.tsx +0 -243
  34. package/src/components/WfoForms/formFields/AcceptFieldStyling.ts +0 -35
  35. package/src/components/WfoForms/formFields/BoolField.tsx +0 -77
  36. package/src/components/WfoForms/formFields/BoolFieldStyling.ts +0 -64
  37. package/src/components/WfoForms/formFields/ConnectedSelectField.tsx +0 -19
  38. package/src/components/WfoForms/formFields/CustomerField.tsx +0 -77
  39. package/src/components/WfoForms/formFields/DateField.tsx +0 -72
  40. package/src/components/WfoForms/formFields/DividerField.tsx +0 -29
  41. package/src/components/WfoForms/formFields/ErrorField.tsx +0 -40
  42. package/src/components/WfoForms/formFields/ErrorsField.tsx +0 -34
  43. package/src/components/WfoForms/formFields/LabelField.tsx +0 -43
  44. package/src/components/WfoForms/formFields/ListAddField.tsx +0 -95
  45. package/src/components/WfoForms/formFields/ListDelField.tsx +0 -95
  46. package/src/components/WfoForms/formFields/ListField.tsx +0 -117
  47. package/src/components/WfoForms/formFields/ListItemField.tsx +0 -40
  48. package/src/components/WfoForms/formFields/ListSelectField.tsx +0 -95
  49. package/src/components/WfoForms/formFields/LocationCodeField.tsx +0 -60
  50. package/src/components/WfoForms/formFields/LongTextField.tsx +0 -68
  51. package/src/components/WfoForms/formFields/NestField.tsx +0 -107
  52. package/src/components/WfoForms/formFields/NumField.tsx +0 -85
  53. package/src/components/WfoForms/formFields/OptGroupField.tsx +0 -74
  54. package/src/components/WfoForms/formFields/RadioField.tsx +0 -87
  55. package/src/components/WfoForms/formFields/SelectField/SelectField.tsx +0 -177
  56. package/src/components/WfoForms/formFields/SelectField/index.ts +0 -1
  57. package/src/components/WfoForms/formFields/SelectField/styles.ts +0 -52
  58. package/src/components/WfoForms/formFields/SubmitField.tsx +0 -50
  59. package/src/components/WfoForms/formFields/SubscriptionSummaryField.tsx +0 -74
  60. package/src/components/WfoForms/formFields/SummaryField.tsx +0 -104
  61. package/src/components/WfoForms/formFields/SummaryFieldStyling.ts +0 -44
  62. package/src/components/WfoForms/formFields/TextField.tsx +0 -81
  63. package/src/components/WfoForms/formFields/commonStyles.ts +0 -32
  64. package/src/components/WfoForms/formFields/deprecated/ContactPersonAutocomplete.tsx +0 -99
  65. package/src/components/WfoForms/formFields/deprecated/ContactPersonAutocompleteStyles.ts +0 -41
  66. package/src/components/WfoForms/formFields/deprecated/ContactPersonNameField.tsx +0 -263
  67. package/src/components/WfoForms/formFields/deprecated/FileUploadField.tsx +0 -151
  68. package/src/components/WfoForms/formFields/deprecated/ImsNodeIdField.tsx +0 -109
  69. package/src/components/WfoForms/formFields/deprecated/ImsPortIdField.tsx +0 -233
  70. package/src/components/WfoForms/formFields/deprecated/ImsPortIdFieldStyling.ts +0 -17
  71. package/src/components/WfoForms/formFields/deprecated/IpNetworkField.tsx +0 -105
  72. package/src/components/WfoForms/formFields/deprecated/IpPrefixTableField.tsx +0 -390
  73. package/src/components/WfoForms/formFields/deprecated/IpPrefixTableFieldStyling.ts +0 -117
  74. package/src/components/WfoForms/formFields/deprecated/SplitPrefix.tsx +0 -138
  75. package/src/components/WfoForms/formFields/deprecated/SplitPrefixStyling.ts +0 -11
  76. package/src/components/WfoForms/formFields/deprecated/SubscriptionField.tsx +0 -263
  77. package/src/components/WfoForms/formFields/deprecated/SubscriptionFieldStyling.ts +0 -33
  78. package/src/components/WfoForms/formFields/deprecated/TimestampField.tsx +0 -110
  79. package/src/components/WfoForms/formFields/deprecated/VlanField.tsx +0 -300
  80. package/src/components/WfoForms/formFields/deprecated/index.ts +0 -15
  81. package/src/components/WfoForms/formFields/deprecated/types.ts +0 -74
  82. package/src/components/WfoForms/formFields/deprecated/utils.ts +0 -1
  83. package/src/components/WfoForms/formFields/index.ts +0 -30
  84. package/src/components/WfoForms/formFields/listFieldStyling.ts +0 -86
  85. package/src/components/WfoForms/formFields/types.ts +0 -41
  86. package/src/components/WfoForms/formFields/utils.spec.ts +0 -296
  87. package/src/components/WfoForms/formFields/utils.ts +0 -69
  88. package/src/components/WfoForms/index.ts +0 -5
  89. package/src/components/WfoWorkflowSteps/WfoStep/WfoStepFormOld.tsx +0 -67
  90. package/src/hooks/deprecated/useGetSurfSubcriptionDropdownOptions.ts +0 -37
  91. package/src/hooks/deprecated/useIsTaggedPort.ts +0 -25
  92. package/src/rtk/endpoints/deprecated/index.ts +0 -1
  93. package/src/rtk/endpoints/deprecated/surfSubscriptionDropdownOptions.ts +0 -53
  94. package/src/rtk/endpoints/formFields.ts +0 -131
  95. package/src/rtk/endpoints/ipam.ts +0 -54
  96. package/src/types/deprecated/SurfSubscriptionDropdownOptionsFilterParams.ts +0 -10
  97. package/src/types/deprecated/index.ts +0 -1
@@ -1,233 +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 React, { useCallback, useEffect, useState } from 'react';
16
- import ReactSelect, { SingleValue } from 'react-select';
17
-
18
- import { useTranslations } from 'next-intl';
19
- import { connectField, filterDOMProps } from 'uniforms';
20
-
21
- import { EuiFlexItem, EuiFormRow, EuiText } from '@elastic/eui';
22
-
23
- import { useWithOrchestratorTheme } from '@/hooks';
24
- import {
25
- useFreePortsByNodeSubscriptionIdAndSpeedQuery,
26
- useGetNodeSubscriptionOptionsQuery,
27
- } from '@/rtk/endpoints/formFields';
28
- import type { Option } from '@/types';
29
-
30
- import { getSelectFieldStyles } from '../SelectField/styles';
31
- import { FieldProps } from '../types';
32
- import { imsPortIdFieldStyling } from './ImsPortIdFieldStyling';
33
- import { ImsPort, NodeSubscriptionOption } from './types';
34
-
35
- export type ImsPortFieldProps = FieldProps<
36
- number,
37
- {
38
- nodeSubscriptionId?: string;
39
- interfaceSpeed: number | string;
40
- imsPortMode?: 'patched' | 'unpatched' | 'all';
41
- nodeStatuses?: ('active' | 'provisioning')[];
42
- }
43
- >;
44
-
45
- function nodeToOptionCorelink(nodeOption: NodeSubscriptionOption): Option {
46
- return {
47
- value: nodeOption.subscriptionId,
48
- label: `${nodeOption.subscriptionId.substring(0, 8)} ${
49
- nodeOption.description.trim() || '<No description>'
50
- }`,
51
- };
52
- }
53
-
54
- declare module 'uniforms' {
55
- interface FilterDOMProps {
56
- nodeSubscriptionId: never;
57
- interfaceSpeed: never;
58
- nodeStatuses: never;
59
- imsPortMode: never;
60
- }
61
- }
62
- filterDOMProps.register(
63
- 'nodeSubscriptionId',
64
- 'interfaceSpeed',
65
- 'nodeStatuses',
66
- 'imsPortMode',
67
- );
68
-
69
- function ImsPortId({
70
- id,
71
- name,
72
- label,
73
- description,
74
- onChange,
75
- value,
76
- disabled,
77
- readOnly,
78
- error,
79
- showInlineError,
80
- errorMessage,
81
- nodeSubscriptionId,
82
- interfaceSpeed,
83
- imsPortMode = 'all',
84
- nodeStatuses,
85
- ...props
86
- }: ImsPortFieldProps) {
87
- const [nodeId, setNodeId] = useState<number | string | undefined>(
88
- nodeSubscriptionId,
89
- );
90
- const [ports, setPorts] = useState<ImsPort[]>([]);
91
-
92
- const t = useTranslations('pydanticForms');
93
- // React select allows callbacks to supply style for innercomponents: https://react-select.com/styles#inner-components
94
- const { reactSelectInnerComponentStyles } =
95
- useWithOrchestratorTheme(getSelectFieldStyles);
96
-
97
- const {
98
- data: freePorts,
99
- error: freePortsError,
100
- isFetching: loading,
101
- } = useFreePortsByNodeSubscriptionIdAndSpeedQuery(
102
- {
103
- nodeSubscriptionId: nodeId as string,
104
- interfaceSpeed: interfaceSpeed as number,
105
- mode: imsPortMode,
106
- },
107
- {
108
- skip: !nodeId,
109
- refetchOnMountOrArgChange: true,
110
- },
111
- );
112
-
113
- const { data: nodeSubscriptionOptions } =
114
- useGetNodeSubscriptionOptionsQuery({
115
- statuses: nodeStatuses?.join('|') ?? 'active',
116
- });
117
-
118
- useEffect(() => {
119
- setPorts(freePorts ?? []);
120
- }, [freePorts, freePortsError]);
121
-
122
- const onChangeNodes = useCallback(
123
- (option: SingleValue<Option>) => {
124
- const value = option?.value;
125
-
126
- if (value === undefined) {
127
- return;
128
- }
129
- // Clears the value when another selection is made
130
- onChange(undefined);
131
- setNodeId(value);
132
- setPorts([]);
133
- },
134
- [onChange],
135
- );
136
-
137
- const nodesPlaceholder = loading
138
- ? t('widgets.nodePort.loadingNodes')
139
- : t('widgets.nodePort.selectNode');
140
-
141
- const portPlaceholder = loading
142
- ? t('widgets.nodePort.loadingPorts')
143
- : nodeId
144
- ? t('widgets.nodePort.selectPort')
145
- : t('widgets.nodePort.selectNodeFirst');
146
-
147
- const nodeOptions: Option[] =
148
- nodeSubscriptionOptions?.map(nodeToOptionCorelink) || [];
149
-
150
- nodeOptions.sort((x, y) => x.label.localeCompare(y.label));
151
- const nodeValue = nodeOptions.find(
152
- (option) => option.value === nodeId?.toString(),
153
- );
154
-
155
- const portOptions: Option<number>[] = ports
156
- .map((aPort) => ({
157
- value: aPort.id,
158
- label: `${aPort.port} (${aPort.status}) (${aPort.iface_type})`,
159
- }))
160
- .sort((x, y) => x.label.localeCompare(y.label));
161
- const portValue = portOptions.find((option) => option.value === value);
162
- return (
163
- <EuiFlexItem css={imsPortIdFieldStyling}>
164
- <section {...filterDOMProps(props)}>
165
- <EuiFormRow
166
- label={label}
167
- labelAppend={<EuiText size="m">{description} </EuiText>}
168
- error={showInlineError ? errorMessage : false}
169
- isInvalid={error}
170
- id={id}
171
- fullWidth
172
- >
173
- {(!nodeValue && nodeSubscriptionId && (
174
- <EuiText>
175
- This Node subscription is missing. Please check the
176
- nodes status: {nodeSubscriptionId}
177
- </EuiText>
178
- )) || (
179
- <section className="node-port">
180
- <div className="node-select">
181
- <EuiFormRow
182
- label="Node"
183
- id={`${id}.node`}
184
- fullWidth
185
- >
186
- <ReactSelect<Option, false>
187
- inputId={`${id}.node.search`}
188
- name={`${name}.node`}
189
- onChange={onChangeNodes}
190
- options={nodeOptions}
191
- placeholder={nodesPlaceholder}
192
- value={nodeValue}
193
- isSearchable={true}
194
- isDisabled={
195
- disabled ||
196
- readOnly ||
197
- nodeOptions.length === 0 ||
198
- !!nodeSubscriptionId
199
- }
200
- styles={reactSelectInnerComponentStyles}
201
- />
202
- </EuiFormRow>
203
- </div>
204
- <div className="port-select">
205
- <EuiFormRow label="Port" id={id} fullWidth>
206
- <ReactSelect<Option<number>, false>
207
- inputId={`${id}.search`}
208
- name={name}
209
- onChange={(selected) => {
210
- onChange(selected?.value);
211
- }}
212
- options={portOptions}
213
- placeholder={portPlaceholder}
214
- value={portValue || null}
215
- isSearchable={true}
216
- isDisabled={
217
- disabled ||
218
- readOnly ||
219
- portOptions.length === 0
220
- }
221
- styles={reactSelectInnerComponentStyles}
222
- />
223
- </EuiFormRow>
224
- </div>
225
- </section>
226
- )}
227
- </EuiFormRow>
228
- </section>
229
- </EuiFlexItem>
230
- );
231
- }
232
-
233
- export const ImsPortIdField = connectField(ImsPortId, { kind: 'leaf' });
@@ -1,17 +0,0 @@
1
- import { css } from '@emotion/react';
2
-
3
- export const imsPortIdFieldStyling = css`
4
- section.node-port {
5
- display: flex;
6
- flex-direction: row;
7
- flex-wrap: wrap;
8
-
9
- div.node-select {
10
- width: 50%;
11
- }
12
- div.port-select {
13
- width: 50%;
14
- padding-left: 5px;
15
- }
16
- }
17
- `;
@@ -1,105 +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 React, { useState } from 'react';
16
-
17
- import { connectField, filterDOMProps } from 'uniforms';
18
-
19
- import { EuiFormRow, EuiText } from '@elastic/eui';
20
-
21
- import { getCommonFormFieldStyles } from '@/components/WfoForms/formFields/commonStyles';
22
- import SplitPrefix from '@/components/WfoForms/formFields/deprecated/SplitPrefix';
23
- import { useWithOrchestratorTheme } from '@/hooks';
24
-
25
- import { FieldProps } from '../types';
26
-
27
- export function getUsedPrefixMin(
28
- netmask: string,
29
- prefixMin: number | undefined,
30
- name: string,
31
- ) {
32
- const netMaskInt = parseInt(netmask, 10);
33
- return (
34
- prefixMin ??
35
- (netMaskInt < 32 && name === 'ip_sub_prefix'
36
- ? netMaskInt + 1
37
- : netMaskInt)
38
- );
39
- }
40
-
41
- export type IPvAnyNetworkFieldProps = FieldProps<
42
- string,
43
- { prefixMin?: number }
44
- >;
45
-
46
- function IpNetwork({
47
- id,
48
- label,
49
- description,
50
- name,
51
- onChange,
52
- readOnly,
53
- value,
54
- error,
55
- showInlineError,
56
- errorMessage,
57
- prefixMin,
58
- ...props
59
- }: IPvAnyNetworkFieldProps) {
60
- const { formRowStyle } = useWithOrchestratorTheme(getCommonFormFieldStyles);
61
-
62
- // The state is needed in order to keep the selected prefix in the SplitPrefix component
63
- const [selectedPrefix] = useState<string | undefined>(value);
64
-
65
- const usePrefix = selectedPrefix;
66
- const [subnet, netmask] = usePrefix?.split('/') ?? ['', ''];
67
-
68
- const usedPrefixMin = getUsedPrefixMin(netmask, prefixMin, name);
69
-
70
- return (
71
- <section {...filterDOMProps(props)}>
72
- <EuiFormRow
73
- css={formRowStyle}
74
- label={label}
75
- labelAppend={<EuiText size="m">{description}</EuiText>}
76
- error={showInlineError ? errorMessage : false}
77
- isInvalid={error}
78
- id={id}
79
- fullWidth
80
- >
81
- <section className="ipblock-selector">
82
- <div id={id}>
83
- {usePrefix && (
84
- <SplitPrefix
85
- id={id}
86
- name={name}
87
- subnet={subnet}
88
- prefixlen={parseInt(netmask, 10)}
89
- prefixMin={usedPrefixMin}
90
- onChange={(prefix: string) => {
91
- if (!readOnly) {
92
- onChange(prefix);
93
- }
94
- }}
95
- selectedSubnet={usePrefix}
96
- />
97
- )}
98
- </div>
99
- </section>
100
- </EuiFormRow>
101
- </section>
102
- );
103
- }
104
-
105
- export const IpNetworkField = connectField(IpNetwork, { kind: 'leaf' });