Commit e6b77c83 authored by Thomas Randolph's avatar Thomas Randolph

Load the user settings endpoint into the diffs app

parent 1e2ae8e5
...@@ -89,6 +89,11 @@ export default { ...@@ -89,6 +89,11 @@ export default {
required: false, required: false,
default: '', default: '',
}, },
endpointUpdateUser: {
type: String,
required: false,
default: '',
},
projectPath: { projectPath: {
type: String, type: String,
required: true, required: true,
...@@ -283,6 +288,7 @@ export default { ...@@ -283,6 +288,7 @@ export default {
endpointBatch: this.endpointBatch, endpointBatch: this.endpointBatch,
endpointCoverage: this.endpointCoverage, endpointCoverage: this.endpointCoverage,
endpointCodequality: this.endpointCodequality, endpointCodequality: this.endpointCodequality,
endpointUpdateUser: this.endpointUpdateUser,
projectPath: this.projectPath, projectPath: this.projectPath,
dismissEndpoint: this.dismissEndpoint, dismissEndpoint: this.dismissEndpoint,
showSuggestPopover: this.showSuggestPopover, showSuggestPopover: this.showSuggestPopover,
......
...@@ -74,6 +74,7 @@ export default function initDiffsApp(store) { ...@@ -74,6 +74,7 @@ export default function initDiffsApp(store) {
endpointBatch: dataset.endpointBatch || '', endpointBatch: dataset.endpointBatch || '',
endpointCoverage: dataset.endpointCoverage || '', endpointCoverage: dataset.endpointCoverage || '',
endpointCodequality: dataset.endpointCodequality || '', endpointCodequality: dataset.endpointCodequality || '',
endpointUpdateUser: dataset.updateCurrentUserPath,
projectPath: dataset.projectPath, projectPath: dataset.projectPath,
helpPagePath: dataset.helpPagePath, helpPagePath: dataset.helpPagePath,
currentUser: JSON.parse(dataset.currentUserData) || {}, currentUser: JSON.parse(dataset.currentUserData) || {},
...@@ -116,6 +117,7 @@ export default function initDiffsApp(store) { ...@@ -116,6 +117,7 @@ export default function initDiffsApp(store) {
endpointBatch: this.endpointBatch, endpointBatch: this.endpointBatch,
endpointCoverage: this.endpointCoverage, endpointCoverage: this.endpointCoverage,
endpointCodequality: this.endpointCodequality, endpointCodequality: this.endpointCodequality,
endpointUpdateUser: this.endpointUpdateUser,
currentUser: this.currentUser, currentUser: this.currentUser,
projectPath: this.projectPath, projectPath: this.projectPath,
helpPagePath: this.helpPagePath, helpPagePath: this.helpPagePath,
......
...@@ -62,6 +62,7 @@ export const setBaseConfig = ({ commit }, options) => { ...@@ -62,6 +62,7 @@ export const setBaseConfig = ({ commit }, options) => {
endpointBatch, endpointBatch,
endpointCoverage, endpointCoverage,
endpointCodequality, endpointCodequality,
endpointUpdateUser,
projectPath, projectPath,
dismissEndpoint, dismissEndpoint,
showSuggestPopover, showSuggestPopover,
...@@ -75,6 +76,7 @@ export const setBaseConfig = ({ commit }, options) => { ...@@ -75,6 +76,7 @@ export const setBaseConfig = ({ commit }, options) => {
endpointBatch, endpointBatch,
endpointCoverage, endpointCoverage,
endpointCodequality, endpointCodequality,
endpointUpdateUser,
projectPath, projectPath,
dismissEndpoint, dismissEndpoint,
showSuggestPopover, showSuggestPopover,
......
...@@ -23,6 +23,7 @@ export default () => ({ ...@@ -23,6 +23,7 @@ export default () => ({
addedLines: null, addedLines: null,
removedLines: null, removedLines: null,
endpoint: '', endpoint: '',
endpointUpdateUser: '',
basePath: '', basePath: '',
commit: null, commit: null,
startVersion: null, // Null unless a target diff is selected for comparison that is not the "base" diff startVersion: null, // Null unless a target diff is selected for comparison that is not the "base" diff
......
...@@ -34,6 +34,7 @@ export default { ...@@ -34,6 +34,7 @@ export default {
endpointBatch, endpointBatch,
endpointCoverage, endpointCoverage,
endpointCodequality, endpointCodequality,
endpointUpdateUser,
projectPath, projectPath,
dismissEndpoint, dismissEndpoint,
showSuggestPopover, showSuggestPopover,
...@@ -47,6 +48,7 @@ export default { ...@@ -47,6 +48,7 @@ export default {
endpointBatch, endpointBatch,
endpointCoverage, endpointCoverage,
endpointCodequality, endpointCodequality,
endpointUpdateUser,
projectPath, projectPath,
dismissEndpoint, dismissEndpoint,
showSuggestPopover, showSuggestPopover,
......
...@@ -7,15 +7,17 @@ import diffFileMockData from '../mock_data/diff_file'; ...@@ -7,15 +7,17 @@ import diffFileMockData from '../mock_data/diff_file';
describe('DiffsStoreMutations', () => { describe('DiffsStoreMutations', () => {
describe('SET_BASE_CONFIG', () => { describe('SET_BASE_CONFIG', () => {
it('should set endpoint and project path', () => { it.each`
prop | value
${'endpoint'} | ${'/diffs/endpoint'}
${'projectPath'} | ${'/root/project'}
${'endpointUpdateUser'} | ${'/user/preferences'}
`('should set the $prop property into state', ({ prop, value }) => {
const state = {}; const state = {};
const endpoint = '/diffs/endpoint';
const projectPath = '/root/project';
mutations[types.SET_BASE_CONFIG](state, { endpoint, projectPath }); mutations[types.SET_BASE_CONFIG](state, { [prop]: value });
expect(state.endpoint).toEqual(endpoint); expect(state[prop]).toEqual(value);
expect(state.projectPath).toEqual(projectPath);
}); });
}); });
......
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