@openshift-assisted/ui-lib 2.14.8-cim → 2.14.10-cim
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/build/@types/cim/components/Agent/tableUtils.d.ts +5 -1
- package/build/@types/cim/components/Agent/tableUtils.d.ts.map +1 -1
- package/build/@types/cim/components/ClusterDeployment/ClusterDetailsFormFields.d.ts.map +1 -1
- package/build/@types/cim/components/Hypershift/HostedClusterWizard/DetailsStep/DetailsForm.d.ts.map +1 -1
- package/build/@types/cim/components/Hypershift/HostedClusterWizard/DetailsStep/DetailsStep.d.ts.map +1 -1
- package/build/@types/cim/components/Hypershift/HostedClusterWizard/DetailsStep/types.d.ts +6 -1
- package/build/@types/cim/components/Hypershift/HostedClusterWizard/DetailsStep/types.d.ts.map +1 -1
- package/build/@types/cim/components/Hypershift/hooks/useSupportedOCPVersions.d.ts +1 -1
- package/build/@types/cim/components/Hypershift/hooks/useSupportedOCPVersions.d.ts.map +1 -1
- package/build/@types/cim/components/InfraEnv/InfraEnvAgentTable.d.ts.map +1 -1
- package/build/@types/common/components/clusterConfiguration/index.d.ts +0 -1
- package/build/@types/common/components/clusterConfiguration/index.d.ts.map +1 -1
- package/build/@types/common/components/hosts/AITable.d.ts +3 -1
- package/build/@types/common/components/hosts/AITable.d.ts.map +1 -1
- package/build/@types/common/components/hosts/HostsTable.d.ts +2 -1
- package/build/@types/common/components/hosts/HostsTable.d.ts.map +1 -1
- package/build/@types/common/components/hosts/utils.d.ts +4 -1
- package/build/@types/common/components/hosts/utils.d.ts.map +1 -1
- package/build/cjs/cim/components/Agent/tableUtils.js +4 -3
- package/build/cjs/cim/components/Agent/tableUtils.js.map +1 -1
- package/build/cjs/cim/components/ClusterDeployment/ClusterDetailsFormFields.js +16 -14
- package/build/cjs/cim/components/ClusterDeployment/ClusterDetailsFormFields.js.map +1 -1
- package/build/cjs/cim/components/Hypershift/HostedClusterWizard/DetailsStep/DetailsForm.js +21 -3
- package/build/cjs/cim/components/Hypershift/HostedClusterWizard/DetailsStep/DetailsForm.js.map +1 -1
- package/build/cjs/cim/components/Hypershift/HostedClusterWizard/DetailsStep/DetailsStep.js +3 -1
- package/build/cjs/cim/components/Hypershift/HostedClusterWizard/DetailsStep/DetailsStep.js.map +1 -1
- package/build/cjs/cim/components/Hypershift/hooks/useSupportedOCPVersions.js +3 -3
- package/build/cjs/cim/components/Hypershift/hooks/useSupportedOCPVersions.js.map +1 -1
- package/build/cjs/cim/components/Hypershift/modals/AddNodePoolModal.js +1 -1
- package/build/cjs/cim/components/Hypershift/modals/AddNodePoolModal.js.map +1 -1
- package/build/cjs/cim/components/InfraEnv/InfraEnvAgentTable.js +2 -2
- package/build/cjs/cim/components/InfraEnv/InfraEnvAgentTable.js.map +1 -1
- package/build/cjs/common/components/clusterConfiguration/index.js +1 -3
- package/build/cjs/common/components/clusterConfiguration/index.js.map +1 -1
- package/build/cjs/common/components/hosts/AITable.js +54 -38
- package/build/cjs/common/components/hosts/AITable.js.map +1 -1
- package/build/cjs/common/components/hosts/AITableMemo.js +16 -13
- package/build/cjs/common/components/hosts/AITableMemo.js.map +1 -1
- package/build/cjs/common/components/hosts/HostsTable.js +8 -5
- package/build/cjs/common/components/hosts/HostsTable.js.map +1 -1
- package/build/cjs/common/components/hosts/utils.js +12 -2
- package/build/cjs/common/components/hosts/utils.js.map +1 -1
- package/lib/cim/components/Agent/tableUtils.tsx +4 -3
- package/lib/cim/components/ClusterDeployment/ClusterDetailsFormFields.tsx +21 -18
- package/lib/cim/components/Hypershift/HostedClusterWizard/DetailsStep/DetailsForm.tsx +48 -3
- package/lib/cim/components/Hypershift/HostedClusterWizard/DetailsStep/DetailsStep.tsx +4 -0
- package/lib/cim/components/Hypershift/HostedClusterWizard/DetailsStep/types.ts +6 -1
- package/lib/cim/components/Hypershift/hooks/useSupportedOCPVersions.ts +3 -2
- package/lib/cim/components/Hypershift/modals/AddNodePoolModal.tsx +1 -1
- package/lib/cim/components/InfraEnv/InfraEnvAgentTable.tsx +2 -0
- package/lib/common/components/clusterConfiguration/index.ts +0 -1
- package/lib/common/components/hosts/AITable.tsx +61 -37
- package/lib/common/components/hosts/AITableMemo.tsx +1 -1
- package/lib/common/components/hosts/HostsTable.tsx +21 -9
- package/lib/common/components/hosts/utils.ts +18 -2
- package/package.json +3 -3
- package/build/@types/common/components/clusterConfiguration/OpenShiftVersionSelect.d.ts +0 -10
- package/build/@types/common/components/clusterConfiguration/OpenShiftVersionSelect.d.ts.map +0 -1
- package/build/cjs/common/components/clusterConfiguration/OpenShiftVersionSelect.js +0 -52
- package/build/cjs/common/components/clusterConfiguration/OpenShiftVersionSelect.js.map +0 -1
- package/lib/common/components/clusterConfiguration/OpenShiftVersionSelect.tsx +0 -81
|
@@ -8,6 +8,7 @@ export type DetailsFormValues = {
|
|
|
8
8
|
openshiftVersion: string;
|
|
9
9
|
pullSecret: string;
|
|
10
10
|
baseDnsDomain: string;
|
|
11
|
+
customOpenshiftSelect: OpenshiftVersionOptionType | null;
|
|
11
12
|
};
|
|
12
13
|
|
|
13
14
|
type UseDetailsFormikArgs = {
|
|
@@ -19,7 +20,10 @@ type UseDetailsFormikArgs = {
|
|
|
19
20
|
|
|
20
21
|
export type UseDetailsFormik = (
|
|
21
22
|
args: UseDetailsFormikArgs,
|
|
22
|
-
) => [
|
|
23
|
+
) => [
|
|
24
|
+
DetailsFormValues,
|
|
25
|
+
ObjectSchema<Omit<DetailsFormValues, 'openshiftVersion' | 'customOpenshiftSelect'>>,
|
|
26
|
+
];
|
|
23
27
|
|
|
24
28
|
export type DetailsStepProps = {
|
|
25
29
|
usedClusterNames: string[];
|
|
@@ -35,4 +39,5 @@ export type DetailsStepProps = {
|
|
|
35
39
|
|
|
36
40
|
export type DetailsFormProps = Pick<DetailsStepProps, 'onValuesChanged' | 'extensionAfter'> & {
|
|
37
41
|
ocpVersions: OpenshiftVersionOptionType[];
|
|
42
|
+
allVersions: OpenshiftVersionOptionType[];
|
|
38
43
|
};
|
|
@@ -11,9 +11,10 @@ export const getSupportedCM = (configMaps: ConfigMapK8sResource[]) =>
|
|
|
11
11
|
export const useSupportedOCPVersions = (
|
|
12
12
|
clusterImages: ClusterImageSetK8sResource[],
|
|
13
13
|
supportedVersionsCM?: ConfigMapK8sResource,
|
|
14
|
+
extended?: boolean,
|
|
14
15
|
) => {
|
|
15
16
|
return React.useMemo(() => {
|
|
16
|
-
const ocpVersions = getOCPVersions(clusterImages, false);
|
|
17
|
+
const ocpVersions = getOCPVersions(clusterImages, false, undefined, extended);
|
|
17
18
|
const supportedVersionsString = supportedVersionsCM?.data?.['supported-versions'];
|
|
18
19
|
if (supportedVersionsString) {
|
|
19
20
|
try {
|
|
@@ -25,5 +26,5 @@ export const useSupportedOCPVersions = (
|
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
28
|
return ocpVersions;
|
|
28
|
-
}, [clusterImages, supportedVersionsCM]);
|
|
29
|
+
}, [clusterImages, extended, supportedVersionsCM?.data]);
|
|
29
30
|
};
|
|
@@ -41,7 +41,7 @@ const AddNodePoolModal = ({
|
|
|
41
41
|
const handleSubmit = async (values: NodePoolFormValues) => {
|
|
42
42
|
setError(undefined);
|
|
43
43
|
const nodePool: NodePoolK8sResource = {
|
|
44
|
-
apiVersion: 'hypershift.openshift.io/
|
|
44
|
+
apiVersion: 'hypershift.openshift.io/v1beta1',
|
|
45
45
|
kind: 'NodePool',
|
|
46
46
|
metadata: {
|
|
47
47
|
name: values.nodePoolName,
|
|
@@ -123,6 +123,7 @@ const InfraEnvAgentTable: React.FC<InfraEnvAgentTableProps> = ({
|
|
|
123
123
|
setStatusFilter,
|
|
124
124
|
statusFilter,
|
|
125
125
|
filteredHosts: hosts,
|
|
126
|
+
sorted,
|
|
126
127
|
} = useAgentsFilter({
|
|
127
128
|
agents,
|
|
128
129
|
agentStatuses,
|
|
@@ -226,6 +227,7 @@ const InfraEnvAgentTable: React.FC<InfraEnvAgentTableProps> = ({
|
|
|
226
227
|
<StackItem>
|
|
227
228
|
<HostsTable
|
|
228
229
|
hosts={hosts}
|
|
230
|
+
alreadySorted={sorted}
|
|
229
231
|
content={content}
|
|
230
232
|
actionResolver={actionResolver}
|
|
231
233
|
selectedIDs={selectedHostIDs}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export { default as SNOControlGroup } from './SNOControlGroup';
|
|
2
2
|
export { default as SNODisclaimer } from './SNODisclaimer';
|
|
3
|
-
export { default as OpenShiftVersionSelect } from './OpenShiftVersionSelect';
|
|
4
3
|
export { default as UploadSSH } from './UploadSSH';
|
|
5
4
|
export { default as ProxyFields, ProxyInputFields } from './ProxyFields';
|
|
6
5
|
export { default as DownloadIsoModal } from './DownloadIsoModal';
|
|
@@ -80,6 +80,7 @@ export type AITableProps<R> = ReturnType<typeof usePagination> & {
|
|
|
80
80
|
actionResolver?: ActionsResolver<R>;
|
|
81
81
|
canSelectAll?: boolean;
|
|
82
82
|
variant?: TableProps['variant'];
|
|
83
|
+
alreadySorted?: boolean;
|
|
83
84
|
};
|
|
84
85
|
|
|
85
86
|
// eslint-disable-next-line
|
|
@@ -103,8 +104,21 @@ const AITable = <R extends any>({
|
|
|
103
104
|
perPageOptions,
|
|
104
105
|
canSelectAll,
|
|
105
106
|
variant,
|
|
107
|
+
alreadySorted,
|
|
106
108
|
}: WithTestID & AITableProps<R>) => {
|
|
107
109
|
const itemIDs = React.useMemo(() => data.map(getDataId), [data, getDataId]);
|
|
110
|
+
const [openRows, setOpenRows] = React.useState<OpenRows>({});
|
|
111
|
+
|
|
112
|
+
const sortByRef = React.useRef<ISortBy>();
|
|
113
|
+
const [sortBy, setSortBy] = React.useState<ISortBy>({
|
|
114
|
+
index: onSelect ? 1 : 0,
|
|
115
|
+
direction: SortByDirection.asc,
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
const dataRef = React.useRef(data);
|
|
119
|
+
if (dataRef.current !== data) {
|
|
120
|
+
dataRef.current = data;
|
|
121
|
+
}
|
|
108
122
|
|
|
109
123
|
React.useEffect(() => {
|
|
110
124
|
if (selectedIDs && setSelectedIDs) {
|
|
@@ -121,16 +135,29 @@ const AITable = <R extends any>({
|
|
|
121
135
|
}
|
|
122
136
|
}, [data, setSelectedIDs, selectedIDs, getDataId]);
|
|
123
137
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
138
|
+
React.useEffect(() => {
|
|
139
|
+
if (alreadySorted) {
|
|
140
|
+
sortByRef.current = sortBy;
|
|
141
|
+
setSortBy({
|
|
142
|
+
index: -1,
|
|
143
|
+
direction: SortByDirection.asc,
|
|
144
|
+
});
|
|
145
|
+
} else {
|
|
146
|
+
if (sortBy.index === -1 && sortByRef.current) {
|
|
147
|
+
setSortBy(sortByRef.current);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
151
|
+
}, [alreadySorted]);
|
|
152
|
+
|
|
153
|
+
React.useEffect(() => {
|
|
154
|
+
if (!alreadySorted) {
|
|
155
|
+
sortByRef.current = sortBy;
|
|
156
|
+
} else if (alreadySorted && sortBy.index !== -1) {
|
|
157
|
+
sortByRef.current = sortBy;
|
|
158
|
+
}
|
|
159
|
+
}, [sortBy, alreadySorted]);
|
|
129
160
|
|
|
130
|
-
const dataRef = React.useRef(data);
|
|
131
|
-
if (dataRef.current !== data) {
|
|
132
|
-
dataRef.current = data;
|
|
133
|
-
}
|
|
134
161
|
const onSelectAll = React.useCallback(
|
|
135
162
|
(isChecked: boolean) => {
|
|
136
163
|
setSelectedIDs?.(isChecked ? dataRef.current.map(getDataId) : []);
|
|
@@ -169,33 +196,27 @@ const AITable = <R extends any>({
|
|
|
169
196
|
return [newContent, columns];
|
|
170
197
|
}, [canSelectAll, content, getDataId, onSelect, onSelectAll]);
|
|
171
198
|
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
ExpandComponent,
|
|
194
|
-
getDataId,
|
|
195
|
-
contentWithAdditions,
|
|
196
|
-
openRows,
|
|
197
|
-
actionResolver,
|
|
198
|
-
]);
|
|
199
|
+
const getRows = React.useCallback(
|
|
200
|
+
(data: R[]) =>
|
|
201
|
+
(data || [])
|
|
202
|
+
.map<IRow>((obj) => {
|
|
203
|
+
const id = getDataId(obj);
|
|
204
|
+
const cells = contentWithAdditions.filter((c) => !!c.cell).map((c) => c.cell?.(obj));
|
|
205
|
+
const isOpen = !!openRows[id];
|
|
206
|
+
return {
|
|
207
|
+
isOpen,
|
|
208
|
+
cells,
|
|
209
|
+
key: `${id}-master`,
|
|
210
|
+
id,
|
|
211
|
+
actions: actionResolver ? actionResolver(obj) : undefined,
|
|
212
|
+
nestedComponent: ExpandComponent ? <ExpandComponent obj={obj} /> : undefined,
|
|
213
|
+
};
|
|
214
|
+
})
|
|
215
|
+
.slice((page - 1) * perPage, page * perPage),
|
|
216
|
+
[page, perPage, getDataId, contentWithAdditions, openRows, actionResolver, ExpandComponent],
|
|
217
|
+
);
|
|
218
|
+
|
|
219
|
+
const hostRows = React.useMemo(() => getRows(data), [data, getRows]);
|
|
199
220
|
|
|
200
221
|
const rows = React.useMemo(() => {
|
|
201
222
|
if (hostRows.length) {
|
|
@@ -223,10 +244,13 @@ const AITable = <R extends any>({
|
|
|
223
244
|
}, []);
|
|
224
245
|
|
|
225
246
|
const sortedRows = React.useMemo(() => {
|
|
247
|
+
if (alreadySorted && sortBy.index === -1) {
|
|
248
|
+
return getRows(data);
|
|
249
|
+
}
|
|
226
250
|
return rows.sort(
|
|
227
251
|
rowSorter(sortBy, (row: IRow, index = 0) => row.cells?.[index] as string | HumanizedSortable),
|
|
228
252
|
);
|
|
229
|
-
}, [rows,
|
|
253
|
+
}, [alreadySorted, sortBy, rows, getRows, data]);
|
|
230
254
|
|
|
231
255
|
return (
|
|
232
256
|
<>
|
|
@@ -60,20 +60,32 @@ type HostsTableProps = ReturnType<typeof usePagination> &
|
|
|
60
60
|
| 'variant'
|
|
61
61
|
> & {
|
|
62
62
|
hosts: Host[];
|
|
63
|
+
alreadySorted?: boolean;
|
|
63
64
|
skipDisabled?: boolean;
|
|
64
65
|
children: React.ReactNode;
|
|
65
66
|
};
|
|
66
67
|
|
|
67
|
-
const HostsTable = ({
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
68
|
+
const HostsTable = ({
|
|
69
|
+
hosts,
|
|
70
|
+
skipDisabled,
|
|
71
|
+
alreadySorted,
|
|
72
|
+
...rest
|
|
73
|
+
}: HostsTableProps & WithTestID) => {
|
|
74
|
+
const data = React.useMemo(() => {
|
|
75
|
+
const filteredHosts = (hosts || []).filter(
|
|
76
|
+
(host) => !skipDisabled || host.status !== 'disabled',
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
return alreadySorted
|
|
80
|
+
? filteredHosts
|
|
81
|
+
: filteredHosts.sort((a, b) =>
|
|
82
|
+
a.createdAt && b.createdAt && a.createdAt < b.createdAt ? -1 : 1,
|
|
83
|
+
);
|
|
84
|
+
}, [hosts, skipDisabled, alreadySorted]);
|
|
75
85
|
|
|
76
|
-
return
|
|
86
|
+
return (
|
|
87
|
+
<AITable<Host> getDataId={getHostId} data={data} alreadySorted={alreadySorted} {...rest} />
|
|
88
|
+
);
|
|
77
89
|
};
|
|
78
90
|
|
|
79
91
|
export default HostsTable;
|
|
@@ -196,7 +196,7 @@ export const getInventory = (host: Host) => {
|
|
|
196
196
|
|
|
197
197
|
export const filterByHostname = (hosts: Host[], hostnameFilter: string | undefined) => {
|
|
198
198
|
if (!hostnameFilter) {
|
|
199
|
-
return hosts;
|
|
199
|
+
return { hosts, sorted: false };
|
|
200
200
|
}
|
|
201
201
|
const hostsWithHostname = hosts.map((host) => {
|
|
202
202
|
const { inventory: inventoryString = '' } = host;
|
|
@@ -209,12 +209,28 @@ export const filterByHostname = (hosts: Host[], hostnameFilter: string | undefin
|
|
|
209
209
|
});
|
|
210
210
|
|
|
211
211
|
const fuse = new Fuse(hostsWithHostname, {
|
|
212
|
+
includeScore: true,
|
|
212
213
|
ignoreLocation: true,
|
|
213
214
|
threshold: 0.3,
|
|
214
215
|
keys: ['hostname'],
|
|
215
216
|
});
|
|
216
217
|
|
|
217
|
-
|
|
218
|
+
const filteredHosts = fuse.search(hostnameFilter);
|
|
219
|
+
|
|
220
|
+
const sortedHosts = filteredHosts
|
|
221
|
+
.sort((a, b) => (a.score || 0) - (b.score || 0))
|
|
222
|
+
.map(({ item }) => item.host);
|
|
223
|
+
|
|
224
|
+
const sorted =
|
|
225
|
+
filteredHosts.length > 1 &&
|
|
226
|
+
filteredHosts.some(
|
|
227
|
+
(result, index) => index > 0 && (result.score || 0) !== (filteredHosts[0].score || 0),
|
|
228
|
+
);
|
|
229
|
+
|
|
230
|
+
return {
|
|
231
|
+
hosts: sortedHosts,
|
|
232
|
+
sorted,
|
|
233
|
+
};
|
|
218
234
|
};
|
|
219
235
|
|
|
220
236
|
export const getFailingHostValidations = (validationsInfo: HostValidationsInfo) =>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dependencies": {
|
|
3
|
-
"@openshift-assisted/locales": "2.14.
|
|
4
|
-
"@openshift-assisted/types": "2.14.
|
|
3
|
+
"@openshift-assisted/locales": "2.14.10-cim",
|
|
4
|
+
"@openshift-assisted/types": "2.14.10-cim",
|
|
5
5
|
"@openshift-console/dynamic-plugin-sdk": "0.0.3",
|
|
6
6
|
"@patternfly/patternfly": "5.2.0",
|
|
7
7
|
"@patternfly/react-code-editor": "5.2.0",
|
|
@@ -140,5 +140,5 @@
|
|
|
140
140
|
]
|
|
141
141
|
}
|
|
142
142
|
},
|
|
143
|
-
"version": "2.14.
|
|
143
|
+
"version": "2.14.10-cim"
|
|
144
144
|
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { OpenshiftVersionOptionType } from '../../types';
|
|
3
|
-
import { SelectFieldProps } from '../ui/formik/types';
|
|
4
|
-
type OpenShiftVersionSelectProps = {
|
|
5
|
-
versions: OpenshiftVersionOptionType[];
|
|
6
|
-
onChange?: SelectFieldProps['onChange'];
|
|
7
|
-
};
|
|
8
|
-
declare const OpenShiftVersionSelect: React.FC<OpenShiftVersionSelectProps>;
|
|
9
|
-
export default OpenShiftVersionSelect;
|
|
10
|
-
//# sourceMappingURL=OpenShiftVersionSelect.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OpenShiftVersionSelect.d.ts","sourceRoot":"","sources":["../../../../../lib/common/components/clusterConfiguration/OpenShiftVersionSelect.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAGzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AA4CtD,KAAK,2BAA2B,GAAG;IACjC,QAAQ,EAAE,0BAA0B,EAAE,CAAC;IACvC,QAAQ,CAAC,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAC;CACzC,CAAC;AACF,QAAA,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC,2BAA2B,CAqBjE,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const react_1 = tslib_1.__importDefault(require("react"));
|
|
5
|
-
const exclamation_circle_icon_1 = require("@patternfly/react-icons/dist/js/icons/exclamation-circle-icon");
|
|
6
|
-
const exclamation_triangle_icon_1 = require("@patternfly/react-icons/dist/js/icons/exclamation-triangle-icon");
|
|
7
|
-
const external_link_alt_icon_1 = require("@patternfly/react-icons/dist/js/icons/external-link-alt-icon");
|
|
8
|
-
const config_1 = require("../../config");
|
|
9
|
-
const ui_1 = require("../ui");
|
|
10
|
-
const use_translation_wrapper_1 = require("../../hooks/use-translation-wrapper");
|
|
11
|
-
const OpenShiftLifeCycleDatesLink = () => {
|
|
12
|
-
const { t } = (0, use_translation_wrapper_1.useTranslation)();
|
|
13
|
-
return (react_1.default.createElement("a", { href: config_1.OPENSHIFT_LIFE_CYCLE_DATES_LINK, target: "_blank", rel: "noopener noreferrer" },
|
|
14
|
-
t('ai:Learn more'),
|
|
15
|
-
" ",
|
|
16
|
-
react_1.default.createElement(external_link_alt_icon_1.ExternalLinkAltIcon, null)));
|
|
17
|
-
};
|
|
18
|
-
const getOpenshiftVersionHelperText =
|
|
19
|
-
// eslint-disable-next-line react/display-name
|
|
20
|
-
(versions) => (selectedVersionValue) => {
|
|
21
|
-
const { t } = (0, use_translation_wrapper_1.useTranslation)();
|
|
22
|
-
if (!versions.length) {
|
|
23
|
-
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
24
|
-
react_1.default.createElement(ui_1.UiIcon, { size: "sm", status: "danger", icon: react_1.default.createElement(exclamation_circle_icon_1.ExclamationCircleIcon, null) }),
|
|
25
|
-
"\u00A0 ",
|
|
26
|
-
t('ai:No release image is available.')));
|
|
27
|
-
}
|
|
28
|
-
const selectedVersion = versions.find((version) => version.value === selectedVersionValue);
|
|
29
|
-
if (!selectedVersionValue || !selectedVersion) {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
if (selectedVersion.supportLevel !== 'production' &&
|
|
33
|
-
selectedVersion.supportLevel !== 'maintenance') {
|
|
34
|
-
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
35
|
-
react_1.default.createElement(ui_1.UiIcon, { size: "sm", status: "warning", icon: react_1.default.createElement(exclamation_triangle_icon_1.ExclamationTriangleIcon, null) }),
|
|
36
|
-
"\u00A0",
|
|
37
|
-
t('ai:Please note that this version is not production-ready.'),
|
|
38
|
-
"\u00A0",
|
|
39
|
-
react_1.default.createElement(OpenShiftLifeCycleDatesLink, null)));
|
|
40
|
-
}
|
|
41
|
-
return null;
|
|
42
|
-
};
|
|
43
|
-
const OpenShiftVersionSelect = ({ versions, onChange }) => {
|
|
44
|
-
const selectOptions = react_1.default.useMemo(() => versions.map((version) => ({
|
|
45
|
-
label: version.label,
|
|
46
|
-
value: version.value,
|
|
47
|
-
})), [versions]);
|
|
48
|
-
const { t } = (0, use_translation_wrapper_1.useTranslation)();
|
|
49
|
-
return (react_1.default.createElement(ui_1.SelectField, { label: t('ai:OpenShift version'), name: "openshiftVersion", options: selectOptions, getHelperText: getOpenshiftVersionHelperText(versions), isDisabled: versions.length === 0, isRequired: true, onChange: onChange }));
|
|
50
|
-
};
|
|
51
|
-
exports.default = OpenShiftVersionSelect;
|
|
52
|
-
//# sourceMappingURL=OpenShiftVersionSelect.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OpenShiftVersionSelect.js","sourceRoot":"","sources":["../../../../../lib/common/components/clusterConfiguration/OpenShiftVersionSelect.tsx"],"names":[],"mappings":";;;AAAA,0DAA0B;AAC1B,2GAAsG;AACtG,+GAA0G;AAC1G,yGAAmG;AAEnG,yCAA+D;AAE/D,8BAA4C;AAC5C,iFAAqE;AAGrE,MAAM,2BAA2B,GAAG,GAAG,EAAE;IACvC,MAAM,EAAE,CAAC,EAAE,GAAG,IAAA,wCAAc,GAAE,CAAC;IAC/B,OAAO,CACL,qCAAG,IAAI,EAAE,wCAA+B,EAAE,MAAM,EAAC,QAAQ,EAAC,GAAG,EAAC,qBAAqB;QAChF,CAAC,CAAC,eAAe,CAAC;;QAAE,8BAAC,4CAAmB,OAAG,CAC1C,CACL,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,6BAA6B;AACjC,8CAA8C;AAC9C,CAAC,QAAsC,EAAE,EAAE,CAAC,CAAC,oBAA4B,EAAE,EAAE;IAC3E,MAAM,EAAE,CAAC,EAAE,GAAG,IAAA,wCAAc,GAAE,CAAC;IAC/B,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;QACpB,OAAO,CACL;YACE,8BAAC,WAAM,IAAC,IAAI,EAAC,IAAI,EAAC,MAAM,EAAC,QAAQ,EAAC,IAAI,EAAE,8BAAC,+CAAqB,OAAG,GAAI;;YAC7D,CAAC,CAAC,mCAAmC,CAAC,CAC7C,CACJ,CAAC;KACH;IACD,MAAM,eAAe,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,KAAK,oBAAoB,CAAC,CAAC;IAC3F,IAAI,CAAC,oBAAoB,IAAI,CAAC,eAAe,EAAE;QAC7C,OAAO,IAAI,CAAC;KACb;IAED,IACE,eAAe,CAAC,YAAY,KAAK,YAAY;QAC7C,eAAe,CAAC,YAAY,KAAK,aAAa,EAC9C;QACA,OAAO,CACL;YACE,8BAAC,WAAM,IAAC,IAAI,EAAC,IAAI,EAAC,MAAM,EAAC,SAAS,EAAC,IAAI,EAAE,8BAAC,mDAAuB,OAAG,GAAI;;YACjE,CAAC,CAAC,2DAA2D,CAAC;;YACrE,8BAAC,2BAA2B,OAAG,CAC9B,CACJ,CAAC;KACH;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAMJ,MAAM,sBAAsB,GAA0C,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC/F,MAAM,aAAa,GAAG,eAAK,CAAC,OAAO,CACjC,GAAG,EAAE,CACH,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACzB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,KAAK,EAAE,OAAO,CAAC,KAAK;KACrB,CAAC,CAAC,EACL,CAAC,QAAQ,CAAC,CACX,CAAC;IACF,MAAM,EAAE,CAAC,EAAE,GAAG,IAAA,wCAAc,GAAE,CAAC;IAC/B,OAAO,CACL,8BAAC,gBAAW,IACV,KAAK,EAAE,CAAC,CAAC,sBAAsB,CAAC,EAChC,IAAI,EAAC,kBAAkB,EACvB,OAAO,EAAE,aAAa,EACtB,aAAa,EAAE,6BAA6B,CAAC,QAAQ,CAAC,EACtD,UAAU,EAAE,QAAQ,CAAC,MAAM,KAAK,CAAC,EACjC,UAAU,QACV,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,sBAAsB,CAAC"}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ExclamationCircleIcon } from '@patternfly/react-icons/dist/js/icons/exclamation-circle-icon';
|
|
3
|
-
import { ExclamationTriangleIcon } from '@patternfly/react-icons/dist/js/icons/exclamation-triangle-icon';
|
|
4
|
-
import { ExternalLinkAltIcon } from '@patternfly/react-icons/dist/js/icons/external-link-alt-icon';
|
|
5
|
-
|
|
6
|
-
import { OPENSHIFT_LIFE_CYCLE_DATES_LINK } from '../../config';
|
|
7
|
-
import { OpenshiftVersionOptionType } from '../../types';
|
|
8
|
-
import { SelectField, UiIcon } from '../ui';
|
|
9
|
-
import { useTranslation } from '../../hooks/use-translation-wrapper';
|
|
10
|
-
import { SelectFieldProps } from '../ui/formik/types';
|
|
11
|
-
|
|
12
|
-
const OpenShiftLifeCycleDatesLink = () => {
|
|
13
|
-
const { t } = useTranslation();
|
|
14
|
-
return (
|
|
15
|
-
<a href={OPENSHIFT_LIFE_CYCLE_DATES_LINK} target="_blank" rel="noopener noreferrer">
|
|
16
|
-
{t('ai:Learn more')} <ExternalLinkAltIcon />
|
|
17
|
-
</a>
|
|
18
|
-
);
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const getOpenshiftVersionHelperText =
|
|
22
|
-
// eslint-disable-next-line react/display-name
|
|
23
|
-
(versions: OpenshiftVersionOptionType[]) => (selectedVersionValue: string) => {
|
|
24
|
-
const { t } = useTranslation();
|
|
25
|
-
if (!versions.length) {
|
|
26
|
-
return (
|
|
27
|
-
<>
|
|
28
|
-
<UiIcon size="sm" status="danger" icon={<ExclamationCircleIcon />} />
|
|
29
|
-
{t('ai:No release image is available.')}
|
|
30
|
-
</>
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
const selectedVersion = versions.find((version) => version.value === selectedVersionValue);
|
|
34
|
-
if (!selectedVersionValue || !selectedVersion) {
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (
|
|
39
|
-
selectedVersion.supportLevel !== 'production' &&
|
|
40
|
-
selectedVersion.supportLevel !== 'maintenance'
|
|
41
|
-
) {
|
|
42
|
-
return (
|
|
43
|
-
<>
|
|
44
|
-
<UiIcon size="sm" status="warning" icon={<ExclamationTriangleIcon />} />
|
|
45
|
-
{t('ai:Please note that this version is not production-ready.')}
|
|
46
|
-
<OpenShiftLifeCycleDatesLink />
|
|
47
|
-
</>
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return null;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
type OpenShiftVersionSelectProps = {
|
|
55
|
-
versions: OpenshiftVersionOptionType[];
|
|
56
|
-
onChange?: SelectFieldProps['onChange'];
|
|
57
|
-
};
|
|
58
|
-
const OpenShiftVersionSelect: React.FC<OpenShiftVersionSelectProps> = ({ versions, onChange }) => {
|
|
59
|
-
const selectOptions = React.useMemo(
|
|
60
|
-
() =>
|
|
61
|
-
versions.map((version) => ({
|
|
62
|
-
label: version.label,
|
|
63
|
-
value: version.value,
|
|
64
|
-
})),
|
|
65
|
-
[versions],
|
|
66
|
-
);
|
|
67
|
-
const { t } = useTranslation();
|
|
68
|
-
return (
|
|
69
|
-
<SelectField
|
|
70
|
-
label={t('ai:OpenShift version')}
|
|
71
|
-
name="openshiftVersion"
|
|
72
|
-
options={selectOptions}
|
|
73
|
-
getHelperText={getOpenshiftVersionHelperText(versions)}
|
|
74
|
-
isDisabled={versions.length === 0}
|
|
75
|
-
isRequired
|
|
76
|
-
onChange={onChange}
|
|
77
|
-
/>
|
|
78
|
-
);
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
export default OpenShiftVersionSelect;
|