From 0f4af8cec40d8e1de0b51be6a5d751b46c3818f5 Mon Sep 17 00:00:00 2001 From: Celia Amador Date: Wed, 10 Jun 2026 12:29:32 +0200 Subject: [PATCH] EDM-4144: Clarify OCI reference terminology Made-with: Cursor --- libs/i18n/locales/en/translation.json | 9 +++--- .../steps/TypeConfigStep.tsx | 4 +-- .../Catalog/AddCatalogItemWizard/utils.ts | 28 ++++++++++--------- .../CreateRepository/CreateRepositoryForm.tsx | 2 +- 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/libs/i18n/locales/en/translation.json b/libs/i18n/locales/en/translation.json index e45250668..117ea1cc0 100644 --- a/libs/i18n/locales/en/translation.json +++ b/libs/i18n/locales/en/translation.json @@ -237,8 +237,7 @@ "Provide a valid container image reference": "Provide a valid container image reference", "Application image": "Application image", "Select a type": "Select a type", - "URI": "URI", - "Artifact URI": "Artifact URI", + "OCI reference": "OCI reference", "e.g. https://example.com/image.qcow2": "e.g. https://example.com/image.qcow2", "Artifact name": "Artifact name", "Optional display name": "Optional display name", @@ -286,13 +285,14 @@ "Channel names must be valid DNS subdomain names (lowercase alphanumeric, hyphens, dots). Invalid: {{ channels }}": "Channel names must be valid DNS subdomain names (lowercase alphanumeric, hyphens, dots). Invalid: {{ channels }}", "Deprecation message is required": "Deprecation message is required", "At least one version is required": "At least one version is required", - "Container image URI is required": "Container image URI is required", - "URI must not include a tag (\":\") or digest (\"@\"). Specify those in the version fields.": "URI must not include a tag (\":\") or digest (\"@\"). Specify those in the version fields.", + "Must not include a tag (\":\") or digest (\"@\"). Specify those in the version fields.": "Must not include a tag (\":\") or digest (\"@\"). Specify those in the version fields.", "Catalog is required": "Catalog is required", "Must be a valid URL or data URI": "Must be a valid URL or data URI", "Type is required": "Type is required", + "Container image reference is required": "Container image reference is required", "Invalid artifact type": "Invalid artifact type", "Each artifact type can only be used once": "Each artifact type can only be used once", + "OCI reference is required": "OCI reference is required", "At least one artifact is required": "At least one artifact is required", "Select {{ name }}": "Select {{ name }}", "Provided by {{provider}}": "Provided by {{provider}}", @@ -784,7 +784,6 @@ "Select an application type": "Select an application type", "Definition source": "Definition source", "Configuration Sources": "Configuration Sources", - "OCI reference": "OCI reference", "Pull definitions from container registry (reusable, versioned).": "Pull definitions from container registry (reusable, versioned).", "Inline": "Inline", "Define application files directly in this interface (custom, one-off).": "Define application files directly in this interface (custom, one-off).", diff --git a/libs/ui-components/src/components/Catalog/AddCatalogItemWizard/steps/TypeConfigStep.tsx b/libs/ui-components/src/components/Catalog/AddCatalogItemWizard/steps/TypeConfigStep.tsx index 30bd080a1..21e4f8a18 100644 --- a/libs/ui-components/src/components/Catalog/AddCatalogItemWizard/steps/TypeConfigStep.tsx +++ b/libs/ui-components/src/components/Catalog/AddCatalogItemWizard/steps/TypeConfigStep.tsx @@ -126,10 +126,10 @@ const TypeConfigStep = ({ isEdit, isReadOnly }: { isEdit?: boolean; isReadOnly?: isDisabled={isReadOnly} /> - + .min(1, t('At least one version is required')); }); -const artifactURISchema = (t: TFunction) => +const uriHasNoTagOrDigest = (value: string | undefined) => { + if (!value) { + return true; + } + const path = value.replace(/^[a-z]+:\/\//, ''); + const imageName = path.includes('/') ? path.substring(path.lastIndexOf('/') + 1) : path; + return !imageName.includes(':') && !imageName.includes('@'); +}; + +const imageReferenceWithoutVersionSchema = (t: TFunction, requiredMessage: string) => Yup.string() - .required(t('Container image URI is required')) + .required(requiredMessage) .test( 'no-tag-or-digest', - t('URI must not include a tag (":") or digest ("@"). Specify those in the version fields.'), - (value) => { - if (!value) { - return true; - } - const path = value.replace(/^[a-z]+:\/\//, ''); - const imageName = path.includes('/') ? path.substring(path.lastIndexOf('/') + 1) : path; - return !imageName.includes(':') && !imageName.includes('@'); - }, + t('Must not include a tag (":") or digest ("@"). Specify those in the version fields.'), + uriHasNoTagOrDigest, ); export const getValidationSchema = (t: TFunction) => @@ -543,7 +545,7 @@ export const getValidationSchema = (t: TFunction) => type: Yup.string().oneOf(Object.values(CatalogItemType)).required(t('Type is required')), containerUri: Yup.string().when('type', { is: (type: string) => appTypeIds.includes(type as CatalogItemType), - then: () => artifactURISchema(t), + then: () => imageReferenceWithoutVersionSchema(t, t('Container image reference is required')), otherwise: () => Yup.string(), }), artifacts: Yup.mixed().when('type', { @@ -572,7 +574,7 @@ export const getValidationSchema = (t: TFunction) => return !duplicateTypes.has(value); }), name: Yup.string(), - uri: artifactURISchema(t), + uri: imageReferenceWithoutVersionSchema(t, t('OCI reference is required')), }), ) .min(1, t('At least one artifact is required')); diff --git a/libs/ui-components/src/components/Repository/CreateRepository/CreateRepositoryForm.tsx b/libs/ui-components/src/components/Repository/CreateRepository/CreateRepositoryForm.tsx index 70ef549ab..d92e608b7 100644 --- a/libs/ui-components/src/components/Repository/CreateRepository/CreateRepositoryForm.tsx +++ b/libs/ui-components/src/components/Repository/CreateRepository/CreateRepositoryForm.tsx @@ -456,7 +456,7 @@ export const RepositoryForm = ({