gitlab-org--gitlab-foss/app/assets/javascripts/ide/components/repo_tabs.vue

47 lines
905 B
Vue
Raw Normal View History

<script>
import { mapActions } from 'vuex';
import RepoTab from './repo_tab.vue';
export default {
components: {
RepoTab,
},
props: {
activeFile: {
type: Object,
required: true,
},
files: {
type: Array,
required: true,
},
viewer: {
type: String,
required: true,
},
},
methods: {
...mapActions(['updateViewer', 'removePendingTab']),
openFileViewer(viewer) {
this.updateViewer(viewer);
if (this.activeFile.pending) {
2018-03-23 15:59:09 +00:00
return this.removePendingTab(this.activeFile).then(() => {
this.$router.push(`/project${this.activeFile.url}`);
});
}
2018-03-23 16:15:09 +00:00
return null;
},
},
};
</script>
<template>
<div class="multi-file-tabs">
<ul ref="tabsScroller" class="list-unstyled gl-mb-0">
2018-11-16 20:07:38 +00:00
<repo-tab v-for="tab in files" :key="tab.key" :tab="tab" />
</ul>
</div>
</template>