fix(ui): update details on task resolve (#12117)

This commit is contained in:
Chirag Madlani 2023-06-23 18:50:35 +05:30 committed by GitHub
parent 1116d98703
commit 881a63e5b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 137 additions and 179 deletions

View File

@ -61,6 +61,7 @@ export const ActivityFeedTab = ({
description,
columns,
entityType,
onUpdateEntityDetails,
}: ActivityFeedTabProps) => {
const history = useHistory();
const { t } = useTranslation();
@ -395,6 +396,7 @@ export const ActivityFeedTab = ({
owner={owner}
tags={tags}
task={selectedThread}
onUpdateEntityDetails={onUpdateEntityDetails}
/>
) : (
<TaskTab
@ -403,6 +405,7 @@ export const ActivityFeedTab = ({
owner={owner}
tags={tags}
task={selectedThread}
onUpdateEntityDetails={onUpdateEntityDetails}
/>
)}
</div>

View File

@ -26,6 +26,7 @@ export enum ActivityFeedTabs {
export interface ActivityFeedTabBasicProps {
fqn: string;
onFeedUpdate: () => void;
onUpdateEntityDetails?: () => void;
owner?: EntityReference;
tags?: TagLabel[];
description?: string;

View File

@ -34,6 +34,7 @@ import {
import { getDashboardDetailsPath } from 'constants/constants';
import { compare } from 'fast-json-patch';
import { TagSource } from 'generated/type/schema';
import { EntityFieldThreadCount } from 'interface/feed.interface';
import { isEmpty, isUndefined, map } from 'lodash';
import { EntityTags, TagOption } from 'Models';
import React, { useCallback, useEffect, useMemo, useState } from 'react';
@ -52,7 +53,11 @@ import { EntityTabs, EntityType } from '../../enums/entity.enum';
import { Dashboard } from '../../generated/entity/data/dashboard';
import { ThreadType } from '../../generated/entity/feed/thread';
import { LabelType, State, TagLabel } from '../../generated/type/tagLabel';
import { getCurrentUserId, refreshPage } from '../../utils/CommonUtils';
import {
getCurrentUserId,
getFeedCounts,
refreshPage,
} from '../../utils/CommonUtils';
import { getEntityFieldThreadCounts } from '../../utils/FeedUtils';
import { DEFAULT_ENTITY_PERMISSION } from '../../utils/PermissionsUtils';
import { getTagsWithoutTier, getTierTags } from '../../utils/TableUtils';
@ -79,10 +84,7 @@ const DashboardDetails = ({
chartDescriptionUpdateHandler,
chartTagUpdateHandler,
versionHandler,
feedCount,
entityFieldThreadCount,
createThread,
entityFieldTaskCount,
onDashboardUpdate,
}: DashboardDetailsProps) => {
const { t } = useTranslation();
@ -96,6 +98,13 @@ const DashboardDetails = ({
chart: ChartType;
index: number;
}>();
const [feedCount, setFeedCount] = useState<number>(0);
const [entityFieldThreadCount, setEntityFieldThreadCount] = useState<
EntityFieldThreadCount[]
>([]);
const [entityFieldTaskCount, setEntityFieldTaskCount] = useState<
EntityFieldThreadCount[]
>([]);
const [tagFetchFailed, setTagFetchFailed] = useState<boolean>(false);
const [isTagLoading, setIsTagLoading] = useState<boolean>(false);
@ -182,6 +191,20 @@ const DashboardDetails = ({
}
}, []);
const getEntityFeedCount = () => {
getFeedCounts(
EntityType.DASHBOARD,
dashboardFQN,
setEntityFieldThreadCount,
setEntityFieldTaskCount,
setFeedCount
);
};
useEffect(() => {
getEntityFeedCount();
}, [dashboardFQN]);
const getAllChartsPermissions = useCallback(
async (charts: ChartType[]) => {
const permissionsArray: Array<ChartsPermissions> = [];
@ -690,7 +713,7 @@ const DashboardDetails = ({
<ActivityFeedTab
entityType={EntityType.DASHBOARD}
fqn={dashboardDetails?.fullyQualifiedName ?? ''}
onFeedUpdate={() => Promise.resolve()}
onFeedUpdate={getEntityFeedCount}
/>
</ActivityFeedProvider>
),

View File

@ -16,7 +16,6 @@ import { Operation } from 'fast-json-patch';
import { CreateThread } from '../../generated/api/feed/createThread';
import { Chart } from '../../generated/entity/data/chart';
import { Dashboard } from '../../generated/entity/data/dashboard';
import { EntityFieldThreadCount } from '../../interface/feed.interface';
export interface ChartType extends Chart {
displayName: string;
@ -29,9 +28,6 @@ export interface ChartsPermissions {
export interface DashboardDetailsProps {
charts: Array<ChartType>;
dashboardDetails: Dashboard;
feedCount: number;
entityFieldThreadCount: EntityFieldThreadCount[];
entityFieldTaskCount: EntityFieldThreadCount[];
createThread: (data: CreateThread) => void;
followDashboardHandler: () => Promise<void>;
unFollowDashboardHandler: () => Promise<void>;

View File

@ -65,9 +65,6 @@ const dashboardDetailsProps: DashboardDetailsProps = {
chartTagUpdateHandler: jest.fn(),
onDashboardUpdate: jest.fn(),
versionHandler: jest.fn(),
feedCount: 0,
entityFieldThreadCount: [],
entityFieldTaskCount: [],
createThread: jest.fn(),
};

View File

@ -30,11 +30,13 @@ import { EntityField } from 'constants/Feeds.constants';
import { CSMode } from 'enums/codemirror.enum';
import { EntityTabs, EntityType } from 'enums/entity.enum';
import { LabelType, State, TagLabel, TagSource } from 'generated/type/tagLabel';
import { isUndefined, toString } from 'lodash';
import { EntityFieldThreadCount } from 'interface/feed.interface';
import { isUndefined, noop, toString } from 'lodash';
import { EntityTags } from 'Models';
import React, { useMemo, useState } from 'react';
import React, { useEffect, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useHistory, useParams } from 'react-router-dom';
import { getFeedCounts } from 'utils/CommonUtils';
import { getEntityName, getEntityThreadLink } from 'utils/EntityUtils';
import { getEntityFieldThreadCounts } from 'utils/FeedUtils';
import { getTagsWithoutTier } from 'utils/TableUtils';
@ -42,8 +44,6 @@ import { DataModelDetailsProps } from './DataModelDetails.interface';
import ModelTab from './ModelTab/ModelTab.component';
const DataModelDetails = ({
entityFieldThreadCount,
feedCount,
dataModelData,
dataModelPermissions,
createThread,
@ -63,6 +63,10 @@ const DataModelDetails = ({
const [isEditDescription, setIsEditDescription] = useState<boolean>(false);
const [threadLink, setThreadLink] = useState<string>('');
const [feedCount, setFeedCount] = useState<number>(0);
const [entityFieldThreadCount, setEntityFieldThreadCount] = useState<
EntityFieldThreadCount[]
>([]);
const {
hasEditDescriptionPermission,
@ -91,6 +95,20 @@ const DataModelDetails = ({
};
}, [dataModelData]);
const getEntityFeedCount = () => {
getFeedCounts(
EntityType.DASHBOARD_DATA_MODEL,
dashboardDataModelFQN,
setEntityFieldThreadCount,
noop,
setFeedCount
);
};
useEffect(() => {
dashboardDataModelFQN && getEntityFeedCount();
}, [dashboardDataModelFQN]);
const handleUpdateDisplayName = async (data: EntityName) => {
if (isUndefined(dataModelData)) {
return;
@ -247,7 +265,7 @@ const DataModelDetails = ({
<ActivityFeedTab
entityType={EntityType.DASHBOARD_DATA_MODEL}
fqn={dataModelData?.fullyQualifiedName ?? ''}
onFeedUpdate={() => Promise.resolve()}
onFeedUpdate={getEntityFeedCount}
/>
</ActivityFeedProvider>
),

View File

@ -16,12 +16,9 @@ import { CreateThread } from 'generated/api/feed/createThread';
import { DashboardDataModel } from 'generated/entity/data/dashboardDataModel';
import { Column } from 'generated/entity/data/table';
import { EntityReference } from 'generated/entity/type';
import { EntityFieldThreadCount } from 'interface/feed.interface';
import { EntityTags } from 'Models';
export interface DataModelDetailsProps {
entityFieldThreadCount: EntityFieldThreadCount[];
feedCount: number;
dataModelData: DashboardDataModel;
dataModelPermissions: OperationPermission;
createThread: (data: CreateThread) => void;

View File

@ -25,6 +25,7 @@ import { EntityName } from 'components/Modals/EntityNameModal/EntityNameModal.in
import TabsLabel from 'components/TabsLabel/TabsLabel.component';
import TagsContainerV1 from 'components/Tag/TagsContainerV1/TagsContainerV1';
import { TagLabel, TagSource } from 'generated/type/schema';
import { EntityFieldThreadCount } from 'interface/feed.interface';
import { isEmpty } from 'lodash';
import { EntityTags } from 'Models';
import React, { FC, useCallback, useEffect, useMemo, useState } from 'react';
@ -40,7 +41,11 @@ import { MlHyperParameter } from '../../generated/api/data/createMlModel';
import { Mlmodel, MlStore } from '../../generated/entity/data/mlmodel';
import { ThreadType } from '../../generated/entity/feed/thread';
import { LabelType, State } from '../../generated/type/tagLabel';
import { getEmptyPlaceholder, refreshPage } from '../../utils/CommonUtils';
import {
getEmptyPlaceholder,
getFeedCounts,
refreshPage,
} from '../../utils/CommonUtils';
import { getEntityFieldThreadCounts } from '../../utils/FeedUtils';
import { DEFAULT_ENTITY_PERMISSION } from '../../utils/PermissionsUtils';
import { getTagsWithoutTier, getTierTags } from '../../utils/TableUtils';
@ -62,10 +67,8 @@ const MlModelDetail: FC<MlModelDetailProp> = ({
settingsUpdateHandler,
updateMlModelFeatures,
onExtensionUpdate,
feedCount,
createThread,
entityFieldTaskCount,
entityFieldThreadCount,
versionHandler,
tagUpdateHandler,
}) => {
@ -76,6 +79,13 @@ const MlModelDetail: FC<MlModelDetailProp> = ({
useParams<{ tab: EntityTabs; mlModelFqn: string }>();
const [isEdit, setIsEdit] = useState<boolean>(false);
const [feedCount, setFeedCount] = useState<number>(0);
const [entityFieldThreadCount, setEntityFieldThreadCount] = useState<
EntityFieldThreadCount[]
>([]);
const [entityFieldTaskCount, setEntityFieldTaskCount] = useState<
EntityFieldThreadCount[]
>([]);
const [mlModelPermissions, setPipelinePermissions] = useState(
DEFAULT_ENTITY_PERMISSION
@ -127,6 +137,22 @@ const MlModelDetail: FC<MlModelDetailProp> = ({
};
}, [mlModelDetail]);
const fetchEntityFeedCount = () => {
getFeedCounts(
EntityType.MLMODEL,
mlModelFqn,
setEntityFieldThreadCount,
setEntityFieldTaskCount,
setFeedCount
);
};
useEffect(() => {
if (mlModelPermissions.ViewAll || mlModelPermissions.ViewBasic) {
fetchEntityFeedCount();
}
}, [mlModelPermissions, mlModelFqn]);
const handleTabChange = (activeKey: string) => {
if (activeKey !== activeTab) {
history.push(getMlModelDetailsPath(mlModelFqn, activeKey));
@ -442,7 +468,7 @@ const MlModelDetail: FC<MlModelDetailProp> = ({
<ActivityFeedTab
entityType={EntityType.MLMODEL}
fqn={mlModelDetail?.fullyQualifiedName ?? ''}
onFeedUpdate={() => Promise.resolve()}
onFeedUpdate={fetchEntityFeedCount}
/>
</ActivityFeedProvider>
),

View File

@ -14,12 +14,10 @@
import { HTMLAttributes } from 'react';
import { CreateThread } from '../../generated/api/feed/createThread';
import { Mlmodel } from '../../generated/entity/data/mlmodel';
import { EntityFieldThreadCount } from '../../interface/feed.interface';
export interface MlModelDetailProp extends HTMLAttributes<HTMLDivElement> {
mlModelDetail: Mlmodel;
version?: string;
feedCount: number;
followMlModelHandler: () => Promise<void>;
unFollowMlModelHandler: () => Promise<void>;
descriptionUpdateHandler: (updatedMlModel: Mlmodel) => Promise<void>;
@ -28,7 +26,5 @@ export interface MlModelDetailProp extends HTMLAttributes<HTMLDivElement> {
settingsUpdateHandler: (updatedMlModel: Mlmodel) => Promise<void>;
versionHandler: () => void;
onExtensionUpdate: (updatedMlModel: Mlmodel) => Promise<void>;
entityFieldThreadCount: EntityFieldThreadCount[];
entityFieldTaskCount: EntityFieldThreadCount[];
createThread: (data: CreateThread) => void;
}

View File

@ -700,7 +700,7 @@ const PipelineDetails = ({
<ActivityFeedTab
entityType={EntityType.PIPELINE}
fqn={pipelineDetails?.fullyQualifiedName ?? ''}
onFeedUpdate={() => Promise.resolve()}
onFeedUpdate={getEntityFeedCount}
/>
</ActivityFeedProvider>
),

View File

@ -158,6 +158,7 @@ export const TaskTab = ({
updateTask(TaskOperation.RESOLVE, taskDetails?.id + '', data)
.then(() => {
showSuccessToast(t('server.task-resolved-successfully'));
rest.onUpdateEntityDetails?.();
history.push(getEntityLink(entityType ?? '', entityFQN ?? ''));
})
.catch((err: AxiosError) => showErrorToast(err));

View File

@ -20,6 +20,7 @@ export type TaskTabProps = {
task: Thread;
owner?: EntityReference;
tags?: TagLabel[];
onUpdateEntityDetails?: () => void;
description?: string;
} & (
| TableTaskTabProps

View File

@ -1077,7 +1077,7 @@ const TeamDetailsV1 = ({
onChange={updateActiveTab}
/>
<div className="flex-grow d-flex flex-col tw-pt-4">
<div className="flex-grow d-flex flex-col">
{currentTab === TeamsPageTab.TEAMS &&
(currentTeam.childrenCount === 0 && !searchTerm ? (
fetchErrorPlaceHolder({
@ -1113,6 +1113,7 @@ const TeamDetailsV1 = ({
{t('label.deleted')}
</Typography.Text>
</span>
<Button
data-testid="add-team"
disabled={!createTeamPermission}

View File

@ -25,6 +25,7 @@ import TabsLabel from 'components/TabsLabel/TabsLabel.component';
import TagsContainerV1 from 'components/Tag/TagsContainerV1/TagsContainerV1';
import { getTopicDetailsPath } from 'constants/constants';
import { TagLabel } from 'generated/type/schema';
import { EntityFieldThreadCount } from 'interface/feed.interface';
import { EntityTags } from 'Models';
import React, { useCallback, useEffect, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
@ -36,7 +37,11 @@ import { EntityTabs, EntityType } from '../../enums/entity.enum';
import { Topic } from '../../generated/entity/data/topic';
import { ThreadType } from '../../generated/entity/feed/thread';
import { LabelType, State, TagSource } from '../../generated/type/tagLabel';
import { getCurrentUserId, refreshPage } from '../../utils/CommonUtils';
import {
getCurrentUserId,
getFeedCounts,
refreshPage,
} from '../../utils/CommonUtils';
import { getEntityFieldThreadCounts } from '../../utils/FeedUtils';
import { DEFAULT_ENTITY_PERMISSION } from '../../utils/PermissionsUtils';
import { getTagsWithoutTier, getTierTags } from '../../utils/TableUtils';
@ -60,10 +65,8 @@ const TopicDetails: React.FC<TopicDetailsProps> = ({
followTopicHandler,
unFollowTopicHandler,
versionHandler,
feedCount,
entityFieldThreadCount,
createThread,
entityFieldTaskCount,
onTopicUpdate,
}: TopicDetailsProps) => {
const { t } = useTranslation();
@ -73,6 +76,13 @@ const TopicDetails: React.FC<TopicDetailsProps> = ({
const history = useHistory();
const [isEdit, setIsEdit] = useState(false);
const [threadLink, setThreadLink] = useState<string>('');
const [feedCount, setFeedCount] = useState<number>(0);
const [entityFieldThreadCount, setEntityFieldThreadCount] = useState<
EntityFieldThreadCount[]
>([]);
const [entityFieldTaskCount, setEntityFieldTaskCount] = useState<
EntityFieldThreadCount[]
>([]);
const [threadType, setThreadType] = useState<ThreadType>(
ThreadType.Conversation
@ -261,6 +271,22 @@ const TopicDetails: React.FC<TopicDetailsProps> = ({
}
};
const getEntityFeedCount = () => {
getFeedCounts(
EntityType.TOPIC,
topicFQN,
setEntityFieldThreadCount,
setEntityFieldTaskCount,
setFeedCount
);
};
useEffect(() => {
if (topicPermissions.ViewAll || topicPermissions.ViewBasic) {
getEntityFeedCount();
}
}, [topicPermissions, topicFQN]);
const tabs = useMemo(
() => [
{
@ -355,7 +381,7 @@ const TopicDetails: React.FC<TopicDetailsProps> = ({
<ActivityFeedTab
entityType={EntityType.TOPIC}
fqn={topicDetails?.fullyQualifiedName ?? ''}
onFeedUpdate={() => Promise.resolve()}
onFeedUpdate={getEntityFeedCount}
/>
</ActivityFeedProvider>
),

View File

@ -14,13 +14,9 @@
import { CreateThread } from '../../generated/api/feed/createThread';
import { CleanupPolicy, Topic } from '../../generated/entity/data/topic';
import { SchemaType } from '../../generated/type/schema';
import { EntityFieldThreadCount } from '../../interface/feed.interface';
export interface TopicDetailsProps {
topicDetails: Topic;
feedCount: number;
entityFieldThreadCount: EntityFieldThreadCount[];
entityFieldTaskCount: EntityFieldThreadCount[];
createThread: (data: CreateThread) => void;
followTopicHandler: () => Promise<void>;
unFollowTopicHandler: () => Promise<void>;

View File

@ -54,9 +54,6 @@ const topicDetailsProps: TopicDetailsProps = {
unFollowTopicHandler: jest.fn(),
onTopicUpdate: jest.fn(),
versionHandler: jest.fn(),
feedCount: 0,
entityFieldThreadCount: [],
entityFieldTaskCount: [],
createThread: jest.fn(),
};

View File

@ -25,7 +25,7 @@ import { SearchedDataProps } from 'components/searched-data/SearchedData.interfa
import TabsLabel from 'components/TabsLabel/TabsLabel.component';
import TeamsSelectable from 'components/TeamsSelectable/TeamsSelectable';
import { EntityType } from 'enums/entity.enum';
import { isEmpty, toLower } from 'lodash';
import { isEmpty, noop, toLower } from 'lodash';
import { observer } from 'mobx-react';
import React, {
Fragment,
@ -729,7 +729,7 @@ const Users = ({
<ActivityFeedTab
entityType={EntityType.USER_NAME}
fqn={username}
onFeedUpdate={() => Promise.resolve()}
onFeedUpdate={noop}
/>
</ActivityFeedProvider>
);

View File

@ -674,7 +674,8 @@ const ContainerPage = () => {
<ActivityFeedTab
entityType={EntityType.CONTAINER}
fqn={containerName}
onFeedUpdate={() => Promise.resolve()}
onFeedUpdate={getEntityFeedCount}
onUpdateEntityDetails={() => fetchContainerDetail(containerName)}
/>
</ActivityFeedProvider>
),

View File

@ -36,12 +36,10 @@ import { EntityType } from '../../enums/entity.enum';
import { CreateThread } from '../../generated/api/feed/createThread';
import { Chart } from '../../generated/entity/data/chart';
import { Dashboard } from '../../generated/entity/data/dashboard';
import { EntityFieldThreadCount } from '../../interface/feed.interface';
import {
addToRecentViewed,
getCurrentUserId,
getEntityMissingError,
getFeedCounts,
} from '../../utils/CommonUtils';
import {
defaultFields,
@ -69,14 +67,6 @@ const DashboardDetailsPage = () => {
const [charts, setCharts] = useState<ChartType[]>([]);
const [isError, setIsError] = useState(false);
const [feedCount, setFeedCount] = useState<number>(0);
const [entityFieldThreadCount, setEntityFieldThreadCount] = useState<
EntityFieldThreadCount[]
>([]);
const [entityFieldTaskCount, setEntityFieldTaskCount] = useState<
EntityFieldThreadCount[]
>([]);
const [dashboardPermissions, setDashboardPermissions] = useState(
DEFAULT_ENTITY_PERMISSION
);
@ -102,16 +92,6 @@ const DashboardDetailsPage = () => {
}
};
const getEntityFeedCount = () => {
getFeedCounts(
EntityType.DASHBOARD,
dashboardFQN,
setEntityFieldThreadCount,
setEntityFieldTaskCount,
setFeedCount
);
};
const saveUpdatedDashboardData = (updatedData: Dashboard) => {
const jsonPatch = compare(
omitBy(dashboardDetails, isUndefined),
@ -183,8 +163,6 @@ const DashboardDetailsPage = () => {
[key]: response[key],
};
});
getEntityFeedCount();
} catch (error) {
showErrorToast(error as AxiosError);
}
@ -198,7 +176,6 @@ const DashboardDetailsPage = () => {
...prev,
followers: [...(prev?.followers ?? []), ...newValue],
}));
getEntityFeedCount();
} catch (error) {
showErrorToast(
error as AxiosError,
@ -221,8 +198,6 @@ const DashboardDetailsPage = () => {
(follower) => follower.id !== oldValue[0].id
) ?? [],
}));
getEntityFeedCount();
} catch (error) {
showErrorToast(
error as AxiosError,
@ -267,7 +242,6 @@ const DashboardDetailsPage = () => {
// which leads to wrong PATCH payload sent after further tags removal
return sortTagsForCharts(charts);
});
getEntityFeedCount();
} catch (error) {
showErrorToast(
error as AxiosError,
@ -288,7 +262,6 @@ const DashboardDetailsPage = () => {
const createThread = async (data: CreateThread) => {
try {
await postThread(data);
getEntityFeedCount();
} catch (error) {
showErrorToast(
error as AxiosError,
@ -302,7 +275,6 @@ const DashboardDetailsPage = () => {
useEffect(() => {
if (dashboardPermissions.ViewAll || dashboardPermissions.ViewBasic) {
fetchDashboardDetail(dashboardFQN);
getEntityFeedCount();
}
}, [dashboardFQN, dashboardPermissions]);
@ -331,9 +303,6 @@ const DashboardDetailsPage = () => {
charts={charts}
createThread={createThread}
dashboardDetails={dashboardDetails}
entityFieldTaskCount={entityFieldTaskCount}
entityFieldThreadCount={entityFieldThreadCount}
feedCount={feedCount}
followDashboardHandler={followDashboard}
unFollowDashboardHandler={unFollowDashboard}
versionHandler={versionHandler}

View File

@ -22,13 +22,11 @@ import {
ResourceEntity,
} from 'components/PermissionProvider/PermissionProvider.interface';
import { ERROR_PLACEHOLDER_TYPE } from 'enums/common.enum';
import { EntityType } from 'enums/entity.enum';
import { compare } from 'fast-json-patch';
import { CreateThread } from 'generated/api/feed/createThread';
import { DashboardDataModel } from 'generated/entity/data/dashboardDataModel';
import { Include } from 'generated/type/include';
import { LabelType, State, TagSource } from 'generated/type/tagLabel';
import { EntityFieldThreadCount } from 'interface/feed.interface';
import { isUndefined, omitBy } from 'lodash';
import { observer } from 'mobx-react';
import { EntityTags } from 'Models';
@ -48,11 +46,7 @@ import {
removeDataModelFollower,
} from 'rest/dataModelsAPI';
import { postThread } from 'rest/feedsAPI';
import {
getCurrentUserId,
getEntityMissingError,
getFeedCounts,
} from 'utils/CommonUtils';
import { getCurrentUserId, getEntityMissingError } from 'utils/CommonUtils';
import { getSortedDataModelColumnTags } from 'utils/DataModelsUtils';
import { DEFAULT_ENTITY_PERMISSION } from 'utils/PermissionsUtils';
import { getTagsWithoutTier, getTierTags } from 'utils/TableUtils';
@ -73,13 +67,6 @@ const DataModelsPage = () => {
{} as DashboardDataModel
);
const [feedCount, setFeedCount] = useState<number>(0);
const [entityFieldThreadCount, setEntityFieldThreadCount] = useState<
EntityFieldThreadCount[]
>([]);
const [, setEntityFieldTaskCount] = useState<EntityFieldThreadCount[]>([]);
// get current user details
const currentUser = useMemo(
() => AppState.getCurrentUserDetails(),
@ -102,16 +89,6 @@ const DataModelsPage = () => {
};
}, [dataModelData]);
const getEntityFeedCount = () => {
getFeedCounts(
EntityType.DASHBOARD_DATA_MODEL,
dashboardDataModelFQN,
setEntityFieldThreadCount,
setEntityFieldTaskCount,
setFeedCount
);
};
const fetchResourcePermission = async (dashboardDataModelFQN: string) => {
setIsLoading(true);
try {
@ -134,7 +111,6 @@ const DataModelsPage = () => {
const createThread = async (data: CreateThread) => {
try {
await postThread(data);
getEntityFeedCount();
} catch (error) {
showErrorToast(
error as AxiosError,
@ -180,7 +156,6 @@ const DataModelsPage = () => {
description: newDescription,
version,
}));
getEntityFeedCount();
} catch (error) {
showErrorToast(error as AxiosError);
}
@ -226,7 +201,6 @@ const DataModelsPage = () => {
tags: newTags,
version,
}));
getEntityFeedCount();
} catch (error) {
showErrorToast(error as AxiosError);
}
@ -245,7 +219,6 @@ const DataModelsPage = () => {
owner: newOwner,
version,
}));
getEntityFeedCount();
} catch (error) {
showErrorToast(error as AxiosError);
}
@ -274,7 +247,6 @@ const DataModelsPage = () => {
tags: newTags,
version,
}));
getEntityFeedCount();
}
} catch (error) {
showErrorToast(error as AxiosError);
@ -295,7 +267,6 @@ const DataModelsPage = () => {
columns: getSortedDataModelColumnTags(newColumns),
version,
}));
getEntityFeedCount();
} catch (error) {
showErrorToast(error as AxiosError);
}
@ -313,7 +284,6 @@ const DataModelsPage = () => {
[key]: response[key],
version: response.version,
}));
getEntityFeedCount();
} catch (error) {
showErrorToast(error as AxiosError);
}
@ -322,7 +292,6 @@ const DataModelsPage = () => {
useEffect(() => {
if (hasViewPermission) {
fetchDataModelDetails(dashboardDataModelFQN);
getEntityFeedCount();
}
}, [dashboardDataModelFQN, dataModelPermissions]);
@ -352,8 +321,6 @@ const DataModelsPage = () => {
createThread={createThread}
dataModelData={dataModelData}
dataModelPermissions={dataModelPermissions}
entityFieldThreadCount={entityFieldThreadCount}
feedCount={feedCount}
handleColumnUpdateDataModel={handleColumnUpdateDataModel}
handleFollowDataModel={handleFollowDataModel}
handleUpdateDescription={handleUpdateDescription}

View File

@ -741,7 +741,8 @@ const DatabaseSchemaPage: FunctionComponent = () => {
<ActivityFeedTab
entityType={EntityType.DATABASE_SCHEMA}
fqn={databaseSchema?.fullyQualifiedName ?? ''}
onFeedUpdate={() => Promise.resolve()}
onFeedUpdate={getEntityFeedCount}
onUpdateEntityDetails={getDetailsByFQN}
/>
</ActivityFeedProvider>
)}

View File

@ -35,11 +35,9 @@ import { getVersionPath } from '../../constants/constants';
import { EntityType } from '../../enums/entity.enum';
import { CreateThread } from '../../generated/api/feed/createThread';
import { Mlmodel } from '../../generated/entity/data/mlmodel';
import { EntityFieldThreadCount } from '../../interface/feed.interface';
import {
getCurrentUserId,
getEntityMissingError,
getFeedCounts,
sortTagsCaseInsensitive,
} from '../../utils/CommonUtils';
import { getEntityName } from '../../utils/EntityUtils';
@ -59,14 +57,6 @@ const MlModelPage = () => {
DEFAULT_ENTITY_PERMISSION
);
const [feedCount, setFeedCount] = useState<number>(0);
const [entityFieldThreadCount, setEntityFieldThreadCount] = useState<
EntityFieldThreadCount[]
>([]);
const [entityFieldTaskCount, setEntityFieldTaskCount] = useState<
EntityFieldThreadCount[]
>([]);
const [currentVersion, setCurrentVersion] = useState<string>();
const { getEntityPermissionByFqn } = usePermissionProvider();
@ -90,16 +80,6 @@ const MlModelPage = () => {
}
};
const fetchEntityFeedCount = () => {
getFeedCounts(
EntityType.MLMODEL,
mlModelFqn,
setEntityFieldThreadCount,
setEntityFieldTaskCount,
setFeedCount
);
};
const fetchMlModelDetails = async (name: string) => {
setIsDetailLoading(true);
try {
@ -113,6 +93,12 @@ const MlModelPage = () => {
}
};
useEffect(() => {
if (mlModelPermissions.ViewAll || mlModelPermissions.ViewBasic) {
fetchMlModelDetails(mlModelFqn);
}
}, [mlModelPermissions, mlModelFqn]);
const saveUpdatedMlModelData = (updatedData: Mlmodel) => {
const jsonPatch = compare(omitBy(mlModelDetail, isUndefined), updatedData);
@ -128,7 +114,6 @@ const MlModelPage = () => {
...preVDetail,
description: description,
}));
fetchEntityFeedCount();
} catch (error) {
showErrorToast(error as AxiosError);
}
@ -142,7 +127,6 @@ const MlModelPage = () => {
...preVDetail,
followers: [...(mlModelDetail.followers || []), ...newValue],
}));
fetchEntityFeedCount();
} catch (error) {
showErrorToast(
error as AxiosError,
@ -163,7 +147,6 @@ const MlModelPage = () => {
(follower) => follower.id !== oldValue[0].id
),
}));
fetchEntityFeedCount();
} catch (error) {
showErrorToast(
error as AxiosError,
@ -182,7 +165,6 @@ const MlModelPage = () => {
tags: sortTagsCaseInsensitive(res.tags || []),
}));
setCurrentVersion(res.version?.toString());
fetchEntityFeedCount();
} catch (error) {
showErrorToast(
error as AxiosError,
@ -205,7 +187,6 @@ const MlModelPage = () => {
tags: res.tags,
}));
setCurrentVersion(res.version?.toString());
fetchEntityFeedCount();
} catch (error) {
showErrorToast(
error as AxiosError,
@ -224,7 +205,6 @@ const MlModelPage = () => {
mlFeatures: response.mlFeatures,
}));
setCurrentVersion(response.version?.toString());
fetchEntityFeedCount();
} catch (error) {
showErrorToast(error as AxiosError);
}
@ -235,7 +215,6 @@ const MlModelPage = () => {
const data = await saveUpdatedMlModelData(updatedMlModel);
setMlModelDetail(data);
setCurrentVersion(data.version?.toString());
fetchEntityFeedCount();
} catch (error) {
showErrorToast(
error as AxiosError,
@ -249,7 +228,6 @@ const MlModelPage = () => {
const createThread = async (data: CreateThread) => {
try {
await postThread(data);
fetchEntityFeedCount();
} catch (error) {
showErrorToast(
error as AxiosError,
@ -266,13 +244,6 @@ const MlModelPage = () => {
);
};
useEffect(() => {
if (mlModelPermissions.ViewAll || mlModelPermissions.ViewBasic) {
fetchMlModelDetails(mlModelFqn);
fetchEntityFeedCount();
}
}, [mlModelPermissions, mlModelFqn]);
useEffect(() => {
fetchResourcePermission(mlModelFqn);
}, [mlModelFqn]);
@ -302,9 +273,6 @@ const MlModelPage = () => {
<MlModelDetailComponent
createThread={createThread}
descriptionUpdateHandler={descriptionUpdateHandler}
entityFieldTaskCount={entityFieldTaskCount}
entityFieldThreadCount={entityFieldThreadCount}
feedCount={feedCount}
followMlModelHandler={followMlModel}
mlModelDetail={mlModelDetail}
settingsUpdateHandler={settingsUpdateHandler}

View File

@ -516,6 +516,7 @@ const TableDetailsPageV1 = () => {
owner={tableDetails?.owner}
tags={tableDetails?.tags}
onFeedUpdate={getEntityFeedCount}
onUpdateEntityDetails={fetchTableDetails}
/>
</ActivityFeedProvider>
),

View File

@ -38,12 +38,10 @@ import { getVersionPath } from '../../constants/constants';
import { EntityType, TabSpecificField } from '../../enums/entity.enum';
import { CreateThread } from '../../generated/api/feed/createThread';
import { Topic } from '../../generated/entity/data/topic';
import { EntityFieldThreadCount } from '../../interface/feed.interface';
import {
addToRecentViewed,
getCurrentUserId,
getEntityMissingError,
getFeedCounts,
sortTagsCaseInsensitive,
} from '../../utils/CommonUtils';
import { getEntityName } from '../../utils/EntityUtils';
@ -61,28 +59,10 @@ const TopicDetailsPage: FunctionComponent = () => {
const [isLoading, setLoading] = useState<boolean>(true);
const [isError, setIsError] = useState(false);
const [feedCount, setFeedCount] = useState<number>(0);
const [entityFieldThreadCount, setEntityFieldThreadCount] = useState<
EntityFieldThreadCount[]
>([]);
const [entityFieldTaskCount, setEntityFieldTaskCount] = useState<
EntityFieldThreadCount[]
>([]);
const [topicPermissions, setTopicPermissions] = useState<OperationPermission>(
DEFAULT_ENTITY_PERMISSION
);
const getEntityFeedCount = () => {
getFeedCounts(
EntityType.TOPIC,
topicFQN,
setEntityFieldThreadCount,
setEntityFieldTaskCount,
setFeedCount
);
};
const { id: topicId, version: currentVersion } = topicDetails;
const saveUpdatedTopicData = (updatedData: Topic) => {
@ -110,7 +90,6 @@ const TopicDetailsPage: FunctionComponent = () => {
[key]: res[key],
};
});
getEntityFeedCount();
} catch (error) {
showErrorToast(error as AxiosError);
}
@ -181,7 +160,6 @@ const TopicDetailsPage: FunctionComponent = () => {
...prev,
followers: [...(prev?.followers ?? []), ...newValue],
}));
getEntityFeedCount();
} catch (error) {
showErrorToast(
error as AxiosError,
@ -202,7 +180,6 @@ const TopicDetailsPage: FunctionComponent = () => {
(follower) => follower.id !== oldValue[0].id
),
}));
getEntityFeedCount();
} catch (error) {
showErrorToast(
error as AxiosError,
@ -223,7 +200,6 @@ const TopicDetailsPage: FunctionComponent = () => {
const createThread = async (data: CreateThread) => {
try {
await postThread(data);
getEntityFeedCount();
} catch (error) {
showErrorToast(
error as AxiosError,
@ -241,7 +217,6 @@ const TopicDetailsPage: FunctionComponent = () => {
useEffect(() => {
if (topicPermissions.ViewAll || topicPermissions.ViewBasic) {
fetchTopicDetail(topicFQN);
getEntityFeedCount();
}
}, [topicPermissions, topicFQN]);
@ -262,9 +237,6 @@ const TopicDetailsPage: FunctionComponent = () => {
return (
<TopicDetails
createThread={createThread}
entityFieldTaskCount={entityFieldTaskCount}
entityFieldThreadCount={entityFieldThreadCount}
feedCount={feedCount}
followTopicHandler={followTopic}
topicDetails={topicDetails}
unFollowTopicHandler={unFollowTopic}

View File

@ -894,7 +894,7 @@ const DatabaseDetails: FunctionComponent = () => {
<ActivityFeedTab
entityType={EntityType.DATABASE}
fqn={database?.fullyQualifiedName ?? ''}
onFeedUpdate={() => Promise.resolve()}
onFeedUpdate={getEntityFeedCount}
/>
</ActivityFeedProvider>
)}