@orchestrator-ui/orchestrator-ui-components 2.14.0 → 2.14.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 +1 -1
- package/.turbo/turbo-test.log +8 -8
- package/CHANGELOG.md +7 -0
- package/dist/index.d.ts +4 -3
- package/dist/index.js +853 -1216
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/WfoForms/formFields/deprecated/IpNetworkField.tsx +21 -50
- package/src/configuration/version.ts +1 -1
- package/src/utils/uuid.spec.ts +5 -0
- package/src/utils/uuid.ts +2 -1
package/package.json
CHANGED
|
@@ -14,18 +14,29 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import React, { useState } from 'react';
|
|
16
16
|
|
|
17
|
-
import { useTranslations } from 'next-intl';
|
|
18
17
|
import { connectField, filterDOMProps } from 'uniforms';
|
|
19
18
|
|
|
20
|
-
import {
|
|
19
|
+
import { EuiFormRow, EuiText } from '@elastic/eui';
|
|
21
20
|
|
|
22
21
|
import { getCommonFormFieldStyles } from '@/components/WfoForms/formFields/commonStyles';
|
|
23
22
|
import SplitPrefix from '@/components/WfoForms/formFields/deprecated/SplitPrefix';
|
|
24
23
|
import { useWithOrchestratorTheme } from '@/hooks';
|
|
25
24
|
|
|
26
25
|
import { FieldProps } from '../types';
|
|
27
|
-
|
|
28
|
-
|
|
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
|
+
}
|
|
29
40
|
|
|
30
41
|
export type IPvAnyNetworkFieldProps = FieldProps<
|
|
31
42
|
string,
|
|
@@ -48,17 +59,13 @@ function IpNetwork({
|
|
|
48
59
|
}: IPvAnyNetworkFieldProps) {
|
|
49
60
|
const { formRowStyle } = useWithOrchestratorTheme(getCommonFormFieldStyles);
|
|
50
61
|
|
|
51
|
-
|
|
52
|
-
const [selectedPrefix
|
|
53
|
-
undefined,
|
|
54
|
-
);
|
|
55
|
-
const [manualOverride, setManualOverride] = useState(false);
|
|
62
|
+
// The state is needed in order to keep the selected prefix in the SplitPrefix component
|
|
63
|
+
const [selectedPrefix] = useState<string | undefined>(value);
|
|
56
64
|
|
|
57
|
-
const usePrefix = selectedPrefix
|
|
65
|
+
const usePrefix = selectedPrefix;
|
|
58
66
|
const [subnet, netmask] = usePrefix?.split('/') ?? ['', ''];
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
parseInt(netmask, 10) + (selectedPrefix?.state === 0 ? 0 : 1);
|
|
67
|
+
|
|
68
|
+
const usedPrefixMin = getUsedPrefixMin(netmask, prefixMin, name);
|
|
62
69
|
|
|
63
70
|
return (
|
|
64
71
|
<section {...filterDOMProps(props)}>
|
|
@@ -73,32 +80,7 @@ function IpNetwork({
|
|
|
73
80
|
>
|
|
74
81
|
<section className="ipblock-selector">
|
|
75
82
|
<div id={id}>
|
|
76
|
-
{
|
|
77
|
-
<IpPrefixTableField
|
|
78
|
-
id={id}
|
|
79
|
-
name={name}
|
|
80
|
-
onChange={(prefix: IpBlock) => {
|
|
81
|
-
if (!readOnly) {
|
|
82
|
-
if (
|
|
83
|
-
prefix.state === 0 ||
|
|
84
|
-
prefix.state === 1
|
|
85
|
-
) {
|
|
86
|
-
setSelectedPrefix(prefix);
|
|
87
|
-
}
|
|
88
|
-
setManualOverride(false);
|
|
89
|
-
onChange(prefix.prefix);
|
|
90
|
-
}
|
|
91
|
-
}}
|
|
92
|
-
onManualOverride={(prefixString: string) => {
|
|
93
|
-
if (!readOnly) {
|
|
94
|
-
setManualOverride(true);
|
|
95
|
-
onChange(prefixString);
|
|
96
|
-
}
|
|
97
|
-
}}
|
|
98
|
-
selected_prefix_id={selectedPrefix?.id}
|
|
99
|
-
/>
|
|
100
|
-
)}
|
|
101
|
-
{usePrefix && !manualOverride && (
|
|
83
|
+
{usePrefix && (
|
|
102
84
|
<SplitPrefix
|
|
103
85
|
id={id}
|
|
104
86
|
name={name}
|
|
@@ -113,17 +95,6 @@ function IpNetwork({
|
|
|
113
95
|
selectedSubnet={usePrefix}
|
|
114
96
|
/>
|
|
115
97
|
)}
|
|
116
|
-
{usePrefix && manualOverride && (
|
|
117
|
-
<EuiCallOut
|
|
118
|
-
title={t(
|
|
119
|
-
'widgets.ipvAnyNetworkField.manuallySelectedPrefix',
|
|
120
|
-
)}
|
|
121
|
-
color="primary"
|
|
122
|
-
iconType="check"
|
|
123
|
-
>
|
|
124
|
-
<p>{value}</p>
|
|
125
|
-
</EuiCallOut>
|
|
126
|
-
)}
|
|
127
98
|
</div>
|
|
128
99
|
</section>
|
|
129
100
|
</EuiFormRow>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const ORCHESTRATOR_UI_LIBRARY_VERSION = '2.14.
|
|
1
|
+
export const ORCHESTRATOR_UI_LIBRARY_VERSION = '2.14.1';
|
package/src/utils/uuid.spec.ts
CHANGED
|
@@ -5,6 +5,11 @@ describe('getFirstUuidPart()', () => {
|
|
|
5
5
|
const result = getFirstUuidPart('12345678-1234-1234-1234-123456789abc');
|
|
6
6
|
expect(result).toEqual('12345678');
|
|
7
7
|
});
|
|
8
|
+
|
|
9
|
+
it('returns empty string for empty uuid', () => {
|
|
10
|
+
const result = getFirstUuidPart();
|
|
11
|
+
expect(result).toEqual('');
|
|
12
|
+
});
|
|
8
13
|
});
|
|
9
14
|
|
|
10
15
|
describe('isUuid4()', () => {
|
package/src/utils/uuid.ts
CHANGED