fix(app): fix wording and 2 key validation [EE-6233] (#10944)
Co-authored-by: testa113 <testa113>pull/10943/head
parent
55f66f161e
commit
cb7efd8601
|
@ -62,7 +62,7 @@ export function ConfigMapsFormSection({
|
|||
configurations={configMaps}
|
||||
onRemoveItem={() => onRemoveItem(index)}
|
||||
index={index}
|
||||
dataCyType="config"
|
||||
configurationType="ConfigMap"
|
||||
/>
|
||||
)}
|
||||
itemBuilder={() => ({
|
||||
|
|
|
@ -11,7 +11,11 @@ import { isErrorType } from '@@/form-components/formikUtils';
|
|||
import { Button } from '@@/buttons';
|
||||
import { TextTip } from '@@/Tip/TextTip';
|
||||
|
||||
import { ConfigurationFormValues, ConfigurationOverrideKey } from './types';
|
||||
import {
|
||||
ConfigurationFormValues,
|
||||
ConfigurationOverrideKey,
|
||||
ConfigurationType,
|
||||
} from './types';
|
||||
import { ConfigurationData } from './ConfigurationKey';
|
||||
|
||||
type Props = {
|
||||
|
@ -21,7 +25,7 @@ type Props = {
|
|||
configurations: Array<ConfigMap | Secret>;
|
||||
index: number;
|
||||
error?: ItemError<ConfigurationFormValues>;
|
||||
dataCyType: 'config' | 'secret';
|
||||
configurationType: ConfigurationType;
|
||||
};
|
||||
|
||||
export function ConfigurationItem({
|
||||
|
@ -31,7 +35,7 @@ export function ConfigurationItem({
|
|||
configurations,
|
||||
index,
|
||||
onRemoveItem,
|
||||
dataCyType,
|
||||
configurationType,
|
||||
}: Props) {
|
||||
// rule out the error being of type string
|
||||
const formikError = isErrorType(error) ? error : undefined;
|
||||
|
@ -55,7 +59,7 @@ export function ConfigurationItem({
|
|||
)}
|
||||
onChange={onSelectConfigMap}
|
||||
size="sm"
|
||||
data-cy={`k8sAppCreate-add${dataCyType}Select_${index}`}
|
||||
data-cy={`k8sAppCreate-add${configurationType}Select_${index}`}
|
||||
/>
|
||||
</InputGroup>
|
||||
{formikError?.selectedConfiguration && (
|
||||
|
@ -95,8 +99,8 @@ export function ConfigurationItem({
|
|||
{!item.overriden && (
|
||||
<TextTip color="blue">
|
||||
The following keys will be loaded from the{' '}
|
||||
<code>{item.selectedConfiguration.metadata?.name}</code>
|
||||
ConfigMap as environment variables:
|
||||
<code>{item.selectedConfiguration.metadata?.name}</code>{' '}
|
||||
{configurationType} as environment variables:
|
||||
{Object.keys(configurationData).map((key, index) => (
|
||||
<span key={key}>
|
||||
<code>{key}</code>
|
||||
|
@ -116,7 +120,7 @@ export function ConfigurationItem({
|
|||
onChange({ ...item, overridenKeys: newOverridenKeys });
|
||||
}}
|
||||
overrideKeysErrors={formikError?.overridenKeys}
|
||||
dataCyType={dataCyType}
|
||||
configurationType={configurationType}
|
||||
configurationIndex={index}
|
||||
keyIndex={keyIndex}
|
||||
/>
|
||||
|
|
|
@ -7,7 +7,7 @@ import { Button } from '@@/buttons';
|
|||
import { FormError } from '@@/form-components/FormError';
|
||||
import { isArrayErrorType } from '@@/form-components/formikUtils';
|
||||
|
||||
import { ConfigurationOverrideKey } from './types';
|
||||
import { ConfigurationOverrideKey, ConfigurationType } from './types';
|
||||
|
||||
type Props = {
|
||||
value: ConfigurationOverrideKey;
|
||||
|
@ -18,7 +18,7 @@ type Props = {
|
|||
| string
|
||||
| string[]
|
||||
| FormikErrors<ConfigurationOverrideKey>[];
|
||||
dataCyType: 'config' | 'secret';
|
||||
configurationType: ConfigurationType;
|
||||
};
|
||||
|
||||
export function ConfigurationData({
|
||||
|
@ -27,8 +27,10 @@ export function ConfigurationData({
|
|||
overrideKeysErrors,
|
||||
configurationIndex,
|
||||
keyIndex,
|
||||
dataCyType,
|
||||
configurationType,
|
||||
}: Props) {
|
||||
const dataCyType = configurationType.toLowerCase();
|
||||
|
||||
// rule out the error (from formik) being of type string
|
||||
const overriddenKeyError = isArrayErrorType(overrideKeysErrors)
|
||||
? overrideKeysErrors[keyIndex]
|
||||
|
|
|
@ -62,7 +62,7 @@ export function SecretsFormSection({
|
|||
configurations={secrets}
|
||||
onRemoveItem={() => onRemoveItem(index)}
|
||||
index={index}
|
||||
dataCyType="secret"
|
||||
configurationType="Secret"
|
||||
/>
|
||||
)}
|
||||
itemBuilder={() => ({
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import { SchemaOf, array, boolean, mixed, object, string } from 'yup';
|
||||
|
||||
import { buildUniquenessTest } from '@@/form-components/validate-unique';
|
||||
|
||||
import { ConfigurationFormValues } from './types';
|
||||
|
||||
export function configurationsValidationSchema(
|
||||
|
@ -36,13 +34,7 @@ export function configurationsValidationSchema(
|
|||
}),
|
||||
type: mixed().oneOf(['NONE', 'ENVIRONMENT', 'FILESYSTEM']),
|
||||
})
|
||||
)
|
||||
.test(
|
||||
'No duplicates',
|
||||
'This path is already used.',
|
||||
buildUniquenessTest(() => 'This path is already used.', 'path')
|
||||
)
|
||||
.required(),
|
||||
).required(),
|
||||
})
|
||||
);
|
||||
}
|
||||
|
|
|
@ -12,4 +12,6 @@ export type ConfigurationOverrideKey = {
|
|||
path?: string;
|
||||
};
|
||||
|
||||
export type ConfigurationType = 'ConfigMap' | 'Secret';
|
||||
|
||||
type ConfigurationOverrideKeyType = 'NONE' | 'ENVIRONMENT' | 'FILESYSTEM';
|
||||
|
|
Loading…
Reference in New Issue