UI : Fix Tags page and minor ui issue (#7247)

* Fix Tags page and minor ui issue

* Fix cypress issue
This commit is contained in:
Ashish Gupta 2022-09-06 19:00:04 +05:30 committed by GitHub
parent 57501dc8ee
commit 652a12e4d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 27 deletions

View File

@ -200,6 +200,7 @@ const ActivityFeedList: FC<ActivityFeedListProp> = ({
</Button> </Button>
{showThreadTypeList && ( {showThreadTypeList && (
<DropDownList <DropDownList
horzPosRight
dropDownList={threadFilterList} dropDownList={threadFilterList}
value={threadType} value={threadType}
onSelect={handleThreadTypeDropDownChange} onSelect={handleThreadTypeDropDownChange}

View File

@ -348,7 +348,7 @@ const GlossaryV1 = ({
: NO_PERMISSION_FOR_ACTION : NO_PERMISSION_FOR_ACTION
}> }>
<button <button
className="tw-mt-1 tw-w-full tw-flex-center tw-gap-2 tw-py-1 tw-text-primary tw-border tw-rounded-md" className="tw-mt-1 tw-w-full tw-flex-center tw-gap-2 tw-py-1 tw-text-primary tw-border tw-rounded-md tw-text-center"
disabled={!createGlossaryPermission} disabled={!createGlossaryPermission}
onClick={handleAddGlossaryClick}> onClick={handleAddGlossaryClick}>
<SVGIcons alt="plus" icon={Icons.ICON_PLUS_PRIMERY} />{' '} <SVGIcons alt="plus" icon={Icons.ICON_PLUS_PRIMERY} />{' '}

View File

@ -279,18 +279,13 @@ const GlossaryDetails = ({ permissions, glossary, updateGlossary }: props) => {
placement="topRight" placement="topRight"
title={permissions.EditAll ? 'Add Reviewer' : NO_PERMISSION_FOR_ACTION}> title={permissions.EditAll ? 'Add Reviewer' : NO_PERMISSION_FOR_ACTION}>
<ButtonAntd <ButtonAntd
className="tw-p-0 add-reviewer-btn" className="tw-p-0 flex-center"
data-testid="add-new-reviewer" data-testid="add-new-reviewer"
disabled={!permissions.EditAll} disabled={!permissions.EditAll}
size="small"
type="text" type="text"
onClick={() => setShowRevieweModal(true)}> onClick={() => setShowRevieweModal(true)}>
<SVGIcons <SVGIcons alt="edit" icon={Icons.EDIT} title="Edit" width="16px" />
alt="edit"
className="tw--mt-1"
icon={Icons.EDIT}
title="Edit"
width="16px"
/>
</ButtonAntd> </ButtonAntd>
</Tooltip> </Tooltip>
); );
@ -307,19 +302,13 @@ const GlossaryDetails = ({ permissions, glossary, updateGlossary }: props) => {
: NO_PERMISSION_FOR_ACTION : NO_PERMISSION_FOR_ACTION
}> }>
<ButtonAntd <ButtonAntd
className="tw-p-0" className="tw-p-0 flex-center"
data-testid="owner-dropdown" data-testid="owner-dropdown"
disabled={!(permissions.EditOwner || permissions.EditAll)} disabled={!(permissions.EditOwner || permissions.EditAll)}
size="small" size="small"
type="text" type="text"
onClick={handleSelectOwnerDropdown}> onClick={handleSelectOwnerDropdown}>
<SVGIcons <SVGIcons alt="edit" icon={Icons.EDIT} title="Edit" width="16px" />
alt="edit"
className="tw--mt-1"
icon={Icons.EDIT}
title="Edit"
width="16px"
/>
</ButtonAntd> </ButtonAntd>
</Tooltip> </Tooltip>
{listVisible && ( {listVisible && (

View File

@ -31,13 +31,13 @@ const Card = ({ children, heading, action, className }: CardProps) => {
className className
)} )}
data-testid={`${lowerCase(heading)}-card-container`}> data-testid={`${lowerCase(heading)}-card-container`}>
<Row className="tw-border-b tw-px-4 tw-py-3 tw-w-full"> <Row className="tw-border-b tw-px-4 tw-py-2 tw-w-full tw-items-center">
<Col span={8}> <Col span={8}>
<span className="tw-font-semibold">{heading}</span> <span className="tw-font-medium">{heading}</span>
</Col> </Col>
<Col offset={14}>{action}</Col> <Col offset={14}>{action}</Col>
</Row> </Row>
<div className="tw-p-4">{children}</div> <div className="tw-px-4 tw-py-2">{children}</div>
</div> </div>
); );
}; };

View File

@ -137,12 +137,15 @@ const TagsPage = () => {
} }
}; };
const fetchCategories = () => { const fetchCategories = (setCurrent?: boolean) => {
setIsLoading(true); setIsLoading(true);
getTagCategories('usageCount') getTagCategories('usageCount')
.then((res) => { .then((res) => {
if (res.data) { if (res.data) {
setCategoreis(res.data); setCategoreis(res.data);
if (setCurrent) {
setCurrentCategory(res.data[0]);
}
} else { } else {
throw jsonData['api-error-messages']['unexpected-server-response']; throw jsonData['api-error-messages']['unexpected-server-response'];
} }
@ -424,19 +427,21 @@ const TagsPage = () => {
}; };
useEffect(() => { useEffect(() => {
fetchCategories(); fetchCategories(true);
}, []); }, []);
useEffect(() => { useEffect(() => {
setCurrentCategory(categories[0]);
if (currentCategory) { if (currentCategory) {
setCurrentCategory(currentCategory);
fetchCurrentCategoryPermission(); fetchCurrentCategoryPermission();
} }
}, [categories, currentCategory]); }, [currentCategory]);
useEffect(() => { useEffect(() => {
fetchCurrentCategory(tagCategoryName); if (tagCategoryName) {
fetchCurrentCategory(tagCategoryName);
} else {
setCurrentCategory(categories[0]);
}
}, [tagCategoryName]); }, [tagCategoryName]);
const fetchLeftPanel = () => { const fetchLeftPanel = () => {
@ -455,7 +460,7 @@ const TagsPage = () => {
: NO_PERMISSION_FOR_ACTION : NO_PERMISSION_FOR_ACTION
}> }>
<button <button
className="tw--mt-1 tw-w-full tw-flex-center tw-gap-2 tw-py-1 tw-text-primary tw-border tw-rounded-md" className="tw--mt-1 tw-w-full tw-flex-center tw-gap-2 tw-py-1 tw-text-primary tw-border tw-rounded-md tw-text-center"
data-testid="add-category" data-testid="add-category"
disabled={!createCategoryPermission} disabled={!createCategoryPermission}
onClick={() => { onClick={() => {