fixed issue allow user to add tag 64 character long (#6144)

This commit is contained in:
Shailesh Parmar 2022-07-18 15:09:09 +05:30 committed by GitHub
parent 78e41a66a6
commit ef495e1118
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -143,6 +143,7 @@ const TagsPage = () => {
); );
showErrorToast(errMsg); showErrorToast(errMsg);
setError(errMsg); setError(errMsg);
setCurrentCategory({ name } as TagCategory);
setIsLoading(false); setIsLoading(false);
} }
} }
@ -163,8 +164,8 @@ const TagsPage = () => {
) )
) { ) {
errData['name'] = 'Name already exists'; errData['name'] = 'Name already exists';
} else if (data.name.length < 2 || data.name.length > 25) { } else if (data.name.length < 2 || data.name.length > 64) {
errData['name'] = 'Name size must be between 2 and 25'; errData['name'] = 'Name size must be between 2 and 64';
} else if (!isUrlFriendlyName(data.name.trim())) { } else if (!isUrlFriendlyName(data.name.trim())) {
errData['name'] = 'Special characters are not allowed'; errData['name'] = 'Special characters are not allowed';
} }
@ -326,8 +327,8 @@ const TagsPage = () => {
) )
) { ) {
errData['name'] = 'Name already exists'; errData['name'] = 'Name already exists';
} else if (data.name.length < 2 || data.name.length > 25) { } else if (data.name.length < 2 || data.name.length > 64) {
errData['name'] = 'Name size must be between 2 and 25'; errData['name'] = 'Name size must be between 2 and 64';
} }
setErrorDataTag(errData); setErrorDataTag(errData);
@ -474,16 +475,14 @@ const TagsPage = () => {
}; };
return ( return (
<>
{error ? (
<ErrorPlaceHolder>
<p className="tw-text-center tw-m-auto">{error}</p>
</ErrorPlaceHolder>
) : (
<PageContainerV1 className="tw-py-4"> <PageContainerV1 className="tw-py-4">
<PageLayout leftPanel={fetchLeftPanel()}> <PageLayout leftPanel={fetchLeftPanel()}>
{isLoading ? ( {isLoading ? (
<Loader /> <Loader />
) : error ? (
<ErrorPlaceHolder>
<p className="tw-text-center tw-m-auto">{error}</p>
</ErrorPlaceHolder>
) : ( ) : (
<div <div
className="full-height" className="full-height"
@ -559,9 +558,7 @@ const TagsPage = () => {
<table className="tw-w-full" data-testid="table"> <table className="tw-w-full" data-testid="table">
<thead> <thead>
<tr className="tableHead-row"> <tr className="tableHead-row">
<th <th className="tableHead-cell" data-testid="heading-name">
className="tableHead-cell"
data-testid="heading-name">
Name Name
</th> </th>
<th <th
@ -657,8 +654,7 @@ const TagsPage = () => {
data: { data: {
id: tag.id as string, id: tag.id as string,
name: tag.name, name: tag.name,
categoryName: categoryName: currentCategory.name,
currentCategory.name,
isCategory: false, isCategory: false,
status: 'waiting', status: 'waiting',
}, },
@ -666,14 +662,10 @@ const TagsPage = () => {
}) })
}> }>
{deleteTags.data?.id === tag.id ? ( {deleteTags.data?.id === tag.id ? (
deleteTags.data?.status === deleteTags.data?.status === 'success' ? (
'success' ? (
<FontAwesomeIcon icon="check" /> <FontAwesomeIcon icon="check" />
) : ( ) : (
<Loader <Loader size="small" type="default" />
size="small"
type="default"
/>
) )
) : ( ) : (
<SVGIcons <SVGIcons
@ -693,9 +685,7 @@ const TagsPage = () => {
) )
) : ( ) : (
<tr className="tableBody-row"> <tr className="tableBody-row">
<td <td className="tableBody-cell tw-text-center" colSpan={4}>
className="tableBody-cell tw-text-center"
colSpan={4}>
No tags available. No tags available.
</td> </td>
</tr> </tr>
@ -775,8 +765,6 @@ const TagsPage = () => {
)} )}
</PageLayout> </PageLayout>
</PageContainerV1> </PageContainerV1>
)}
</>
); );
}; };