Show error when there's no storge classes (#2070)
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
This commit is contained in:
@@ -112,7 +112,7 @@ const AddTenant = () => {
|
||||
};
|
||||
|
||||
const createButton: IWizardButton = {
|
||||
componentRender: <CreateTenantButton />,
|
||||
componentRender: <CreateTenantButton key={"create-tenant"} />,
|
||||
};
|
||||
|
||||
const wizardSteps: IWizardElement[] = [
|
||||
|
||||
@@ -908,6 +908,10 @@ export const createTenantSlice = createSlice({
|
||||
const elements: IQuotaElement[] = get(action.payload, "elements", []);
|
||||
state.limitSize = getLimitSizes(action.payload!);
|
||||
|
||||
if (elements === null || elements.length === 0) {
|
||||
state.validationErrors["namespace"] = "No storage classes available.";
|
||||
return;
|
||||
}
|
||||
const newStorage = elements.map((storageClass: any) => {
|
||||
const name = get(storageClass, "name", "").split(
|
||||
".storageclass.storage.k8s.io/requests.storage"
|
||||
@@ -917,7 +921,6 @@ export const createTenantSlice = createSlice({
|
||||
});
|
||||
|
||||
state.storageClasses = newStorage;
|
||||
|
||||
const stExists = newStorage.findIndex(
|
||||
(storageClass) =>
|
||||
storageClass.value === state.fields.nameTenant.selectedStorageClass
|
||||
|
||||
@@ -61,6 +61,9 @@ export const ecListTransform = (
|
||||
|
||||
export const getLimitSizes = (resourceQuotas: IQuotas) => {
|
||||
const quotas: IQuotaElement[] = get(resourceQuotas, "elements", []);
|
||||
if (quotas === null) {
|
||||
return {};
|
||||
}
|
||||
|
||||
const returnQuotas: any = {};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user