Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
DaoDaoNoCode committed Dec 8, 2022
1 parent bccb3e5 commit f330c8a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions frontend/src/pages/projects/components/PVSizeField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ type PVSizeFieldProps = {
};

const PVSizeField: React.FC<PVSizeFieldProps> = ({ fieldID, size, setSize, currentSize }) => {
const MIN_SIZE = currentSize ? (!isNaN(parseInt(currentSize)) ? parseInt(currentSize) : 1) : 1;
const minSize = parseInt(currentSize || 'NaN') || 1;
const defaultSize = useDefaultPvcSize();
const availableSize = defaultSize * 2;

const onStep = (step: number) => {
setSize(normalizeBetween(size + step, MIN_SIZE, availableSize));
setSize(normalizeBetween(size + step, minSize, availableSize));
};
return (
<FormGroup
Expand All @@ -37,13 +37,13 @@ const PVSizeField: React.FC<PVSizeFieldProps> = ({ fieldID, size, setSize, curre
name={fieldID}
value={size}
max={availableSize}
min={MIN_SIZE}
min={minSize}
onPlus={() => onStep(1)}
onMinus={() => onStep(-1)}
onChange={(event) => {
if (isHTMLInputElement(event.target)) {
const newSize = Number(event.target.value);
setSize(isNaN(newSize) ? size : normalizeBetween(newSize, MIN_SIZE, availableSize));
setSize(isNaN(newSize) ? size : normalizeBetween(newSize, minSize, availableSize));
}
}}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { getFullStatusFromPercentage } from './utils';

type PercentageStorageStatus = {
[projectName: string]: {
/** string value is percentage full status of the PVC since last check */
/** string value is the last status that was used for this pvcName */
[pvcName: string]: string;
};
};
Expand Down Expand Up @@ -42,7 +42,7 @@ const useStorageStatusAlert = (pvc: PersistentVolumeClaimKind, percentageFull: n
};
setPercentageStorageStatuses(newValue);
} else if (lastStatus) {
const newValue = Object.assign({}, percentageStorageStatuses);
const newValue = { ...percentageStorageStatuses };
delete newValue[pvc.metadata.namespace]?.[pvc.metadata.name];
setPercentageStorageStatuses(newValue);
}
Expand Down

0 comments on commit f330c8a

Please sign in to comment.