BigW Consortium Gitlab

fixed staged/unstaged files not opening when another 1 is open

fixes eslint
parent 748cd767
......@@ -50,11 +50,7 @@ export default {
...mapGetters(['collapseButtonIcon', 'collapseButtonTooltip']),
},
methods: {
...mapActions([
'toggleRightPanelCollapsed',
'stageAllChanges',
'unstageAllChanges',
]),
...mapActions(['toggleRightPanelCollapsed', 'stageAllChanges', 'unstageAllChanges']),
actionBtnClicked() {
this[this.action]();
},
......@@ -131,6 +127,7 @@ export default {
<list-item
:file="file"
:action-component="itemActionComponent"
:key-prefix="title"
/>
</li>
</ul>
......
......@@ -19,6 +19,11 @@ export default {
type: String,
required: true,
},
keyPrefix: {
type: String,
required: false,
default: '',
},
},
computed: {
iconName() {
......@@ -39,7 +44,7 @@ export default {
openFileInEditor() {
return this.openPendingTab({
file: this.file,
keyPrefix: this.file.staged ? 'staged' : 'unstaged',
keyPrefix: this.keyPrefix.toLowerCase(),
}).then(changeViewer => {
if (changeViewer) {
this.updateViewer('diff');
......
......@@ -154,9 +154,10 @@ export default {
});
},
[types.ADD_PENDING_TAB](state, { file, keyPrefix = 'pending' }) {
const pendingTab = state.openFiles.find(f => f.path === file.path && f.pending);
const key = `${keyPrefix}-${file.key}`;
const pendingTab = state.openFiles.find(f => f.key === key && f.pending);
let openFiles = state.openFiles.map(f =>
Object.assign(f, { active: f.path === file.path, opened: false, active: false }),
Object.assign(f, { active: f.key === key, opened: false }),
);
if (!pendingTab) {
......@@ -172,7 +173,7 @@ export default {
active: true,
pending: true,
opened: true,
key: `${keyPrefix}-${f.key}`,
key,
});
}
......
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