summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/repository/components/table/index.vue
blob: 7119861c7b3bbc04a3f71e8796883cce47c004b3 (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
59
60
61
62
63
64
65
<script>
import { GlLoadingIcon } from '@gitlab/ui';
import { sprintf, __ } from '../../../locale';
import getRefMixin from '../../mixins/get_ref';
import getFiles from '../../queries/getFiles.graphql';
import TableHeader from './header.vue';

export default {
  components: {
    GlLoadingIcon,
    TableHeader,
  },
  mixins: [getRefMixin],
  apollo: {
    files: {
      query: getFiles,
      variables() {
        return {
          ref: this.ref,
          path: this.path,
        };
      },
    },
  },
  props: {
    path: {
      type: String,
      required: true,
    },
  },
  data() {
    return {
      files: [],
    };
  },
  computed: {
    tableCaption() {
      return sprintf(
        __('Files, directories, and submodules in the path %{path} for commit reference %{ref}'),
        { path: this.path, ref: this.ref },
      );
    },
    isLoadingFiles() {
      return this.$apollo.queries.files.loading;
    },
  },
};
</script>

<template>
  <div class="tree-content-holder">
    <div class="table-holder bordered-box">
      <table class="table tree-table qa-file-tree" aria-live="polite">
        <caption class="sr-only">
          {{
            tableCaption
          }}
        </caption>
        <table-header />
        <tbody></tbody>
      </table>
      <gl-loading-icon v-if="isLoadingFiles" class="my-3" size="md" />
    </div>
  </div>
</template>