Skip to content

Commit

Permalink
Fix request payload for PVCPool BackingStore
Browse files Browse the repository at this point in the history
Payload did not contain the field resources.request.storage.
  • Loading branch information
bipuladh committed May 20, 2020
1 parent 5994c64 commit 0f70bc0
Showing 1 changed file with 21 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,12 @@ const PVCType: React.FC<PVCTypeProps> = ({ state, dispatch }) => {
TiB: 'TiB',
};

// Noobaa expected Ti console standrad is to show TiB
const unitConverter = {
GiB: 'Gi',
TiB: 'Ti',
};

// Fix for updating the storage class by force rerender
const forceUpdate = React.useCallback(() => updateState({}), []);

Expand All @@ -207,17 +213,23 @@ const PVCType: React.FC<PVCTypeProps> = ({ state, dispatch }) => {

const onChange = (event) => {
const { value, unit } = event;
const input = `${value} ${unit}`;
const input = `${value}${unitConverter[unit]}`;
setSize(value);
dispatch({ type: 'setVolumeSize', value: input });
};

const substract = () => {
const substractVolumes = () => {
if (state.numVolumes > 1) {
dispatch({ type: 'setVolumes', value: state.numVolumes - 1 });
}
};

const addVolumes = () => {
if (state.numVolumes < 20) {
dispatch({ type: 'setVolumes', value: state.numVolumes + 1 });
}
};

return (
<>
<FormGroup
Expand All @@ -228,13 +240,11 @@ const PVCType: React.FC<PVCTypeProps> = ({ state, dispatch }) => {
>
<InputGroup>
<InputGroupText>
<MinusIcon onClick={substract} />{' '}
<MinusIcon onClick={substractVolumes} />
</InputGroupText>
<TextInput value={state.numVolumes} aria-label="Number of Volumes" />
<InputGroupText>
<PlusIcon
onClick={() => dispatch({ type: 'setVolumes', value: state.numVolumes + 1 })}
/>{' '}
<PlusIcon onClick={addVolumes} />
</InputGroupText>
</InputGroup>
</FormGroup>
Expand Down Expand Up @@ -546,6 +556,11 @@ const CreateBackingStoreForm: React.FC<CreateBackingStoreFormProps> = withHandle
bsPayload.spec['pvPool'] = {
numVolumes: providerDataState.numVolumes,
storageClass: providerDataState.storageClass,
resources: {
requests: {
storage: providerDataState.volumeSize,
},
},
};
} else if (externalProviders.includes(provider)) {
bsPayload.spec = {
Expand Down

0 comments on commit 0f70bc0

Please sign in to comment.