2022-01-26 12:08:38 +05:30
|
|
|
import Vue from 'vue';
|
2018-05-09 12:01:36 +05:30
|
|
|
import * as types from '../mutation_types';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
[types.SET_CURRENT_PROJECT](state, currentProjectId) {
|
|
|
|
Object.assign(state, {
|
|
|
|
currentProjectId,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
[types.SET_PROJECT](state, { projectPath, project }) {
|
|
|
|
// Add client side properties
|
|
|
|
Object.assign(project, {
|
|
|
|
tree: [],
|
|
|
|
branches: {},
|
|
|
|
mergeRequests: {},
|
|
|
|
active: true,
|
|
|
|
});
|
|
|
|
|
|
|
|
Object.assign(state, {
|
2020-05-24 23:13:21 +05:30
|
|
|
projects: { ...state.projects, [projectPath]: project },
|
2018-05-09 12:01:36 +05:30
|
|
|
});
|
|
|
|
},
|
2019-09-04 21:01:54 +05:30
|
|
|
[types.TOGGLE_EMPTY_STATE](state, { projectPath, value }) {
|
|
|
|
Object.assign(state.projects[projectPath], {
|
|
|
|
empty_repo: value,
|
|
|
|
});
|
|
|
|
},
|
2022-01-26 12:08:38 +05:30
|
|
|
[types.UPDATE_PROJECT](state, { projectPath, props }) {
|
|
|
|
const project = state.projects[projectPath];
|
|
|
|
|
|
|
|
if (!project || !props) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Object.keys(props).forEach((key) => {
|
|
|
|
Vue.set(project, key, props[key]);
|
|
|
|
});
|
|
|
|
},
|
2018-05-09 12:01:36 +05:30
|
|
|
};
|