tree.js 791 字节
Newer Older
P
Phil Hughes 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
import * as types from '../mutation_types';

export default {
  [types.TOGGLE_TREE_OPEN](state, path) {
    Object.assign(state.entries[path], {
      opened: !state.entries[path].opened,
    });
  },
  [types.CREATE_TREE](state, { treePath }) {
    Object.assign(state, {
      trees: Object.assign({}, state.trees, {
        [treePath]: {
          tree: [],
          loading: true,
        },
      }),
    });
  },
  [types.SET_DIRECTORY_DATA](state, { data, treePath }) {
20 21
    Object.assign(state.trees[treePath], {
      tree: data,
P
Phil Hughes 已提交
22 23 24 25 26 27 28 29 30 31 32 33 34
    });
  },
  [types.SET_LAST_COMMIT_URL](state, { tree = state, url }) {
    Object.assign(tree, {
      lastCommitPath: url,
    });
  },
  [types.REMOVE_ALL_CHANGES_FILES](state) {
    Object.assign(state, {
      changedFiles: [],
    });
  },
};