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

work_item_notes_activity_header.vue « notes « components « work_items « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1578c78ac4fef0a427f0518eeeccb8f2131dbe17 (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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<script>
import WorkItemActivitySortFilter from '~/work_items/components/notes/work_item_activity_sort_filter.vue';
import { s__ } from '~/locale';
import { ASC } from '~/notes/constants';
import {
  WORK_ITEM_NOTES_FILTER_ALL_NOTES,
  WORK_ITEM_ACTIVITY_FILTER_OPTIONS,
  WORK_ITEM_NOTES_FILTER_KEY,
  WORK_ITEM_ACTIVITY_SORT_OPTIONS,
  WORK_ITEM_NOTES_SORT_ORDER_KEY,
} from '~/work_items/constants';

export default {
  i18n: {
    activityLabel: s__('WorkItem|Activity'),
  },
  components: {
    WorkItemActivitySortFilter,
  },
  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);
    },
  },
  WORK_ITEM_ACTIVITY_FILTER_OPTIONS,
  WORK_ITEM_NOTES_FILTER_KEY,
  WORK_ITEM_NOTES_FILTER_ALL_NOTES,
  WORK_ITEM_ACTIVITY_SORT_OPTIONS,
  WORK_ITEM_NOTES_SORT_ORDER_KEY,
  ASC,
};
</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">
      <work-item-activity-sort-filter
        :work-item-type="workItemType"
        :loading="disableActivityFilterSort"
        :sort-filter-prop="discussionFilter"
        :items="$options.WORK_ITEM_ACTIVITY_FILTER_OPTIONS"
        :storage-key="$options.WORK_ITEM_NOTES_FILTER_KEY"
        :default-sort-filter-prop="$options.WORK_ITEM_NOTES_FILTER_ALL_NOTES"
        tracking-action="work_item_notes_filter_changed"
        tracking-label="item_track_notes_filtering"
        filter-event="changeFilter"
        data-testid="work-item-filter"
        @changeFilter="filterDiscussions"
      />
      <work-item-activity-sort-filter
        :work-item-type="workItemType"
        :loading="disableActivityFilterSort"
        :sort-filter-prop="sortOrder"
        :items="$options.WORK_ITEM_ACTIVITY_SORT_OPTIONS"
        :storage-key="$options.WORK_ITEM_NOTES_SORT_ORDER_KEY"
        :default-sort-filter-prop="$options.ASC"
        tracking-action="work_item_notes_sort_order_changed"
        tracking-label="item_track_notes_sorting"
        filter-event="changeSort"
        data-testid="work-item-sort"
        @changeSort="changeNotesSortOrder"
      />
    </div>
  </div>
</template>