diff --git a/dashboard/src/components/DeploymentFormBody/BasicDeploymentForm/BasicDeploymentForm.test.tsx b/dashboard/src/components/DeploymentFormBody/BasicDeploymentForm/BasicDeploymentForm.test.tsx index b3b0ab297a8..c24ade4141f 100644 --- a/dashboard/src/components/DeploymentFormBody/BasicDeploymentForm/BasicDeploymentForm.test.tsx +++ b/dashboard/src/components/DeploymentFormBody/BasicDeploymentForm/BasicDeploymentForm.test.tsx @@ -36,7 +36,12 @@ const defaultProps = { { description: "renders a basic deployment with a disk size", params: { - diskSize: { path: "size", value: "10Gi", type: "string" } as IBasicFormParam, + diskSize: { + path: "size", + value: "10Gi", + type: "string", + render: "slider", + } as IBasicFormParam, }, }, { diff --git a/dashboard/src/components/DeploymentFormBody/BasicDeploymentForm/BasicDeploymentForm.tsx b/dashboard/src/components/DeploymentFormBody/BasicDeploymentForm/BasicDeploymentForm.tsx index 21f23c202cf..8ee036e9823 100644 --- a/dashboard/src/components/DeploymentFormBody/BasicDeploymentForm/BasicDeploymentForm.tsx +++ b/dashboard/src/components/DeploymentFormBody/BasicDeploymentForm/BasicDeploymentForm.tsx @@ -3,12 +3,9 @@ import { IBasicFormParam } from "shared/types"; import TextParam from "./TextParam"; import { - CPU_REQUEST, - DISK_SIZE, ENABLE_INGRESS, EXTERNAL_DB, INGRESS, - MEMORY_REQUEST, RESOURCES, USE_SELF_HOSTED_DB, } from "../../../shared/schema"; @@ -73,20 +70,6 @@ class BasicDeploymentForm extends React.Component { enablerCondition={false} /> ); - case DISK_SIZE: - return ( - - ); case RESOURCES: return ( { param={param} /> ); - case MEMORY_REQUEST: - return ( - - ); - case CPU_REQUEST: - return ( - - ); case INGRESS: return ( { param={param} /> ); + case "string": { + if (param.render === "slider") { + return ( + + ); + } + } default: return (
- Gi - + />
diff --git a/dashboard/src/components/DeploymentFormBody/DeploymentFormBody.test.tsx b/dashboard/src/components/DeploymentFormBody/DeploymentFormBody.test.tsx index abc993deafa..6b0dcd1c466 100644 --- a/dashboard/src/components/DeploymentFormBody/DeploymentFormBody.test.tsx +++ b/dashboard/src/components/DeploymentFormBody/DeploymentFormBody.test.tsx @@ -107,6 +107,7 @@ describe("when there are changes in the selected version", () => { .state as IDeploymentFormBodyState; const basicFormParameters = { foo: { + form: "foo", path: "foo", value: "bar", type: "string", @@ -130,6 +131,7 @@ describe("when there are changes in the selected version", () => { }); const basicFormParameters = { foo: { + form: "foo", path: "foo", value: "notBar", type: "string", @@ -154,6 +156,7 @@ describe("when there are changes in the selected version", () => { }); const basicFormParameters = { foo: { + form: "foo", path: "foo", value: "notBar", type: "string", @@ -188,6 +191,7 @@ describe("when there are changes in the selected version", () => { }); const basicFormParameters = { foo: { + form: "foo", path: "foo", value: "notBar", type: "string", diff --git a/dashboard/src/shared/schema.ts b/dashboard/src/shared/schema.ts index 516556f8fed..49860f565d3 100644 --- a/dashboard/src/shared/schema.ts +++ b/dashboard/src/shared/schema.ts @@ -14,9 +14,6 @@ nullOptions.nullStr = ""; // Form keys that require pre-definition. This list should be kept as small as possible export const EXTERNAL_DB = "externalDatabase"; export const USE_SELF_HOSTED_DB = "useSelfHostedDatabase"; -export const DISK_SIZE = "diskSize"; -export const MEMORY_REQUEST = "memoryRequest"; -export const CPU_REQUEST = "cpuRequest"; export const RESOURCES = "resources"; export const INGRESS = "ingress"; export const ENABLE_INGRESS = "enableIngress"; @@ -35,19 +32,16 @@ export function retrieveBasicFormParams( Object.keys(properties).map(propertyKey => { // The param path is its parent path + the object key const itemPath = `${parentPath || ""}${propertyKey}`; - const { type, title, description, form, minimum, maximum } = properties[propertyKey]; + const { type, form } = properties[propertyKey]; // If the property has the key "form", it's a basic parameter if (form) { // Use the default value either from the JSON schema or the default values const value = getValue(defaultValues, itemPath, properties[propertyKey].default); const param: IBasicFormParam = { + ...properties[propertyKey], path: itemPath, type: String(type), value, - title, - description, - minimum, - maximum, children: properties[propertyKey].type === "object" ? retrieveBasicFormParams(defaultValues, properties[propertyKey], `${itemPath}.`) diff --git a/dashboard/src/shared/types.ts b/dashboard/src/shared/types.ts index 70c2b5c4415..7584b7d5073 100644 --- a/dashboard/src/shared/types.ts +++ b/dashboard/src/shared/types.ts @@ -383,6 +383,10 @@ export interface IBasicFormParam { title?: string; minimum?: number; maximum?: number; + render?: string; + sliderMin?: number; + sliderMax?: number; + sliderUnit?: string; description?: string; children?: { [name: string]: IBasicFormParam }; }