fix(striker-ui): add clear to file selects

main
Tsu-ba-me 3 years ago
parent 653f7e6609
commit 949afb4f62
  1. 74
      striker-ui/components/ProvisionServerDialog.tsx

@ -1064,6 +1064,42 @@ const ProvisionServerDialog = ({
); );
}; };
const handleInstallISOFileUUIDChange = (uuid: string) => {
setInstallISOFileUUID(uuid);
updateLimits(
[
allAnvils,
storageGroupUUIDMapToFree,
cpuCoresValue,
memoryValue,
virtualDisks.sizes,
virtualDisks.inputStorageGroupUUIDs,
[uuid, driverISOFileUUID],
],
inputMemoryUnit,
virtualDisks,
);
};
const handleDriverISOFileUUIDChange = (uuid: string) => {
setDriverISOFileUUID(uuid);
updateLimits(
[
allAnvils,
storageGroupUUIDMapToFree,
cpuCoresValue,
memoryValue,
virtualDisks.sizes,
virtualDisks.inputStorageGroupUUIDs,
[installISOFileUUID, uuid],
],
inputMemoryUnit,
virtualDisks,
);
};
useEffect(() => { useEffect(() => {
const data = MOCK_DATA; const data = MOCK_DATA;
@ -1245,21 +1281,10 @@ const ProvisionServerDialog = ({
onChange: ({ target: { value } }) => { onChange: ({ target: { value } }) => {
const newInstallISOFileUUID = value as string; const newInstallISOFileUUID = value as string;
setInstallISOFileUUID(newInstallISOFileUUID); handleInstallISOFileUUIDChange(newInstallISOFileUUID);
},
updateLimits( onClearIndicatorClick: () => {
[ handleInstallISOFileUUIDChange('');
allAnvils,
storageGroupUUIDMapToFree,
cpuCoresValue,
memoryValue,
virtualDisks.sizes,
virtualDisks.inputStorageGroupUUIDs,
[newInstallISOFileUUID, driverISOFileUUID],
],
inputMemoryUnit,
virtualDisks,
);
}, },
value: installISOFileUUID, value: installISOFileUUID,
}, },
@ -1275,21 +1300,10 @@ const ProvisionServerDialog = ({
onChange: ({ target: { value } }) => { onChange: ({ target: { value } }) => {
const newDriverISOFileUUID = value as string; const newDriverISOFileUUID = value as string;
setDriverISOFileUUID(newDriverISOFileUUID); handleDriverISOFileUUIDChange(newDriverISOFileUUID);
},
updateLimits( onClearIndicatorClick: () => {
[ handleDriverISOFileUUIDChange('');
allAnvils,
storageGroupUUIDMapToFree,
cpuCoresValue,
memoryValue,
virtualDisks.sizes,
virtualDisks.inputStorageGroupUUIDs,
[installISOFileUUID, newDriverISOFileUUID],
],
inputMemoryUnit,
virtualDisks,
);
}, },
value: driverISOFileUUID, value: driverISOFileUUID,
}, },

Loading…
Cancel
Save