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 (
|
||||
<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 && (
|
||||
<div
|
||||
className="h-full p-x-md"
|
||||
|
@ -51,13 +51,16 @@ import { ActivityFeedProviderContextType } from './ActivityFeedProviderContext.i
|
||||
|
||||
interface Props {
|
||||
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(
|
||||
{} as ActivityFeedProviderContextType
|
||||
);
|
||||
|
||||
const ActivityFeedProvider = ({ children }: Props) => {
|
||||
const ActivityFeedProvider = ({ children, user }: Props) => {
|
||||
const { t } = useTranslation();
|
||||
const [entityThread, setEntityThread] = useState<Thread[]>([]);
|
||||
const [entityPaging, setEntityPaging] = useState<Paging>({} as Paging);
|
||||
@ -105,7 +108,11 @@ const ActivityFeedProvider = ({ children }: Props) => {
|
||||
setLoading(true);
|
||||
const feedFilterType = filterType ?? FeedFilter.ALL;
|
||||
const userId =
|
||||
feedFilterType === FeedFilter.ALL ? undefined : currentUser?.id;
|
||||
entityType === EntityType.USER_NAME
|
||||
? user
|
||||
: feedFilterType === FeedFilter.ALL
|
||||
? undefined
|
||||
: currentUser?.id;
|
||||
|
||||
const { data, paging } = await getAllFeeds(
|
||||
entityType !== EntityType.USER_NAME
|
||||
@ -360,6 +367,7 @@ const ActivityFeedProvider = ({ children }: Props) => {
|
||||
updateEditorFocus,
|
||||
setActiveThread,
|
||||
entityPaging,
|
||||
userId: user ?? currentUser?.id ?? '',
|
||||
};
|
||||
}, [
|
||||
entityThread,
|
||||
@ -379,6 +387,8 @@ const ActivityFeedProvider = ({ children }: Props) => {
|
||||
updateEditorFocus,
|
||||
setActiveThread,
|
||||
entityPaging,
|
||||
user,
|
||||
currentUser,
|
||||
]);
|
||||
|
||||
return (
|
||||
|
@ -31,6 +31,7 @@ export interface ActivityFeedProviderContextType {
|
||||
focusReplyEditor: boolean;
|
||||
entityPaging: Paging;
|
||||
setActiveThread: (thread?: Thread) => void;
|
||||
userId: string;
|
||||
deleteFeed: (
|
||||
threadId: string,
|
||||
postId: string,
|
||||
|
@ -11,7 +11,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { Menu, Typography } from 'antd';
|
||||
import AppState from 'AppState';
|
||||
import classNames from 'classnames';
|
||||
import Loader from 'components/Loader/Loader';
|
||||
import { TaskTab } from 'components/Task/TaskTab/TaskTab.component';
|
||||
@ -72,11 +71,6 @@ export const ActivityFeedTab = ({
|
||||
const [allCount, setAllCount] = useState(0);
|
||||
const [tasksCount, setTasksCount] = useState(0);
|
||||
|
||||
const currentUser = useMemo(
|
||||
() => AppState.getCurrentUserDetails(),
|
||||
[AppState.userDetails, AppState.nonSecureUserDetails]
|
||||
);
|
||||
|
||||
const {
|
||||
postFeed,
|
||||
selectedThread,
|
||||
@ -84,6 +78,7 @@ export const ActivityFeedTab = ({
|
||||
entityThread,
|
||||
getFeedData,
|
||||
loading,
|
||||
userId,
|
||||
entityPaging,
|
||||
} = useActivityFeedProvider();
|
||||
|
||||
@ -143,41 +138,37 @@ export const ActivityFeedTab = ({
|
||||
}
|
||||
);
|
||||
} else {
|
||||
if (activeTab !== ActivityFeedTabs.TASKS) {
|
||||
// count for task on userProfile page
|
||||
getAllFeeds(
|
||||
undefined,
|
||||
undefined,
|
||||
ThreadType.Task,
|
||||
FeedFilter.OWNER,
|
||||
undefined,
|
||||
currentUser?.id
|
||||
).then((res) => {
|
||||
if (res) {
|
||||
setTasksCount(res.paging.total);
|
||||
} else {
|
||||
throw t('server.entity-feed-fetch-error');
|
||||
}
|
||||
});
|
||||
}
|
||||
// count for task on userProfile page
|
||||
getAllFeeds(
|
||||
undefined,
|
||||
undefined,
|
||||
ThreadType.Task,
|
||||
FeedFilter.OWNER,
|
||||
undefined,
|
||||
userId
|
||||
).then((res) => {
|
||||
if (res) {
|
||||
setTasksCount(res.paging.total);
|
||||
} else {
|
||||
throw t('server.entity-feed-fetch-error');
|
||||
}
|
||||
});
|
||||
|
||||
if (activeTab !== ActivityFeedTabs.ALL) {
|
||||
// count for all on userProfile page
|
||||
getAllFeeds(
|
||||
undefined,
|
||||
undefined,
|
||||
ThreadType.Conversation,
|
||||
FeedFilter.OWNER,
|
||||
undefined,
|
||||
currentUser?.id
|
||||
).then((res) => {
|
||||
if (res) {
|
||||
setAllCount(res.paging.total);
|
||||
} else {
|
||||
throw t('server.entity-feed-fetch-error');
|
||||
}
|
||||
});
|
||||
}
|
||||
// count for all on userProfile page
|
||||
getAllFeeds(
|
||||
undefined,
|
||||
undefined,
|
||||
ThreadType.Conversation,
|
||||
FeedFilter.OWNER,
|
||||
undefined,
|
||||
userId
|
||||
).then((res) => {
|
||||
if (res) {
|
||||
setAllCount(res.paging.total);
|
||||
} else {
|
||||
throw t('server.entity-feed-fetch-error');
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@ -185,15 +176,6 @@ export const ActivityFeedTab = ({
|
||||
fetchFeedsCount();
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (isUserEntity && activeTab === ActivityFeedTabs.ALL && !allCount) {
|
||||
setAllCount(entityPaging.total);
|
||||
}
|
||||
if (isUserEntity && activeTab === ActivityFeedTabs.TASKS && !tasksCount) {
|
||||
setTasksCount(entityPaging.total);
|
||||
}
|
||||
});
|
||||
|
||||
const { feedFilter, threadType } = useMemo(() => {
|
||||
return {
|
||||
threadType:
|
||||
@ -371,6 +353,7 @@ export const ActivityFeedTab = ({
|
||||
data-testid="observer-element"
|
||||
id="observer-element"
|
||||
ref={elementRef as RefObject<HTMLDivElement>}
|
||||
style={{ height: '2px' }}
|
||||
/>
|
||||
</div>
|
||||
<div className=" right-container">
|
||||
|
@ -736,7 +736,7 @@ const Users = ({
|
||||
}
|
||||
case UserPageTabs.ACTIVITY:
|
||||
return (
|
||||
<ActivityFeedProvider>
|
||||
<ActivityFeedProvider user={userData.id}>
|
||||
<ActivityFeedTab
|
||||
entityType={EntityType.USER_NAME}
|
||||
fqn={username}
|
||||
|
@ -20,7 +20,7 @@ import { LOGIN_SLIDE } from '../../constants/Login.constants';
|
||||
const LoginCarousel = () => {
|
||||
return (
|
||||
<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) => (
|
||||
<div
|
||||
className="text-center"
|
||||
|
Loading…
x
Reference in New Issue
Block a user