summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/ide/components/ide_review.vue
blob: fb0747439c42f078a963f9cfe42d3049c03d645a (plain)
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
54
55
<script>
import { mapGetters, mapState, mapActions } from 'vuex';
import IdeTreeList from './ide_tree_list.vue';
import EditorModeDropdown from './editor_mode_dropdown.vue';

export default {
  components: {
    IdeTreeList,
    EditorModeDropdown,
  },
  computed: {
    ...mapGetters(['currentMergeRequest']),
    ...mapState(['viewer']),
  },
  mounted() {
    this.$nextTick(() => {
      this.updateViewer(this.currentMergeRequest ? 'mrdiff' : 'diff');
    });
  },
  methods: {
    ...mapActions(['updateViewer']),
  },
};
</script>

<template>
  <ide-tree-list
    :viewer-type="viewer"
    header-class="ide-review-header"
    :disable-action-dropdown="true"
  >
    <template
      slot="header"
    >
      <div class="ide-review-button-holder">
        {{ __('Review') }}
        <editor-mode-dropdown
          v-if="currentMergeRequest"
          :viewer="viewer"
          :merge-request-id="currentMergeRequest.iid"
          @click="updateViewer"
        />
      </div>
      <div class="prepend-top-5 ide-review-sub-header">
        <template v-if="!currentMergeRequest || viewer === 'diff'">
          {{ __('Lastest changes') }}
        </template>
        <template v-else-if="currentMergeRequest && viewer === 'mrdiff'">
          Merge request
          (<a :href="currentMergeRequest.web_url">!{{ currentMergeRequest.iid }}</a>)
        </template>
      </div>
    </template>
  </ide-tree-list>
</template>