debian-mirror-gitlab/app/assets/javascripts/super_sidebar/components/user_bar.vue

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

121 lines
3.5 KiB
Vue
Raw Normal View History

2023-03-17 16:20:25 +05:30
<script>
2023-05-27 22:25:52 +05:30
import { GlBadge, GlButton, GlTooltipDirective } from '@gitlab/ui';
2023-03-17 16:20:25 +05:30
import { __ } from '~/locale';
import SafeHtml from '~/vue_shared/directives/safe_html';
import logo from '../../../../views/shared/_logo.svg';
2023-05-27 22:25:52 +05:30
import { toggleSuperSidebarCollapsed } from '../super_sidebar_collapsed_state_manager';
2023-04-23 21:23:45 +05:30
import CreateMenu from './create_menu.vue';
2023-03-17 16:20:25 +05:30
import Counter from './counter.vue';
2023-04-23 21:23:45 +05:30
import MergeRequestMenu from './merge_request_menu.vue';
2023-05-27 22:25:52 +05:30
import UserMenu from './user_menu.vue';
2023-03-17 16:20:25 +05:30
export default {
2023-05-27 22:25:52 +05:30
// "GitLab Next" is a proper noun, so don't translate "Next"
/* eslint-disable-next-line @gitlab/require-i18n-strings */
NEXT_LABEL: 'Next',
2023-03-17 16:20:25 +05:30
logo,
components: {
Counter,
2023-05-27 22:25:52 +05:30
CreateMenu,
GlBadge,
GlButton,
2023-04-23 21:23:45 +05:30
MergeRequestMenu,
2023-05-27 22:25:52 +05:30
UserMenu,
2023-03-17 16:20:25 +05:30
},
i18n: {
2023-05-27 22:25:52 +05:30
collapseSidebar: __('Collapse sidebar'),
2023-04-23 21:23:45 +05:30
createNew: __('Create new...'),
2023-03-17 16:20:25 +05:30
issues: __('Issues'),
mergeRequests: __('Merge requests'),
2023-05-27 22:25:52 +05:30
search: __('Search'),
2023-03-17 16:20:25 +05:30
todoList: __('To-Do list'),
},
directives: {
2023-04-23 21:23:45 +05:30
GlTooltip: GlTooltipDirective,
2023-03-17 16:20:25 +05:30
SafeHtml,
},
2023-05-27 22:25:52 +05:30
inject: ['rootPath'],
2023-03-17 16:20:25 +05:30
props: {
sidebarData: {
type: Object,
required: true,
},
},
2023-05-27 22:25:52 +05:30
methods: {
collapseSidebar() {
toggleSuperSidebarCollapsed(true, true, true);
},
},
2023-03-17 16:20:25 +05:30
};
</script>
<template>
<div class="user-bar">
2023-05-27 22:25:52 +05:30
<div class="gl-display-flex gl-align-items-center gl-px-3 gl-py-2 gl-gap-2">
<a :href="rootPath">
<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"
>{{ $options.NEXT_LABEL }}</gl-badge
>
<div class="gl-flex-grow-1"></div>
<gl-button
v-gl-tooltip:super-sidebar.hover.bottom="$options.i18n.collapseSidebar"
:aria-label="$options.i18n.collapseSidebar"
icon="sidebar"
category="tertiary"
@click="collapseSidebar"
/>
2023-04-23 21:23:45 +05:30
<create-menu :groups="sidebarData.create_new_menu_groups" />
2023-05-27 22:25:52 +05:30
<gl-button
icon="search"
:aria-label="$options.i18n.search"
category="tertiary"
href="/search"
/>
<user-menu :data="sidebarData" />
2023-03-17 16:20:25 +05:30
</div>
<div class="gl-display-flex gl-justify-content-space-between gl-px-3 gl-py-2 gl-gap-2">
<counter
2023-04-23 21:23:45 +05:30
v-gl-tooltip:super-sidebar.hover.bottom="$options.i18n.issues"
class="gl-flex-basis-third"
2023-03-17 16:20:25 +05:30
icon="issues"
:count="sidebarData.assigned_open_issues_count"
:href="sidebarData.issues_dashboard_path"
:label="$options.i18n.issues"
/>
2023-04-23 21:23:45 +05:30
<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>
2023-03-17 16:20:25 +05:30
<counter
2023-04-23 21:23:45 +05:30
v-gl-tooltip:super-sidebar.hover.bottom="$options.i18n.todoList"
class="gl-flex-basis-third"
2023-03-17 16:20:25 +05:30
icon="todo-done"
:count="sidebarData.todos_pending_count"
href="/dashboard/todos"
:label="$options.i18n.todoList"
2023-05-27 22:25:52 +05:30
data-qa-selector="todos_shortcut_button"
2023-03-17 16:20:25 +05:30
/>
</div>
</div>
</template>