Skip to content

Commit

Permalink
TASK: Code cleanup of tag validation change
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebobo committed Nov 4, 2024
1 parent e88d8b9 commit d66a809
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const AddTagButton: React.FC = () => {
setCreateTagDialogState({
visible: true,
label: '',
tags: [],
validation: {
valid: false,
errors: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -28,7 +26,6 @@ const CreateTagDialog: React.FC = () => {
setDialogState({
visible: false,
label: '',
tags: [],
validation: {
valid: false,
errors: [],
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const createTagDialogState = atom({
default: {
visible: false,
label: '',
tags: [],
validation: {
valid: false,
errors: [],
Expand Down
2 changes: 1 addition & 1 deletion Resources/Private/JavaScript/media-module/tests/tags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions Resources/Private/Translations/de/Main.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -412,12 +412,12 @@
<source>Create tag</source>
<target>Tag erstellen</target>
</trans-unit>
<trans-unit id="tagActions.validation.emtpyTagLabl" xml:space="preserve" approved="yes">
<trans-unit id="tagActions.validation.emptyTagLabel" xml:space="preserve" approved="yes">
<source>Please provide a tag label</source>
<target>Bitte geben Sie einen Tag-Namen ein</target>
</trans-unit>
<trans-unit id="tagActions.validation.tagExists" xml:space="preserve" approved="yes">
<source>This tag is already exists. Please choose a different one.</source>
<source>This tag already exists. Please choose a different one.</source>
<target>Dieser Tag existiert bereits. Bitte wählen Sie einen anderen aus.</target>
</trans-unit>
<trans-unit id="tagActions.create.success" xml:space="preserve" approved="yes">
Expand Down Expand Up @@ -884,7 +884,7 @@
<target>Tag-Erstellung fehlgeschlagen</target>
</trans-unit>
<trans-unit id="errors.1603921233.message" xml:space="preserve" approved="yes">
<source>This tag is already exists. Please choose a different one.</source>
<source>This tag already exists. Please choose a different one.</source>
<target>Dieser Tag existiert bereits. Bitte wählen Sie einen anderen aus.</target>
</trans-unit>
<trans-unit id="errors.1509632861.message" xml:space="preserve" approved="yes">
Expand Down
6 changes: 3 additions & 3 deletions Resources/Private/Translations/en/Main.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -316,11 +316,11 @@
<trans-unit id="tagActions.create.success" xml:space="preserve" approved="yes">
<source>Tag was created</source>
</trans-unit>
<trans-unit id="tagActions.validation.emtpyTagLabl" xml:space="preserve" approved="yes">
<trans-unit id="tagActions.validation.emptyTagLabel" xml:space="preserve" approved="yes">
<source>Please provide a tag label</source>
</trans-unit>
<trans-unit id="tagActions.validation.tagExists" xml:space="preserve" approved="yes">
<source>This tag is already exists. Please choose a different one.</source>
<source>This tag already exists. Please choose a different one.</source>
</trans-unit>
<trans-unit id="tagActions.create.error" xml:space="preserve" approved="yes">
<source>Failed to create tag</source>
Expand Down Expand Up @@ -676,7 +676,7 @@
<source>Failed to create tag</source>
</trans-unit>
<trans-unit id="errors.1603921233.message" xml:space="preserve" approved="yes">
<source>This tag is already exists. Please choose a different one.</source>
<source>This tag already exists. Please choose a different one.</source>
</trans-unit>
<trans-unit id="errors.1509632861.message" xml:space="preserve" approved="yes">
<source>The specified asset was not found.</source>
Expand Down

0 comments on commit d66a809

Please sign in to comment.