fix(striker-ui): consolidate organize and filter logic in Provision Server form

main
Tsu-ba-me 3 years ago
parent 740f6c27b8
commit 54a8a9f54b
  1. 422
      striker-ui/components/ProvisionServerDialog.tsx

@ -388,10 +388,18 @@ const createOutlinedInputWithSelect = (
</FormControl> </FormControl>
); );
const organizeAnvils = ( const organizeAnvils = (data: AnvilDetailMetadataForProvisionServer[]) => {
data: AnvilDetailMetadataForProvisionServer[], const anvilFiles: Record<string, FileMetadataForProvisionServer> = {};
): OrganizedAnvilDetailMetadataForProvisionServer[] =>
data.map((anvil) => { const result = data.reduce<{
anvils: OrganizedAnvilDetailMetadataForProvisionServer[];
anvilSelectItems: SelectItem[];
files: FileMetadataForProvisionServer[];
fileSelectItems: SelectItem[];
storageGroups: OrganizedStorageGroupMetadataForProvisionServer[];
storageGroupSelectItems: SelectItem[];
}>(
(reduceContainer, anvil) => {
const { const {
anvilUUID, anvilUUID,
anvilName, anvilName,
@ -404,31 +412,49 @@ const organizeAnvils = (
files, files,
} = anvil; } = anvil;
const { storageGroupUUIDs, organizedStorageGroups } = storageGroups.reduce<{ const { storageGroupUUIDs, anvilStorageGroups } = storageGroups.reduce<{
storageGroupUUIDs: string[]; storageGroupUUIDs: string[];
organizedStorageGroups: OrganizedStorageGroupMetadataForProvisionServer[]; anvilStorageGroups: OrganizedStorageGroupMetadataForProvisionServer[];
}>( }>(
(reduced, storageGroup) => { (reducedStorageGroups, storageGroup) => {
reduced.storageGroupUUIDs.push(storageGroup.storageGroupUUID); const anvilStorageGroup = {
reduced.organizedStorageGroups.push({
...storageGroup, ...storageGroup,
anvilUUID, anvilUUID,
anvilName, anvilName,
storageGroupSize: BigInt(storageGroup.storageGroupSize), storageGroupSize: BigInt(storageGroup.storageGroupSize),
storageGroupFree: BigInt(storageGroup.storageGroupFree), storageGroupFree: BigInt(storageGroup.storageGroupFree),
};
reducedStorageGroups.storageGroupUUIDs.push(
storageGroup.storageGroupUUID,
);
reducedStorageGroups.anvilStorageGroups.push(anvilStorageGroup);
reduceContainer.storageGroups.push(anvilStorageGroup);
reduceContainer.storageGroupSelectItems.push({
displayValue: `${anvilName} -- ${storageGroup.storageGroupName}`,
value: storageGroup.storageGroupUUID,
}); });
return reduced; return reducedStorageGroups;
}, },
{ {
storageGroupUUIDs: [], storageGroupUUIDs: [],
organizedStorageGroups: [], anvilStorageGroups: [],
}, },
); );
const fileUUIDs = files.map(({ fileUUID }) => fileUUID); const fileUUIDs: string[] = [];
return { files.forEach((file) => {
const { fileUUID } = file;
fileUUIDs.push(fileUUID);
anvilFiles[fileUUID] = file;
});
reduceContainer.anvils.push({
...anvil, ...anvil,
anvilTotalMemory: BigInt(anvilTotalMemory), anvilTotalMemory: BigInt(anvilTotalMemory),
anvilTotalAllocatedMemory: BigInt(anvilTotalAllocatedMemory), anvilTotalAllocatedMemory: BigInt(anvilTotalAllocatedMemory),
@ -442,43 +468,36 @@ const organizeAnvils = (
serverMemory: BigInt(server.serverMemory), serverMemory: BigInt(server.serverMemory),
})), })),
storageGroupUUIDs, storageGroupUUIDs,
storageGroups: organizedStorageGroups, storageGroups: anvilStorageGroups,
fileUUIDs, fileUUIDs,
}; });
reduceContainer.anvilSelectItems.push({
displayValue: anvilName,
value: anvilUUID,
}); });
const organizeStorageGroups = ( return reduceContainer;
organizedAnvils: OrganizedAnvilDetailMetadataForProvisionServer[], },
) => {
organizedAnvils.reduce<OrganizedStorageGroupMetadataForProvisionServer[]>( anvils: [],
(reducedStorageGroups, { storageGroups }) => { anvilSelectItems: [],
reducedStorageGroups.push(...storageGroups); files: [],
fileSelectItems: [],
return reducedStorageGroups; storageGroups: [],
storageGroupSelectItems: [],
}, },
[],
); );
const organizeFiles = ( Object.values(anvilFiles).forEach((distinctFile) => {
organizedAnvils: OrganizedAnvilDetailMetadataForProvisionServer[], result.files.push(distinctFile);
) => result.fileSelectItems.push({
organizedAnvils.reduce<FileMetadataForProvisionServer[]>( displayValue: distinctFile.fileName,
(reducedFiles, { files }) => { value: distinctFile.fileUUID,
files.forEach((file) => { });
// Avoid pushing duplicate file UUIDs.
if (
reducedFiles.find(({ fileUUID }) => file.fileUUID === fileUUID) ===
undefined
) {
reducedFiles.push(file);
}
}); });
return reducedFiles; return result;
}, };
[],
);
const dSize = ( const dSize = (
valueToFormat: FormatDataSizeInputValue, valueToFormat: FormatDataSizeInputValue,
{ {
@ -536,6 +555,7 @@ const filterAnvils = (
organizedAnvils: OrganizedAnvilDetailMetadataForProvisionServer[], organizedAnvils: OrganizedAnvilDetailMetadataForProvisionServer[],
cpuCores: number, cpuCores: number,
memory: bigint, memory: bigint,
fileUUIDs: string[],
{ {
includeAnvilUUIDs = [], includeAnvilUUIDs = [],
includeStorageGroupUUIDs = [], includeStorageGroupUUIDs = [],
@ -559,21 +579,35 @@ const filterAnvils = (
return organizedAnvils.reduce<{ return organizedAnvils.reduce<{
anvils: OrganizedAnvilDetailMetadataForProvisionServer[]; anvils: OrganizedAnvilDetailMetadataForProvisionServer[];
anvilUUIDs: string[]; anvilUUIDs: string[];
fileUUIDs: string[];
maxCPUCores: number; maxCPUCores: number;
maxMemory: bigint; maxMemory: bigint;
maxVirtualDiskSize: bigint; maxVirtualDiskSize: bigint;
storageGroupUUIDs: string[];
}>( }>(
(result, organizedAnvil) => { (result, organizedAnvil) => {
const { anvilUUID } = organizedAnvil; const { anvilUUID } = organizedAnvil;
if (testIncludeAnvil(anvilUUID)) { if (testIncludeAnvil(anvilUUID)) {
const { anvilTotalCPUCores, anvilTotalAvailableMemory, storageGroups } = const {
organizedAnvil; anvilTotalCPUCores,
anvilTotalAvailableMemory,
files,
fileUUIDs: localFileUUIDs,
storageGroups,
} = organizedAnvil;
const isEnoughCPUCores = cpuCores <= anvilTotalCPUCores; const isEnoughCPUCores = cpuCores <= anvilTotalCPUCores;
const isEnoughMemory = memory <= anvilTotalAvailableMemory; const isEnoughMemory = memory <= anvilTotalAvailableMemory;
const hasFiles = fileUUIDs.reduce<boolean>(
(localHasFiles, fileUUID) =>
fileUUID === ''
? localHasFiles
: localHasFiles && localFileUUIDs.includes(fileUUID),
true,
);
if (isEnoughCPUCores && isEnoughMemory) { if (isEnoughCPUCores && isEnoughMemory && hasFiles) {
result.anvils.push(organizedAnvil); result.anvils.push(organizedAnvil);
result.anvilUUIDs.push(anvilUUID); result.anvilUUIDs.push(anvilUUID);
@ -583,11 +617,19 @@ const filterAnvils = (
result.maxMemory = anvilTotalAvailableMemory; result.maxMemory = anvilTotalAvailableMemory;
} }
files.forEach(({ fileUUID }) => {
if (!result.fileUUIDs.includes(fileUUID)) {
result.fileUUIDs.push(fileUUID);
}
});
storageGroups.forEach(({ storageGroupUUID, storageGroupFree }) => { storageGroups.forEach(({ storageGroupUUID, storageGroupFree }) => {
if ( if (
testIncludeStorageGroup(storageGroupUUID) && testIncludeStorageGroup(storageGroupUUID) &&
storageGroupFree > result.maxVirtualDiskSize storageGroupFree > result.maxVirtualDiskSize
) { ) {
result.storageGroupUUIDs.push(storageGroupUUID);
result.maxVirtualDiskSize = storageGroupFree; result.maxVirtualDiskSize = storageGroupFree;
} }
}); });
@ -599,9 +641,11 @@ const filterAnvils = (
{ {
anvils: [], anvils: [],
anvilUUIDs: [], anvilUUIDs: [],
fileUUIDs: [],
maxCPUCores: 0, maxCPUCores: 0,
maxMemory: BIGINT_ZERO, maxMemory: BIGINT_ZERO,
maxVirtualDiskSize: BIGINT_ZERO, maxVirtualDiskSize: BIGINT_ZERO,
storageGroupUUIDs: [],
}, },
); );
}; };
@ -630,6 +674,25 @@ const filterStorageGroups = (
const ProvisionServerDialog = ({ const ProvisionServerDialog = ({
dialogProps: { open }, dialogProps: { open },
}: ProvisionServerDialogProps): JSX.Element => { }: ProvisionServerDialogProps): JSX.Element => {
const [allAnvils, setAllAnvils] = useState<
OrganizedAnvilDetailMetadataForProvisionServer[]
>([]);
const [allFiles, setAllFiles] = useState<FileMetadataForProvisionServer[]>(
[],
);
const [allStorageGroups, setAllStorageGroups] = useState<
OrganizedStorageGroupMetadataForProvisionServer[]
>([]);
const [anvilSelectItems, setAnvilSelectItems] = useState<SelectItem[]>([]);
const [fileSelectItems, setFileSelectItems] = useState<SelectItem[]>([]);
const [osAutocompleteOptions, setOSAutocompleteOptions] = useState<
{ label: string; key: string }[]
>([]);
const [storageGroupSelectItems, setStorageGroupSelectItems] = useState<
SelectItem[]
>([]);
const [cpuCoresValue, setCPUCoresValue] = useState<number>(1); const [cpuCoresValue, setCPUCoresValue] = useState<number>(1);
const [inputCPUCoresMax, setInputCPUCoresMax] = useState<number>(0); const [inputCPUCoresMax, setInputCPUCoresMax] = useState<number>(0);
@ -648,7 +711,7 @@ const ProvisionServerDialog = ({
useState<DataSizeUnit>('B'); useState<DataSizeUnit>('B');
const [storageGroupValue, setStorageGroupValue] = useState<string[]>([]); const [storageGroupValue, setStorageGroupValue] = useState<string[]>([]);
const [excludedStorageGroupUUIDs, setExcludedStorageGroupUUIDs] = useState< const [includeStorageGroupUUIDs, setIncludeStorageGroupUUIDs] = useState<
string[] string[]
>([]); >([]);
const [selectedStorageGroupUUID, setSelectedStorageGroupUUID] = useState< const [selectedStorageGroupUUID, setSelectedStorageGroupUUID] = useState<
@ -657,42 +720,61 @@ const ProvisionServerDialog = ({
const [installISOFileUUID, setInstallISOFileUUID] = useState<string>(''); const [installISOFileUUID, setInstallISOFileUUID] = useState<string>('');
const [driverISOFileUUID, setDriverISOFileUUID] = useState<string>(''); const [driverISOFileUUID, setDriverISOFileUUID] = useState<string>('');
const [excludedFileUUIDs, setExcludedFileUUIDs] = useState<string[]>([]); const [includeFileUUIDs, setIncludeFileUUIDs] = useState<string[]>([]);
const [anvilValue, setAnvilValue] = useState<string[]>([]); const [anvilValue, setAnvilValue] = useState<string[]>([]);
const [includeAnvilUUIDs, setIncludeAnvilUUIDs] = useState<string[]>([]); const [includeAnvilUUIDs, setIncludeAnvilUUIDs] = useState<string[]>([]);
const data = MOCK_DATA; useEffect(() => {
console.log(`After server returns data.`);
const organizedAnvils = organizeAnvils(data.anvils);
const organizedStorageGroups = organizeStorageGroups(organizedAnvils);
const organizedFiles = organizeFiles(organizedAnvils);
const { maxCPUCores, maxMemory, maxVirtualDiskSize } = filterAnvils( const data = MOCK_DATA;
organizedAnvils,
0,
BIGINT_ZERO,
);
const selectFiles = organizedFiles.map(({ fileUUID, fileName }) => ({ const {
displayValue: fileName, anvils: localAllAnvils,
value: fileUUID, anvilSelectItems: localAnvilSelectItems,
})); files: localAllFiles,
fileSelectItems: localFileSelectItems,
storageGroups: localAllStorageGroups,
storageGroupSelectItems: localStorageGroupSelectItems,
} = organizeAnvils(data.anvils);
setAllAnvils(localAllAnvils);
setAllFiles(localAllFiles);
setAllStorageGroups(localAllStorageGroups);
setAnvilSelectItems(localAnvilSelectItems);
setFileSelectItems(localFileSelectItems);
setStorageGroupSelectItems(localStorageGroupSelectItems);
const optimizeOSList = data.osList.map((keyValuePair) => { const {
anvilUUIDs: initialIncludeAnvilUUIDs,
fileUUIDs: initialIncludeFileUUIDs,
maxCPUCores: initialMaxCPUCores,
maxMemory: initialMaxMemory,
maxVirtualDiskSize: initialMaxVDSize,
storageGroupUUIDs: initialIncludeStorageGroupUUIDs,
} = filterAnvils(localAllAnvils, 0, BIGINT_ZERO, []);
setIncludeAnvilUUIDs(initialIncludeAnvilUUIDs);
setIncludeFileUUIDs(initialIncludeFileUUIDs);
setIncludeStorageGroupUUIDs(initialIncludeStorageGroupUUIDs);
setOSAutocompleteOptions(
data.osList.map((keyValuePair) => {
const [osKey, osValue] = keyValuePair.split(','); const [osKey, osValue] = keyValuePair.split(',');
return { return {
label: osValue, label: osValue,
key: osKey, key: osKey,
}; };
}); }),
);
useEffect(() => { setInputCPUCoresMax(initialMaxCPUCores);
setInputCPUCoresMax(maxCPUCores); setInputMemoryMax(initialMaxMemory);
setInputMemoryMax(maxMemory); setInputVirtualDiskSizeMax(initialMaxVDSize);
setInputVirtualDiskSizeMax(maxVirtualDiskSize); }, []);
}, [maxCPUCores, maxMemory, maxVirtualDiskSize]);
return ( return (
<Dialog <Dialog
@ -728,16 +810,24 @@ const ProvisionServerDialog = ({
setCPUCoresValue(setValue); setCPUCoresValue(setValue);
const { const {
anvilUUIDs, anvilUUIDs: localAnvilUUIDs,
fileUUIDs: localFileUUIDs,
maxCPUCores: localMaxCPUCores, maxCPUCores: localMaxCPUCores,
maxMemory: localMaxMemory, maxMemory: localMaxMemory,
maxVirtualDiskSize: localMaxVDSize, maxVirtualDiskSize: localMaxVDSize,
} = filterAnvils(organizedAnvils, setValue, memoryValue); storageGroupUUIDs: localStorageGroupUUIDs,
} = filterAnvils(allAnvils, setValue, memoryValue, [
installISOFileUUID,
driverISOFileUUID,
]);
setIncludeAnvilUUIDs(anvilUUIDs);
setInputCPUCoresMax(localMaxCPUCores); setInputCPUCoresMax(localMaxCPUCores);
setInputMemoryMax(localMaxMemory); setInputMemoryMax(localMaxMemory);
setInputVirtualDiskSizeMax(localMaxVDSize); setInputVirtualDiskSizeMax(localMaxVDSize);
setIncludeAnvilUUIDs(localAnvilUUIDs);
setIncludeFileUUIDs(localFileUUIDs);
setIncludeStorageGroupUUIDs(localStorageGroupUUIDs);
}, },
max: inputCPUCoresMax, max: inputCPUCoresMax,
min: 1, min: 1,
@ -756,20 +846,26 @@ const ProvisionServerDialog = ({
setMemoryValue(convertedMemoryValue); setMemoryValue(convertedMemoryValue);
const { const {
anvilUUIDs, anvilUUIDs: localAnvilUUIDs,
fileUUIDs: localFileUUIDs,
maxCPUCores: localMaxCPUCores, maxCPUCores: localMaxCPUCores,
maxMemory: localMaxMemory, maxMemory: localMaxMemory,
maxVirtualDiskSize: localMaxVDSize, maxVirtualDiskSize: localMaxVDSize,
storageGroupUUIDs: localStorageGroupUUIDs,
} = filterAnvils( } = filterAnvils(
organizedAnvils, allAnvils,
cpuCoresValue, cpuCoresValue,
convertedMemoryValue, convertedMemoryValue,
[installISOFileUUID, driverISOFileUUID],
); );
setIncludeAnvilUUIDs(anvilUUIDs);
setInputCPUCoresMax(localMaxCPUCores); setInputCPUCoresMax(localMaxCPUCores);
setInputMemoryMax(localMaxMemory); setInputMemoryMax(localMaxMemory);
setInputVirtualDiskSizeMax(localMaxVDSize); setInputVirtualDiskSizeMax(localMaxVDSize);
setIncludeAnvilUUIDs(localAnvilUUIDs);
setIncludeFileUUIDs(localFileUUIDs);
setIncludeStorageGroupUUIDs(localStorageGroupUUIDs);
}); });
}, },
value: inputMemoryValue, value: inputMemoryValue,
@ -787,20 +883,26 @@ const ProvisionServerDialog = ({
setMemoryValue(convertedMemoryValue); setMemoryValue(convertedMemoryValue);
const { const {
anvilUUIDs, anvilUUIDs: localAnvilUUIDs,
fileUUIDs: localFileUUIDs,
maxCPUCores: localMaxCPUCores, maxCPUCores: localMaxCPUCores,
maxMemory: localMaxMemory, maxMemory: localMaxMemory,
maxVirtualDiskSize: localMaxVDSize, maxVirtualDiskSize: localMaxVDSize,
storageGroupUUIDs: localStorageGroupUUIDs,
} = filterAnvils( } = filterAnvils(
organizedAnvils, allAnvils,
cpuCoresValue, cpuCoresValue,
convertedMemoryValue, convertedMemoryValue,
[installISOFileUUID, driverISOFileUUID],
); );
setIncludeAnvilUUIDs(anvilUUIDs);
setInputCPUCoresMax(localMaxCPUCores); setInputCPUCoresMax(localMaxCPUCores);
setInputMemoryMax(localMaxMemory); setInputMemoryMax(localMaxMemory);
setInputVirtualDiskSizeMax(localMaxVDSize); setInputVirtualDiskSizeMax(localMaxVDSize);
setIncludeAnvilUUIDs(localAnvilUUIDs);
setIncludeFileUUIDs(localFileUUIDs);
setIncludeStorageGroupUUIDs(localStorageGroupUUIDs);
}, },
); );
}, },
@ -850,15 +952,10 @@ const ProvisionServerDialog = ({
{createOutlinedSelect( {createOutlinedSelect(
'ps-storage-group', 'ps-storage-group',
'Storage group', 'Storage group',
organizedStorageGroups.map( storageGroupSelectItems,
({ anvilName, storageGroupUUID, storageGroupName }) => ({
displayValue: `${anvilName} -- ${storageGroupName}`,
value: storageGroupUUID,
}),
),
{ {
checkItem: (value) => storageGroupValue.includes(value), checkItem: (value) => storageGroupValue.includes(value),
hideItem: (value) => excludedStorageGroupUUIDs.includes(value), hideItem: (value) => !includeStorageGroupUUIDs.includes(value),
selectProps: { selectProps: {
multiple: true, multiple: true,
onChange: ({ target: { value } }) => { onChange: ({ target: { value } }) => {
@ -868,54 +965,43 @@ const ProvisionServerDialog = ({
: (value as string[]); : (value as string[]);
setStorageGroupValue(subsetStorageGroupsUUID); setStorageGroupValue(subsetStorageGroupsUUID);
setSelectedStorageGroupUUID(
filterStorageGroups(
organizedStorageGroups,
virtualDiskSizeValue,
subsetStorageGroupsUUID,
)[0]?.storageGroupUUID,
);
// setInputVirtualDiskSizeMax(
// getMaxAvailableValues(organizedAnvils, {
// includeAnvilUUIDs: anvilValue,
// includeStorageGroupUUIDs: subsetStorageGroupsUUID,
// }).maxVirtualDiskSize,
// );
}, },
value: storageGroupValue, value: storageGroupValue,
}, },
}, },
)} )}
{createOutlinedSelect('ps-install-image', 'Install ISO', selectFiles, { {createOutlinedSelect(
hideItem: (value) => excludedFileUUIDs.includes(value), 'ps-install-image',
'Install ISO',
fileSelectItems,
{
hideItem: (value) => !includeFileUUIDs.includes(value),
selectProps: { selectProps: {
onChange: ({ target: { value } }) => { onChange: ({ target: { value } }) => {
setInstallISOFileUUID(value as string); setInstallISOFileUUID(value as string);
}, },
value: installISOFileUUID, value: installISOFileUUID,
}, },
})} },
{createOutlinedSelect('ps-driver-image', 'Driver ISO', selectFiles, { )}
hideItem: (value) => excludedFileUUIDs.includes(value), {createOutlinedSelect(
'ps-driver-image',
'Driver ISO',
fileSelectItems,
{
hideItem: (value) => !includeFileUUIDs.includes(value),
selectProps: { selectProps: {
onChange: ({ target: { value } }) => { onChange: ({ target: { value } }) => {
setDriverISOFileUUID(value as string); setDriverISOFileUUID(value as string);
}, },
value: driverISOFileUUID, value: driverISOFileUUID,
}, },
})} },
{createOutlinedSelect( )}
'ps-anvil', {createOutlinedSelect('ps-anvil', 'Anvil', anvilSelectItems, {
'Anvil',
organizedAnvils.map(({ anvilUUID, anvilName }) => ({
displayValue: anvilName,
value: anvilUUID,
})),
{
checkItem: (value) => anvilValue.includes(value), checkItem: (value) => anvilValue.includes(value),
hideItem: (value) => !includeAnvilUUIDs.includes(value), disableItem: (value) => !includeAnvilUUIDs.includes(value),
// hideItem: (value) => !includeAnvilUUIDs.includes(value),
selectProps: { selectProps: {
multiple: true, multiple: true,
onChange: ({ target: { value } }) => { onChange: ({ target: { value } }) => {
@ -926,63 +1012,60 @@ const ProvisionServerDialog = ({
setAnvilValue(subsetAnvilUUIDs); setAnvilValue(subsetAnvilUUIDs);
const includedFileUUIDs: string[] = []; // const includedFileUUIDs: string[] = [];
let newExcludedStorageGroupUUIDs: string[] = []; // let newExcludedStorageGroupUUIDs: string[] = [];
let newExcludedFileUUIDs: string[] = []; // let newExcludedFileUUIDs: string[] = [];
if (subsetAnvilUUIDs.length > 0) { // if (subsetAnvilUUIDs.length > 0) {
({ newExcludedStorageGroupUUIDs, newExcludedFileUUIDs } = // ({ newExcludedStorageGroupUUIDs, newExcludedFileUUIDs } =
organizedAnvils.reduce<{ // organizedAnvils.reduce<{
newExcludedStorageGroupUUIDs: string[]; // newExcludedStorageGroupUUIDs: string[];
newExcludedFileUUIDs: string[]; // newExcludedFileUUIDs: string[];
}>( // }>(
( // (reduced, { anvilUUID, storageGroupUUIDs, fileUUIDs }) => {
reduced, // if (subsetAnvilUUIDs.includes(anvilUUID)) {
{ anvilUUID, storageGroupUUIDs, fileUUIDs }, // includedFileUUIDs.push(...fileUUIDs);
) => { // } else {
if (subsetAnvilUUIDs.includes(anvilUUID)) { // reduced.newExcludedStorageGroupUUIDs.push(
includedFileUUIDs.push(...fileUUIDs); // ...storageGroupUUIDs,
} else { // );
reduced.newExcludedStorageGroupUUIDs.push( // reduced.newExcludedFileUUIDs.push(...fileUUIDs);
...storageGroupUUIDs, // }
);
reduced.newExcludedFileUUIDs.push(...fileUUIDs); // return reduced;
} // },
// {
return reduced; // newExcludedStorageGroupUUIDs: [],
}, // newExcludedFileUUIDs: [],
{ // },
newExcludedStorageGroupUUIDs: [], // ));
newExcludedFileUUIDs: [],
}, // includedFileUUIDs.forEach((fileUUID) => {
)); // newExcludedFileUUIDs.splice(
// newExcludedFileUUIDs.indexOf(fileUUID),
includedFileUUIDs.forEach((fileUUID) => { // 1,
newExcludedFileUUIDs.splice( // );
newExcludedFileUUIDs.indexOf(fileUUID), // });
1, // }
);
});
}
setExcludedStorageGroupUUIDs(newExcludedStorageGroupUUIDs); // setIncludeStorageGroupUUIDs(newExcludedStorageGroupUUIDs);
setExcludedFileUUIDs(newExcludedFileUUIDs); // setIncludeFileUUIDs(newExcludedFileUUIDs);
const newStorageGroupValue = storageGroupValue.filter( // const newStorageGroupValue = storageGroupValue.filter(
(uuid) => !newExcludedStorageGroupUUIDs.includes(uuid), // (uuid) => !newExcludedStorageGroupUUIDs.includes(uuid),
); // );
setStorageGroupValue(newStorageGroupValue); // setStorageGroupValue(newStorageGroupValue);
newExcludedFileUUIDs.forEach((excludedFileUUID) => { // newExcludedFileUUIDs.forEach((excludedFileUUID) => {
if (installISOFileUUID === excludedFileUUID) { // if (installISOFileUUID === excludedFileUUID) {
setInstallISOFileUUID(''); // setInstallISOFileUUID('');
} // }
if (driverISOFileUUID === excludedFileUUID) { // if (driverISOFileUUID === excludedFileUUID) {
setDriverISOFileUUID(''); // setDriverISOFileUUID('');
} // }
}); // });
// const { // const {
// maxCPUCores: localMaxCPUCores, // maxCPUCores: localMaxCPUCores,
@ -999,14 +1082,13 @@ const ProvisionServerDialog = ({
}, },
value: anvilValue, value: anvilValue,
}, },
}, })}
)}
<Autocomplete <Autocomplete
id="ps-optimize-for-os" id="ps-optimize-for-os"
label="Optimize for OS" label="Optimize for OS"
noOptionsText="No matching OS" noOptionsText="No matching OS"
openOnFocus openOnFocus
options={optimizeOSList} options={osAutocompleteOptions}
/> />
</Box> </Box>
<Box <Box

Loading…
Cancel
Save