@orchestrator-ui/orchestrator-ui-components 0.2.7 → 0.3.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 +6 -6
- package/.turbo/turbo-lint.log +0 -6
- package/.turbo/turbo-test.log +10 -9
- package/CHANGELOG.md +6 -0
- package/dist/index.d.ts +1005 -123
- package/dist/index.js +33849 -6199
- package/package.json +14 -12
- package/src/api/index.ts +55 -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/WfoForms/AutoFieldLoader.tsx +5 -1
- package/src/components/WfoForms/CreateForm.tsx +1 -0
- package/src/components/WfoForms/UserInputForm.tsx +75 -44
- 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/SubscriptionField.tsx +2 -1
- 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 +1 -0
- package/src/components/WfoJsonCodeBlock/index.ts +1 -0
- package/src/components/WfoPageTemplate/WfoPageHeader/WfoPageHeader.tsx +4 -3
- package/src/components/WfoPageTemplate/WfoSidebar/WfoSidebar.tsx +14 -14
- package/src/components/WfoPageTemplate/WfoSidebar/WfoStartCreateWorkflowButtonComboBox.tsx +15 -9
- package/src/components/WfoPageTemplate/paths.ts +3 -2
- package/src/components/{WfoProcessesList → WfoProcessList}/WfoProcessList.tsx +18 -14
- package/src/components/WfoProcessList/index.ts +1 -0
- package/src/components/{WfoProcessesList → WfoProcessList}/processListObjectMappers.ts +4 -2
- package/src/components/WfoSearchBar/WfoSearchField.tsx +27 -37
- package/src/components/{WfoSettingsPage → WfoSettings}/WfoEngineStatusButton.tsx +7 -4
- package/src/components/{WfoSettingsPage → WfoSettings}/WfoFlushSettings.tsx +13 -12
- 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/WfoStartPage/WfoListStartPage.tsx +3 -3
- package/src/components/WfoStartTaskButtonComboBox/WfoStartTaskButtonComboBox.tsx +14 -8
- package/src/components/WfoSubscription/WfoProcessesTimeline.tsx +11 -18
- package/src/components/WfoSubscription/WfoSubscription.tsx +1 -1
- package/src/components/WfoSubscription/WfoSubscriptionActions.tsx +41 -33
- package/src/components/WfoSubscription/WfoSubscriptionDetailTree.tsx +32 -22
- package/src/components/WfoSubscription/WfoSubscriptionProductBlock.tsx +94 -90
- package/src/components/WfoSubscription/WfoTargetTypeIcon.tsx +26 -0
- package/src/components/WfoSubscription/utils/utils.spec.ts +24 -0
- package/src/components/WfoSubscription/utils/utils.ts +16 -0
- package/src/components/WfoSubscriptionsList/WfoSubscriptionsList.tsx +17 -37
- package/src/components/WfoTable/WfoTableWithFilter/WfoTableWithFilter.tsx +20 -19
- package/src/components/WfoTable/WfoTableWithFilter/updateQueryString.spec.ts +95 -0
- package/src/components/WfoTable/WfoTableWithFilter/updateQueryString.ts +60 -0
- 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/WfoWorkflowSteps/WfoStep/WfoStep.tsx +39 -24
- 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/stepListUtils.ts +1 -28
- package/src/components/confirmationDialog/WfoConfirmationDialog.tsx +3 -3
- package/src/components/index.ts +6 -1
- package/src/contexts/ConfirmationDialogProvider.tsx +2 -2
- package/src/contexts/TreeContext.tsx +5 -0
- package/src/graphqlQueries/index.ts +1 -0
- package/src/graphqlQueries/processDetailQuery.ts +8 -0
- package/src/graphqlQueries/processListQuery.ts +7 -6
- package/src/graphqlQueries/processStepsQuery.ts +22 -0
- package/src/graphqlQueries/productBlocksQuery.ts +9 -5
- package/src/graphqlQueries/productsQuery.ts +7 -3
- package/src/graphqlQueries/relatedSubscriptionsQuery.ts +2 -2
- package/src/graphqlQueries/resourceTypesQuery.ts +8 -4
- package/src/graphqlQueries/subscriptionDetailQuery.ts +1 -0
- package/src/graphqlQueries/subscriptionsListQuery.ts +5 -3
- package/src/graphqlQueries/workflows/workflowsQuery.ts +8 -4
- package/src/graphqlQueries/workflows/workflowsQueryForDropdownList.ts +2 -2
- package/src/hooks/DataFetchHooks.ts +9 -4
- package/src/hooks/index.ts +3 -0
- 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/messages/{en-US.json → en-GB.json} +85 -37
- package/src/messages/getTranslationMessages.spec.ts +25 -40
- package/src/messages/index.ts +1 -1
- package/src/messages/nl-NL.json +95 -48
- package/src/messages/useGetTranslationMessages.ts +51 -0
- package/src/pages/metadata/WfoProductBlocksPage.tsx +12 -10
- package/src/pages/metadata/WfoProductsPage.tsx +24 -25
- package/src/pages/metadata/WfoResourceTypesPage.tsx +12 -10
- package/src/pages/metadata/WfoWorkflowsPage.tsx +12 -10
- package/src/pages/processes/WfoProcessDetail.tsx +96 -79
- package/src/pages/processes/WfoProcessDetailPage.tsx +5 -3
- package/src/pages/{workflow/WfoStartWorkflowPage.tsx → processes/WfoStartProcessPage.tsx} +100 -50
- 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/tasks/WfoTaskListPage.tsx +35 -9
- package/src/pages/{processes/WfoProcessListPage.tsx → workflow/WfoWorkflowListPage.tsx} +22 -23
- package/src/pages/workflow/getWorkflowListTabTypeFromString.ts +19 -0
- package/src/pages/workflow/index.ts +1 -1
- package/src/pages/{processes → workflow}/tabConfig.ts +6 -6
- package/src/types/types.ts +33 -3
- package/src/utils/getDefaultTableConfig.ts +1 -1
- package/src/components/WfoSettingsPage/WfoModifySettings.tsx +0 -33
- package/src/components/WfoSettingsPage/WfoSettings.tsx +0 -40
- 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/components/{WfoSettingsPage → WfoSettings}/index.ts +0 -0
|
@@ -0,0 +1,238 @@
|
|
|
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 { getReactSelectInnerComponentStyles } from '@/components/WfoForms/formFields/reactSelectStyles';
|
|
24
|
+
import { useOrchestratorTheme } from '@/hooks';
|
|
25
|
+
|
|
26
|
+
import { useAxiosApiClient } from '../useAxiosApiClient';
|
|
27
|
+
import { imsPortIdFieldStyling } from './ImsPortIdFieldStyling';
|
|
28
|
+
import { ImsNode, ImsPort, NodeSubscription } from './surf/types';
|
|
29
|
+
import { FieldProps, Option } from './types';
|
|
30
|
+
|
|
31
|
+
export type ImsPortFieldProps = FieldProps<
|
|
32
|
+
number,
|
|
33
|
+
{
|
|
34
|
+
nodeSubscriptionId?: string;
|
|
35
|
+
interfaceSpeed: number | string;
|
|
36
|
+
imsPortMode?: 'patched' | 'unpatched' | 'all';
|
|
37
|
+
nodeStatuses?: ('active' | 'provisioning')[];
|
|
38
|
+
}
|
|
39
|
+
>;
|
|
40
|
+
|
|
41
|
+
function nodeToOptionCorelink(node: NodeSubscription): Option {
|
|
42
|
+
return {
|
|
43
|
+
value: node.subscription_id,
|
|
44
|
+
label: `${node.subscription_id.substring(0, 8)} ${
|
|
45
|
+
node.description.trim() || '<No description>'
|
|
46
|
+
}`,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
declare module 'uniforms' {
|
|
51
|
+
interface FilterDOMProps {
|
|
52
|
+
nodeSubscriptionId: never;
|
|
53
|
+
interfaceSpeed: never;
|
|
54
|
+
nodeStatuses: never;
|
|
55
|
+
imsPortMode: never;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
filterDOMProps.register(
|
|
59
|
+
'nodeSubscriptionId',
|
|
60
|
+
'interfaceSpeed',
|
|
61
|
+
'nodeStatuses',
|
|
62
|
+
'imsPortMode',
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
function ImsPortId({
|
|
66
|
+
id,
|
|
67
|
+
name,
|
|
68
|
+
label,
|
|
69
|
+
description,
|
|
70
|
+
onChange,
|
|
71
|
+
value,
|
|
72
|
+
disabled,
|
|
73
|
+
readOnly,
|
|
74
|
+
error,
|
|
75
|
+
showInlineError,
|
|
76
|
+
errorMessage,
|
|
77
|
+
nodeSubscriptionId,
|
|
78
|
+
interfaceSpeed,
|
|
79
|
+
imsPortMode = 'all',
|
|
80
|
+
nodeStatuses,
|
|
81
|
+
...props
|
|
82
|
+
}: ImsPortFieldProps) {
|
|
83
|
+
const apiClient = useAxiosApiClient();
|
|
84
|
+
const t = useTranslations('pydanticForms');
|
|
85
|
+
const { theme } = useOrchestratorTheme();
|
|
86
|
+
// React select allows callbacks to supply style for innercomponents: https://react-select.com/styles#inner-components
|
|
87
|
+
const reactSelectInnerComponentStyles =
|
|
88
|
+
getReactSelectInnerComponentStyles(theme);
|
|
89
|
+
|
|
90
|
+
const [nodes, setNodes] = useState<ImsNode[] | NodeSubscription[]>([]);
|
|
91
|
+
const [nodeId, setNodeId] = useState<number | string | undefined>(
|
|
92
|
+
nodeSubscriptionId,
|
|
93
|
+
);
|
|
94
|
+
const [ports, setPorts] = useState<ImsPort[]>([]);
|
|
95
|
+
const [loading, setLoading] = useState(true);
|
|
96
|
+
|
|
97
|
+
const onChangeNodes = useCallback(
|
|
98
|
+
(option: SingleValue<Option>) => {
|
|
99
|
+
const value = option?.value;
|
|
100
|
+
|
|
101
|
+
if (value === undefined) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
setLoading(true);
|
|
106
|
+
setNodeId(value);
|
|
107
|
+
setPorts([]);
|
|
108
|
+
|
|
109
|
+
apiClient
|
|
110
|
+
.getFreePortsByNodeSubscriptionIdAndSpeed(
|
|
111
|
+
value as string,
|
|
112
|
+
interfaceSpeed as number,
|
|
113
|
+
imsPortMode,
|
|
114
|
+
)
|
|
115
|
+
.then((result) => {
|
|
116
|
+
setPorts(result);
|
|
117
|
+
setLoading(false);
|
|
118
|
+
});
|
|
119
|
+
},
|
|
120
|
+
[interfaceSpeed, imsPortMode, apiClient],
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
useEffect(() => {
|
|
124
|
+
setLoading(true);
|
|
125
|
+
|
|
126
|
+
const nodesPromise = apiClient.nodeSubscriptions(
|
|
127
|
+
nodeStatuses ?? ['active'],
|
|
128
|
+
);
|
|
129
|
+
if (nodeSubscriptionId) {
|
|
130
|
+
nodesPromise.then((result) => {
|
|
131
|
+
setNodes(
|
|
132
|
+
result.filter(
|
|
133
|
+
(subscription) =>
|
|
134
|
+
subscription.subscription_id === nodeSubscriptionId,
|
|
135
|
+
),
|
|
136
|
+
);
|
|
137
|
+
setLoading(false);
|
|
138
|
+
onChangeNodes({ value: nodeSubscriptionId } as Option);
|
|
139
|
+
});
|
|
140
|
+
} else {
|
|
141
|
+
nodesPromise.then((result) => {
|
|
142
|
+
setNodes(result);
|
|
143
|
+
setLoading(false);
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
}, [onChangeNodes, nodeStatuses, nodeSubscriptionId, apiClient]);
|
|
147
|
+
const nodesPlaceholder = loading
|
|
148
|
+
? t('widgets.nodePort.loadingNodes')
|
|
149
|
+
: t('widgets.nodePort.selectNode');
|
|
150
|
+
|
|
151
|
+
const portPlaceholder = loading
|
|
152
|
+
? t('widgets.nodePort.loadingPorts')
|
|
153
|
+
: nodeId
|
|
154
|
+
? t('widgets.nodePort.selectPort')
|
|
155
|
+
: t('widgets.nodePort.selectNodeFirst');
|
|
156
|
+
|
|
157
|
+
const node_options: Option[] = (nodes as NodeSubscription[]).map(
|
|
158
|
+
nodeToOptionCorelink,
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
node_options.sort((x, y) => x.label.localeCompare(y.label));
|
|
162
|
+
const node_value = node_options.find(
|
|
163
|
+
(option) => option.value === nodeId?.toString(),
|
|
164
|
+
);
|
|
165
|
+
|
|
166
|
+
const port_options: Option<number>[] = ports
|
|
167
|
+
.map((aPort) => ({
|
|
168
|
+
value: aPort.id,
|
|
169
|
+
label: `${aPort.port} (${aPort.status}) (${aPort.iface_type})`,
|
|
170
|
+
}))
|
|
171
|
+
.sort((x, y) => x.label.localeCompare(y.label));
|
|
172
|
+
const port_value = port_options.find((option) => option.value === value);
|
|
173
|
+
|
|
174
|
+
return (
|
|
175
|
+
<EuiFlexItem css={imsPortIdFieldStyling}>
|
|
176
|
+
<section {...filterDOMProps(props)}>
|
|
177
|
+
<EuiFormRow
|
|
178
|
+
label={label}
|
|
179
|
+
labelAppend={<EuiText size="m">{description}</EuiText>}
|
|
180
|
+
error={showInlineError ? errorMessage : false}
|
|
181
|
+
isInvalid={error}
|
|
182
|
+
id={id}
|
|
183
|
+
fullWidth
|
|
184
|
+
>
|
|
185
|
+
<section className="node-port">
|
|
186
|
+
<div className="node-select">
|
|
187
|
+
<EuiFormRow
|
|
188
|
+
label="Node"
|
|
189
|
+
id={`${id}.node`}
|
|
190
|
+
fullWidth
|
|
191
|
+
>
|
|
192
|
+
<ReactSelect<Option, false>
|
|
193
|
+
inputId={`${id}.node.search`}
|
|
194
|
+
name={`${name}.node`}
|
|
195
|
+
onChange={onChangeNodes}
|
|
196
|
+
options={node_options}
|
|
197
|
+
placeholder={nodesPlaceholder}
|
|
198
|
+
value={node_value}
|
|
199
|
+
isSearchable={true}
|
|
200
|
+
isDisabled={
|
|
201
|
+
disabled ||
|
|
202
|
+
readOnly ||
|
|
203
|
+
!!nodeSubscriptionId ||
|
|
204
|
+
nodes.length === 0
|
|
205
|
+
}
|
|
206
|
+
styles={reactSelectInnerComponentStyles}
|
|
207
|
+
/>
|
|
208
|
+
</EuiFormRow>
|
|
209
|
+
</div>
|
|
210
|
+
<div className="port-select">
|
|
211
|
+
<EuiFormRow label="Port" id={id} fullWidth>
|
|
212
|
+
<ReactSelect<Option<number>, false>
|
|
213
|
+
inputId={`${id}.search`}
|
|
214
|
+
name={name}
|
|
215
|
+
onChange={(selected) => {
|
|
216
|
+
onChange(selected?.value);
|
|
217
|
+
}}
|
|
218
|
+
options={port_options}
|
|
219
|
+
placeholder={portPlaceholder}
|
|
220
|
+
value={port_value}
|
|
221
|
+
isSearchable={true}
|
|
222
|
+
isDisabled={
|
|
223
|
+
disabled ||
|
|
224
|
+
readOnly ||
|
|
225
|
+
ports.length === 0
|
|
226
|
+
}
|
|
227
|
+
styles={reactSelectInnerComponentStyles}
|
|
228
|
+
/>
|
|
229
|
+
</EuiFormRow>
|
|
230
|
+
</div>
|
|
231
|
+
</section>
|
|
232
|
+
</EuiFormRow>
|
|
233
|
+
</section>
|
|
234
|
+
</EuiFlexItem>
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export const ImsPortIdField = connectField(ImsPortId, { kind: 'leaf' });
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
`;
|
|
@@ -39,7 +39,7 @@ function ListAdd({
|
|
|
39
39
|
...props
|
|
40
40
|
}: ListAddFieldProps) {
|
|
41
41
|
const { theme } = useOrchestratorTheme();
|
|
42
|
-
const t = useTranslations('pydanticForms.
|
|
42
|
+
const t = useTranslations('pydanticForms.backendTranslations');
|
|
43
43
|
|
|
44
44
|
const nameParts = joinName(null, name);
|
|
45
45
|
const parentName = joinName(nameParts.slice(0, -1));
|
|
@@ -37,7 +37,7 @@ function ListDel({
|
|
|
37
37
|
...props
|
|
38
38
|
}: ListDelFieldProps) {
|
|
39
39
|
const { theme } = useOrchestratorTheme();
|
|
40
|
-
const t = useTranslations('pydanticForms.
|
|
40
|
+
const t = useTranslations('pydanticForms.backendTranslations');
|
|
41
41
|
|
|
42
42
|
const nameParts = joinName(null, name);
|
|
43
43
|
const nameIndex = +nameParts[nameParts.length - 1];
|
|
@@ -38,7 +38,7 @@ function OptGroup({
|
|
|
38
38
|
className = '',
|
|
39
39
|
...props
|
|
40
40
|
}: OptGroupFieldProps) {
|
|
41
|
-
const t = useTranslations('pydanticForms.
|
|
41
|
+
const t = useTranslations('pydanticForms.backendTranslations');
|
|
42
42
|
const enabled = useField('enabled', {})[0].value;
|
|
43
43
|
|
|
44
44
|
return (
|
|
@@ -250,7 +250,8 @@ function SubscriptionFieldDefinition({
|
|
|
250
250
|
if (parentName !== name) {
|
|
251
251
|
if (
|
|
252
252
|
parent.fieldType === Array &&
|
|
253
|
-
// @ts-
|
|
253
|
+
// @ts-expect-error Parent field can have the uniqueItems boolean property but this is not part of JSONSchema6 type
|
|
254
|
+
// TODO: Figure out why this is so
|
|
254
255
|
parent.uniqueItems
|
|
255
256
|
) {
|
|
256
257
|
const allValues: string[] = get(model, parentName, []);
|
|
@@ -0,0 +1,103 @@
|
|
|
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 from 'react';
|
|
16
|
+
|
|
17
|
+
import { FieldProps, connectField, filterDOMProps } from 'uniforms';
|
|
18
|
+
|
|
19
|
+
import { EuiFlexItem, EuiFormRow, EuiText } from '@elastic/eui';
|
|
20
|
+
|
|
21
|
+
import { getStyles } from '@/components/WfoForms/formFields/SummaryFieldStyling';
|
|
22
|
+
import { useWithOrchestratorTheme } from '@/hooks';
|
|
23
|
+
|
|
24
|
+
export type SummaryFieldProps = FieldProps<
|
|
25
|
+
null,
|
|
26
|
+
{
|
|
27
|
+
description?: string;
|
|
28
|
+
data?: { headers: string[]; labels: string[]; columns: string[][] };
|
|
29
|
+
}
|
|
30
|
+
>;
|
|
31
|
+
|
|
32
|
+
// onChange not used on purpose
|
|
33
|
+
function Summary({
|
|
34
|
+
id,
|
|
35
|
+
label,
|
|
36
|
+
description,
|
|
37
|
+
data,
|
|
38
|
+
...props
|
|
39
|
+
}: SummaryFieldProps) {
|
|
40
|
+
const { summaryFieldStyle } = useWithOrchestratorTheme(getStyles);
|
|
41
|
+
|
|
42
|
+
if (!data) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const { headers, labels, columns } = data;
|
|
47
|
+
|
|
48
|
+
const extraColumnsData = columns.filter((_, index) => index !== 0);
|
|
49
|
+
|
|
50
|
+
const rows = columns[0].map((row, index) => (
|
|
51
|
+
<tr key={index}>
|
|
52
|
+
{labels && <td className={`label`}>{labels[index]}</td>}
|
|
53
|
+
<td className={`value`}>
|
|
54
|
+
{row.includes('<!doctype html>') ? (
|
|
55
|
+
<div
|
|
56
|
+
className="emailMessage"
|
|
57
|
+
dangerouslySetInnerHTML={{ __html: row }}
|
|
58
|
+
></div>
|
|
59
|
+
) : (
|
|
60
|
+
row
|
|
61
|
+
)}
|
|
62
|
+
</td>
|
|
63
|
+
{extraColumnsData &&
|
|
64
|
+
extraColumnsData.map((_, idx) => (
|
|
65
|
+
<td className={`value`} key={idx}>
|
|
66
|
+
{extraColumnsData[idx][index]}
|
|
67
|
+
</td>
|
|
68
|
+
))}
|
|
69
|
+
</tr>
|
|
70
|
+
));
|
|
71
|
+
|
|
72
|
+
const tableHeader =
|
|
73
|
+
!headers || headers.length === 0 ? null : (
|
|
74
|
+
<tr>
|
|
75
|
+
{labels && <th />}
|
|
76
|
+
{headers.map((header, idx) => (
|
|
77
|
+
<th key={idx}>{header}</th>
|
|
78
|
+
))}
|
|
79
|
+
</tr>
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<EuiFlexItem css={summaryFieldStyle}>
|
|
84
|
+
<section {...filterDOMProps(props)}>
|
|
85
|
+
<EuiFormRow
|
|
86
|
+
label={label}
|
|
87
|
+
labelAppend={<EuiText size="m">{description}</EuiText>}
|
|
88
|
+
id={id}
|
|
89
|
+
fullWidth
|
|
90
|
+
>
|
|
91
|
+
<section className="table-summary">
|
|
92
|
+
<table id={`${id}-table`}>
|
|
93
|
+
<thead>{tableHeader}</thead>
|
|
94
|
+
<tbody>{rows}</tbody>
|
|
95
|
+
</table>
|
|
96
|
+
</section>
|
|
97
|
+
</EuiFormRow>
|
|
98
|
+
</section>
|
|
99
|
+
</EuiFlexItem>
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export const SummaryField = connectField(Summary, { kind: 'leaf' });
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { tint } from '@elastic/eui';
|
|
2
|
+
import { EuiThemeComputed } from '@elastic/eui/src/services/theme/types';
|
|
3
|
+
import { css } from '@emotion/react';
|
|
4
|
+
|
|
5
|
+
export const getStyles = (theme: EuiThemeComputed) => {
|
|
6
|
+
const toShadeColor = (color: string) => tint(color, 0.9);
|
|
7
|
+
|
|
8
|
+
const summaryFieldStyle = css({
|
|
9
|
+
'div.emailMessage': {
|
|
10
|
+
td: {
|
|
11
|
+
color: theme.colors.text,
|
|
12
|
+
},
|
|
13
|
+
p: {
|
|
14
|
+
color: theme.colors.text,
|
|
15
|
+
},
|
|
16
|
+
html: {
|
|
17
|
+
marginLeft: '-10px',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
'section.table-summary': {
|
|
21
|
+
marginTop: '20px',
|
|
22
|
+
width: '100%',
|
|
23
|
+
td: {
|
|
24
|
+
padding: '10px',
|
|
25
|
+
verticalAlign: 'top',
|
|
26
|
+
},
|
|
27
|
+
'td:not(:first-child):not(:last-child)': {
|
|
28
|
+
borderRight: `1px solid ${theme.colors.lightestShade}`,
|
|
29
|
+
},
|
|
30
|
+
'.label': {
|
|
31
|
+
fontWeight: 'bold',
|
|
32
|
+
color: theme.colors.lightestShade,
|
|
33
|
+
backgroundColor: theme.colors.primary,
|
|
34
|
+
borderRight: `2px solid ${theme.colors.lightestShade}`,
|
|
35
|
+
borderBottom: `1px solid ${theme.colors.lightestShade}`,
|
|
36
|
+
},
|
|
37
|
+
'.value': {
|
|
38
|
+
backgroundColor: toShadeColor(theme.colors.primary),
|
|
39
|
+
borderBottom: `1px solid ${theme.colors.lightestShade}`,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
return {
|
|
44
|
+
summaryFieldStyle: summaryFieldStyle,
|
|
45
|
+
};
|
|
46
|
+
};
|
|
@@ -210,20 +210,20 @@ function Vlan({
|
|
|
210
210
|
const placeholder = imsIsLoading
|
|
211
211
|
? t('widgets.vlan.loadingIms')
|
|
212
212
|
: subscriptionId
|
|
213
|
-
|
|
214
|
-
|
|
213
|
+
? t('widgets.vlan.placeholder')
|
|
214
|
+
: t('widgets.vlan.placeholderNoServicePort');
|
|
215
215
|
|
|
216
216
|
const errorMessageExtra = missingInIms
|
|
217
217
|
? t('widgets.vlan.missingInIms')
|
|
218
218
|
: !validFormat
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
219
|
+
? t('widgets.vlan.invalidVlan')
|
|
220
|
+
: vlansInUse.length
|
|
221
|
+
? vlansInUse.length >= 1 && vlansInUse[0] === 0
|
|
222
|
+
? t('widgets.vlan.untaggedPortInUse')
|
|
223
|
+
: t('widgets.vlan.vlansInUseError', {
|
|
224
|
+
vlans: vlanRangeFromNumbers(vlansInUse),
|
|
225
|
+
})
|
|
226
|
+
: undefined;
|
|
227
227
|
|
|
228
228
|
let message = '';
|
|
229
229
|
if (!imsIsLoading) {
|
|
@@ -21,9 +21,11 @@ export * from './TimestampField';
|
|
|
21
21
|
export * from './OrganisationField';
|
|
22
22
|
export * from './ContactPersonNameField';
|
|
23
23
|
export * from './ImsNodeIdField';
|
|
24
|
+
export * from './ImsPortIdField';
|
|
24
25
|
export * from './LocationCodeField';
|
|
25
26
|
export * from './VlanField';
|
|
26
27
|
export * from './NestField';
|
|
27
28
|
export * from './OptGroupField';
|
|
28
29
|
export * from './SubscriptionField';
|
|
29
30
|
export * from './IpNetworkField';
|
|
31
|
+
export * from './SummaryField';
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
import { ProductDefinition } from '../../../../types';
|
|
2
|
+
|
|
3
|
+
export interface NodeSubscription {
|
|
4
|
+
name: string;
|
|
5
|
+
subscription_id: string;
|
|
6
|
+
description: string;
|
|
7
|
+
product: ProductDefinition;
|
|
8
|
+
product_id: string;
|
|
9
|
+
status: string;
|
|
10
|
+
insync: boolean;
|
|
11
|
+
customer_id: string;
|
|
12
|
+
start_date: number;
|
|
13
|
+
end_date: number;
|
|
14
|
+
note: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
1
17
|
export interface ServicePort {
|
|
2
18
|
subscription_id?: string;
|
|
3
19
|
vlan?: string;
|
|
@@ -22,6 +38,16 @@ export enum ProductTag {
|
|
|
22
38
|
AGGSPNL = 'AGGSPNL',
|
|
23
39
|
}
|
|
24
40
|
|
|
41
|
+
export interface ImsPort {
|
|
42
|
+
id: number;
|
|
43
|
+
line_name: string;
|
|
44
|
+
node: string;
|
|
45
|
+
port: string;
|
|
46
|
+
iface_type: string;
|
|
47
|
+
patchposition: string;
|
|
48
|
+
status: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
25
51
|
export interface ImsNode {
|
|
26
52
|
id: number;
|
|
27
53
|
name: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './WfoJsonCodeBlock';
|
|
@@ -54,7 +54,6 @@ export const WfoPageHeader: FC<WfoPageHeaderProps> = ({
|
|
|
54
54
|
<WfoLogoutIcon color={theme.colors.emptyShade} />
|
|
55
55
|
)}
|
|
56
56
|
css={{ width: 48, height: 48, marginLeft: 10 }}
|
|
57
|
-
color="ghost"
|
|
58
57
|
onClick={handleSideMenuClick}
|
|
59
58
|
/>
|
|
60
59
|
</EuiHeaderSection>
|
|
@@ -72,8 +71,10 @@ export const WfoPageHeader: FC<WfoPageHeaderProps> = ({
|
|
|
72
71
|
iconType={() => (
|
|
73
72
|
<WfoLogoutIcon color={theme.colors.emptyShade} />
|
|
74
73
|
)}
|
|
75
|
-
css={{
|
|
76
|
-
|
|
74
|
+
css={{
|
|
75
|
+
width: 48,
|
|
76
|
+
height: 48,
|
|
77
|
+
}}
|
|
77
78
|
onClick={handleLogoutClick}
|
|
78
79
|
/>
|
|
79
80
|
</EuiHeaderSectionItem>
|
|
@@ -12,11 +12,11 @@ import {
|
|
|
12
12
|
PATH_METADATA_PRODUCT_BLOCKS,
|
|
13
13
|
PATH_METADATA_RESOURCE_TYPES,
|
|
14
14
|
PATH_METADATA_WORKFLOWS,
|
|
15
|
-
PATH_PROCESSES,
|
|
16
15
|
PATH_SETTINGS,
|
|
17
16
|
PATH_START,
|
|
18
17
|
PATH_SUBSCRIPTIONS,
|
|
19
18
|
PATH_TASKS,
|
|
19
|
+
PATH_WORKFLOWS,
|
|
20
20
|
} from '../paths';
|
|
21
21
|
import { WfoStartCreateWorkflowButtonComboBox } from './WfoStartCreateWorkflowButtonComboBox';
|
|
22
22
|
|
|
@@ -37,7 +37,7 @@ export const WfoSidebar: FC<WfoSidebarProps> = ({ overrideMenuItems }) => {
|
|
|
37
37
|
|
|
38
38
|
const defaultMenuItems: EuiSideNavItemType<object>[] = [
|
|
39
39
|
{
|
|
40
|
-
name: '
|
|
40
|
+
name: t('start'),
|
|
41
41
|
id: '2',
|
|
42
42
|
isSelected: router.pathname === PATH_START,
|
|
43
43
|
onClick: (e) => {
|
|
@@ -46,17 +46,17 @@ export const WfoSidebar: FC<WfoSidebarProps> = ({ overrideMenuItems }) => {
|
|
|
46
46
|
},
|
|
47
47
|
},
|
|
48
48
|
{
|
|
49
|
-
name: '
|
|
49
|
+
name: t('workflows'),
|
|
50
50
|
id: '3',
|
|
51
|
-
isSelected: router.pathname ===
|
|
52
|
-
href:
|
|
51
|
+
isSelected: router.pathname === PATH_WORKFLOWS,
|
|
52
|
+
href: PATH_WORKFLOWS,
|
|
53
53
|
onClick: (e) => {
|
|
54
54
|
e.preventDefault();
|
|
55
|
-
router.push(
|
|
55
|
+
router.push(PATH_WORKFLOWS);
|
|
56
56
|
},
|
|
57
57
|
},
|
|
58
58
|
{
|
|
59
|
-
name: '
|
|
59
|
+
name: t('subscriptions'),
|
|
60
60
|
id: '4',
|
|
61
61
|
isSelected: router.pathname === PATH_SUBSCRIPTIONS,
|
|
62
62
|
href: PATH_SUBSCRIPTIONS,
|
|
@@ -66,14 +66,14 @@ export const WfoSidebar: FC<WfoSidebarProps> = ({ overrideMenuItems }) => {
|
|
|
66
66
|
},
|
|
67
67
|
},
|
|
68
68
|
{
|
|
69
|
-
name: '
|
|
69
|
+
name: t('metadata'),
|
|
70
70
|
id: '5',
|
|
71
71
|
onClick: () => {
|
|
72
72
|
router.push(PATH_METADATA);
|
|
73
73
|
},
|
|
74
74
|
items: [
|
|
75
75
|
{
|
|
76
|
-
name: '
|
|
76
|
+
name: t('metadataProducts'),
|
|
77
77
|
id: '5.1',
|
|
78
78
|
isSelected: router.pathname === PATH_METADATA_PRODUCTS,
|
|
79
79
|
onClick: (e) => {
|
|
@@ -82,7 +82,7 @@ export const WfoSidebar: FC<WfoSidebarProps> = ({ overrideMenuItems }) => {
|
|
|
82
82
|
},
|
|
83
83
|
},
|
|
84
84
|
{
|
|
85
|
-
name: '
|
|
85
|
+
name: t('metadataProductblocks'),
|
|
86
86
|
id: '5.2',
|
|
87
87
|
isSelected:
|
|
88
88
|
router.pathname === PATH_METADATA_PRODUCT_BLOCKS,
|
|
@@ -92,7 +92,7 @@ export const WfoSidebar: FC<WfoSidebarProps> = ({ overrideMenuItems }) => {
|
|
|
92
92
|
},
|
|
93
93
|
},
|
|
94
94
|
{
|
|
95
|
-
name: '
|
|
95
|
+
name: t('metadataResourceTypes'),
|
|
96
96
|
id: '5.3',
|
|
97
97
|
isSelected:
|
|
98
98
|
router.pathname === PATH_METADATA_RESOURCE_TYPES,
|
|
@@ -102,7 +102,7 @@ export const WfoSidebar: FC<WfoSidebarProps> = ({ overrideMenuItems }) => {
|
|
|
102
102
|
},
|
|
103
103
|
},
|
|
104
104
|
{
|
|
105
|
-
name: '
|
|
105
|
+
name: t('metadataWorkflows'),
|
|
106
106
|
id: '5.4',
|
|
107
107
|
isSelected: router.pathname === PATH_METADATA_WORKFLOWS,
|
|
108
108
|
onClick: (e) => {
|
|
@@ -113,7 +113,7 @@ export const WfoSidebar: FC<WfoSidebarProps> = ({ overrideMenuItems }) => {
|
|
|
113
113
|
],
|
|
114
114
|
},
|
|
115
115
|
{
|
|
116
|
-
name: '
|
|
116
|
+
name: t('tasks'),
|
|
117
117
|
isSelected: router.pathname === PATH_TASKS,
|
|
118
118
|
id: '6',
|
|
119
119
|
onClick: (e) => {
|
|
@@ -123,7 +123,7 @@ export const WfoSidebar: FC<WfoSidebarProps> = ({ overrideMenuItems }) => {
|
|
|
123
123
|
href: PATH_TASKS,
|
|
124
124
|
},
|
|
125
125
|
{
|
|
126
|
-
name: '
|
|
126
|
+
name: t('settings'),
|
|
127
127
|
isSelected: router.pathname === PATH_SETTINGS,
|
|
128
128
|
id: '7',
|
|
129
129
|
onClick: (e) => {
|