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

app.vue « components « sidebar « search « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 789efc8f09dbfc1432af9f5c85559962393b6ef9 (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
<script>
import { GlButton, GlLink } from '@gitlab/ui';
import { mapActions, mapState } from 'vuex';
import ConfidentialityFilter from './confidentiality_filter.vue';
import StatusFilter from './status_filter.vue';

export default {
  name: 'GlobalSearchSidebar',
  components: {
    GlButton,
    GlLink,
    StatusFilter,
    ConfidentialityFilter,
  },
  computed: {
    ...mapState(['urlQuery', 'sidebarDirty']),
    showReset() {
      return this.urlQuery.state || this.urlQuery.confidential;
    },
    showSidebar() {
      return this.urlQuery.scope === 'issues' || this.urlQuery.scope === 'merge_requests';
    },
  },
  methods: {
    ...mapActions(['applyQuery', 'resetQuery']),
  },
};
</script>

<template>
  <form
    class="search-sidebar gl-display-flex gl-flex-direction-column gl-mr-4 gl-mb-6 gl-mt-5"
    @submit.prevent="applyQuery"
  >
    <template v-if="showSidebar">
      <status-filter />
      <confidentiality-filter />
      <div class="gl-display-flex gl-align-items-center gl-mt-3">
        <gl-button category="primary" variant="confirm" type="submit" :disabled="!sidebarDirty">
          {{ __('Apply') }}
        </gl-button>
        <gl-link v-if="showReset" class="gl-ml-auto" @click="resetQuery">{{
          __('Reset filters')
        }}</gl-link>
      </div>
    </template>
  </form>
</template>