mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-10-13 09:48:19 +00:00
fix(ui): user profile page activity feed (#12226)
This commit is contained in:
parent
70b76a34c1
commit
f74004d9c8
@ -57,7 +57,7 @@ const ActivityFeedListV1 = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="feed-list-container h-full p-y-md" id="feedData">
|
<div className="feed-list-container p-y-md m-b-sm" id="feedData">
|
||||||
{entityThread.length === 0 && (
|
{entityThread.length === 0 && (
|
||||||
<div
|
<div
|
||||||
className="h-full p-x-md"
|
className="h-full p-x-md"
|
||||||
|
@ -51,13 +51,16 @@ import { ActivityFeedProviderContextType } from './ActivityFeedProviderContext.i
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
|
// To override current userId in case of User profile page
|
||||||
|
// Will update logic to ser userID from props later
|
||||||
|
user?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ActivityFeedContext = createContext(
|
export const ActivityFeedContext = createContext(
|
||||||
{} as ActivityFeedProviderContextType
|
{} as ActivityFeedProviderContextType
|
||||||
);
|
);
|
||||||
|
|
||||||
const ActivityFeedProvider = ({ children }: Props) => {
|
const ActivityFeedProvider = ({ children, user }: Props) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [entityThread, setEntityThread] = useState<Thread[]>([]);
|
const [entityThread, setEntityThread] = useState<Thread[]>([]);
|
||||||
const [entityPaging, setEntityPaging] = useState<Paging>({} as Paging);
|
const [entityPaging, setEntityPaging] = useState<Paging>({} as Paging);
|
||||||
@ -105,7 +108,11 @@ const ActivityFeedProvider = ({ children }: Props) => {
|
|||||||
setLoading(true);
|
setLoading(true);
|
||||||
const feedFilterType = filterType ?? FeedFilter.ALL;
|
const feedFilterType = filterType ?? FeedFilter.ALL;
|
||||||
const userId =
|
const userId =
|
||||||
feedFilterType === FeedFilter.ALL ? undefined : currentUser?.id;
|
entityType === EntityType.USER_NAME
|
||||||
|
? user
|
||||||
|
: feedFilterType === FeedFilter.ALL
|
||||||
|
? undefined
|
||||||
|
: currentUser?.id;
|
||||||
|
|
||||||
const { data, paging } = await getAllFeeds(
|
const { data, paging } = await getAllFeeds(
|
||||||
entityType !== EntityType.USER_NAME
|
entityType !== EntityType.USER_NAME
|
||||||
@ -360,6 +367,7 @@ const ActivityFeedProvider = ({ children }: Props) => {
|
|||||||
updateEditorFocus,
|
updateEditorFocus,
|
||||||
setActiveThread,
|
setActiveThread,
|
||||||
entityPaging,
|
entityPaging,
|
||||||
|
userId: user ?? currentUser?.id ?? '',
|
||||||
};
|
};
|
||||||
}, [
|
}, [
|
||||||
entityThread,
|
entityThread,
|
||||||
@ -379,6 +387,8 @@ const ActivityFeedProvider = ({ children }: Props) => {
|
|||||||
updateEditorFocus,
|
updateEditorFocus,
|
||||||
setActiveThread,
|
setActiveThread,
|
||||||
entityPaging,
|
entityPaging,
|
||||||
|
user,
|
||||||
|
currentUser,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -31,6 +31,7 @@ export interface ActivityFeedProviderContextType {
|
|||||||
focusReplyEditor: boolean;
|
focusReplyEditor: boolean;
|
||||||
entityPaging: Paging;
|
entityPaging: Paging;
|
||||||
setActiveThread: (thread?: Thread) => void;
|
setActiveThread: (thread?: Thread) => void;
|
||||||
|
userId: string;
|
||||||
deleteFeed: (
|
deleteFeed: (
|
||||||
threadId: string,
|
threadId: string,
|
||||||
postId: string,
|
postId: string,
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import { Menu, Typography } from 'antd';
|
import { Menu, Typography } from 'antd';
|
||||||
import AppState from 'AppState';
|
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import Loader from 'components/Loader/Loader';
|
import Loader from 'components/Loader/Loader';
|
||||||
import { TaskTab } from 'components/Task/TaskTab/TaskTab.component';
|
import { TaskTab } from 'components/Task/TaskTab/TaskTab.component';
|
||||||
@ -72,11 +71,6 @@ export const ActivityFeedTab = ({
|
|||||||
const [allCount, setAllCount] = useState(0);
|
const [allCount, setAllCount] = useState(0);
|
||||||
const [tasksCount, setTasksCount] = useState(0);
|
const [tasksCount, setTasksCount] = useState(0);
|
||||||
|
|
||||||
const currentUser = useMemo(
|
|
||||||
() => AppState.getCurrentUserDetails(),
|
|
||||||
[AppState.userDetails, AppState.nonSecureUserDetails]
|
|
||||||
);
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
postFeed,
|
postFeed,
|
||||||
selectedThread,
|
selectedThread,
|
||||||
@ -84,6 +78,7 @@ export const ActivityFeedTab = ({
|
|||||||
entityThread,
|
entityThread,
|
||||||
getFeedData,
|
getFeedData,
|
||||||
loading,
|
loading,
|
||||||
|
userId,
|
||||||
entityPaging,
|
entityPaging,
|
||||||
} = useActivityFeedProvider();
|
} = useActivityFeedProvider();
|
||||||
|
|
||||||
@ -143,41 +138,37 @@ export const ActivityFeedTab = ({
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
if (activeTab !== ActivityFeedTabs.TASKS) {
|
// count for task on userProfile page
|
||||||
// count for task on userProfile page
|
getAllFeeds(
|
||||||
getAllFeeds(
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
ThreadType.Task,
|
||||||
ThreadType.Task,
|
FeedFilter.OWNER,
|
||||||
FeedFilter.OWNER,
|
undefined,
|
||||||
undefined,
|
userId
|
||||||
currentUser?.id
|
).then((res) => {
|
||||||
).then((res) => {
|
if (res) {
|
||||||
if (res) {
|
setTasksCount(res.paging.total);
|
||||||
setTasksCount(res.paging.total);
|
} else {
|
||||||
} else {
|
throw t('server.entity-feed-fetch-error');
|
||||||
throw t('server.entity-feed-fetch-error');
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (activeTab !== ActivityFeedTabs.ALL) {
|
// count for all on userProfile page
|
||||||
// count for all on userProfile page
|
getAllFeeds(
|
||||||
getAllFeeds(
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
ThreadType.Conversation,
|
||||||
ThreadType.Conversation,
|
FeedFilter.OWNER,
|
||||||
FeedFilter.OWNER,
|
undefined,
|
||||||
undefined,
|
userId
|
||||||
currentUser?.id
|
).then((res) => {
|
||||||
).then((res) => {
|
if (res) {
|
||||||
if (res) {
|
setAllCount(res.paging.total);
|
||||||
setAllCount(res.paging.total);
|
} else {
|
||||||
} else {
|
throw t('server.entity-feed-fetch-error');
|
||||||
throw t('server.entity-feed-fetch-error');
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -185,15 +176,6 @@ export const ActivityFeedTab = ({
|
|||||||
fetchFeedsCount();
|
fetchFeedsCount();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (isUserEntity && activeTab === ActivityFeedTabs.ALL && !allCount) {
|
|
||||||
setAllCount(entityPaging.total);
|
|
||||||
}
|
|
||||||
if (isUserEntity && activeTab === ActivityFeedTabs.TASKS && !tasksCount) {
|
|
||||||
setTasksCount(entityPaging.total);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const { feedFilter, threadType } = useMemo(() => {
|
const { feedFilter, threadType } = useMemo(() => {
|
||||||
return {
|
return {
|
||||||
threadType:
|
threadType:
|
||||||
@ -371,6 +353,7 @@ export const ActivityFeedTab = ({
|
|||||||
data-testid="observer-element"
|
data-testid="observer-element"
|
||||||
id="observer-element"
|
id="observer-element"
|
||||||
ref={elementRef as RefObject<HTMLDivElement>}
|
ref={elementRef as RefObject<HTMLDivElement>}
|
||||||
|
style={{ height: '2px' }}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className=" right-container">
|
<div className=" right-container">
|
||||||
|
@ -736,7 +736,7 @@ const Users = ({
|
|||||||
}
|
}
|
||||||
case UserPageTabs.ACTIVITY:
|
case UserPageTabs.ACTIVITY:
|
||||||
return (
|
return (
|
||||||
<ActivityFeedProvider>
|
<ActivityFeedProvider user={userData.id}>
|
||||||
<ActivityFeedTab
|
<ActivityFeedTab
|
||||||
entityType={EntityType.USER_NAME}
|
entityType={EntityType.USER_NAME}
|
||||||
fqn={username}
|
fqn={username}
|
||||||
|
@ -20,7 +20,7 @@ import { LOGIN_SLIDE } from '../../constants/Login.constants';
|
|||||||
const LoginCarousel = () => {
|
const LoginCarousel = () => {
|
||||||
return (
|
return (
|
||||||
<div className="carousal-container" data-testid="carousel-container">
|
<div className="carousal-container" data-testid="carousel-container">
|
||||||
<Carousel autoplay dots autoplaySpeed={1500} easing="ease-in-out">
|
<Carousel autoplay dots autoplaySpeed={3000} easing="ease-in-out">
|
||||||
{LOGIN_SLIDE.map((data) => (
|
{LOGIN_SLIDE.map((data) => (
|
||||||
<div
|
<div
|
||||||
className="text-center"
|
className="text-center"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user