diff options
author | Tim Zallmann <tzallmann@gitlab.com> | 2017-12-21 15:05:47 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-12-21 15:05:47 +0000 |
commit | 213e91d43926f09eb969859aa2c306eeb127deb4 (patch) | |
tree | 4904c49f664a8ad040e593e5ac354a36b7033f60 /app/assets/javascripts/ide/stores/mutations.js | |
parent | 889c7081f1c8bea2cd2cf7d50854babd7df92f72 (diff) | |
download | gitlab-ce-213e91d43926f09eb969859aa2c306eeb127deb4.tar.gz |
Resolve "Decouple multi-file editor from file list"
Diffstat (limited to 'app/assets/javascripts/ide/stores/mutations.js')
-rw-r--r-- | app/assets/javascripts/ide/stores/mutations.js | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/app/assets/javascripts/ide/stores/mutations.js b/app/assets/javascripts/ide/stores/mutations.js new file mode 100644 index 00000000000..2fed9019cb6 --- /dev/null +++ b/app/assets/javascripts/ide/stores/mutations.js @@ -0,0 +1,65 @@ +import * as types from './mutation_types'; +import projectMutations from './mutations/project'; +import fileMutations from './mutations/file'; +import treeMutations from './mutations/tree'; +import branchMutations from './mutations/branch'; + +export default { + [types.SET_INITIAL_DATA](state, data) { + Object.assign(state, data); + }, + [types.SET_PREVIEW_MODE](state) { + Object.assign(state, { + currentBlobView: 'repo-preview', + }); + }, + [types.SET_EDIT_MODE](state) { + Object.assign(state, { + currentBlobView: 'repo-editor', + }); + }, + [types.TOGGLE_LOADING](state, entry) { + Object.assign(entry, { + loading: !entry.loading, + }); + }, + [types.TOGGLE_EDIT_MODE](state) { + Object.assign(state, { + editMode: !state.editMode, + }); + }, + [types.TOGGLE_DISCARD_POPUP](state, discardPopupOpen) { + Object.assign(state, { + discardPopupOpen, + }); + }, + [types.SET_ROOT](state, isRoot) { + Object.assign(state, { + isRoot, + isInitialRoot: isRoot, + }); + }, + [types.SET_LEFT_PANEL_COLLAPSED](state, collapsed) { + Object.assign(state, { + leftPanelCollapsed: collapsed, + }); + }, + [types.SET_RIGHT_PANEL_COLLAPSED](state, collapsed) { + Object.assign(state, { + rightPanelCollapsed: collapsed, + }); + }, + [types.SET_LAST_COMMIT_DATA](state, { entry, lastCommit }) { + Object.assign(entry.lastCommit, { + id: lastCommit.commit.id, + url: lastCommit.commit_path, + message: lastCommit.commit.message, + author: lastCommit.commit.author_name, + updatedAt: lastCommit.commit.authored_date, + }); + }, + ...projectMutations, + ...fileMutations, + ...treeMutations, + ...branchMutations, +}; |