Commit 908dc8d9 authored by David O'Regan's avatar David O'Regan Committed by Olena Horal-Koretska

Fix alert details sidebar assignee CSS

parent ac4588fe
...@@ -27,25 +27,12 @@ export default { ...@@ -27,25 +27,12 @@ export default {
<gl-dropdown-item <gl-dropdown-item
:key="user.username" :key="user.username"
data-testid="assigneeDropdownItem" data-testid="assigneeDropdownItem"
class="assignee-dropdown-item gl-vertical-align-middle"
:active="active" :active="active"
active-class="is-active" active-class="is-active"
:avatar-url="user.avatar_url"
:secondary-text="`@${user.username}`"
@click="$emit('update-alert-assignees', user.username)" @click="$emit('update-alert-assignees', user.username)"
> >
<span class="gl-relative mr-2"> {{ user.name }}
<img
:alt="user.username"
:src="user.avatar_url"
:width="32"
class="avatar avatar-inline gl-m-0 s32"
data-qa-selector="avatar_image"
/>
</span>
<span class="d-flex gl-flex-direction-column gl-overflow-hidden">
<strong class="dropdown-menu-user-full-name">
{{ user.name }}
</strong>
<span class="dropdown-menu-user-username"> {{ user.username }}</span>
</span>
</gl-dropdown-item> </gl-dropdown-item>
</template> </template>
...@@ -13,7 +13,7 @@ import { ...@@ -13,7 +13,7 @@ import {
} from '@gitlab/ui'; } from '@gitlab/ui';
import { debounce } from 'lodash'; import { debounce } from 'lodash';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import { s__ } from '~/locale'; import { s__, __ } from '~/locale';
import alertSetAssignees from '../../graphql/mutations/alert_set_assignees.mutation.graphql'; import alertSetAssignees from '../../graphql/mutations/alert_set_assignees.mutation.graphql';
import SidebarAssignee from './sidebar_assignee.vue'; import SidebarAssignee from './sidebar_assignee.vue';
...@@ -96,7 +96,10 @@ export default { ...@@ -96,7 +96,10 @@ export default {
.sort((a, b) => (a.active === b.active ? 0 : a.active ? -1 : 1)); // eslint-disable-line no-nested-ternary .sort((a, b) => (a.active === b.active ? 0 : a.active ? -1 : 1)); // eslint-disable-line no-nested-ternary
}, },
dropdownClass() { dropdownClass() {
return this.isDropdownShowing ? 'show' : 'gl-display-none'; return this.isDropdownShowing ? 'dropdown-menu-selectable show' : 'gl-display-none';
},
dropDownTitle() {
return this.userName ?? __('Select assignee');
}, },
userListValid() { userListValid() {
return !this.isDropdownSearching && this.users.length > 0; return !this.isDropdownSearching && this.users.length > 0;
...@@ -217,81 +220,80 @@ export default { ...@@ -217,81 +220,80 @@ export default {
</a> </a>
</p> </p>
<div class="dropdown dropdown-menu-selectable" :class="dropdownClass"> <gl-dropdown
<gl-dropdown ref="dropdown"
ref="dropdown" :text="dropDownTitle"
:text="userName" class="gl-w-full"
class="w-100" :class="dropdownClass"
toggle-class="dropdown-menu-toggle" toggle-class="dropdown-menu-toggle"
@keydown.esc.native="hideDropdown" @keydown.esc.native="hideDropdown"
@hide="hideDropdown" @hide="hideDropdown"
> >
<p class="gl-new-dropdown-header-top"> <p class="gl-new-dropdown-header-top">
{{ __('Assign To') }} {{ __('Assign To') }}
</p> </p>
<gl-search-box-by-type v-model.trim="search" :placeholder="__('Search users')" /> <gl-search-box-by-type v-model.trim="search" :placeholder="__('Search users')" />
<div class="dropdown-content dropdown-body"> <div class="dropdown-content dropdown-body">
<template v-if="userListValid"> <template v-if="userListValid">
<gl-dropdown-item <gl-dropdown-item
:active="!userName" :active="!userName"
active-class="is-active" active-class="is-active"
@click="updateAlertAssignees('')" @click="updateAlertAssignees('')"
> >
{{ __('Unassigned') }} {{ __('Unassigned') }}
</gl-dropdown-item> </gl-dropdown-item>
<gl-dropdown-divider /> <gl-dropdown-divider />
<gl-dropdown-section-header>
{{ __('Assignee') }}
</gl-dropdown-section-header>
<sidebar-assignee
v-for="user in sortedUsers"
:key="user.username"
:user="user"
:active="user.active"
@update-alert-assignees="updateAlertAssignees"
/>
</template>
<p v-else-if="userListEmpty" class="mx-3 my-2">
{{ __('No Matching Results') }}
</p>
<gl-loading-icon v-else />
</div>
</gl-dropdown>
</div>
<gl-loading-icon v-if="isUpdating" :inline="true" /> <gl-dropdown-section-header>
<div v-else-if="!isDropdownShowing" class="value gl-m-0" :class="{ 'no-value': !userName }"> {{ __('Assignee') }}
<div v-if="userName" class="gl-display-inline-flex gl-mt-2" data-testid="assigned-users"> </gl-dropdown-section-header>
<span class="gl-relative mr-2"> <sidebar-assignee
<img v-for="user in sortedUsers"
:alt="userName" :key="user.username"
:src="userImg" :user="user"
:width="32" :active="user.active"
class="avatar avatar-inline gl-m-0 s32" @update-alert-assignees="updateAlertAssignees"
data-qa-selector="avatar_image"
/> />
</span> </template>
<span class="gl-display-flex gl-flex-direction-column gl-overflow-hidden"> <p v-else-if="userListEmpty" class="gl-mx-5 gl-my-4">
<strong class="dropdown-menu-user-full-name"> {{ __('No Matching Results') }}
{{ userFullName }} </p>
</strong> <gl-loading-icon v-else />
<span class="dropdown-menu-user-username">{{ userName }}</span>
</span>
</div> </div>
<span v-else class="gl-display-flex gl-align-items-center gl-line-height-normal"> </gl-dropdown>
{{ __('None') }} - </div>
<gl-button
class="gl-ml-2" <gl-loading-icon v-if="isUpdating" :inline="true" />
href="#" <div v-else-if="!isDropdownShowing" class="value gl-m-0" :class="{ 'no-value': !userName }">
variant="link" <div v-if="userName" class="gl-display-inline-flex gl-mt-2" data-testid="assigned-users">
data-testid="unassigned-users" <span class="gl-relative gl-mr-4">
@click="updateAlertAssignees(currentUser)" <img
> :alt="userName"
{{ __('assign yourself') }} :src="userImg"
</gl-button> :width="32"
class="avatar avatar-inline gl-m-0 s32"
data-qa-selector="avatar_image"
/>
</span>
<span class="gl-display-flex gl-flex-direction-column gl-overflow-hidden">
<strong class="dropdown-menu-user-full-name">
{{ userFullName }}
</strong>
<span class="dropdown-menu-user-username">@{{ userName }}</span>
</span> </span>
</div> </div>
<span v-else class="gl-display-flex gl-align-items-center gl-line-height-normal">
{{ __('None') }} -
<gl-button
class="gl-ml-2"
href="#"
variant="link"
data-testid="unassigned-users"
@click="updateAlertAssignees(currentUser)"
>
{{ __('assign yourself') }}
</gl-button>
</span>
</div> </div>
</div> </div>
</template> </template>
...@@ -17,22 +17,19 @@ ...@@ -17,22 +17,19 @@
} }
} }
.assignee-dropdown-item { .dropdown-item {
.dropdown-item { &:first-child {
@include gl-display-flex;
@include gl-align-items-center;
&::before { &::before {
top: 50% !important; @include gl-pt-0;
} }
}
&.is-active { &::before {
&:last-child { @include gl-pt-8;
@include gl-border-b-gray-100; }
@include gl-border-b-1;
@include gl-border-b-solid; .gl-new-dropdown-item-text-wrapper {
} @include gl-py-0;
}
} }
} }
......
---
title: Update alert details sidebar assignee dropdown to use correct styling and formatting
merge_request: 48285
author:
type: fixed
...@@ -179,7 +179,7 @@ describe('Alert Details Sidebar Assignees', () => { ...@@ -179,7 +179,7 @@ describe('Alert Details Sidebar Assignees', () => {
findAssigned() findAssigned()
.find('.dropdown-menu-user-username') .find('.dropdown-menu-user-username')
.text(), .text(),
).toBe('root'); ).toBe('@root');
}); });
}); });
}); });
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment