Commit e01ee693 authored by Andrew Fontaine's avatar Andrew Fontaine

Merge branch 'lm-hover-state-sort' into 'master'

Add hovering icon for sorting columns on alert management list

See merge request gitlab-org/gitlab!33429
parents 1ab0075e b592f26a
...@@ -31,7 +31,8 @@ import updateAlertStatus from '../graphql/mutations/update_alert_status.graphql' ...@@ -31,7 +31,8 @@ import updateAlertStatus from '../graphql/mutations/update_alert_status.graphql'
import { convertToSnakeCase } from '~/lib/utils/text_utility'; import { convertToSnakeCase } from '~/lib/utils/text_utility';
import Tracking from '~/tracking'; import Tracking from '~/tracking';
const tdClass = 'table-col d-flex d-md-table-cell align-items-center'; const tdClass = 'table-col gl-display-flex d-md-table-cell gl-align-items-center';
const thClass = 'gl-hover-bg-blue-50';
const bodyTrClass = const bodyTrClass =
'gl-border-1 gl-border-t-solid gl-border-gray-100 gl-hover-bg-blue-50 gl-hover-cursor-pointer gl-hover-border-b-solid gl-hover-border-blue-200'; 'gl-border-1 gl-border-t-solid gl-border-gray-100 gl-hover-bg-blue-50 gl-hover-cursor-pointer gl-hover-border-b-solid gl-hover-border-blue-200';
...@@ -57,32 +58,34 @@ export default { ...@@ -57,32 +58,34 @@ export default {
key: 'severity', key: 'severity',
label: s__('AlertManagement|Severity'), label: s__('AlertManagement|Severity'),
tdClass: `${tdClass} rounded-top text-capitalize`, tdClass: `${tdClass} rounded-top text-capitalize`,
thClass,
sortable: true, sortable: true,
}, },
{ {
key: 'startedAt', key: 'startedAt',
label: s__('AlertManagement|Start time'), label: s__('AlertManagement|Start time'),
thClass: 'js-started-at', thClass: `${thClass} js-started-at`,
tdClass, tdClass,
sortable: true, sortable: true,
}, },
{ {
key: 'endedAt', key: 'endedAt',
label: s__('AlertManagement|End time'), label: s__('AlertManagement|End time'),
thClass,
tdClass, tdClass,
sortable: true, sortable: true,
}, },
{ {
key: 'title', key: 'title',
label: s__('AlertManagement|Alert'), label: s__('AlertManagement|Alert'),
thClass: 'w-30p alert-title', thClass: `${thClass} w-30p gl-pointer-events-none`,
tdClass, tdClass,
sortable: false, sortable: false,
}, },
{ {
key: 'eventCount', key: 'eventCount',
label: s__('AlertManagement|Events'), label: s__('AlertManagement|Events'),
thClass: 'text-right gl-pr-9 w-3rem', thClass: `${thClass} text-right gl-pr-9 w-3rem`,
tdClass: `${tdClass} text-md-right`, tdClass: `${tdClass} text-md-right`,
sortable: true, sortable: true,
}, },
...@@ -93,7 +96,7 @@ export default { ...@@ -93,7 +96,7 @@ export default {
}, },
{ {
key: 'status', key: 'status',
thClass: 'w-15p', thClass: `${thClass} w-15p`,
label: s__('AlertManagement|Status'), label: s__('AlertManagement|Status'),
tdClass: `${tdClass} rounded-bottom`, tdClass: `${tdClass} rounded-bottom`,
sortable: true, sortable: true,
...@@ -194,6 +197,7 @@ export default { ...@@ -194,6 +197,7 @@ export default {
pagination: initialPaginationState, pagination: initialPaginationState,
sortBy: 'startedAt', sortBy: 'startedAt',
sortDesc: true, sortDesc: true,
sortDirection: 'desc',
}; };
}, },
computed: { computed: {
...@@ -239,11 +243,11 @@ export default { ...@@ -239,11 +243,11 @@ export default {
this.filteredByStatus = status; this.filteredByStatus = status;
}, },
fetchSortedData({ sortBy, sortDesc }) { fetchSortedData({ sortBy, sortDesc }) {
const sortDirection = sortDesc ? 'DESC' : 'ASC'; const sortingDirection = sortDesc ? 'DESC' : 'ASC';
const sortColumn = convertToSnakeCase(sortBy).toUpperCase(); const sortingColumn = convertToSnakeCase(sortBy).toUpperCase();
this.resetPagination(); this.resetPagination();
this.sort = `${sortColumn}_${sortDirection}`; this.sort = `${sortingColumn}_${sortingDirection}`;
}, },
updateAlertStatus(status, iid) { updateAlertStatus(status, iid) {
this.$apollo this.$apollo
...@@ -344,6 +348,7 @@ export default { ...@@ -344,6 +348,7 @@ export default {
stacked="md" stacked="md"
:tbody-tr-class="tbodyTrClass" :tbody-tr-class="tbodyTrClass"
:no-local-sorting="true" :no-local-sorting="true"
:sort-direction="sortDirection"
:sort-desc.sync="sortDesc" :sort-desc.sync="sortDesc"
:sort-by.sync="sortBy" :sort-by.sync="sortBy"
sort-icon-left sort-icon-left
......
...@@ -8,22 +8,43 @@ ...@@ -8,22 +8,43 @@
outline: none; outline: none;
} }
> :not([aria-sort='none']).b-table-sort-icon-left:hover::before {
content: '' !important;
}
td, td,
th { th {
// TODO: There is no gl-pl-9 utlity for this padding, to be done and then removed. // TODO: There is no gl-pl-9 utlity for this padding, to be done and then removed.
padding-left: 1.25rem; padding-left: 1.25rem;
@include gl-py-5; @include gl-py-5;
@include gl-outline-none; @include gl-outline-none;
@include gl-relative;
&.alert-title {
@include gl-pointer-events-none;
}
} }
th { th {
background-color: transparent; background-color: transparent;
font-weight: $gl-font-weight-bold; font-weight: $gl-font-weight-bold;
color: $gl-gray-600; color: $gl-gray-600;
&:hover::before {
left: 3%;
top: 34%;
@include gl-absolute;
content: url("data:image/svg+xml,%3Csvg \
xmlns='http://www.w3.org/2000/svg' \
width='14' height='14' viewBox='0 0 16 \
16'%3E%3Cpath fill='%23BABABA' fill-rule='evenodd' \
d='M11.707085,11.7071 L7.999975,15.4142 L4.292875,11.7071 \
C3.902375,11.3166 3.902375,10.6834 \
4.292875,10.2929 C4.683375,9.90237 \
5.316575,9.90237 5.707075,10.2929 \
L6.999975,11.5858 L6.999975,2 C6.999975,1.44771 \
7.447695,1 7.999975,1 C8.552255,1 8.999975,1.44771 \
8.999975,2 L8.999975,11.5858 L10.292865,10.2929 \
C10.683395,9.90237 11.316555,9.90237 11.707085,10.2929 \
C12.097605,10.6834 12.097605,11.3166 11.707085,11.7071 \
Z'/%3E%3C/svg%3E%0A");
}
} }
} }
......
---
title: Add hovering icon for sorting columns on alert management list
merge_request: 33429
author:
type: other
...@@ -344,11 +344,11 @@ describe('AlertManagementList', () => { ...@@ -344,11 +344,11 @@ describe('AlertManagementList', () => {
it('updates sort with new direction and column key', () => { it('updates sort with new direction and column key', () => {
findSeverityColumnHeader().trigger('click'); findSeverityColumnHeader().trigger('click');
expect(wrapper.vm.$data.sort).toBe('SEVERITY_ASC'); expect(wrapper.vm.$data.sort).toBe('SEVERITY_DESC');
findSeverityColumnHeader().trigger('click'); findSeverityColumnHeader().trigger('click');
expect(wrapper.vm.$data.sort).toBe('SEVERITY_DESC'); expect(wrapper.vm.$data.sort).toBe('SEVERITY_ASC');
}); });
}); });
......
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