mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-25 17:04:54 +00:00
Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
a0e5087494
@ -119,6 +119,7 @@ ENTITY_FIELD
|
||||
| 'sourceHash'
|
||||
| 'testCaseResult'
|
||||
| 'tests'
|
||||
| 'pipelineStatus'
|
||||
;
|
||||
|
||||
|
||||
|
@ -35,6 +35,7 @@ import {
|
||||
Post,
|
||||
TaskType,
|
||||
Thread,
|
||||
ThreadTaskStatus,
|
||||
ThreadType,
|
||||
} from '../../../generated/entity/feed/thread';
|
||||
import { EntityReference } from '../../../generated/entity/type';
|
||||
@ -164,7 +165,8 @@ const ActivityFeedProvider = ({ children, user }: Props) => {
|
||||
after?: string,
|
||||
type?: ThreadType,
|
||||
entityType?: EntityType,
|
||||
fqn?: string
|
||||
fqn?: string,
|
||||
taskStatus?: ThreadTaskStatus
|
||||
) => {
|
||||
try {
|
||||
setLoading(true);
|
||||
@ -183,7 +185,7 @@ const ActivityFeedProvider = ({ children, user }: Props) => {
|
||||
after,
|
||||
type,
|
||||
feedFilterType,
|
||||
undefined,
|
||||
taskStatus,
|
||||
userId
|
||||
);
|
||||
setEntityThread((prev) => (after ? [...prev, ...data] : [...data]));
|
||||
|
@ -18,6 +18,7 @@ import {
|
||||
Post,
|
||||
ReactionType,
|
||||
Thread,
|
||||
ThreadTaskStatus,
|
||||
ThreadType,
|
||||
} from '../../../generated/entity/feed/thread';
|
||||
import { EntityReference } from '../../../generated/entity/type';
|
||||
@ -53,7 +54,8 @@ export interface ActivityFeedProviderContextType {
|
||||
after?: string,
|
||||
type?: ThreadType,
|
||||
entityType?: EntityType,
|
||||
fqn?: string
|
||||
fqn?: string,
|
||||
taskStatus?: ThreadTaskStatus
|
||||
) => Promise<void>;
|
||||
showDrawer: (thread: Thread) => void;
|
||||
hideDrawer: () => void;
|
||||
|
@ -343,7 +343,8 @@ export const ActivityFeedTab = ({
|
||||
</Space>
|
||||
|
||||
<span>
|
||||
{getCountBadge(
|
||||
{!isUserEntity &&
|
||||
getCountBadge(
|
||||
count.conversationCount,
|
||||
'',
|
||||
activeTab === ActivityFeedTabs.ALL
|
||||
@ -390,7 +391,7 @@ export const ActivityFeedTab = ({
|
||||
<span>{t('label.task-plural')}</span>
|
||||
</Space>
|
||||
<span>
|
||||
{getCountBadge(count.totalTasksCount, '', isTaskActiveTab)}
|
||||
{getCountBadge(count.openTaskCount, '', isTaskActiveTab)}
|
||||
</span>
|
||||
</div>
|
||||
),
|
||||
|
@ -12,6 +12,7 @@
|
||||
*/
|
||||
import { CloseOutlined, DragOutlined } from '@ant-design/icons';
|
||||
import { Button, Space, Tabs, Typography } from 'antd';
|
||||
import { AxiosError } from 'axios';
|
||||
import { isUndefined } from 'lodash';
|
||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
@ -21,6 +22,7 @@ import { useActivityFeedProvider } from '../../../components/ActivityFeed/Activi
|
||||
import { ActivityFeedTabs } from '../../../components/ActivityFeed/ActivityFeedTab/ActivityFeedTab.interface';
|
||||
import { useTourProvider } from '../../../components/TourProvider/TourProvider';
|
||||
import { ROUTES } from '../../../constants/constants';
|
||||
import { FEED_COUNT_INITIAL_DATA } from '../../../constants/entity.constants';
|
||||
import { mockFeedData } from '../../../constants/mockTourData.constants';
|
||||
import { EntityTabs, EntityType } from '../../../enums/entity.enum';
|
||||
import { FeedFilter } from '../../../enums/mydata.enum';
|
||||
@ -28,13 +30,15 @@ import {
|
||||
ThreadTaskStatus,
|
||||
ThreadType,
|
||||
} from '../../../generated/entity/feed/thread';
|
||||
import { FeedCounts } from '../../../interface/feed.interface';
|
||||
import { WidgetCommonProps } from '../../../pages/CustomizablePage/CustomizablePage.interface';
|
||||
import { getFeedsWithFilter } from '../../../rest/feedsAPI';
|
||||
import { getFeedCount } from '../../../rest/feedsAPI';
|
||||
import {
|
||||
getCountBadge,
|
||||
getEntityDetailLink,
|
||||
Transi18next,
|
||||
} from '../../../utils/CommonUtils';
|
||||
import { getEntityUserLink } from '../../../utils/EntityUtils';
|
||||
import { showErrorToast } from '../../../utils/ToastUtils';
|
||||
import { useAuthContext } from '../../Auth/AuthProviders/AuthProvider';
|
||||
import FeedsFilterPopover from '../../common/FeedsFilterPopover/FeedsFilterPopover.component';
|
||||
@ -54,7 +58,7 @@ const FeedsWidget = ({
|
||||
);
|
||||
const { loading, entityThread, entityPaging, getFeedData } =
|
||||
useActivityFeedProvider();
|
||||
const [taskCount, setTaskCount] = useState(0);
|
||||
const [count, setCount] = useState<FeedCounts>(FEED_COUNT_INITIAL_DATA);
|
||||
|
||||
const [defaultFilter, setDefaultFilter] = useState<FeedFilter>(
|
||||
currentUser?.isAdmin ? FeedFilter.ALL : FeedFilter.OWNER_OR_FOLLOWS
|
||||
@ -66,13 +70,36 @@ const FeedsWidget = ({
|
||||
} else if (activeTab === ActivityFeedTabs.MENTIONS) {
|
||||
getFeedData(FeedFilter.MENTIONS);
|
||||
} else if (activeTab === ActivityFeedTabs.TASKS) {
|
||||
getFeedData(FeedFilter.OWNER, undefined, ThreadType.Task);
|
||||
getFeedData(
|
||||
FeedFilter.OWNER,
|
||||
undefined,
|
||||
ThreadType.Task,
|
||||
undefined,
|
||||
undefined,
|
||||
ThreadTaskStatus.Open
|
||||
);
|
||||
}
|
||||
}, [activeTab, defaultFilter]);
|
||||
|
||||
const countBadge = useMemo(() => {
|
||||
return getCountBadge(taskCount, '', activeTab === 'tasks');
|
||||
}, [taskCount, activeTab]);
|
||||
const mentionCountBadge = useMemo(
|
||||
() =>
|
||||
getCountBadge(
|
||||
count.mentionCount,
|
||||
'',
|
||||
activeTab === ActivityFeedTabs.MENTIONS
|
||||
),
|
||||
[count.mentionCount, activeTab]
|
||||
);
|
||||
|
||||
const taskCountBadge = useMemo(
|
||||
() =>
|
||||
getCountBadge(
|
||||
count.openTaskCount,
|
||||
'',
|
||||
activeTab === ActivityFeedTabs.TASKS
|
||||
),
|
||||
[count.openTaskCount, activeTab]
|
||||
);
|
||||
|
||||
const onTabChange = (key: string) => setActiveTab(key as ActivityFeedTabs);
|
||||
|
||||
@ -106,23 +133,27 @@ const FeedsWidget = ({
|
||||
setDefaultFilter(filter);
|
||||
};
|
||||
|
||||
const fetchFeedsCount = async () => {
|
||||
try {
|
||||
const res = await getFeedCount(
|
||||
getEntityUserLink(currentUser?.name ?? '')
|
||||
);
|
||||
setCount((prev) => ({
|
||||
...prev,
|
||||
openTaskCount: res?.[0]?.openTaskCount ?? 0,
|
||||
|
||||
mentionCount: res?.[0]?.mentionCount ?? 0,
|
||||
}));
|
||||
} catch (err) {
|
||||
showErrorToast(err as AxiosError, t('server.entity-feed-fetch-error'));
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
setDefaultFilter(
|
||||
currentUser?.isAdmin ? FeedFilter.ALL : FeedFilter.OWNER_OR_FOLLOWS
|
||||
);
|
||||
getFeedsWithFilter(
|
||||
currentUser?.id,
|
||||
FeedFilter.OWNER,
|
||||
undefined,
|
||||
ThreadType.Task,
|
||||
ThreadTaskStatus.Open
|
||||
)
|
||||
.then((res) => {
|
||||
setTaskCount(res.data.length);
|
||||
})
|
||||
.catch((err) => {
|
||||
showErrorToast(err);
|
||||
});
|
||||
fetchFeedsCount();
|
||||
}, [currentUser]);
|
||||
|
||||
const threads = useMemo(() => {
|
||||
@ -177,7 +208,12 @@ const FeedsWidget = ({
|
||||
),
|
||||
},
|
||||
{
|
||||
label: `@${t('label.mention-plural')}`,
|
||||
label: (
|
||||
<>
|
||||
{`@${t('label.mention-plural')}`}
|
||||
{mentionCountBadge}
|
||||
</>
|
||||
),
|
||||
key: ActivityFeedTabs.MENTIONS,
|
||||
children: (
|
||||
<>
|
||||
@ -196,7 +232,7 @@ const FeedsWidget = ({
|
||||
label: (
|
||||
<>
|
||||
{`${t('label.task-plural')} `}
|
||||
{countBadge}
|
||||
{taskCountBadge}
|
||||
</>
|
||||
),
|
||||
key: ActivityFeedTabs.TASKS,
|
||||
|
@ -81,7 +81,7 @@ p {
|
||||
}
|
||||
|
||||
.page-container {
|
||||
padding: 0 24px;
|
||||
padding: 0 24px 16px 24px;
|
||||
}
|
||||
|
||||
a,
|
||||
|
Loading…
x
Reference in New Issue
Block a user