Commit b5ac9eb4 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch '196719-make-vuex-store-consistent' into 'master'

Align VueX actions for Secure diff results

See merge request gitlab-org/gitlab!23826
parents 6c1b45ff 48ec35be
...@@ -93,7 +93,7 @@ export const updateContainerScanningIssue = ({ commit }, issue) => ...@@ -93,7 +93,7 @@ export const updateContainerScanningIssue = ({ commit }, issue) =>
*/ */
export const setDastDiffEndpoint = ({ commit }, path) => commit(types.SET_DAST_DIFF_ENDPOINT, path); export const setDastDiffEndpoint = ({ commit }, path) => commit(types.SET_DAST_DIFF_ENDPOINT, path);
export const requestDastReports = ({ commit }) => commit(types.REQUEST_DAST_REPORTS); export const requestDastDiff = ({ commit }) => commit(types.REQUEST_DAST_DIFF);
export const updateDastIssue = ({ commit }, issue) => commit(types.UPDATE_DAST_ISSUE, issue); export const updateDastIssue = ({ commit }, issue) => commit(types.UPDATE_DAST_ISSUE, issue);
...@@ -103,7 +103,7 @@ export const receiveDastDiffSuccess = ({ commit }, response) => ...@@ -103,7 +103,7 @@ export const receiveDastDiffSuccess = ({ commit }, response) =>
export const receiveDastDiffError = ({ commit }) => commit(types.RECEIVE_DAST_DIFF_ERROR); export const receiveDastDiffError = ({ commit }) => commit(types.RECEIVE_DAST_DIFF_ERROR);
export const fetchDastDiff = ({ state, dispatch }) => { export const fetchDastDiff = ({ state, dispatch }) => {
dispatch('requestDastReports'); dispatch('requestDastDiff');
return Promise.all([ return Promise.all([
pollUntilComplete(state.dast.paths.diffEndpoint), pollUntilComplete(state.dast.paths.diffEndpoint),
...@@ -131,8 +131,8 @@ export const fetchDastDiff = ({ state, dispatch }) => { ...@@ -131,8 +131,8 @@ export const fetchDastDiff = ({ state, dispatch }) => {
export const setDependencyScanningDiffEndpoint = ({ commit }, path) => export const setDependencyScanningDiffEndpoint = ({ commit }, path) =>
commit(types.SET_DEPENDENCY_SCANNING_DIFF_ENDPOINT, path); commit(types.SET_DEPENDENCY_SCANNING_DIFF_ENDPOINT, path);
export const requestDependencyScanningReports = ({ commit }) => export const requestDependencyScanningDiff = ({ commit }) =>
commit(types.REQUEST_DEPENDENCY_SCANNING_REPORTS); commit(types.REQUEST_DEPENDENCY_SCANNING_DIFF);
export const receiveDependencyScanningDiffSuccess = ({ commit }, response) => export const receiveDependencyScanningDiffSuccess = ({ commit }, response) =>
commit(types.RECEIVE_DEPENDENCY_SCANNING_DIFF_SUCCESS, response); commit(types.RECEIVE_DEPENDENCY_SCANNING_DIFF_SUCCESS, response);
...@@ -141,7 +141,7 @@ export const receiveDependencyScanningDiffError = ({ commit }) => ...@@ -141,7 +141,7 @@ export const receiveDependencyScanningDiffError = ({ commit }) =>
commit(types.RECEIVE_DEPENDENCY_SCANNING_DIFF_ERROR); commit(types.RECEIVE_DEPENDENCY_SCANNING_DIFF_ERROR);
export const fetchDependencyScanningDiff = ({ state, dispatch }) => { export const fetchDependencyScanningDiff = ({ state, dispatch }) => {
dispatch('requestDependencyScanningReports'); dispatch('requestDependencyScanningDiff');
return Promise.all([ return Promise.all([
pollUntilComplete(state.dependencyScanning.paths.diffEndpoint), pollUntilComplete(state.dependencyScanning.paths.diffEndpoint),
......
...@@ -4,7 +4,7 @@ import * as types from './mutation_types'; ...@@ -4,7 +4,7 @@ import * as types from './mutation_types';
export const setDiffEndpoint = ({ commit }, path) => commit(types.SET_DIFF_ENDPOINT, path); export const setDiffEndpoint = ({ commit }, path) => commit(types.SET_DIFF_ENDPOINT, path);
export const requestReports = ({ commit }) => commit(types.REQUEST_REPORTS); export const requestDiff = ({ commit }) => commit(types.REQUEST_DIFF);
export const updateVulnerability = ({ commit }, vulnerability) => export const updateVulnerability = ({ commit }, vulnerability) =>
commit(types.UPDATE_VULNERABILITY, vulnerability); commit(types.UPDATE_VULNERABILITY, vulnerability);
...@@ -16,7 +16,7 @@ export const receiveDiffError = ({ commit }, response) => ...@@ -16,7 +16,7 @@ export const receiveDiffError = ({ commit }, response) =>
commit(types.RECEIVE_DIFF_ERROR, response); commit(types.RECEIVE_DIFF_ERROR, response);
export const fetchDiff = ({ state, rootState, dispatch }) => { export const fetchDiff = ({ state, rootState, dispatch }) => {
dispatch('requestReports'); dispatch('requestDiff');
return Promise.all([ return Promise.all([
pollUntilComplete(state.paths.diffEndpoint), pollUntilComplete(state.paths.diffEndpoint),
......
export const RECEIVE_DIFF_SUCCESS = 'RECEIVE_DIFF_SUCCESS'; export const RECEIVE_DIFF_SUCCESS = 'RECEIVE_DIFF_SUCCESS';
export const RECEIVE_DIFF_ERROR = 'RECEIVE_DIFF_ERROR'; export const RECEIVE_DIFF_ERROR = 'RECEIVE_DIFF_ERROR';
export const REQUEST_REPORTS = 'REQUEST_REPORTS'; export const REQUEST_DIFF = 'REQUEST_DIFF';
export const SET_DIFF_ENDPOINT = 'SET_DIFF_ENDPOINT'; export const SET_DIFF_ENDPOINT = 'SET_DIFF_ENDPOINT';
export const UPDATE_VULNERABILITY = 'UPDATE_VULNERABILITY'; export const UPDATE_VULNERABILITY = 'UPDATE_VULNERABILITY';
...@@ -7,7 +7,7 @@ export default { ...@@ -7,7 +7,7 @@ export default {
Vue.set(state.paths, 'diffEndpoint', path); Vue.set(state.paths, 'diffEndpoint', path);
}, },
[types.REQUEST_REPORTS](state) { [types.REQUEST_DIFF](state) {
state.isLoading = true; state.isLoading = true;
}, },
......
...@@ -21,13 +21,13 @@ export const RECEIVE_SAST_CONTAINER_DIFF_ERROR = 'RECEIVE_SAST_CONTAINER_DIFF_ER ...@@ -21,13 +21,13 @@ export const RECEIVE_SAST_CONTAINER_DIFF_ERROR = 'RECEIVE_SAST_CONTAINER_DIFF_ER
// DAST // DAST
export const SET_DAST_DIFF_ENDPOINT = 'SET_DAST_DIFF_ENDPOINT'; export const SET_DAST_DIFF_ENDPOINT = 'SET_DAST_DIFF_ENDPOINT';
export const REQUEST_DAST_REPORTS = 'REQUEST_DAST_REPORTS'; export const REQUEST_DAST_DIFF = 'REQUEST_DAST_DIFF';
export const RECEIVE_DAST_DIFF_SUCCESS = 'RECEIVE_DAST_DIFF_SUCCESS'; export const RECEIVE_DAST_DIFF_SUCCESS = 'RECEIVE_DAST_DIFF_SUCCESS';
export const RECEIVE_DAST_DIFF_ERROR = 'RECEIVE_DAST_DIFF_ERROR'; export const RECEIVE_DAST_DIFF_ERROR = 'RECEIVE_DAST_DIFF_ERROR';
// DEPENDENCY_SCANNING // DEPENDENCY_SCANNING
export const SET_DEPENDENCY_SCANNING_DIFF_ENDPOINT = 'SET_DEPENDENCY_SCANNING_DIFF_ENDPOINT'; export const SET_DEPENDENCY_SCANNING_DIFF_ENDPOINT = 'SET_DEPENDENCY_SCANNING_DIFF_ENDPOINT';
export const REQUEST_DEPENDENCY_SCANNING_REPORTS = 'REQUEST_DEPENDENCY_SCANNING_REPORTS'; export const REQUEST_DEPENDENCY_SCANNING_DIFF = 'REQUEST_DEPENDENCY_SCANNING_DIFF';
export const RECEIVE_DEPENDENCY_SCANNING_DIFF_SUCCESS = 'RECEIVE_DEPENDENCY_SCANNING_DIFF_SUCCESS'; export const RECEIVE_DEPENDENCY_SCANNING_DIFF_SUCCESS = 'RECEIVE_DEPENDENCY_SCANNING_DIFF_SUCCESS';
export const RECEIVE_DEPENDENCY_SCANNING_DIFF_ERROR = 'RECEIVE_DEPENDENCY_SCANNING_DIFF_ERROR'; export const RECEIVE_DEPENDENCY_SCANNING_DIFF_ERROR = 'RECEIVE_DEPENDENCY_SCANNING_DIFF_ERROR';
......
...@@ -82,7 +82,7 @@ export default { ...@@ -82,7 +82,7 @@ export default {
Vue.set(state.dast.paths, 'diffEndpoint', path); Vue.set(state.dast.paths, 'diffEndpoint', path);
}, },
[types.REQUEST_DAST_REPORTS](state) { [types.REQUEST_DAST_DIFF](state) {
Vue.set(state.dast, 'isLoading', true); Vue.set(state.dast, 'isLoading', true);
}, },
...@@ -110,7 +110,7 @@ export default { ...@@ -110,7 +110,7 @@ export default {
Vue.set(state.dependencyScanning.paths, 'diffEndpoint', path); Vue.set(state.dependencyScanning.paths, 'diffEndpoint', path);
}, },
[types.REQUEST_DEPENDENCY_SCANNING_REPORTS](state) { [types.REQUEST_DEPENDENCY_SCANNING_DIFF](state) {
Vue.set(state.dependencyScanning, 'isLoading', true); Vue.set(state.dependencyScanning, 'isLoading', true);
}, },
......
...@@ -8,8 +8,8 @@ import { ...@@ -8,8 +8,8 @@ import {
setCanCreateIssuePermission, setCanCreateIssuePermission,
setCanCreateFeedbackPermission, setCanCreateFeedbackPermission,
requestSastContainerReports, requestSastContainerReports,
requestDastReports, requestDastDiff,
requestDependencyScanningReports, requestDependencyScanningDiff,
openModal, openModal,
setModalData, setModalData,
requestDismissVulnerability, requestDismissVulnerability,
...@@ -247,15 +247,15 @@ describe('security reports actions', () => { ...@@ -247,15 +247,15 @@ describe('security reports actions', () => {
}); });
}); });
describe('requestDastReports', () => { describe('requestDastDiff', () => {
it('should commit request mutation', done => { it('should commit request mutation', done => {
testAction( testAction(
requestDastReports, requestDastDiff,
null, null,
mockedState, mockedState,
[ [
{ {
type: types.REQUEST_DAST_REPORTS, type: types.REQUEST_DAST_DIFF,
}, },
], ],
[], [],
...@@ -264,15 +264,15 @@ describe('security reports actions', () => { ...@@ -264,15 +264,15 @@ describe('security reports actions', () => {
}); });
}); });
describe('requestDependencyScanningReports', () => { describe('requestDependencyScanningDiff', () => {
it('should commit request mutation', done => { it('should commit request mutation', done => {
testAction( testAction(
requestDependencyScanningReports, requestDependencyScanningDiff,
null, null,
mockedState, mockedState,
[ [
{ {
type: types.REQUEST_DEPENDENCY_SCANNING_REPORTS, type: types.REQUEST_DEPENDENCY_SCANNING_DIFF,
}, },
], ],
[], [],
...@@ -1327,7 +1327,7 @@ describe('security reports actions', () => { ...@@ -1327,7 +1327,7 @@ describe('security reports actions', () => {
[], [],
[ [
{ {
type: 'requestDependencyScanningReports', type: 'requestDependencyScanningDiff',
}, },
{ {
type: 'receiveDependencyScanningDiffSuccess', type: 'receiveDependencyScanningDiffSuccess',
...@@ -1360,7 +1360,7 @@ describe('security reports actions', () => { ...@@ -1360,7 +1360,7 @@ describe('security reports actions', () => {
[], [],
[ [
{ {
type: 'requestDependencyScanningReports', type: 'requestDependencyScanningDiff',
}, },
{ {
type: 'receiveDependencyScanningDiffError', type: 'receiveDependencyScanningDiffError',
...@@ -1389,7 +1389,7 @@ describe('security reports actions', () => { ...@@ -1389,7 +1389,7 @@ describe('security reports actions', () => {
[], [],
[ [
{ {
type: 'requestDependencyScanningReports', type: 'requestDependencyScanningDiff',
}, },
{ {
type: 'receiveDependencyScanningDiffError', type: 'receiveDependencyScanningDiffError',
...@@ -1484,7 +1484,7 @@ describe('security reports actions', () => { ...@@ -1484,7 +1484,7 @@ describe('security reports actions', () => {
[], [],
[ [
{ {
type: 'requestDastReports', type: 'requestDastDiff',
}, },
{ {
type: 'receiveDastDiffSuccess', type: 'receiveDastDiffSuccess',
...@@ -1517,7 +1517,7 @@ describe('security reports actions', () => { ...@@ -1517,7 +1517,7 @@ describe('security reports actions', () => {
[], [],
[ [
{ {
type: 'requestDastReports', type: 'requestDastDiff',
}, },
{ {
type: 'receiveDastDiffError', type: 'receiveDastDiffError',
...@@ -1546,7 +1546,7 @@ describe('security reports actions', () => { ...@@ -1546,7 +1546,7 @@ describe('security reports actions', () => {
[], [],
[ [
{ {
type: 'requestDastReports', type: 'requestDastDiff',
}, },
{ {
type: 'receiveDastDiffError', type: 'receiveDastDiffError',
......
...@@ -44,9 +44,9 @@ describe('sast report actions', () => { ...@@ -44,9 +44,9 @@ describe('sast report actions', () => {
}); });
}); });
describe('requestReports', () => { describe('requestDiff', () => {
it(`should commit ${types.REQUEST_REPORTS}`, done => { it(`should commit ${types.REQUEST_DIFF}`, done => {
testAction(actions.requestReports, {}, state, [{ type: types.REQUEST_REPORTS }], [], done); testAction(actions.requestDiff, {}, state, [{ type: types.REQUEST_DIFF }], [], done);
}); });
}); });
...@@ -115,7 +115,7 @@ describe('sast report actions', () => { ...@@ -115,7 +115,7 @@ describe('sast report actions', () => {
{ ...rootState, ...state }, { ...rootState, ...state },
[], [],
[ [
{ type: 'requestReports' }, { type: 'requestDiff' },
{ {
type: 'receiveDiffSuccess', type: 'receiveDiffSuccess',
payload: { payload: {
...@@ -144,7 +144,7 @@ describe('sast report actions', () => { ...@@ -144,7 +144,7 @@ describe('sast report actions', () => {
{}, {},
{ ...rootState, ...state }, { ...rootState, ...state },
[], [],
[{ type: 'requestReports' }, { type: 'receiveDiffError' }], [{ type: 'requestDiff' }, { type: 'receiveDiffError' }],
done, done,
); );
}); });
...@@ -165,7 +165,7 @@ describe('sast report actions', () => { ...@@ -165,7 +165,7 @@ describe('sast report actions', () => {
{}, {},
{ ...rootState, ...state }, { ...rootState, ...state },
[], [],
[{ type: 'requestReports' }, { type: 'receiveDiffError' }], [{ type: 'requestDiff' }, { type: 'receiveDiffError' }],
done, done,
); );
}); });
......
...@@ -20,9 +20,9 @@ describe('sast module mutations', () => { ...@@ -20,9 +20,9 @@ describe('sast module mutations', () => {
}); });
}); });
describe(types.REQUEST_REPORTS, () => { describe(types.REQUEST_DIFF, () => {
it('should set the `isLoading` status to `true`', () => { it('should set the `isLoading` status to `true`', () => {
mutations[types.REQUEST_REPORTS](state); mutations[types.REQUEST_DIFF](state);
expect(state.isLoading).toBe(true); expect(state.isLoading).toBe(true);
}); });
......
...@@ -79,17 +79,17 @@ describe('security reports mutations', () => { ...@@ -79,17 +79,17 @@ describe('security reports mutations', () => {
}); });
}); });
describe('REQUEST_DAST_REPORTS', () => { describe('REQUEST_DAST_DIFF', () => {
it('should set dast loading flag to true', () => { it('should set dast loading flag to true', () => {
mutations[types.REQUEST_DAST_REPORTS](stateCopy); mutations[types.REQUEST_DAST_DIFF](stateCopy);
expect(stateCopy.dast.isLoading).toEqual(true); expect(stateCopy.dast.isLoading).toEqual(true);
}); });
}); });
describe('REQUEST_DEPENDENCY_SCANNING_REPORTS', () => { describe('REQUEST_DEPENDENCY_SCANNING_DIFF', () => {
it('should set dependency scanning loading flag to true', () => { it('should set dependency scanning loading flag to true', () => {
mutations[types.REQUEST_DEPENDENCY_SCANNING_REPORTS](stateCopy); mutations[types.REQUEST_DEPENDENCY_SCANNING_DIFF](stateCopy);
expect(stateCopy.dependencyScanning.isLoading).toEqual(true); expect(stateCopy.dependencyScanning.isLoading).toEqual(true);
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment