diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-22 21:10:41 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-22 21:10:41 +0300 |
commit | e5f8220301d524167441f8fac5fd5fcf5fc31e1f (patch) | |
tree | 1b73a8c16126db5386b5bae59f61e990a457acc5 /app/assets/javascripts/super_sidebar/components | |
parent | c60010859638f577dab891358e83945561b35ad2 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/super_sidebar/components')
-rw-r--r-- | app/assets/javascripts/super_sidebar/components/user_menu.vue | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/app/assets/javascripts/super_sidebar/components/user_menu.vue b/app/assets/javascripts/super_sidebar/components/user_menu.vue index f129d067cdc..cc558edfd68 100644 --- a/app/assets/javascripts/super_sidebar/components/user_menu.vue +++ b/app/assets/javascripts/super_sidebar/components/user_menu.vue @@ -30,6 +30,8 @@ export default { oneOfGroupsRunningOutOfPipelineMinutes: s__('CurrentUser|One of your groups is running out'), gitlabNext: s__('CurrentUser|Switch to GitLab Next'), startTrial: s__('CurrentUser|Start an Ultimate trial'), + enterAdminMode: s__('CurrentUser|Enter Admin Mode'), + leaveAdminMode: s__('CurrentUser|Leave Admin Mode'), signOut: __('Sign out'), }, components: { @@ -142,6 +144,27 @@ export default { }, }; }, + enterAdminModeItem() { + return { + text: this.$options.i18n.enterAdminMode, + href: this.data.admin_mode.enter_admin_mode_url, + extraAttrs: { + ...USER_MENU_TRACKING_DEFAULTS, + 'data-track-label': 'enter_admin_mode', + }, + }; + }, + leaveAdminModeItem() { + return { + text: this.$options.i18n.leaveAdminMode, + href: this.data.admin_mode.leave_admin_mode_url, + extraAttrs: { + ...USER_MENU_TRACKING_DEFAULTS, + 'data-track-label': 'leave_admin_mode', + 'data-method': 'post', + }, + }; + }, signOutGroup() { return { items: [ @@ -184,6 +207,20 @@ export default { } : {}; }, + showEnterAdminModeItem() { + return ( + this.data.admin_mode.user_is_admin && + this.data.admin_mode.admin_mode_feature_enabled && + !this.data.admin_mode.admin_mode_active + ); + }, + showLeaveAdminModeItem() { + return ( + this.data.admin_mode.user_is_admin && + this.data.admin_mode.admin_mode_feature_enabled && + this.data.admin_mode.admin_mode_active + ); + }, showNotificationDot() { return this.data.pipeline_minutes?.show_notification_dot; }, @@ -248,7 +285,11 @@ export default { @shown="onShow" > <template #toggle> - <gl-button category="tertiary" class="user-bar-dropdown-toggle btn-with-notification"> + <gl-button + category="tertiary" + class="user-bar-dropdown-toggle btn-with-notification" + data-testid="user-menu-toggle" + > <span class="gl-sr-only">{{ toggleText }}</span> <gl-avatar :size="24" @@ -320,6 +361,17 @@ export default { :item="gitlabNextItem" data-testid="gitlab-next-item" /> + + <gl-disclosure-dropdown-item + v-if="showEnterAdminModeItem" + :item="enterAdminModeItem" + data-testid="enter-admin-mode-item" + /> + <gl-disclosure-dropdown-item + v-if="showLeaveAdminModeItem" + :item="leaveAdminModeItem" + data-testid="leave-admin-mode-item" + /> </gl-disclosure-dropdown-group> <gl-disclosure-dropdown-group |