mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-08-16 04:39:15 +00:00
fix: project resource quota not set in POST API payload (#1082)
* fix: project resource quota not set in POST API payload Signed-off-by: Andy Lee <andy.lee@suse.com> * fix: guard onQuotasInput against undefined payload Signed-off-by: Andy Lee <andy.lee@suse.com> --------- Signed-off-by: Andy Lee <andy.lee@suse.com>
This commit is contained in:
parent
9a935434c2
commit
f8a29a1c54
@ -63,6 +63,7 @@ export default {
|
||||
RANCHER_TYPES,
|
||||
fvFormRuleSets: [{ path: 'spec.displayName', rules: ['required'] }],
|
||||
canEditPSPBindings: true,
|
||||
isQuotasValid: true,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@ -190,15 +191,13 @@ export default {
|
||||
this['membershipUpdate'] = update;
|
||||
},
|
||||
|
||||
removeQuota(key) {
|
||||
['resourceQuota', 'namespaceDefaultResourceQuota'].forEach((specProp) => {
|
||||
if (this.value?.spec[specProp]?.limit && this.value?.spec[specProp]?.limit[key]) {
|
||||
delete this.value?.spec[specProp]?.limit[key];
|
||||
}
|
||||
if (this.value?.spec[specProp]?.usedLimit && this.value?.spec[specProp]?.usedLimit[key]) {
|
||||
delete this.value?.spec[specProp]?.usedLimit[key];
|
||||
}
|
||||
});
|
||||
validateQuotas(isValid) {
|
||||
this.isQuotasValid = isValid;
|
||||
},
|
||||
|
||||
onQuotasInput({ projectLimit, nsLimit } = {}) {
|
||||
this.value.spec.resourceQuota = { ...this.value.spec.resourceQuota, limit: projectLimit };
|
||||
this.value.spec.namespaceDefaultResourceQuota = { ...this.value.spec.namespaceDefaultResourceQuota, limit: nsLimit };
|
||||
}
|
||||
},
|
||||
};
|
||||
@ -212,7 +211,7 @@ export default {
|
||||
:resource="value"
|
||||
:subtypes="[]"
|
||||
:can-yaml="false"
|
||||
:validation-passed="fvFormIsValid"
|
||||
:validation-passed="fvFormIsValid && isQuotasValid"
|
||||
@error="e=>errors=e"
|
||||
@finish="save"
|
||||
@cancel="done"
|
||||
@ -267,10 +266,11 @@ export default {
|
||||
:weight="9"
|
||||
>
|
||||
<ResourceQuota
|
||||
v-model:value="value"
|
||||
:value="value"
|
||||
:mode="canEditTabElements"
|
||||
:types="isStandaloneHarvester ? HARVESTER_TYPES : RANCHER_TYPES"
|
||||
@remove="removeQuota"
|
||||
@input="onQuotasInput"
|
||||
@validationChanged="validateQuotas"
|
||||
/>
|
||||
</Tab>
|
||||
<Tab
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user