mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-26 18:06:03 +00:00
Fix: IncidentManager date filtering and update table column title (#20578)
This commit is contained in:
parent
c30878448f
commit
39979d2ed5
@ -59,7 +59,9 @@ import {
|
|||||||
import {
|
import {
|
||||||
formatDateTimeLong,
|
formatDateTimeLong,
|
||||||
getCurrentMillis,
|
getCurrentMillis,
|
||||||
|
getEndOfDayInMillis,
|
||||||
getEpochMillisForPastDays,
|
getEpochMillisForPastDays,
|
||||||
|
getStartOfDayInMillis,
|
||||||
} from '../../utils/date-time/DateTimeUtils';
|
} from '../../utils/date-time/DateTimeUtils';
|
||||||
import {
|
import {
|
||||||
getEntityName,
|
getEntityName,
|
||||||
@ -115,8 +117,10 @@ const IncidentManager = ({
|
|||||||
isLoading: true,
|
isLoading: true,
|
||||||
});
|
});
|
||||||
const [filters, setFilters] = useState<TestCaseIncidentStatusParams>({
|
const [filters, setFilters] = useState<TestCaseIncidentStatusParams>({
|
||||||
startTs: getEpochMillisForPastDays(PROFILER_FILTER_RANGE.last30days.days),
|
startTs: getStartOfDayInMillis(
|
||||||
endTs: getCurrentMillis(),
|
getEpochMillisForPastDays(PROFILER_FILTER_RANGE.last30days.days)
|
||||||
|
),
|
||||||
|
endTs: getEndOfDayInMillis(getCurrentMillis()),
|
||||||
...searchParams,
|
...searchParams,
|
||||||
});
|
});
|
||||||
const [users, setUsers] = useState<{
|
const [users, setUsers] = useState<{
|
||||||
@ -464,7 +468,7 @@ const IncidentManager = ({
|
|||||||
]
|
]
|
||||||
: []),
|
: []),
|
||||||
{
|
{
|
||||||
title: t('label.execution-time'),
|
title: t('label.last-updated'),
|
||||||
dataIndex: 'timestamp',
|
dataIndex: 'timestamp',
|
||||||
key: 'timestamp',
|
key: 'timestamp',
|
||||||
width: 200,
|
width: 200,
|
||||||
|
@ -78,6 +78,14 @@ jest.mock('../../rest/incidentManagerAPI', () => ({
|
|||||||
.mockImplementation(() => Promise.resolve({ data: [] })),
|
.mockImplementation(() => Promise.resolve({ data: [] })),
|
||||||
updateTestCaseIncidentById: jest.fn(),
|
updateTestCaseIncidentById: jest.fn(),
|
||||||
}));
|
}));
|
||||||
|
jest.mock('../../rest/miscAPI', () => ({
|
||||||
|
getUserAndTeamSearch: jest
|
||||||
|
.fn()
|
||||||
|
.mockImplementation(() => Promise.resolve({ data: [] })),
|
||||||
|
}));
|
||||||
|
jest.mock('../../rest/userAPI', () => ({
|
||||||
|
getUsers: jest.fn().mockImplementation(() => Promise.resolve({ data: [] })),
|
||||||
|
}));
|
||||||
jest.mock('../../rest/searchAPI', () => ({
|
jest.mock('../../rest/searchAPI', () => ({
|
||||||
searchQuery: jest
|
searchQuery: jest
|
||||||
.fn()
|
.fn()
|
||||||
@ -98,12 +106,18 @@ jest.mock('../../utils/date-time/DateTimeUtils', () => {
|
|||||||
.mockImplementation(() => 1709556624254),
|
.mockImplementation(() => 1709556624254),
|
||||||
formatDateTime: jest.fn().mockImplementation(() => 'formatted date'),
|
formatDateTime: jest.fn().mockImplementation(() => 'formatted date'),
|
||||||
getCurrentMillis: jest.fn().mockImplementation(() => 1710161424255),
|
getCurrentMillis: jest.fn().mockImplementation(() => 1710161424255),
|
||||||
|
getStartOfDayInMillis: jest
|
||||||
|
.fn()
|
||||||
|
.mockImplementation((timestamp) => timestamp),
|
||||||
|
getEndOfDayInMillis: jest.fn().mockImplementation((timestamp) => timestamp),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('IncidentManagerPage', () => {
|
describe('IncidentManagerPage', () => {
|
||||||
it('should render component', async () => {
|
it('should render component', async () => {
|
||||||
render(<IncidentManager />);
|
await act(async () => {
|
||||||
|
render(<IncidentManager />);
|
||||||
|
});
|
||||||
|
|
||||||
expect(await screen.findByTestId('status-select')).toBeInTheDocument();
|
expect(await screen.findByTestId('status-select')).toBeInTheDocument();
|
||||||
expect(
|
expect(
|
||||||
@ -124,11 +138,13 @@ describe('IncidentManagerPage', () => {
|
|||||||
it('Incident should be fetch with updated time', async () => {
|
it('Incident should be fetch with updated time', async () => {
|
||||||
const mockGetListTestCaseIncidentStatus =
|
const mockGetListTestCaseIncidentStatus =
|
||||||
getListTestCaseIncidentStatus as jest.Mock;
|
getListTestCaseIncidentStatus as jest.Mock;
|
||||||
render(<IncidentManager />);
|
await act(async () => {
|
||||||
|
render(<IncidentManager />);
|
||||||
|
});
|
||||||
|
|
||||||
const timeFilterButton = await screen.findByTestId('time-filter');
|
const timeFilterButton = await screen.findByTestId('time-filter');
|
||||||
|
|
||||||
act(() => {
|
await act(async () => {
|
||||||
fireEvent.click(timeFilterButton);
|
fireEvent.click(timeFilterButton);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -140,14 +156,18 @@ describe('IncidentManagerPage', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should not ender table column if isIncidentManager is false', () => {
|
it('Should not ender table column if isIncidentManager is false', async () => {
|
||||||
render(<IncidentManager isIncidentPage={false} />);
|
await act(async () => {
|
||||||
|
render(<IncidentManager isIncidentPage={false} />);
|
||||||
|
});
|
||||||
|
|
||||||
expect(screen.queryByText('label.table')).not.toBeInTheDocument();
|
expect(screen.queryByText('label.table')).not.toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should render table column if isIncidentManager is true', () => {
|
it('Should render table column if isIncidentManager is true', async () => {
|
||||||
render(<IncidentManager isIncidentPage />);
|
await act(async () => {
|
||||||
|
render(<IncidentManager isIncidentPage />);
|
||||||
|
});
|
||||||
|
|
||||||
expect(screen.getByText('label.table')).toBeInTheDocument();
|
expect(screen.getByText('label.table')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user