mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2026-01-07 13:07:22 +00:00
MINOR: increase the feed size for the landing page feed widget (#17257)
* increase the feed size for the landing page feed widget * minor fix
This commit is contained in:
parent
71bd67a503
commit
2253b7aff3
@ -166,7 +166,8 @@ const ActivityFeedProvider = ({ children, user }: Props) => {
|
||||
type?: ThreadType,
|
||||
entityType?: EntityType,
|
||||
fqn?: string,
|
||||
taskStatus?: ThreadTaskStatus
|
||||
taskStatus?: ThreadTaskStatus,
|
||||
limit?: number
|
||||
) => {
|
||||
try {
|
||||
setLoading(true);
|
||||
@ -187,7 +188,8 @@ const ActivityFeedProvider = ({ children, user }: Props) => {
|
||||
type,
|
||||
feedFilterType,
|
||||
taskStatus,
|
||||
userId
|
||||
userId,
|
||||
limit
|
||||
);
|
||||
setEntityThread((prev) => (after ? [...prev, ...data] : [...data]));
|
||||
setEntityPaging(paging);
|
||||
|
||||
@ -55,7 +55,8 @@ export interface ActivityFeedProviderContextType {
|
||||
type?: ThreadType,
|
||||
entityType?: EntityType,
|
||||
fqn?: string,
|
||||
taskStatus?: ThreadTaskStatus
|
||||
taskStatus?: ThreadTaskStatus,
|
||||
limit?: number
|
||||
) => Promise<void>;
|
||||
showDrawer: (thread: Thread) => void;
|
||||
hideDrawer: () => void;
|
||||
|
||||
@ -17,7 +17,7 @@ import { isUndefined } from 'lodash';
|
||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Link, useHistory } from 'react-router-dom';
|
||||
import { ROUTES } from '../../../../constants/constants';
|
||||
import { PAGE_SIZE_LARGE, ROUTES } from '../../../../constants/constants';
|
||||
import { FEED_COUNT_INITIAL_DATA } from '../../../../constants/entity.constants';
|
||||
import { mockFeedData } from '../../../../constants/mockTourData.constants';
|
||||
import { useTourProvider } from '../../../../context/TourProvider/TourProvider';
|
||||
@ -63,7 +63,15 @@ const FeedsWidget = ({
|
||||
|
||||
useEffect(() => {
|
||||
if (activeTab === ActivityFeedTabs.ALL) {
|
||||
getFeedData(defaultFilter, undefined, ThreadType.Conversation);
|
||||
getFeedData(
|
||||
defaultFilter,
|
||||
undefined,
|
||||
ThreadType.Conversation,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
PAGE_SIZE_LARGE
|
||||
);
|
||||
} else if (activeTab === ActivityFeedTabs.MENTIONS) {
|
||||
getFeedData(FeedFilter.MENTIONS);
|
||||
} else if (activeTab === ActivityFeedTabs.TASKS) {
|
||||
|
||||
@ -12,6 +12,9 @@
|
||||
*/
|
||||
import { act, fireEvent, render, screen } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
import { PAGE_SIZE_LARGE } from '../../../../constants/constants';
|
||||
import { useApplicationStore } from '../../../../hooks/useApplicationStore';
|
||||
import { mockUserData } from '../../../Settings/Users/mocks/User.mocks';
|
||||
import FeedsWidget from './FeedsWidget.component';
|
||||
|
||||
const mockHandleRemoveWidget = jest.fn();
|
||||
@ -114,7 +117,47 @@ jest.mock(
|
||||
})
|
||||
);
|
||||
|
||||
jest.mock('../../../../hooks/useApplicationStore', () => ({
|
||||
useApplicationStore: jest.fn(() => ({
|
||||
currentUser: mockUserData,
|
||||
})),
|
||||
}));
|
||||
|
||||
describe('FeedsWidget', () => {
|
||||
it('should call getFeedData for owner conversation on load for non admin user', () => {
|
||||
render(<FeedsWidget {...widgetProps} />);
|
||||
|
||||
expect(mockUseActivityFeedProviderValue.getFeedData).toHaveBeenCalledWith(
|
||||
'OWNER_OR_FOLLOWS',
|
||||
undefined,
|
||||
'Conversation',
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
PAGE_SIZE_LARGE
|
||||
);
|
||||
});
|
||||
|
||||
it('should call getFeedData for ALL conversation on load for admin user', () => {
|
||||
(useApplicationStore as unknown as jest.Mock).mockImplementationOnce(
|
||||
() => ({
|
||||
currentUser: { ...mockUserData, isAdmin: true },
|
||||
})
|
||||
);
|
||||
|
||||
render(<FeedsWidget {...widgetProps} />);
|
||||
|
||||
expect(mockUseActivityFeedProviderValue.getFeedData).toHaveBeenCalledWith(
|
||||
'ALL',
|
||||
undefined,
|
||||
'Conversation',
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
PAGE_SIZE_LARGE
|
||||
);
|
||||
});
|
||||
|
||||
it('should render FeedsWidget', async () => {
|
||||
await act(async () => {
|
||||
render(<FeedsWidget {...widgetProps} />);
|
||||
|
||||
@ -36,7 +36,8 @@ export const getAllFeeds = async (
|
||||
type?: ThreadType,
|
||||
filterType?: FeedFilter,
|
||||
taskStatus?: ThreadTaskStatus,
|
||||
userId?: string
|
||||
userId?: string,
|
||||
limit?: number
|
||||
) => {
|
||||
const isFilterAll = filterType === FeedFilter.ALL || isUndefined(filterType);
|
||||
|
||||
@ -50,6 +51,7 @@ export const getAllFeeds = async (
|
||||
filterType: isFilterAll ? undefined : filterType,
|
||||
taskStatus,
|
||||
userId: isFilterAll ? undefined : userId,
|
||||
limit,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user