Welcome to mirror list, hosted at ThFree Co, Russian Federation.

list_item.vue « commit_sidebar « components « ide « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e443bd4e3fa7ff099ef495e6f33a946d717271e5 (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
56
57
58
<script>
import { mapActions } from 'vuex';
import icon from '~/vue_shared/components/icon.vue';
import router from '../../ide_router';

export default {
  components: {
    icon,
  },
  props: {
    file: {
      type: Object,
      required: true,
    },
  },
  computed: {
    iconName() {
      return this.file.tempFile ? 'file-addition' : 'file-modified';
    },
    iconClass() {
      return `multi-file-${this.file.tempFile ? 'addition' : 'modified'} append-right-8`;
    },
  },
  methods: {
    ...mapActions(['discardFileChanges', 'updateViewer', 'openPendingTab']),
    openFileInEditor(file) {
      return this.updateViewer('diff').then(() => {
        this.openPendingTab(file);
        router.push(`/project/${file.projectId}/tree/master/`);
      });
    },
  },
};
</script>

<template>
  <div class="multi-file-commit-list-item">
    <button
      type="button"
      class="multi-file-commit-list-path"
      @click="openFileInEditor(file)">
      <span class="multi-file-commit-list-file-path">
        <icon
          :name="iconName"
          :size="16"
          :css-classes="iconClass"
        />{{ file.path }}
      </span>
    </button>
    <button
      type="button"
      class="btn btn-blank multi-file-discard-btn"
      @click="discardFileChanges(file.path)"
    >
      Discard
    </button>
  </div>
</template>