diff --git a/web/crux-ui/src/validations/container.ts b/web/crux-ui/src/validations/container.ts index 79a25f6f0..bcc35d3e5 100644 --- a/web/crux-ui/src/validations/container.ts +++ b/web/crux-ui/src/validations/container.ts @@ -503,28 +503,30 @@ const testRules = (rules: [string, EnvironmentRule][], arr: UniqueKeyValue[], fi } const createContainerConfigBaseSchema = (imageLabels: Record) => - yup.object().shape({ - name: matchContainerName(yup.string().nullable().optional().label('container:common.containerName')), - environment: uniqueKeyValuesSchema - .default(null) - .nullable() - .optional() - .label('container:common.environment') - .test('ruleValidation', 'errors:yup.mixed.required', testEnvironment(imageLabels)), - routing: routingRule, - expose: exposeRule, - user: yup.number().default(null).min(UID_MIN).max(UID_MAX).nullable().optional().label('container:common.user'), - workingDirectory: yup.string().default(null).nullable().optional().label('container:common.workingDirectory'), - tty: yup.boolean().default(null).nullable().optional().label('container:common.tty'), - configContainer: configContainerRule, - ports: portConfigRule, - portRanges: portRangeConfigRule, - volumes: volumeConfigRule, - commands: shellCommandSchema.default(null).nullable().optional(), - args: shellCommandSchema.default(null).nullable().optional(), - initContainers: initContainerRule, - capabilities: uniqueKeyValuesSchema.default(null).nullable().optional().label('container:common.capabilities'), - storage: storageRule, + yup + .object() + .shape({ + name: matchContainerName(yup.string().nullable().optional().label('container:common.containerName')), + environment: uniqueKeyValuesSchema + .default(null) + .nullable() + .optional() + .label('container:common.environment') + .test('ruleValidation', 'errors:yup.mixed.required', testEnvironment(imageLabels)), + routing: routingRule, + expose: exposeRule, + user: yup.number().default(null).min(UID_MIN).max(UID_MAX).nullable().optional().label('container:common.user'), + workingDirectory: yup.string().default(null).nullable().optional().label('container:common.workingDirectory'), + tty: yup.boolean().default(null).nullable().optional().label('container:common.tty'), + configContainer: configContainerRule, + ports: portConfigRule, + portRanges: portRangeConfigRule, + volumes: volumeConfigRule, + commands: shellCommandSchema.default(null).nullable().optional(), + args: shellCommandSchema.default(null).nullable().optional(), + initContainers: initContainerRule, + capabilities: uniqueKeyValuesSchema.default(null).nullable().optional().label('container:common.capabilities'), + storage: storageRule, // dagent: logConfig: logConfigRule, diff --git a/web/crux/src/app/image/image.service.ts b/web/crux/src/app/image/image.service.ts index fd63f8e21..d55206abc 100644 --- a/web/crux/src/app/image/image.service.ts +++ b/web/crux/src/app/image/image.service.ts @@ -318,7 +318,7 @@ export default class ImageService { }, {}) ?? {} const mergedEnv = Object.entries(rules) - .filter(([_, rule]) => !rule.secret) + .filter(([, rule]) => !rule.secret) .reduce((map, it) => { const [key, rule] = it @@ -345,7 +345,7 @@ export default class ImageService { }, {}) ?? {} const mergedSecrets = Object.entries(rules) - .filter(([_, rule]) => rule.secret) + .filter(([, rule]) => rule.secret) .reduce((map, it) => { const [key, rule] = it diff --git a/web/crux/src/domain/validation.ts b/web/crux/src/domain/validation.ts index 1950df8d2..c785a2870 100644 --- a/web/crux/src/domain/validation.ts +++ b/web/crux/src/domain/validation.ts @@ -398,14 +398,14 @@ const validateLabelRule = (rule: EnvironmentRule, field: string, env: KeyValueLi } const testRules = (rules: [string, EnvironmentRule][], arr: UniqueKeyValue[], fieldName: string) => { - if (rules.length == 0) { + if (rules.length === 0) { return null } const requiredKeys = rules.map(([key]) => key) const foundKeys = arr.map(it => it.key) - if (requiredKeys.length > 0 && (!arr || arr.length == 0)) { + if (requiredKeys.length > 0 && (!arr || arr.length === 0)) { return new yup.ValidationError('errors:yup.mixed.required', fieldName, fieldName) } @@ -472,8 +472,8 @@ export const createStartDeploymentSchema = (instanceValidation: Record rule.required) - const envRules = requiredRules.filter(([_, rule]) => !rule.secret) - const secretRules = requiredRules.filter(([_, rule]) => rule.secret) + const envRules = requiredRules.filter(([, rule]) => !rule.secret) + const secretRules = requiredRules.filter(([, rule]) => rule.secret) const envError = testRules(envRules, it.config.environment as UniqueKeyValue[], 'environment') if (envError) {