All files / app/assets/javascripts/ide/components repo_tabs.vue

16.66% Statements 1/6
0% Branches 0/1
0% Functions 0/2
16.66% Lines 1/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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 53    1x                                                                                                    
<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);
 
      Iif (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>