Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions portal-ui/src/screens/Console/Tenants/AddTenant/AddTenant.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
wizardCommon,
} from "../../Common/FormComponents/common/styleLibrary";
import api from "../../../../common/api";
import { generatePoolName } from "../../../../common/utils";
import { generatePoolName, getBytes } from "../../../../common/utils";
import GenericWizard from "../../Common/GenericWizard/GenericWizard";
import { IWizardElement } from "../../Common/GenericWizard/types";
import { NewServiceAccount } from "../../Common/CredentialsPrompt/types";
Expand Down Expand Up @@ -280,7 +280,7 @@ const AddTenant = ({
}
if (fields.tenantSize.resourcesMemoryRequest !== "") {
dataSend.pools[0].resources.requests.memory = parseInt(
fields.tenantSize.resourcesMemoryRequest
getBytes(fields.tenantSize.resourcesMemoryRequest, "Gi", true)
);
}
}
Expand All @@ -297,7 +297,7 @@ const AddTenant = ({
}
if (fields.tenantSize.resourcesMemoryLimit !== "") {
dataSend.pools[0].resources.limits.memory = parseInt(
fields.tenantSize.resourcesMemoryLimit
getBytes(fields.tenantSize.resourcesMemoryLimit, "Gi", true)
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,21 +74,11 @@ const styles = (theme: Theme) =>

const SizePreview = ({
classes,
updateAddField,
isPageValid,
volumeSize,
sizeFactor,
drivesPerServer,
nodes,
memoryNode,
ecParity,
ecParityChoices,
cleanECChoices,
resourcesSize,
distribution,
ecParityCalc,
limitSize,
selectedStorageClass,
cpuToUse,
integrationSelection,
}: ISizePreviewProps) => {
Expand Down Expand Up @@ -253,7 +243,7 @@ const mapState = (state: AppState) => ({
sizeFactor: state.tenants.createTenant.fields.tenantSize.sizeFactor,
drivesPerServer: state.tenants.createTenant.fields.tenantSize.drivesPerServer,
nodes: state.tenants.createTenant.fields.tenantSize.nodes,
memoryNode: state.tenants.createTenant.fields.tenantSize.memoryNode,
memoryNode: state.tenants.createTenant.fields.tenantSize.resourcesMemoryRequest,
ecParity: state.tenants.createTenant.fields.tenantSize.ecParity,
ecParityChoices: state.tenants.createTenant.fields.tenantSize.ecParityChoices,
cleanECChoices: state.tenants.createTenant.fields.tenantSize.cleanECChoices,
Expand All @@ -263,7 +253,7 @@ const mapState = (state: AppState) => ({
limitSize: state.tenants.createTenant.fields.tenantSize.limitSize,
selectedStorageClass:
state.tenants.createTenant.fields.nameTenant.selectedStorageClass,
cpuToUse: state.tenants.createTenant.fields.tenantSize.cpuToUse,
cpuToUse: state.tenants.createTenant.fields.tenantSize.resourcesCPURequest,
integrationSelection:
state.tenants.createTenant.fields.tenantSize.integrationSelection,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,19 @@ const TenantSizeResources = ({
);

const baseCpuUse = Math.max(1, floor(maxAllocatableCPU / 2));
updateField("resourcesCPURequest", baseCpuUse);
if (resourcesCPURequest === "") {
updateField("resourcesCPURequest", baseCpuUse);
}

const baseMemoryUse = Math.max(2, floor(maxMemory / 2));
updateField("resourcesMemoryRequest", baseMemoryUse);
if (resourcesMemoryRequest === "") {
updateField("resourcesMemoryRequest", baseMemoryUse);
}
})
.catch((err: any) => {
updateField("maxMemorySize", 0);
updateField("resourcesCPURequest", "");
updateField("resourcesMemoryRequest", "");

console.error(err);
});
Expand Down