1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
<script>
import { GlTabs } from '@gitlab/ui';
// eslint-disable-next-line no-restricted-imports
import { mapActions, mapGetters } from 'vuex';
import RepoTab from './repo_tab.vue';
export default {
components: {
RepoTab,
GlTabs,
},
props: {
activeFile: {
type: Object,
required: true,
},
files: {
type: Array,
required: true,
},
viewer: {
type: String,
required: true,
},
},
computed: {
...mapGetters(['getUrlForPath']),
},
methods: {
...mapActions(['updateViewer', 'removePendingTab']),
openFileViewer(viewer) {
this.updateViewer(viewer);
if (this.activeFile.pending) {
return this.removePendingTab(this.activeFile).then(() => {
this.$router.push(this.getUrlForPath(this.activeFile.path));
});
}
return null;
},
},
};
</script>
<template>
<div class="multi-file-tabs">
<gl-tabs>
<repo-tab v-for="tab in files" :key="tab.key" :tab="tab" />
</gl-tabs>
</div>
</template>
|