Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADM-879 [frontend] Generate data reports for multiple time ranges #1425

Merged
merged 33 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
b8174e1
ADM-879: [frontend] feat: set date range when select related date range
neomgb Apr 25, 2024
d539365
ADM-924:[frontend]feat: add disabled logic for DateRangeViewer
TingyuDong Apr 25, 2024
058201a
ADM-879-new feat: send multi fetch in report page
Leiqiuhong Apr 25, 2024
7b9856c
ADM-879-new refactor: rename
Leiqiuhong Apr 25, 2024
c4c5e46
ADM-879-new refactor: rename and move function
Leiqiuhong Apr 25, 2024
9b37a01
ADM-879-new refactor: extract function
Leiqiuhong Apr 25, 2024
24b687d
ADM-879-new feat: should change data when select other date range
Leiqiuhong Apr 25, 2024
fbb7c51
ADM-879-new fix: fix update logic
Leiqiuhong Apr 25, 2024
a3feec1
ADM-879-new refactor: rename
Leiqiuhong Apr 26, 2024
df961c8
ADM-879-new refactor: rename
Leiqiuhong Apr 26, 2024
d85d733
ADM-924:[frontend]fix: pass disabled prop to SingleDateRange and Date…
TingyuDong Apr 26, 2024
d615d7d
ADM-879-new feat: add status for alert
Leiqiuhong Apr 26, 2024
e17b832
ADM-879: [frontend] feat: modify style
neomgb Apr 26, 2024
8f540e0
ADM-879-new feat: modify the notification opportunity
Leiqiuhong Apr 26, 2024
bfcf1e0
ADM-879-new feat: remove the notifications when change dateRange in r…
Leiqiuhong Apr 26, 2024
b311a27
ADM-879-new fix: fix notification
Leiqiuhong Apr 28, 2024
57cc478
ADM-879-new fix: fix test
Leiqiuhong Apr 28, 2024
ba67186
ADM-879-new test: fix test
Leiqiuhong Apr 28, 2024
054813f
ADM-879-new test: add unit tests
Leiqiuhong Apr 29, 2024
bdd5a17
ADM-879-new refactor: extract method
Leiqiuhong Apr 29, 2024
b4588b4
Merge branch 'main' into ADM-879-new
Leiqiuhong Apr 29, 2024
48a48d9
ADM-879-new refactor: remove useless code
Leiqiuhong Apr 29, 2024
e02b15e
ADM-879-new test: add unit test
Leiqiuhong Apr 29, 2024
1e133c9
ADM-879-new fix: fix sonarcloud
Leiqiuhong Apr 30, 2024
c51e4a6
ADM-879-new refactor: fix rename
Leiqiuhong Apr 30, 2024
1a9e4d8
ADM-879-new refactor: rename
Leiqiuhong Apr 30, 2024
047a23b
ADM-879-new fix: fix sonarcloud
Leiqiuhong Apr 30, 2024
70e945e
ADM-879-new fix: fix sonarcloud
Leiqiuhong Apr 30, 2024
be01f15
ADM-879-new fix: fix pr issues
Leiqiuhong Apr 30, 2024
618921c
ADM-879-new fix: fix sonarcloud
Leiqiuhong Apr 30, 2024
56d7153
ADM-879-new fix: rename
Leiqiuhong Apr 30, 2024
4eadc84
ADM-879-new fix: fix test field name
Leiqiuhong Apr 30, 2024
c3a2221
Merge branch 'main' into ADM-879-new
Leiqiuhong Apr 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions frontend/__tests__/client/ReportClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ describe('report client', () => {
afterAll(() => server.close());

it('should get response when generate report request status 202', async () => {
const excepted = {
response: MOCK_RETRIEVE_REPORT_RESPONSE,
};
const excepted = MOCK_RETRIEVE_REPORT_RESPONSE;

server.use(
rest.post(MOCK_REPORT_URL, (req, res, ctx) =>
res(ctx.status(HttpStatusCode.Accepted), ctx.json(MOCK_RETRIEVE_REPORT_RESPONSE)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { render } from '@testing-library/react';

describe('DateRangeViewer', () => {
const setup = (dateRanges: DateRange) => {
return render(<DateRangeViewer dateRanges={dateRanges} />);
return render(<DateRangeViewer dateRangeList={dateRanges} />);
};
const mockDateRanges = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
REQUIRED_DATA,
MOCK_PIPELINE_VERIFY_URL,
MOCK_BOARD_URL_FOR_JIRA,
MOCK_REPORT_RESPONSE,
} from '../../fixtures';
import {
updateCycleTimeSettings,
Expand All @@ -24,9 +25,9 @@ import {
updateDeploymentFrequencySettings,
updateTreatFlagCardAsBlock,
} from '@src/context/Metrics/metricsSlice';
import { ASSIGNEE_FILTER_TYPES, DEFAULT_MESSAGE } from '@src/constants/resources';
import { updateDateRange, updateMetrics } from '@src/context/config/configSlice';
import { act, render, screen, waitFor, within } from '@testing-library/react';
import { ASSIGNEE_FILTER_TYPES } from '@src/constants/resources';
import { updateMetrics } from '@src/context/config/configSlice';
import MetricsStepper from '@src/containers/MetricsStepper';
import { setupStore } from '../../utils/setupStoreUtil';
import userEvent from '@testing-library/user-event';
Expand Down Expand Up @@ -56,6 +57,11 @@ const mockValidationCheckContext = {
getDuplicatedPipeLineIds: jest.fn().mockReturnValue([]),
};

const mockDateRange = {
startDate: '2024-02-18T00:00:00.000+08:00',
endDate: '2024-02-28T23:59:59.999+08:00',
};

jest.mock('@src/hooks/useMetricsStepValidationCheckContext', () => ({
useMetricsStepValidationCheckContext: () => mockValidationCheckContext,
}));
Expand Down Expand Up @@ -88,12 +94,29 @@ jest.mock('@src/utils/util', () => ({
}));

jest.mock('@src/hooks/useGenerateReportEffect', () => ({
...jest.requireActual('@src/hooks/useGenerateReportEffect'),
useGenerateReportEffect: jest.fn().mockReturnValue({
startToRequestData: jest.fn(),
startToRequestDoraData: jest.fn(),
stopPollingReports: jest.fn(),
isServerError: false,
errorMessage: '',
closeReportInfosErrorStatus: jest.fn(),
closeBoardMetricsError: jest.fn(),
closePipelineMetricsError: jest.fn(),
closeSourceControlMetricsError: jest.fn(),
reportInfos: [
{
id: mockDateRange.startDate,
timeout4Board: { message: DEFAULT_MESSAGE, shouldShow: true },
timeout4Dora: { message: DEFAULT_MESSAGE, shouldShow: true },
timeout4Report: { message: DEFAULT_MESSAGE, shouldShow: true },
generalError4Board: { message: DEFAULT_MESSAGE, shouldShow: true },
generalError4Dora: { message: DEFAULT_MESSAGE, shouldShow: true },
generalError4Report: { message: DEFAULT_MESSAGE, shouldShow: true },
shouldShowBoardMetricsError: true,
shouldShowPipelineMetricsError: true,
shouldShowSourceControlMetricsError: true,
reportData: { ...MOCK_REPORT_RESPONSE, exportValidityTime: 30 },
},
],
}),
}));

Expand Down Expand Up @@ -160,6 +183,7 @@ const fillMetricsPageDate = async () => {
updateDeploymentFrequencySettings({ updateId: 0, label: 'pipelineName', value: 'mock new pipelineName' }),
);
store.dispatch(updateDeploymentFrequencySettings({ updateId: 0, label: 'step', value: 'mock new step' }));
store.dispatch(updateDateRange([mockDateRange]));
});
};

Expand Down Expand Up @@ -396,8 +420,8 @@ describe('MetricsStepper', () => {
calendarType: 'Regular Calendar(Weekend Considered)',
dateRange: [
{
endDate: dayjs().endOf('date').add(0, 'day').format(COMMON_TIME_FORMAT),
startDate: dayjs().startOf('date').format(COMMON_TIME_FORMAT),
endDate: mockDateRange.endDate,
startDate: mockDateRange.startDate,
},
],
metrics: ['Velocity'],
Expand Down
Loading
Loading