Skip to content

Commit

Permalink
add invalidTagNameError validation for custom tag name.
Browse files Browse the repository at this point in the history
Signed-off-by: krishna2323 <[email protected]>
  • Loading branch information
Krishna2323 committed Sep 10, 2024
1 parent 61ee515 commit c5acec6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/pages/workspace/tags/WorkspaceEditTagsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ function WorkspaceEditTagsPage({route, policyTags}: WorkspaceEditTagsPageProps)
if (!values[INPUT_IDS.POLICY_TAGS_NAME] && values[INPUT_IDS.POLICY_TAGS_NAME].trim() === '') {
errors[INPUT_IDS.POLICY_TAGS_NAME] = translate('common.error.fieldRequired');
}
if (values[INPUT_IDS.POLICY_TAGS_NAME]?.trim() === '0') {
errors[INPUT_IDS.POLICY_TAGS_NAME] = translate('workspace.tags.invalidTagNameError');
}
if (policyTags && Object.values(policyTags).find((tag) => tag.orderWeight !== route.params.orderWeight && tag.name === values[INPUT_IDS.POLICY_TAGS_NAME])) {
errors[INPUT_IDS.POLICY_TAGS_NAME] = translate('workspace.tags.existingTagError');
}
Expand Down

0 comments on commit c5acec6

Please sign in to comment.