Skip to content

Commit

Permalink
ADM-1006 [frontend]: update the name in for the pipeline and repo in …
Browse files Browse the repository at this point in the history
…the doar metrics chart page (#1608)

* ADM-1006 [frontend]: update the name in for the pipeline and repo in the doar metrics chart page

* ADM-1006 [frontend]: fix the mark icon in the date picker in the metrics page

* ADM-1006 [frontend]: fix the multiple popup

* ADM-1006 [frontend]: fix the bug about retry

* ADM-1006 [frontend]: fix the bug not call get repo api when retry

* ADM-1006 [frontend]: fix test and test coverage

* ADM-1006 [frontend]: fix e2e test

* ADM-1006 [frontend]: fix trivy

* ADM-1006 [frontend]: fix sonar issues

* ADM-1006 [frontend]: fix the gitleaks

* ADM-1006 [frontend]: fix the gitleaks

* ADM-1006 [frontend]: try to test gitleaks

* ADM-1006 [frontend]: try to test gitleaks

* ADM-1006 [frontend]: fix gitleaks
  • Loading branch information
zhou-yinyuan authored Sep 14, 2024
1 parent dc5fdfe commit 2a79f8c
Show file tree
Hide file tree
Showing 22 changed files with 350 additions and 154 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
run: |
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock \
-v "${PWD}:/path" \
ghcr.io/gitleaks/gitleaks:latest \
ghcr.io/gitleaks/gitleaks:v8.18.4 \
detect \
--source="/path" \
-v --redact
Expand Down
1 change: 1 addition & 0 deletions .trivyignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ CVE-2023-50387
CVE-2023-50868
CVE-2024-34750
CVE-2024-5171
CVE-2024-38816
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,14 @@ describe('SourceControlConfiguration', () => {
});

it('should display error UI and retry when get repo failed status returns AllFailedTimeout', async () => {
const getSourceControlRepoInfo = jest.fn();
const getSourceControlInfo = jest.fn();
mockRepoEffectResponse = {
...mockInitRepoEffectResponse,
stepFailedStatus: MetricsDataFailStatus.AllFailedTimeout,
getSourceControlRepoInfo,
};
mockOrganizationEffectResponse = {
...mockInitOrganizationEffectResponse,
getSourceControlInfo,
};
setup();

Expand All @@ -268,15 +271,18 @@ describe('SourceControlConfiguration', () => {
await userEvent.click(retryButton);
});

expect(getSourceControlRepoInfo).toHaveBeenCalledTimes(1);
expect(getSourceControlInfo).toHaveBeenCalledTimes(1);
});

it('should display error UI and retry when get branch failed status returns AllFailedTimeout', async () => {
const getSourceControlBranchInfo = jest.fn();
const getSourceControlInfo = jest.fn();
mockBranchEffectResponse = {
...mockInitBranchEffectResponse,
stepFailedStatus: MetricsDataFailStatus.AllFailedTimeout,
getSourceControlBranchInfo,
};
mockOrganizationEffectResponse = {
...mockInitOrganizationEffectResponse,
getSourceControlInfo,
};
setup();

Expand All @@ -289,15 +295,18 @@ describe('SourceControlConfiguration', () => {
await userEvent.click(retryButton);
});

expect(getSourceControlBranchInfo).toHaveBeenCalledTimes(1);
expect(getSourceControlInfo).toHaveBeenCalledTimes(1);
});

it('should display error UI and retry when get crew failed status returns AllFailedTimeout', async () => {
const getSourceControlCrewInfo = jest.fn();
const getSourceControlInfo = jest.fn();
mockCrewEffectResponse = {
...mockInitCrewEffectResponse,
stepFailedStatus: MetricsDataFailStatus.AllFailedTimeout,
getSourceControlCrewInfo,
};
mockOrganizationEffectResponse = {
...mockInitOrganizationEffectResponse,
getSourceControlInfo,
};
mockSourceControlSettings = [
{ id: 0, organization: 'mockOrgName', repo: 'mockRepoName', branches: ['mockBranch1'] },
Expand All @@ -314,6 +323,6 @@ describe('SourceControlConfiguration', () => {
await userEvent.click(retryButton);
});

expect(getSourceControlCrewInfo).toHaveBeenCalledTimes(1);
expect(getSourceControlInfo).toHaveBeenCalledTimes(1);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -13,36 +13,18 @@ const mockInitRepoEffectResponse = {
isGetRepo: true,
isLoading: false,
getSourceControlRepoInfo: jest.fn(),
info: {
code: 200,
data: undefined,
errorTitle: '',
errorMessage: '',
},
stepFailedStatus: MetricsDataFailStatus.NotFailed,
};
const mockInitBranchEffectResponse = {
isLoading: false,
getSourceControlBranchInfo: jest.fn(),
isGetBranch: true,
info: {
code: 200,
data: undefined,
errorTitle: '',
errorMessage: '',
},
stepFailedStatus: MetricsDataFailStatus.NotFailed,
};
const mockInitCrewEffectResponse = {
isLoading: false,
getSourceControlCrewInfo: jest.fn(),
isGetAllCrews: true,
info: {
code: 200,
data: undefined,
errorTitle: '',
errorMessage: '',
},
stepFailedStatus: MetricsDataFailStatus.NotFailed,
};

Expand Down Expand Up @@ -93,6 +75,7 @@ jest.mock('@src/context/config/configSlice', () => ({
selectSourceControlOrganizations: jest.fn().mockReturnValue(['mockOrgName', 'mockOrgName1']),
selectSourceControlRepos: jest.fn().mockImplementation(() => mockSelectSourceControlRepos),
selectSourceControlBranches: jest.fn().mockImplementation(() => mockSelectSourceControlBranches),
selectSourceControlTimes: jest.fn().mockReturnValue([]),
selectDateRange: jest.fn().mockReturnValue([
{ startDate: '2024-07-31T00:00:00.000+08:00', endDate: '2024-08-02T23:59:59.999+08:00' },
{ startDate: '2024-07-15T00:00:00.000+08:00', endDate: '2024-07-28T23:59:59.999+08:00' },
Expand Down Expand Up @@ -221,10 +204,69 @@ describe('SourceControlMetricSelection', () => {
});

expect(onUpdateSourceControl).toHaveBeenCalledTimes(2);
expect(getSourceControlBranchInfoFunction).toHaveBeenCalledTimes(1);
expect(getSourceControlBranchInfoFunction).toHaveBeenCalledTimes(0);
expect(getSourceControlCrewInfoFunction).toHaveBeenCalledTimes(2);
});

it('should update source control when get repo is empty', async () => {
mockSelectSourceControlRepos = [];
setup();

await act(async () => {
await userEvent.click(screen.getAllByRole('button', { name: LIST_OPEN })[0]);
});
const listBox = within(screen.getByRole('listbox'));
await act(async () => {
await userEvent.click(listBox.getByText('mockOrgName1'));
});
const getSourceControlRepoInfo = jest.fn();
mockRepoEffectResponse = {
...mockRepoEffectResponse,
getSourceControlRepoInfo,
};

expect(onUpdateSourceControl).toHaveBeenCalledTimes(1);
});

it('should update source control when get branch is empty', async () => {
mockSelectSourceControlBranches = [];
setup();

await act(async () => {
await userEvent.click(screen.getAllByRole('button', { name: LIST_OPEN })[1]);
});
const listBox = within(screen.getByRole('listbox'));
await act(async () => {
await userEvent.click(listBox.getByText('mockRepoName1'));
});
const getSourceControlBranchInfo = jest.fn();
mockBranchEffectResponse = {
...mockBranchEffectResponse,
getSourceControlBranchInfo,
};

expect(onUpdateSourceControl).toHaveBeenCalledTimes(1);
});

it('should update source control when get crew is empty', async () => {
setup();

await act(async () => {
await userEvent.click(screen.getAllByRole('button', { name: LIST_OPEN })[2]);
});
const listBox = within(screen.getByRole('listbox'));
await act(async () => {
await userEvent.click(listBox.getByText('mockBranchName1'));
});
const getSourceControlCrewInfo = jest.fn();
mockCrewEffectResponse = {
...mockCrewEffectResponse,
getSourceControlCrewInfo,
};

expect(onUpdateSourceControl).toHaveBeenCalledTimes(1);
});

it('should add partial failed 4xx notification when any failed status is PartialFailed4xx', async () => {
mockCrewEffectResponse = {
...mockCrewEffectResponse,
Expand Down
7 changes: 7 additions & 0 deletions frontend/__tests__/context/configSlice.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import configReducer, {
selectSourceControlCrews,
selectSourceControlOrganizations,
selectSourceControlRepos,
selectSourceControlTimes,
selectSteps,
updateCalendarType,
updateDateRange,
Expand Down Expand Up @@ -474,6 +475,12 @@ describe('select methods', () => {
const branches = selectSourceControlBranches(store.getState(), 'test-org1', 'test-repo1');
expect(branches).toEqual(['test-branch1', 'test-branch2']);
});

it('should get all times when call selectSourceControlTimes function', () => {
const times = selectSourceControlTimes(store.getState(), 'test-org1', 'test-repo1', 'test-branch1');
expect(times).toEqual(['1-2', '1-3']);
});

it('should get all crews when call selectSourceControlCrews function', () => {
const crews = selectSourceControlCrews(store.getState(), 'test-org1', 'test-repo1', 'test-branch1', 1, 2);
expect(crews).toEqual(['test-crew1', 'test-crew2']);
Expand Down
13 changes: 6 additions & 7 deletions frontend/e2e/fixtures/create-new/board-20240812-20240818.csv
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"Issue key","Summary","Issue Type","Status","Status Date","Story Points","assignee","Reporter","Project Key","Project Name","Priority","Parent Summary","Sprint","Labels","Cycle Time","Story testing-1","Design","Vulnerability","Flagged","Fix versions","Partner","Time tracking","Story point estimate","QA","Feature/Operation","Story testing-2","Cycle Time / Story Points","Todo Days","Analysis Days","Design Days","In Dev Days","Block Days","Review Days","Waiting For Testing Days","Testing Days","Waiting For Deployment Days","OriginCycleTime: TODO","OriginCycleTime: TESTING","OriginCycleTime: WAIT FOR TEST","OriginCycleTime: DOING","OriginCycleTime: REVIEW","OriginCycleTime: BLOCKED","Rework: total - In dev","Rework: from Block","Rework: from Review","Rework: from Waiting for testing","Rework: from Testing","Rework: from Done"
"ADM-992","[FE] adds ‘story points’ dimension for 'classification' in report page","Story","Done","2024-08-14","3.0","YinYuan Zhou","Yufan Wang","ADM","Auto Dora Metrics","Medium","Precise on Metrics","Sprint42","","1.96","","","","","","","None","3.0","","","","0.65","14.76","0","0","1.24","0","0","0","0.72","0","14.76","0.72","0","1.24","0","0","0","0","0","0","0","0"
"ADM-966","[FE&BE] export data when user mapped 'Design' & ‘Waiting for deployment' in board mapping","Story","Done","2024-08-13","2.0","YinYuan Zhou","Yufan Wang","ADM","Auto Dora Metrics","Medium","easy to use","Sprint42","","1.95","","","","","","","None","2.0","","","","0.98","42.00","0","0","0.89","0","0.06","0.09","0.91","0","42.00","0.91","0.09","0.89","0.06","0","0","0","0","0","0","0"
"ADM-965","[FE&BE] add a heartbeat state 'Design' &'Waiting for deployment' in board mapping","Story","Done","2024-08-12","3.0","YinYuan Zhou","Yufan Wang","ADM","Auto Dora Metrics","Medium","easy to use","Sprint42","","1.96","","","","","","","None","3.0","","","","0.65","42.75","0","0","1.05","0","0","0.01","0.90","0","42.75","0.90","0.01","1.05","0","0","0","0","0","0","0","0"
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
"ADM-999","[FE&BE] support lead time for changes for single data source- case1(metrics)","Story","Blocked","2024-09-06","3.0","YinYuan Zhou","Yufan Wang","ADM","Auto Dora Metrics","High","lead time for changes","Sprint 44","","0","","","","","","","None","3.0","","","","0","16.20","0","0","7.93","1.94","0","0.01","1.11","0","16.20","1.11","0.01","7.93","0","1.94",,,,,,
"ADM-1003","[FE&BE]support lead time for changes for single data source- case1(report)","Story","Doing","2024-09-05","3.0","YinYuan Zhou","Yufan Wang","ADM","Auto Dora Metrics","High","lead time for changes","Sprint 44","","0","","","","","","","None","3.0","","","","0","15.99","0","0","2.94","0","0","0","0","0","15.99","0","0","2.94","0","0",,,,,,
"Issue key","Summary","Issue Type","Status","Status Date","Story Points","assignee","Reporter","Project Key","Project Name","Priority","Parent Summary","Sprint","Labels","Cycle Time","Story testing-1","Design","Vulnerability","Flagged","Fix versions","Partner","Time tracking","Story point estimate","QA","Feature/Operation","Story testing-2","Cycle Time / Story Points","Todo Days","Analysis Days","Design Days","In Dev Days","Block Days","Review Days","Waiting For Testing Days","Testing Days","Waiting For Deployment Days","OriginCycleTime: TODO","OriginCycleTime: TESTING","OriginCycleTime: WAIT FOR TEST","OriginCycleTime: DOING","OriginCycleTime: REVIEW","Rework: total - In dev","Rework: from Block","Rework: from Review","Rework: from Waiting for testing","Rework: from Testing","Rework: from Done"
"ADM-992","[FE] adds ‘story points’ dimension for 'classification' in report page","Story","Done","2024-08-14","3.0","YinYuan Zhou","Yufan Wang","ADM","Auto Dora Metrics","Medium","Precise on Metrics","Sprint42","","1.96","","","","","","","None","3.0","","","","0.65","14.76","0","0","1.24","0","0","0","0.72","0","14.76","0.72","0","1.24","0","0","0","0","0","0","0"
"ADM-966","[FE&BE] export data when user mapped 'Design' & ‘Waiting for deployment' in board mapping","Story","Done","2024-08-13","2.0","YinYuan Zhou","Yufan Wang","ADM","Auto Dora Metrics","Medium","easy to use","Sprint42","","1.95","","","","","","","None","2.0","","","","0.98","42.00","0","0","0.89","0","0.06","0.09","0.91","0","42.00","0.91","0.09","0.89","0.06","0","0","0","0","0","0"
"ADM-965","[FE&BE] add a heartbeat state 'Design' &'Waiting for deployment' in board mapping","Story","Done","2024-08-12","3.0","YinYuan Zhou","Yufan Wang","ADM","Auto Dora Metrics","Medium","easy to use","Sprint42","","1.96","","","","","","","None","3.0","","","","0.65","42.75","0","0","1.05","0","0","0.01","0.90","0","42.75","0.90","0.01","1.05","0","0","0","0","0","0","0"
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
"ADM-1006","[FE]optimize the mark logic on date picker in metrics&report page","Story","Doing","2024-09-13","2.0","YinYuan Zhou","Yufan Wang","ADM","Auto Dora Metrics","High","lead time for changes","Sprint 44","","0","","","","","","","None","2.0","","","","0","6.94","0","0","0.82","0","0","0","0","0","6.94","0","0","0.82","0",,,,,,
9 changes: 4 additions & 5 deletions frontend/e2e/fixtures/create-new/board-20240819-20240825.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"Issue key","Summary","Issue Type","Status","Status Date","Story Points","assignee","Reporter","Project Key","Project Name","Priority","Parent Summary","Sprint","Labels","Cycle Time","Story testing-1","Design","Vulnerability","Flagged","Fix versions","Partner","Time tracking","Story point estimate","QA","Feature/Operation","Story testing-2","Cycle Time / Story Points","Todo Days","Analysis Days","Design Days","In Dev Days","Block Days","Review Days","Waiting For Testing Days","Testing Days","Waiting For Deployment Days","OriginCycleTime: TODO","OriginCycleTime: TESTING","OriginCycleTime: WAIT FOR TEST","OriginCycleTime: DOING","OriginCycleTime: REVIEW","OriginCycleTime: BLOCKED","Rework: total - In dev","Rework: from Block","Rework: from Review","Rework: from Waiting for testing","Rework: from Testing","Rework: from Done"
"ADM-997","[FE] add a mark for new functions (release 1.3.0)","Story","Done","2024-08-19","1.0","YinYuan Zhou","Yufan Wang","ADM","Auto Dora Metrics","Medium","easy to use","Sprint42","","1.98","","","","","","","None","1.0","","","","1.98","10.54","0","0","1.31","0","0","0.65","0.02","0","10.54","0.02","0.65","1.31","0","0","0","0","0","0","0","0"
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
"ADM-999","[FE&BE] support lead time for changes for single data source- case1(metrics)","Story","Blocked","2024-09-06","3.0","YinYuan Zhou","Yufan Wang","ADM","Auto Dora Metrics","High","lead time for changes","Sprint 44","","0","","","","","","","None","3.0","","","","0","16.20","0","0","7.93","1.94","0","0.01","1.11","0","16.20","1.11","0.01","7.93","0","1.94",,,,,,
"ADM-1003","[FE&BE]support lead time for changes for single data source- case1(report)","Story","Doing","2024-09-05","3.0","YinYuan Zhou","Yufan Wang","ADM","Auto Dora Metrics","High","lead time for changes","Sprint 44","","0","","","","","","","None","3.0","","","","0","15.99","0","0","2.94","0","0","0","0","0","15.99","0","0","2.94","0","0",,,,,,
"Issue key","Summary","Issue Type","Status","Status Date","Story Points","assignee","Reporter","Project Key","Project Name","Priority","Parent Summary","Sprint","Labels","Cycle Time","Story testing-1","Design","Vulnerability","Flagged","Fix versions","Partner","Time tracking","Story point estimate","QA","Feature/Operation","Story testing-2","Cycle Time / Story Points","Todo Days","Analysis Days","Design Days","In Dev Days","Block Days","Review Days","Waiting For Testing Days","Testing Days","Waiting For Deployment Days","OriginCycleTime: TODO","OriginCycleTime: TESTING","OriginCycleTime: WAIT FOR TEST","OriginCycleTime: DOING","OriginCycleTime: REVIEW","Rework: total - In dev","Rework: from Block","Rework: from Review","Rework: from Waiting for testing","Rework: from Testing","Rework: from Done"
"ADM-997","[FE] add a mark for new functions (release 1.3.0)","Story","Done","2024-08-19","1.0","YinYuan Zhou","Yufan Wang","ADM","Auto Dora Metrics","Medium","easy to use","Sprint42","","1.98","","","","","","","None","1.0","","","","1.98","10.54","0","0","1.31","0","0","0.65","0.02","0","10.54","0.02","0.65","1.31","0","0","0","0","0","0","0"
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
"ADM-1006","[FE]optimize the mark logic on date picker in metrics&report page","Story","Doing","2024-09-13","2.0","YinYuan Zhou","Yufan Wang","ADM","Auto Dora Metrics","High","lead time for changes","Sprint 44","","0","","","","","","","None","2.0","","","","0","6.94","0","0","0.82","0","0","0","0","0","6.94","0","0","0.82","0",,,,,,
Loading

0 comments on commit 2a79f8c

Please sign in to comment.