2018-05-09 12:01:36 +05:30
|
|
|
<script>
|
2021-04-17 20:07:23 +05:30
|
|
|
import { GlTabs } from '@gitlab/ui';
|
2020-11-24 15:15:51 +05:30
|
|
|
import { mapActions, mapGetters } from 'vuex';
|
2018-05-09 12:01:36 +05:30
|
|
|
import RepoTab from './repo_tab.vue';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
RepoTab,
|
2021-04-17 20:07:23 +05:30
|
|
|
GlTabs,
|
2018-05-09 12:01:36 +05:30
|
|
|
},
|
|
|
|
props: {
|
|
|
|
activeFile: {
|
|
|
|
type: Object,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
files: {
|
|
|
|
type: Array,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
viewer: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
2020-11-24 15:15:51 +05:30
|
|
|
computed: {
|
|
|
|
...mapGetters(['getUrlForPath']),
|
|
|
|
},
|
2018-05-09 12:01:36 +05:30
|
|
|
methods: {
|
|
|
|
...mapActions(['updateViewer', 'removePendingTab']),
|
|
|
|
openFileViewer(viewer) {
|
|
|
|
this.updateViewer(viewer);
|
|
|
|
|
|
|
|
if (this.activeFile.pending) {
|
|
|
|
return this.removePendingTab(this.activeFile).then(() => {
|
2020-11-24 15:15:51 +05:30
|
|
|
this.$router.push(this.getUrlForPath(this.activeFile.path));
|
2018-05-09 12:01:36 +05:30
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div class="multi-file-tabs">
|
2021-04-17 20:07:23 +05:30
|
|
|
<gl-tabs>
|
2019-02-15 15:39:39 +05:30
|
|
|
<repo-tab v-for="tab in files" :key="tab.key" :tab="tab" />
|
2021-04-17 20:07:23 +05:30
|
|
|
</gl-tabs>
|
2018-05-09 12:01:36 +05:30
|
|
|
</div>
|
|
|
|
</template>
|