summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/groups/components/groups.vue
blob: d3482818183799e589c11550c18fd51d5efa0019 (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 tablePagination from '~/vue_shared/components/table_pagination.vue';
import eventHub from '../event_hub';
import { getParameterByName } from '../../lib/utils/common_utils';

export default {
  components: {
    tablePagination,
  },
  props: {
    groups: {
      type: Array,
      required: true,
    },
    pageInfo: {
      type: Object,
      required: true,
    },
    searchEmpty: {
      type: Boolean,
      required: true,
    },
    searchEmptyMessage: {
      type: String,
      required: true,
    },
  },
  methods: {
    change(page) {
      const filterGroupsParam = getParameterByName('filter_groups');
      const sortParam = getParameterByName('sort');
      eventHub.$emit('fetchPage', page, filterGroupsParam, sortParam);
    },
  },
};
</script>

<template>
  <div class="groups-list-tree-container">
    <div
      v-if="searchEmpty"
      class="has-no-search-results">
      {{searchEmptyMessage}}
    </div>
    <group-folder
      v-if="!searchEmpty"
      :groups="groups"
    />
    <table-pagination
      v-if="!searchEmpty"
      :change="change"
      :pageInfo="pageInfo"
    />
  </div>
</template>