summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/work_items/components/notes/work_item_notes_activity_header.vue
blob: e700d5353e267a586df03496c2aa42002e83b027 (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
66
67
<script>
import ActivitySort from '~/work_items/components/notes/activity_sort.vue';
import ActivityFilter from '~/work_items/components/notes/activity_filter.vue';
import { s__ } from '~/locale';
import { ASC } from '~/notes/constants';
import { WORK_ITEM_NOTES_FILTER_ALL_NOTES } from '~/work_items/constants';

export default {
  i18n: {
    activityLabel: s__('WorkItem|Activity'),
  },
  components: {
    ActivitySort,
    ActivityFilter,
  },
  props: {
    disableActivityFilterSort: {
      type: Boolean,
      required: true,
    },
    sortOrder: {
      type: String,
      default: ASC,
      required: false,
    },
    workItemType: {
      type: String,
      required: true,
    },
    discussionFilter: {
      type: String,
      default: WORK_ITEM_NOTES_FILTER_ALL_NOTES,
      required: false,
    },
  },
  methods: {
    changeNotesSortOrder(direction) {
      this.$emit('changeSort', direction);
    },
    filterDiscussions(filterValue) {
      this.$emit('changeFilter', filterValue);
    },
  },
};
</script>

<template>
  <div
    class="gl-display-flex gl-justify-content-space-between gl-flex-wrap gl-pb-3 gl-align-items-center"
  >
    <h3 class="gl-font-base gl-m-0">{{ $options.i18n.activityLabel }}</h3>
    <div class="gl-display-flex gl-gap-3">
      <activity-filter
        :loading="disableActivityFilterSort"
        :work-item-type="workItemType"
        :discussion-filter="discussionFilter"
        @changeFilter="filterDiscussions"
      />
      <activity-sort
        :loading="disableActivityFilterSort"
        :sort-order="sortOrder"
        :work-item-type="workItemType"
        @changeSort="changeNotesSortOrder"
      />
    </div>
  </div>
</template>