UI: Display a switch to show Closed Tasks vs Open Tasks (#5929)

This commit is contained in:
Sachin Chaurasiya 2022-07-07 22:05:55 +05:30 committed by GitHub
parent 0b5b536461
commit e9ef774264
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 171 additions and 77 deletions

View File

@ -1,4 +1,4 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M15.0711 2.55057C14.8504 2.32952 14.4924 2.32914 14.2717 2.54963L7.48968 9.31375L5.04274 6.65614C4.83131 6.42663 4.47383 6.41175 4.24393 6.62315C4.01422 6.83459 3.99951 7.19225 4.21094 7.42196L7.05644 10.5122C7.16064 10.6255 7.30648 10.6913 7.46026 10.6945C7.46439 10.6946 7.46838 10.6946 7.47233 10.6946C7.62178 10.6946 7.76554 10.6353 7.87145 10.5297L15.07 3.35011C15.2912 3.12965 15.2916 2.77161 15.0711 2.55057Z" fill="#7147E8" stroke="#7147E8" stroke-width="0.2"/>
<path d="M14.9347 7.43466C14.6224 7.43466 14.3693 7.68772 14.3693 8C14.3693 11.5122 11.5122 14.3693 8 14.3693C4.48801 14.3693 1.63065 11.5122 1.63065 8C1.63065 4.48801 4.48801 1.63065 8 1.63065C8.31225 1.63065 8.56534 1.37759 8.56534 1.06534C8.56534 0.753066 8.31225 0.5 8 0.5C3.86445 0.5 0.5 3.86445 0.5 8C0.5 12.1354 3.86445 15.5 8 15.5C12.1354 15.5 15.5 12.1354 15.5 8C15.5 7.68775 15.2469 7.43466 14.9347 7.43466Z" fill="#7147E8" stroke="#7147E8" stroke-width="0.2"/>
<svg width="360" height="360" viewBox="0 0 360 360" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M259.568 122.885C265.062 128.378 265.062 137.282 259.568 142.773L165.229 237.115C159.736 242.606 150.834 242.606 145.341 237.115L100.432 192.203C94.9384 186.713 94.9384 177.808 100.432 172.318C105.922 166.825 114.826 166.825 120.317 172.318L155.284 207.285L239.68 122.885C245.174 117.394 254.078 117.394 259.568 122.885V122.885ZM360 180C360 279.495 279.481 360 180 360C80.5051 360 0 279.481 0 180C0 80.5051 80.5188 0 180 0C279.495 0 360 80.5188 360 180ZM331.875 180C331.875 96.0507 263.938 28.125 180 28.125C96.0507 28.125 28.125 96.0617 28.125 180C28.125 263.949 96.0617 331.875 180 331.875C263.949 331.875 331.875 263.938 331.875 180Z" fill="#7147E8"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 772 B

View File

@ -1,5 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M15.6 8C15.6 7.66863 15.3314 7.4 15 7.4C14.6686 7.4 14.4 7.66863 14.4 8H15.6ZM8 1.6C8.33137 1.6 8.6 1.33137 8.6 1C8.6 0.668629 8.33137 0.4 8 0.4V1.6ZM6.6803 0.514273L6.0893 0.617804L6.29636 1.7998L6.88736 1.69627L6.6803 0.514273ZM4.32925 2.7566L4.82044 2.41203L4.1313 1.42964L3.64011 1.77421L4.32925 2.7566ZM1.77421 3.64011L1.42964 4.1313L2.41203 4.82044L2.7566 4.32925L1.77421 3.64011ZM1.69627 6.88736L1.7998 6.29636L0.617804 6.0893L0.514273 6.6803L1.69627 6.88736ZM0.514273 9.3197L0.617804 9.9107L1.7998 9.70364L1.69627 9.11264L0.514273 9.3197ZM2.7566 11.6708L2.41203 11.1796L1.42964 11.8687L1.77421 12.3599L2.7566 11.6708ZM3.64011 14.2258L4.1313 14.5704L4.82044 13.588L4.32925 13.2434L3.64011 14.2258ZM6.88736 14.3037L6.29636 14.2002L6.0893 15.3822L6.6803 15.4857L6.88736 14.3037ZM9.3197 15.4857L9.9107 15.3822L9.70364 14.2002L9.11264 14.3037L9.3197 15.4857ZM11.6708 13.2434L11.1796 13.588L11.8687 14.5704L12.3599 14.2258L11.6708 13.2434ZM14.2258 12.3599L14.5704 11.8687L13.588 11.1796L13.2434 11.6708L14.2258 12.3599ZM14.3037 9.11264L14.2002 9.70364L15.3822 9.9107L15.4857 9.3197L14.3037 9.11264ZM8 0.4C7.55034 0.4 7.10932 0.439118 6.6803 0.514273L6.88736 1.69627C7.24831 1.63304 7.62005 1.6 8 1.6V0.4ZM3.64011 1.77421C2.91497 2.28289 2.28289 2.91497 1.77421 3.64011L2.7566 4.32925C3.18529 3.71814 3.71814 3.18529 4.32925 2.7566L3.64011 1.77421ZM0.514273 6.6803C0.439117 7.10932 0.4 7.55034 0.4 8H1.6C1.6 7.62005 1.63304 7.24831 1.69627 6.88736L0.514273 6.6803ZM0.4 8C0.4 8.44966 0.439118 8.89068 0.514273 9.3197L1.69627 9.11264C1.63304 8.75169 1.6 8.37995 1.6 8H0.4ZM1.77421 12.3599C2.28289 13.085 2.91497 13.7171 3.64011 14.2258L4.32925 13.2434C3.71814 12.8147 3.18529 12.2819 2.7566 11.6708L1.77421 12.3599ZM6.6803 15.4857C7.10932 15.5609 7.55034 15.6 8 15.6V14.4C7.62005 14.4 7.24831 14.367 6.88736 14.3037L6.6803 15.4857ZM8 15.6C8.44966 15.6 8.89068 15.5609 9.3197 15.4857L9.11264 14.3037C8.75169 14.367 8.37995 14.4 8 14.4V15.6ZM12.3599 14.2258C13.085 13.7171 13.7171 13.085 14.2258 12.3599L13.2434 11.6708C12.8147 12.2819 12.2819 12.8147 11.6708 13.2434L12.3599 14.2258ZM15.4857 9.3197C15.5609 8.89068 15.6 8.44966 15.6 8H14.4C14.4 8.37995 14.367 8.75169 14.3037 9.11264L15.4857 9.3197Z" fill="#7147E8"/>
<path d="M15.6 8C15.6 7.66863 15.3314 7.4 15 7.4C14.6686 7.4 14.4 7.66863 14.4 8H15.6ZM8 14.4H7.4V15.6H8V14.4ZM14.4 8C14.4 11.5346 11.5346 14.4 8 14.4V15.6C12.1974 15.6 15.6 12.1974 15.6 8H14.4Z" fill="#7147E8"/>
<path d="M15.0711 2.55057C14.8504 2.32952 14.4924 2.32914 14.2717 2.54963L7.48968 9.31375L5.04274 6.65614C4.83131 6.42663 4.47383 6.41175 4.24393 6.62315C4.01422 6.83459 3.99951 7.19225 4.21094 7.42196L7.05644 10.5122C7.16064 10.6255 7.30648 10.6913 7.46026 10.6945C7.46439 10.6946 7.46838 10.6946 7.47233 10.6946C7.62178 10.6946 7.76554 10.6353 7.87145 10.5297L15.07 3.35011C15.2912 3.12965 15.2916 2.77161 15.0711 2.55057Z" fill="#7147E8" stroke="#7147E8" stroke-width="0.2"/>
<svg width="361" height="361" viewBox="0 0 361 361" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M0.133789 180.133C0.133789 80.7221 80.7226 0.133301 180.134 0.133301C279.546 0.133301 360.134 80.7221 360.134 180.133C360.134 279.546 279.546 360.133 180.134 360.133C80.7226 360.133 0.133789 279.546 0.133789 180.133ZM180.134 27.8256C96.0165 27.8256 27.8261 96.016 27.8261 180.133C27.8261 264.251 96.0165 332.441 180.134 332.441C264.252 332.441 332.441 264.251 332.441 180.133C332.441 96.016 264.252 27.8256 180.134 27.8256ZM180.134 221.672C203.075 221.672 221.673 203.074 221.673 180.133C221.673 157.192 203.075 138.595 180.134 138.595C157.193 138.595 138.596 157.192 138.596 180.133C138.596 203.074 157.193 221.672 180.134 221.672Z" fill="#7147E8"/>
</svg>

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 807 B

View File

@ -17,14 +17,20 @@ import { configOptions } from '../constants/constants';
import { TaskOperation } from '../constants/feed.constants';
import { FeedFilter } from '../enums/mydata.enum';
import { CreateThread } from '../generated/api/feed/createThread';
import { Post, TaskDetails, ThreadType } from '../generated/entity/feed/thread';
import {
Post,
TaskDetails,
ThreadTaskStatus,
ThreadType,
} from '../generated/entity/feed/thread';
import APIClient from './index';
export const getAllFeeds: Function = (
entityLink?: string,
after?: string,
type?: ThreadType,
filterType?: FeedFilter
filterType?: FeedFilter,
taskStatus?: ThreadTaskStatus
): Promise<AxiosResponse> => {
return APIClient.get(`/feed`, {
params: {
@ -32,6 +38,7 @@ export const getAllFeeds: Function = (
after,
type,
filterType: filterType !== FeedFilter.ALL ? filterType : undefined,
taskStatus,
},
});
};
@ -40,7 +47,8 @@ export const getFeedsWithFilter: Function = (
userId?: string,
filterType?: FeedFilter,
after?: string,
type?: ThreadType
type?: ThreadType,
taskStatus?: ThreadTaskStatus
): Promise<AxiosResponse> => {
let config = {};
@ -51,6 +59,7 @@ export const getFeedsWithFilter: Function = (
filterType,
after,
type,
taskStatus,
},
};
} else {
@ -58,6 +67,7 @@ export const getFeedsWithFilter: Function = (
params: {
after,
type,
taskStatus,
},
};
}
@ -67,12 +77,14 @@ export const getFeedsWithFilter: Function = (
export const getFeedCount: Function = (
entityLink?: string,
type?: ThreadType
type?: ThreadType,
taskStatus?: ThreadTaskStatus
): Promise<AxiosResponse> => {
return APIClient.get(`/feed/count`, {
params: {
entityLink: entityLink,
type,
taskStatus,
},
});
};

View File

@ -42,7 +42,6 @@ export interface ActivityThreadPanelBodyProp
> {
threadType: ThreadType;
showHeader?: boolean;
onTabChange?: (key: string) => void;
}
export interface ActivityThreadListProp

View File

@ -84,7 +84,7 @@ describe('Test ActivityThreadPanel Component', () => {
);
expect(panelOverlay).toBeInTheDocument();
expect(panelThreadList).toHaveLength(2);
expect(panelThreadList).toHaveLength(1);
});
it('Should create an observer if IntersectionObserver is available', async () => {

View File

@ -78,7 +78,6 @@ const ActivityThreadPanel: FC<ActivityThreadPanelProp> = ({
threadType={ThreadType.Task}
updateThreadHandler={updateThreadHandler}
onCancel={onCancel}
onTabChange={onTabChange}
/>
</TabPane>
<TabPane key={PanelTab.CONVERSATIONS} tab="Conversations">
@ -90,7 +89,6 @@ const ActivityThreadPanel: FC<ActivityThreadPanelProp> = ({
threadType={ThreadType.Conversation}
updateThreadHandler={updateThreadHandler}
onCancel={onCancel}
onTabChange={onTabChange}
/>
</TabPane>
</Tabs>

View File

@ -11,6 +11,7 @@
* limitations under the License.
*/
import { Empty, Switch } from 'antd';
import { AxiosError, AxiosResponse } from 'axios';
import classNames from 'classnames';
import { Operation } from 'fast-json-patch';
@ -18,19 +19,19 @@ import { isEqual, isUndefined } from 'lodash';
import React, { FC, Fragment, RefObject, useEffect, useState } from 'react';
import AppState from '../../../AppState';
import { getAllFeeds } from '../../../axiosAPIs/feedsAPI';
import {
confirmStateInitialValue,
PanelTab,
} from '../../../constants/feed.constants';
import { confirmStateInitialValue } from '../../../constants/feed.constants';
import { observerOptions } from '../../../constants/Mydata.constants';
import { Thread, ThreadType } from '../../../generated/entity/feed/thread';
import { FeedFilter } from '../../../enums/mydata.enum';
import {
Thread,
ThreadTaskStatus,
ThreadType,
} from '../../../generated/entity/feed/thread';
import { Paging } from '../../../generated/type/paging';
import { useAfterMount } from '../../../hooks/useAfterMount';
import { useInfiniteScroll } from '../../../hooks/useInfiniteScroll';
import jsonData from '../../../jsons/en';
import { getEntityField } from '../../../utils/FeedUtils';
import { showErrorToast } from '../../../utils/ToastUtils';
import ErrorPlaceHolder from '../../common/error-with-placeholder/ErrorPlaceHolder';
import Loader from '../../Loader/Loader';
import { ConfirmState } from '../ActivityFeedCard/ActivityFeedCard.interface';
import ActivityFeedEditor from '../ActivityFeedEditor/ActivityFeedEditor';
@ -50,7 +51,6 @@ const ActivityThreadPanelBody: FC<ActivityThreadPanelBodyProp> = ({
className,
showHeader = true,
threadType,
onTabChange,
}) => {
const [threads, setThreads] = useState<Thread[]>([]);
const [selectedThread, setSelectedThread] = useState<Thread>();
@ -68,9 +68,20 @@ const ActivityThreadPanelBody: FC<ActivityThreadPanelBodyProp> = ({
const [isThreadLoading, setIsThreadLoading] = useState(false);
const [taskStatus, setTaskStatus] = useState<ThreadTaskStatus>(
ThreadTaskStatus.Open
);
const isTaskType = isEqual(threadType, ThreadType.Task);
const isConversationType = isEqual(threadType, ThreadType.Conversation);
const isTaskClosed = isEqual(taskStatus, ThreadTaskStatus.Closed);
const getThreads = (after?: string) => {
const status = isTaskType ? taskStatus : undefined;
setIsThreadLoading(true);
getAllFeeds(threadLink, after, threadType)
getAllFeeds(threadLink, after, threadType, FeedFilter.ALL, status)
.then((res: AxiosResponse) => {
const { data, paging: pagingObj } = res.data;
setThreads((prevData) => {
@ -176,6 +187,14 @@ const ActivityThreadPanelBody: FC<ActivityThreadPanelBodyProp> = ({
}
};
const onSwitchChange = (checked: boolean) => {
if (checked) {
setTaskStatus(ThreadTaskStatus.Closed);
} else {
setTaskStatus(ThreadTaskStatus.Open);
}
};
useEffect(() => {
const escapeKeyHandler = (e: KeyboardEvent) => {
if (e.key === 'Escape') {
@ -195,30 +214,20 @@ const ActivityThreadPanelBody: FC<ActivityThreadPanelBodyProp> = ({
useEffect(() => {
getThreads();
}, [threadLink, threadType]);
}, [threadLink, threadType, taskStatus]);
useEffect(() => {
fetchMoreThread(isInView as boolean, paging, isThreadLoading);
}, [paging, isThreadLoading, isInView]);
useAfterMount(() => {
if (threadType === ThreadType.Task && !isThreadLoading) {
isEqual(threads.length, 0) &&
onTabChange &&
onTabChange(PanelTab.CONVERSATIONS);
}
}, [threads, isThreadLoading]);
return (
<Fragment>
<div id="thread-panel-body">
{showHeader && threadType === ThreadType.Conversation ? (
{showHeader && isConversationType ? (
<FeedPanelHeader
className="tw-px-4 tw-shadow-sm"
entityField={entityField as string}
noun={
threadType === ThreadType.Conversation ? 'Conversations' : 'Tasks'
}
noun={isConversationType ? 'Conversations' : 'Tasks'}
onCancel={() => onCancel && onCancel()}
onShowNewConversation={
threads.length > 0 && isUndefined(selectedThread)
@ -226,7 +235,12 @@ const ActivityThreadPanelBody: FC<ActivityThreadPanelBodyProp> = ({
: undefined
}
/>
) : null}
) : (
<div className="tw-flex tw-justify-end tw-mr-2 tw-mt-2">
<Switch onChange={onSwitchChange} />
<span className="tw-ml-1">Closed Tasks</span>
</div>
)}
{!isUndefined(selectedThread) ? (
<Fragment>
@ -245,9 +259,9 @@ const ActivityThreadPanelBody: FC<ActivityThreadPanelBodyProp> = ({
</Fragment>
) : (
<Fragment>
{showNewConversation || threads.length === 0 ? (
{showNewConversation || isEqual(threads.length, 0) ? (
<Fragment>
{threadType === ThreadType.Conversation ? (
{isConversationType ? (
<Fragment>
<p className="tw-ml-9 tw-mr-2 tw-mb-2 tw-mt-1">
You are starting a new conversation
@ -260,7 +274,12 @@ const ActivityThreadPanelBody: FC<ActivityThreadPanelBodyProp> = ({
/>
</Fragment>
) : (
<ErrorPlaceHolder>No tasks yet</ErrorPlaceHolder>
<Empty
className="ant-empty-tasks"
description={
isTaskClosed ? 'No Closed Tasks' : 'No Open Tasks'
}
/>
)}
</Fragment>
) : null}

View File

@ -197,6 +197,7 @@ const mockProp = {
updateThreadHandler: jest.fn(),
setFeedFilter: jest.fn(),
threadType: 'Task' as ThreadType.Task,
onSwitchChange: jest.fn(),
};
describe('Test User Component', () => {

View File

@ -12,9 +12,9 @@
*/
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { Card } from 'antd';
import { Card, Switch } from 'antd';
import { AxiosError, AxiosResponse } from 'axios';
import { capitalize, isEmpty, isNil, toLower } from 'lodash';
import { capitalize, isEmpty, isEqual, isNil, toLower } from 'lodash';
import { observer } from 'mobx-react';
import React, {
Fragment,
@ -84,6 +84,7 @@ const Users = ({
feedFilter,
setFeedFilter,
threadType,
onSwitchChange,
}: Props) => {
const [activeTab, setActiveTab] = useState(getUserCurrentTab(tab));
const [elementRef, isInView] = useInfiniteScroll(observerOptions);
@ -101,6 +102,8 @@ const Users = ({
const location = useLocation();
const isTaskType = isEqual(threadType, ThreadType.Task);
const handleFilterDropdownChange = useCallback(
(_e: React.MouseEvent<HTMLElement, MouseEvent>, value?: string) => {
if (value) {
@ -661,30 +664,38 @@ const Users = ({
const getFeedTabData = () => {
return (
<Fragment>
<div className="tw-relative tw--mt-4 tw-px-1.5">
<Button
className="hover:tw-no-underline focus:tw-no-underline"
data-testid="feeds"
size="custom"
tag="button"
variant="link"
onClick={() => setShowFilterList((visible) => !visible)}>
<span className="tw-font-medium tw-text-grey">
{(activeTab === 1 ? userPageFilterList : filterListTasks).find(
(f) => f.value === feedFilter
)?.name || capitalize(feedFilter)}
</span>
<DropDownIcon />
</Button>
{showFilterList && (
<DropDownList
dropDownList={
activeTab === 1 ? userPageFilterList : filterListTasks
}
value={feedFilter}
onSelect={handleFilterDropdownChange}
/>
)}
<div className="tw--mt-4 tw-px-1.5 tw-flex tw-justify-between">
<div className="tw-relative">
<Button
className="hover:tw-no-underline focus:tw-no-underline"
data-testid="feeds"
size="custom"
tag="button"
variant="link"
onClick={() => setShowFilterList((visible) => !visible)}>
<span className="tw-font-medium tw-text-grey">
{(activeTab === 1 ? userPageFilterList : filterListTasks).find(
(f) => f.value === feedFilter
)?.name || capitalize(feedFilter)}
</span>
<DropDownIcon />
</Button>
{showFilterList && (
<DropDownList
dropDownList={
activeTab === 1 ? userPageFilterList : filterListTasks
}
value={feedFilter}
onSelect={handleFilterDropdownChange}
/>
)}
</div>
{isTaskType ? (
<div className="tw-flex tw-justify-end">
<Switch onChange={onSwitchChange} />
<span className="tw-ml-1">Closed Tasks</span>
</div>
) : null}
</div>
<div className="tw-mt-3.5">
<ActivityFeedList

View File

@ -54,4 +54,5 @@ export interface Props {
feedFilter: FeedFilter;
setFeedFilter: (value: FeedFilter) => void;
threadType: ThreadType.Task | ThreadType.Conversation;
onSwitchChange: (checked: boolean) => void;
}

View File

@ -13,7 +13,7 @@
import { AxiosError, AxiosResponse } from 'axios';
import { compare, Operation } from 'fast-json-patch';
import { isEmpty } from 'lodash';
import { isEmpty, isEqual } from 'lodash';
import { observer } from 'mobx-react';
import React, { useCallback, useEffect, useMemo, useState } from 'react';
import { useLocation, useParams } from 'react-router-dom';
@ -31,7 +31,11 @@ import {
} from '../../constants/feed.constants';
import { getUserCurrentTab } from '../../constants/usersprofile.constants';
import { FeedFilter } from '../../enums/mydata.enum';
import { Thread, ThreadType } from '../../generated/entity/feed/thread';
import {
Thread,
ThreadTaskStatus,
ThreadType,
} from '../../generated/entity/feed/thread';
import { User } from '../../generated/entity/teams/user';
import { Paging } from '../../generated/type/paging';
import { useAuth } from '../../hooks/authHooks';
@ -59,12 +63,17 @@ const UserPage = () => {
const [feedFilter, setFeedFilter] = useState<FeedFilter>(
(searchParams.get('feedFilter') as FeedFilter) ?? FeedFilter.ALL
);
const [taskStatus, setTaskStatus] = useState<ThreadTaskStatus>(
ThreadTaskStatus.Open
);
const threadType = useMemo(() => {
return getUserCurrentTab(tab) === 2
? ThreadType.Task
: ThreadType.Conversation;
}, [tab]);
const isTaskType = isEqual(threadType, ThreadType.Task);
const fetchUserData = () => {
setUserData({} as User);
getUserByName(username, 'profile,roles,teams,follows,owns')
@ -105,18 +114,25 @@ const UserPage = () => {
after?: string,
feedFilter?: FeedFilter
) => {
const status = isTaskType ? taskStatus : undefined;
setIsFeedLoading(true);
getFeedsWithFilter(
userData.id,
feedFilter || FeedFilter.ALL,
after,
threadType
threadType,
status
)
.then((res: AxiosResponse) => {
const { data, paging: pagingObj } = res.data;
setPaging(pagingObj);
setEntityThread((prevData) => [...prevData, ...data]);
setEntityThread((prevData) => {
if (after) {
return [...prevData, ...data];
} else {
return [...data];
}
});
})
.catch((err: AxiosError) => {
showErrorToast(
@ -223,6 +239,14 @@ const UserPage = () => {
return userName === currentLoggedInUser?.name;
};
const onSwitchChange = (checked: boolean) => {
if (checked) {
setTaskStatus(ThreadTaskStatus.Closed);
} else {
setTaskStatus(ThreadTaskStatus.Open);
}
};
const getUserComponent = () => {
if (!isError && !isEmpty(userData)) {
return (
@ -244,6 +268,7 @@ const UserPage = () => {
updateUserDetails={updateUserDetails}
userData={userData}
username={username}
onSwitchChange={onSwitchChange}
/>
);
} else {
@ -270,7 +295,7 @@ const UserPage = () => {
setEntityThread([]);
getFeedData(threadType, undefined, newFeedFilter);
}
}, [userData, tab, search]);
}, [userData, tab, search, taskStatus]);
useEffect(() => {
setEntityThread([]);

View File

@ -1340,3 +1340,13 @@ div.ant-typography-ellipsis-custom {
.table-query-editor pre.CodeMirror-line {
padding-right: 60px !important;
}
/* antd switch css */
.ant-switch-checked {
background: #7147e8;
}
/* antd switch css */
.ant-empty-tasks {
margin-top: 32px;
}

View File

@ -39,7 +39,7 @@ import {
} from '../constants/regex.constants';
import { EntityType, FqnPart, TabSpecificField } from '../enums/entity.enum';
import { Ownership } from '../enums/mydata.enum';
import { ThreadType } from '../generated/entity/feed/thread';
import { ThreadTaskStatus, ThreadType } from '../generated/entity/feed/thread';
import { EntityReference, User } from '../generated/entity/teams/user';
import jsonData from '../jsons/en';
import { getEntityFeedLink, getTitleCase } from './EntityUtils';
@ -650,13 +650,13 @@ export const getFeedCounts = (
taskCallback: (value: React.SetStateAction<EntityFieldThreadCount[]>) => void,
entityCallback: (value: React.SetStateAction<number>) => void
) => {
// To get conversation count
getFeedCount(
getEntityFeedLink(entityType, entityFQN),
ThreadType.Conversation
)
.then((res: AxiosResponse) => {
if (res.data) {
entityCallback(res.data.totalCount);
conversationCallback(res.data.counts);
} else {
throw jsonData['api-error-messages']['fetch-entity-feed-count-error'];
@ -669,11 +669,31 @@ export const getFeedCounts = (
);
});
getFeedCount(getEntityFeedLink(entityType, entityFQN), ThreadType.Task)
// To get open tasks count
getFeedCount(
getEntityFeedLink(entityType, entityFQN),
ThreadType.Task,
ThreadTaskStatus.Open
)
.then((res: AxiosResponse) => {
if (res.data) {
taskCallback(res.data.counts);
} else {
throw jsonData['api-error-messages']['fetch-entity-feed-count-error'];
}
})
.catch((err: AxiosError) => {
showErrorToast(
err,
jsonData['api-error-messages']['fetch-entity-feed-count-error']
);
});
// To get all thread count (task + conversation)
getFeedCount(getEntityFeedLink(entityType, entityFQN))
.then((res: AxiosResponse) => {
if (res.data) {
entityCallback(res.data.totalCount);
taskCallback(res.data.counts);
} else {
throw jsonData['api-error-messages']['fetch-entity-feed-count-error'];
}