Commit 04f4b868 authored by Phil Hughes's avatar Phil Hughes

update state when staging/unstaging all

parent cfb67193
......@@ -137,8 +137,8 @@ export default {
<button
v-tooltip
v-if="!stagedList"
:title="__('Unstage all changes')"
:aria-label="__('Unstage all changes')"
:title="__('Discard all changes')"
:aria-label="__('Discard all changes')"
:disabled="!filesLength"
:class="{
'disabled-content': !filesLength
......
......@@ -39,7 +39,7 @@ export default {
<template>
<div
v-once
class="multi-file-discard-btn"
class="multi-file-discard-btn d-flex"
>
<button
v-tooltip
......
......@@ -25,7 +25,7 @@ export default {
<template>
<div
v-once
class="multi-file-discard-btn"
class="multi-file-discard-btn d-flex"
>
<button
v-tooltip
......
......@@ -4,6 +4,7 @@ import { visitUrl } from '~/lib/utils/url_utility';
import flash from '~/flash';
import * as types from './mutation_types';
import FilesDecoratorWorker from './workers/files_decorator_worker';
import { stageKeys } from '../constants';
export const redirectToUrl = (_, url) => visitUrl(url);
......@@ -122,14 +123,28 @@ export const scrollToTab = () => {
});
};
export const stageAllChanges = ({ state, commit }) => {
export const stageAllChanges = ({ state, commit, dispatch }) => {
const activeFile = state.openFiles[0];
commit(types.SET_LAST_COMMIT_MSG, '');
state.changedFiles.forEach(file => commit(types.STAGE_CHANGE, file.path));
dispatch('openPendingTab', {
file: state.stagedFiles.find(f => f.path === activeFile.path),
keyPrefix: stageKeys.staged,
});
};
export const unstageAllChanges = ({ state, commit }) => {
export const unstageAllChanges = ({ state, commit, dispatch }) => {
const activeFile = state.openFiles[0];
state.stagedFiles.forEach(file => commit(types.UNSTAGE_CHANGE, file.path));
dispatch('openPendingTab', {
file: state.changedFiles.find(f => f.path === activeFile.path),
keyPrefix: stageKeys.unstaged,
});
};
export const updateViewer = ({ commit }, viewer) => {
......
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