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: cd289be4c057b5d081f88c0dd83a62f82ece9f5e (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
<script>
import { mapState, mapGetters } from 'vuex';
import ScopeLegacyNavigation from '~/search/sidebar/components/scope_legacy_navigation.vue';
import ScopeSidebarNavigation from '~/search/sidebar/components/scope_sidebar_navigation.vue';
import SidebarPortal from '~/super_sidebar/components/sidebar_portal.vue';
import { SCOPE_ISSUES, SCOPE_MERGE_REQUESTS, SCOPE_BLOB } from '../constants';
import IssuesFilters from './issues_filters.vue';
import LanguageFilter from './language_filter/index.vue';

export default {
  name: 'GlobalSearchSidebar',
  components: {
    IssuesFilters,
    ScopeLegacyNavigation,
    ScopeSidebarNavigation,
    LanguageFilter,
    SidebarPortal,
  },
  computed: {
    // useSidebarNavigation refers to whether the new left sidebar navigation is enabled
    ...mapState(['useSidebarNavigation']),
    ...mapGetters(['currentScope']),
    showIssueAndMergeFilters() {
      return this.currentScope === SCOPE_ISSUES || this.currentScope === SCOPE_MERGE_REQUESTS;
    },
    showBlobFilter() {
      return this.currentScope === SCOPE_BLOB;
    },
    showLabelFilter() {
      return this.currentScope === SCOPE_ISSUES;
    },
    showScopeNavigation() {
      // showScopeNavigation refers to whether the scope navigation should be shown
      // while the legacy navigation is being used and there are no search results the scope navigation has to be hidden
      return Boolean(this.currentScope);
    },
  },
};
</script>

<template>
  <section v-if="useSidebarNavigation">
    <sidebar-portal>
      <scope-sidebar-navigation />
      <issues-filters v-if="showIssueAndMergeFilters" />
      <language-filter v-if="showBlobFilter" />
    </sidebar-portal>
  </section>
  <section
    v-else-if="showScopeNavigation"
    class="search-sidebar gl-display-flex gl-flex-direction-column gl-md-mr-5 gl-mb-6 gl-mt-5"
  >
    <scope-legacy-navigation />
    <issues-filters v-if="showIssueAndMergeFilters" />
    <language-filter v-if="showBlobFilter" />
  </section>
</template>