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

user_bar.vue « components « super_sidebar « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 34af935434c4222bff9b623d46a29a81b0781660 (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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<script>
import { GlBadge, GlButton, GlModalDirective, GlTooltipDirective } from '@gitlab/ui';
import { __, s__, sprintf } from '~/locale';
import SafeHtml from '~/vue_shared/directives/safe_html';
import logo from '../../../../views/shared/_logo.svg';
import { toggleSuperSidebarCollapsed } from '../super_sidebar_collapsed_state_manager';
import CreateMenu from './create_menu.vue';
import Counter from './counter.vue';
import MergeRequestMenu from './merge_request_menu.vue';
import UserMenu from './user_menu.vue';
import { SEARCH_MODAL_ID } from './global_search/constants';

export default {
  // "GitLab Next" is a proper noun, so don't translate "Next"
  /* eslint-disable-next-line @gitlab/require-i18n-strings */
  NEXT_LABEL: 'Next',
  logo,
  SEARCH_MODAL_ID,
  components: {
    Counter,
    CreateMenu,
    GlBadge,
    GlButton,
    MergeRequestMenu,
    UserMenu,
    SearchModal: () =>
      import(
        /* webpackChunkName: 'global_search_modal' */ './global_search/components/global_search.vue'
      ),
  },
  i18n: {
    collapseSidebar: __('Collapse sidebar'),
    createNew: __('Create new...'),
    homepage: __('Homepage'),
    issues: __('Issues'),
    mergeRequests: __('Merge requests'),
    navigationSidebar: __('Navigation sidebar'),
    search: __('Search'),
    searchKbdHelp: sprintf(
      s__('GlobalSearch|Search GitLab %{kbdOpen}/%{kbdClose}'),
      { kbdOpen: '<kbd>', kbdClose: '</kbd>' },
      false,
    ),
    todoList: __('To-Do list'),
  },
  directives: {
    GlTooltip: GlTooltipDirective,
    GlModal: GlModalDirective,
    SafeHtml,
  },
  inject: ['rootPath'],
  props: {
    hasCollapseButton: {
      default: true,
      type: Boolean,
      required: false,
    },
    sidebarData: {
      type: Object,
      required: true,
    },
  },
  methods: {
    collapseSidebar() {
      toggleSuperSidebarCollapsed(true, true, true);
    },
  },
};
</script>

<template>
  <div class="user-bar">
    <div class="gl-display-flex gl-align-items-center gl-px-3 gl-py-2">
      <a
        v-gl-tooltip:super-sidebar.hover.bottom="$options.i18n.homepage"
        :href="rootPath"
        :title="$options.i18n.homepage"
      >
        <img
          v-if="sidebarData.logo_url"
          data-testid="brand-header-custom-logo"
          :src="sidebarData.logo_url"
          class="gl-h-6"
        />
        <span v-else v-safe-html="$options.logo"></span>
      </a>
      <gl-badge
        v-if="sidebarData.gitlab_com_and_canary"
        variant="success"
        :href="sidebarData.canary_toggle_com_url"
        size="sm"
        class="gl-ml-2"
        >{{ $options.NEXT_LABEL }}</gl-badge
      >
      <div class="gl-flex-grow-1"></div>
      <gl-button
        v-if="hasCollapseButton"
        v-gl-tooltip:super-sidebar.hover.bottom="$options.i18n.collapseSidebar"
        aria-controls="super-sidebar"
        aria-expanded="true"
        :aria-label="$options.i18n.navigationSidebar"
        data-testid="super-sidebar-collapse-button"
        icon="sidebar"
        category="tertiary"
        @click="collapseSidebar"
      />
      <create-menu :groups="sidebarData.create_new_menu_groups" />

      <gl-button
        id="super-sidebar-search"
        v-gl-tooltip.bottom.hover.html="$options.i18n.searchKbdHelp"
        v-gl-modal="$options.SEARCH_MODAL_ID"
        data-testid="super-sidebar-search-button"
        icon="search"
        :aria-label="$options.i18n.search"
        category="tertiary"
      />
      <search-modal />

      <user-menu :data="sidebarData" />
    </div>
    <div class="gl-display-flex gl-justify-content-space-between gl-px-3 gl-py-2 gl-gap-2">
      <counter
        v-gl-tooltip:super-sidebar.hover.bottom="$options.i18n.issues"
        class="gl-flex-basis-third"
        icon="issues"
        :count="sidebarData.assigned_open_issues_count"
        :href="sidebarData.issues_dashboard_path"
        :label="$options.i18n.issues"
      />
      <merge-request-menu
        class="gl-flex-basis-third gl-display-block!"
        :items="sidebarData.merge_request_menu"
      >
        <counter
          v-gl-tooltip:super-sidebar.hover.bottom="$options.i18n.mergeRequests"
          class="gl-w-full"
          icon="merge-request-open"
          :count="sidebarData.total_merge_requests_count"
          :label="$options.i18n.mergeRequests"
        />
      </merge-request-menu>
      <counter
        v-gl-tooltip:super-sidebar.hover.bottom="$options.i18n.todoList"
        class="gl-flex-basis-third"
        icon="todo-done"
        :count="sidebarData.todos_pending_count"
        href="/dashboard/todos"
        :label="$options.i18n.todoList"
        data-qa-selector="todos_shortcut_button"
      />
    </div>
  </div>
</template>