From 0788481a202735354056cbf1ed060fdf27da3aff Mon Sep 17 00:00:00 2001 From: corpulent Date: Tue, 23 Aug 2022 14:40:27 +0300 Subject: [PATCH] fix: service deploy field validation --- .../modals/docker-compose/service/form-utils.ts | 8 ++++---- services/frontend/src/types/index.ts | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/services/frontend/src/components/modals/docker-compose/service/form-utils.ts b/services/frontend/src/components/modals/docker-compose/service/form-utils.ts index f95479e..397152d 100644 --- a/services/frontend/src/components/modals/docker-compose/service/form-utils.ts +++ b/services/frontend/src/components/modals/docker-compose/service/form-utils.ts @@ -195,7 +195,7 @@ export const validationSchema = yup.object({ limits: yup.object({ cpus: yup.string(), memory: yup.string(), - pids: yup.string() + pids: yup.number().typeError("PIDs should be an integer") }), reservations: yup.object({ cpus: yup.string(), @@ -205,11 +205,11 @@ export const validationSchema = yup.object({ restartPolicy: yup.object({ condition: yup.string().oneOf(["", "none", "on-failure", "any"]), delay: yup.string(), - maxAttempts: yup.string(), + maxAttempts: yup.number().typeError("max attempts should be an integer"), window: yup.string() }), rollbackConfig: yup.object({ - parallelism: yup.string(), + parallelism: yup.number().typeError("parallelism should be an integer"), delay: yup.string(), failureAction: yup.string().oneOf(["", "continue", "pause"]), monitor: yup.string(), @@ -217,7 +217,7 @@ export const validationSchema = yup.object({ order: yup.string().oneOf(["", "stop-first", "start-first"]) }), updateConfig: yup.object({ - parallelism: yup.string(), + parallelism: yup.number().typeError("parallelism should be an integer"), delay: yup.string(), failureAction: yup.string().oneOf(["", "continue", "pause"]), monitor: yup.string(), diff --git a/services/frontend/src/types/index.ts b/services/frontend/src/types/index.ts index 5ff9989..1bf9585 100644 --- a/services/frontend/src/types/index.ts +++ b/services/frontend/src/types/index.ts @@ -2,7 +2,6 @@ import { AnchorId } from "@jsplumb/common"; import { Dictionary } from "lodash"; import { FunctionComponent, ReactNode } from "react"; import { KeyValuePair } from "tailwindcss/types/config"; -import { string } from "yup"; import { NodeGroupType } from "./enums"; type KeyValPair = {