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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-09-20 02:18:09 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-09-20 02:18:09 +0300
commit6ed4ec3e0b1340f96b7c043ef51d1b33bbe85fde (patch)
treedc4d20fe6064752c0bd323187252c77e0a89144b /app/assets/javascripts/notes/components/sort_discussion.vue
parent9868dae7fc0655bd7ce4a6887d4e6d487690eeed (diff)
Add latest changes from gitlab-org/gitlab@15-4-stable-eev15.4.0-rc42
Diffstat (limited to 'app/assets/javascripts/notes/components/sort_discussion.vue')
-rw-r--r--app/assets/javascripts/notes/components/sort_discussion.vue76
1 files changed, 0 insertions, 76 deletions
diff --git a/app/assets/javascripts/notes/components/sort_discussion.vue b/app/assets/javascripts/notes/components/sort_discussion.vue
deleted file mode 100644
index bcc5d12b7c8..00000000000
--- a/app/assets/javascripts/notes/components/sort_discussion.vue
+++ /dev/null
@@ -1,76 +0,0 @@
-<script>
-import { GlDropdown, GlDropdownItem } from '@gitlab/ui';
-import { mapActions, mapGetters } from 'vuex';
-import { __ } from '~/locale';
-import Tracking from '~/tracking';
-import LocalStorageSync from '~/vue_shared/components/local_storage_sync.vue';
-import { ASC, DESC } from '../constants';
-
-const SORT_OPTIONS = [
- { key: DESC, text: __('Newest first'), cls: 'js-newest-first' },
- { key: ASC, text: __('Oldest first'), cls: 'js-oldest-first' },
-];
-
-export default {
- SORT_OPTIONS,
- components: {
- GlDropdown,
- GlDropdownItem,
- LocalStorageSync,
- },
- mixins: [Tracking.mixin()],
- computed: {
- ...mapGetters(['sortDirection', 'persistSortOrder', 'noteableType']),
- selectedOption() {
- return SORT_OPTIONS.find(({ key }) => this.sortDirection === key);
- },
- dropdownText() {
- return this.selectedOption.text;
- },
- storageKey() {
- return `sort_direction_${this.noteableType.toLowerCase()}`;
- },
- },
- methods: {
- ...mapActions(['setDiscussionSortDirection']),
- fetchSortedDiscussions(direction) {
- if (this.isDropdownItemActive(direction)) {
- return;
- }
-
- this.setDiscussionSortDirection({ direction });
- this.track('change_discussion_sort_direction', { property: direction });
- },
- isDropdownItemActive(sortDir) {
- return sortDir === this.sortDirection;
- },
- },
-};
-</script>
-
-<template>
- <div
- data-testid="sort-discussion-filter"
- class="gl-mr-3 gl-display-inline-block gl-vertical-align-bottom full-width-mobile"
- >
- <local-storage-sync
- :value="sortDirection"
- :storage-key="storageKey"
- :persist="persistSortOrder"
- as-string
- @input="setDiscussionSortDirection({ direction: $event })"
- />
- <gl-dropdown :text="dropdownText" class="js-dropdown-text full-width-mobile">
- <gl-dropdown-item
- v-for="{ text, key, cls } in $options.SORT_OPTIONS"
- :key="key"
- :class="cls"
- :is-check-item="true"
- :is-checked="isDropdownItemActive(key)"
- @click="fetchSortedDiscussions(key)"
- >
- {{ text }}
- </gl-dropdown-item>
- </gl-dropdown>
- </div>
-</template>