8000 fix(crux-ui): secret releated env keys by m8vago · Pull Request #974 · dyrector-io/dyrectorio · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix(crux-ui): secret releated env keys #974

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 16, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,14 @@ import {
mergeConfigs,
} from '@app/models'
import { fetcher, toNumber } from '@app/utils'
import { ContainerConfigValidationErrors, findErrorFor, findErrorStartsWith, matchError } from '@app/validations'
import {
ContainerConfigValidationErrors,
findErrorFor,
findErrorStartsWith,
getValidationError,
matchError,
unsafeUniqueKeyValuesSchema,
} from '@app/validations'
import clsx from 'clsx'
import useTranslation from 'next-translate/useTranslation'
import useSWR from 'swr'
Expand Down Expand Up @@ -137,6 +144,9 @@ const CommonConfigSection = (props: CommonConfigSectionProps) => {
onChange(patch)
}

const environmentWarning =
getValidationError(unsafeUniqueKeyValuesSchema, config.environment, undefined, t)?.message ?? null

return !filterEmpty([...COMMON_CONFIG_PROPERTIES], selectedFilters) ? null : (
<div className="my-4">
<DyoHeading className="text-lg text-bright font-semibold tracking-wide bg-dyo-orange/50 w-40 rounded-t-lg text-center pt-[2px]">
Expand Down Expand Up @@ -453,7 +463,8 @@ const CommonConfigSection = (props: CommonConfigSectionProps) => {
editorOptions={editorOptions}
disabled={disabled}
findErrorMessage={index => findErrorStartsWith(fieldErrors, `environment[${index}]`)}
message={findErrorFor(fieldErrors, `environment`)}
message={findErrorFor(fieldErrors, `environment`) ?? environmentWarning}
messageType={!findErrorFor(fieldErrors, `environment`) && environmentWarning ? 'info' : 'error'}
/>
</div>
)}
Expand Down
2 changes: 1 addition & 1 deletion web/crux-ui/src/validations/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const yupErrorTranslate = (error: yup.ValidationError, t: Translate): yup
}

export const getValidationError = (
schema: yup.Schema,
schema: yup.AnySchema,
candidate: any,
options?: yup.ValidateOptions,
t?: Translate,
Expand Down
2 changes: 1 addition & 1 deletion web/crux-ui/src/validations/container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ const testEnvironment = (imageLabels: Record<string, string>) => (arr: UniqueKey
const createContainerConfigBaseSchema = (imageLabels: Record<string, string>) =>
yup.object().shape({
name: matchNoWhitespace(yup.string().required().label('container:common.containerName')),
environment: unsafeUniqueKeyValuesSchema
environment: uniqueKeyValuesSchema
.default([])
.nullable()
.label('container:common.environment')
Expand Down
0