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>
{showThreadTypeList && (
<DropDownList
horzPosRight
dropDownList={threadFilterList}
value={threadType}
onSelect={handleThreadTypeDropDownChange}

View File

@ -348,7 +348,7 @@ const GlossaryV1 = ({
: NO_PERMISSION_FOR_ACTION
}>
<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}
onClick={handleAddGlossaryClick}>
<SVGIcons alt="plus" icon={Icons.ICON_PLUS_PRIMERY} />{' '}

View File

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

View File

@ -31,13 +31,13 @@ const Card = ({ children, heading, action, className }: CardProps) => {
className
)}
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}>
<span className="tw-font-semibold">{heading}</span>
<span className="tw-font-medium">{heading}</span>
</Col>
<Col offset={14}>{action}</Col>
</Row>
<div className="tw-p-4">{children}</div>
<div className="tw-px-4 tw-py-2">{children}</div>
</div>
);
};

View File

@ -137,12 +137,15 @@ const TagsPage = () => {
}
};
const fetchCategories = () => {
const fetchCategories = (setCurrent?: boolean) => {
setIsLoading(true);
getTagCategories('usageCount')
.then((res) => {
if (res.data) {
setCategoreis(res.data);
if (setCurrent) {
setCurrentCategory(res.data[0]);
}
} else {
throw jsonData['api-error-messages']['unexpected-server-response'];
}
@ -424,19 +427,21 @@ const TagsPage = () => {
};
useEffect(() => {
fetchCategories();
fetchCategories(true);
}, []);
useEffect(() => {
setCurrentCategory(categories[0]);
if (currentCategory) {
setCurrentCategory(currentCategory);
fetchCurrentCategoryPermission();
}
}, [categories, currentCategory]);
}, [currentCategory]);
useEffect(() => {
fetchCurrentCategory(tagCategoryName);
if (tagCategoryName) {
fetchCurrentCategory(tagCategoryName);
} else {
setCurrentCategory(categories[0]);
}
}, [tagCategoryName]);
const fetchLeftPanel = () => {
@ -455,7 +460,7 @@ const TagsPage = () => {
: NO_PERMISSION_FOR_ACTION
}>
<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"
disabled={!createCategoryPermission}
onClick={() => {