From d66a809abe3d5adf3a062c2410bfc3846138d069 Mon Sep 17 00:00:00 2001 From: Sebastian Helzle Date: Mon, 4 Nov 2024 16:36:01 +0100 Subject: [PATCH] TASK: Code cleanup of tag validation change --- .../asset-collections/src/components/AddTagButton.tsx | 1 - .../asset-tags/src/components/CreateTagDialog.tsx | 5 +---- .../JavaScript/asset-tags/src/state/createTagDialogState.ts | 1 - Resources/Private/JavaScript/media-module/tests/tags.ts | 2 +- Resources/Private/Translations/de/Main.xlf | 6 +++--- Resources/Private/Translations/en/Main.xlf | 6 +++--- 6 files changed, 8 insertions(+), 13 deletions(-) diff --git a/Resources/Private/JavaScript/asset-collections/src/components/AddTagButton.tsx b/Resources/Private/JavaScript/asset-collections/src/components/AddTagButton.tsx index 65b3f82c2..8152764a2 100644 --- a/Resources/Private/JavaScript/asset-collections/src/components/AddTagButton.tsx +++ b/Resources/Private/JavaScript/asset-collections/src/components/AddTagButton.tsx @@ -19,7 +19,6 @@ const AddTagButton: React.FC = () => { setCreateTagDialogState({ visible: true, label: '', - tags: [], validation: { valid: false, errors: [], diff --git a/Resources/Private/JavaScript/asset-tags/src/components/CreateTagDialog.tsx b/Resources/Private/JavaScript/asset-tags/src/components/CreateTagDialog.tsx index 3f22e7148..6c3d53581 100644 --- a/Resources/Private/JavaScript/asset-tags/src/components/CreateTagDialog.tsx +++ b/Resources/Private/JavaScript/asset-tags/src/components/CreateTagDialog.tsx @@ -4,8 +4,6 @@ import { useRecoilState } from 'recoil'; import { Button, Label, TextInput, Tooltip } from '@neos-project/react-ui-components'; -import TAGS from '../queries/tags'; -import { useQuery } from '@apollo/client'; import { useIntl, useNotify } from '@media-ui/core'; import { useSelectedAssetCollection } from '@media-ui/feature-asset-collections'; import { useCreateTag, useTagsQuery } from '@media-ui/feature-asset-tags'; @@ -28,7 +26,6 @@ const CreateTagDialog: React.FC = () => { setDialogState({ visible: false, label: '', - tags: [], validation: { valid: false, errors: [], @@ -52,7 +49,7 @@ const CreateTagDialog: React.FC = () => { const tagWithLabelExist = tags?.some((tag) => tag.label === trimmedLabel); if (trimmedLabel.length === 0) { - validationErrors.push(translate('tagActions.validation.emtpyTagLabl', 'Please provide a tag label')); + validationErrors.push(translate('tagActions.validation.emptyTagLabel', 'Please provide a tag label')); } if (tagWithLabelExist) { diff --git a/Resources/Private/JavaScript/asset-tags/src/state/createTagDialogState.ts b/Resources/Private/JavaScript/asset-tags/src/state/createTagDialogState.ts index b0b1b4691..b139b856f 100644 --- a/Resources/Private/JavaScript/asset-tags/src/state/createTagDialogState.ts +++ b/Resources/Private/JavaScript/asset-tags/src/state/createTagDialogState.ts @@ -5,7 +5,6 @@ const createTagDialogState = atom({ default: { visible: false, label: '', - tags: [], validation: { valid: false, errors: [], diff --git a/Resources/Private/JavaScript/media-module/tests/tags.ts b/Resources/Private/JavaScript/media-module/tests/tags.ts index 2955b3a13..bcf7246e6 100644 --- a/Resources/Private/JavaScript/media-module/tests/tags.ts +++ b/Resources/Private/JavaScript/media-module/tests/tags.ts @@ -45,7 +45,7 @@ test('Create a new tag and test validation', async (t) => { .expect(ReactSelector('CreateTagDialog').findReact('Button').withProps({ disabled: false }).exists) .ok('Create button should be enabled'); - subSection('Check emtpy tag label validation'); + subSection('Check empty tag label validation'); await t .typeText(ReactSelector('CreateTagDialog').findReact('TextInput'), ' ', { replace: true }) .expect(ReactSelector('CreateTagDialog').findReact('Button').withProps({ disabled: true }).exists) diff --git a/Resources/Private/Translations/de/Main.xlf b/Resources/Private/Translations/de/Main.xlf index 39768f730..3f80df8a6 100644 --- a/Resources/Private/Translations/de/Main.xlf +++ b/Resources/Private/Translations/de/Main.xlf @@ -412,12 +412,12 @@ Create tag Tag erstellen - + Please provide a tag label Bitte geben Sie einen Tag-Namen ein - This tag is already exists. Please choose a different one. + This tag already exists. Please choose a different one. Dieser Tag existiert bereits. Bitte wählen Sie einen anderen aus. @@ -884,7 +884,7 @@ Tag-Erstellung fehlgeschlagen - This tag is already exists. Please choose a different one. + This tag already exists. Please choose a different one. Dieser Tag existiert bereits. Bitte wählen Sie einen anderen aus. diff --git a/Resources/Private/Translations/en/Main.xlf b/Resources/Private/Translations/en/Main.xlf index 43b3b31fa..d46a81ed2 100644 --- a/Resources/Private/Translations/en/Main.xlf +++ b/Resources/Private/Translations/en/Main.xlf @@ -316,11 +316,11 @@ Tag was created - + Please provide a tag label - This tag is already exists. Please choose a different one. + This tag already exists. Please choose a different one. Failed to create tag @@ -676,7 +676,7 @@ Failed to create tag - This tag is already exists. Please choose a different one. + This tag already exists. Please choose a different one. The specified asset was not found.