Commit fcbd16f2 authored by Illya Klymov's avatar Illya Klymov

Merge branch...

Merge branch '214675-reduce-epic-health-status-noise-in-epic-tree-when-no-statuses-are-assigned' into 'master'

Reduce epic health status noise in epic tree

See merge request gitlab-org/gitlab!31555
parents 738e5695 625577ac
...@@ -85,6 +85,10 @@ $item-weight-max-width: 48px; ...@@ -85,6 +85,10 @@ $item-weight-max-width: 48px;
white-space: nowrap; white-space: nowrap;
} }
.health-label-short {
display: none;
}
@include media-breakpoint-down(lg) { @include media-breakpoint-down(lg) {
.issue-count-badge { .issue-count-badge {
padding: 0; padding: 0;
...@@ -96,7 +100,6 @@ $item-weight-max-width: 48px; ...@@ -96,7 +100,6 @@ $item-weight-max-width: 48px;
.item-body, .item-body,
.card-header { .card-header {
.health-label-short { .health-label-short {
display: initial;
max-width: 0; max-width: 0;
} }
...@@ -131,6 +134,12 @@ $item-weight-max-width: 48px; ...@@ -131,6 +134,12 @@ $item-weight-max-width: 48px;
} }
} }
.card-header {
.health-label-short {
display: initial;
}
}
.item-meta { .item-meta {
flex-basis: 100%; flex-basis: 100%;
font-size: $gl-font-size; font-size: $gl-font-size;
...@@ -265,7 +274,6 @@ $item-weight-max-width: 48px; ...@@ -265,7 +274,6 @@ $item-weight-max-width: 48px;
max-width: 90%; max-width: 90%;
} }
.item-body,
.card-header { .card-header {
.health-label-short { .health-label-short {
max-width: 30px; max-width: 30px;
...@@ -306,7 +314,6 @@ $item-weight-max-width: 48px; ...@@ -306,7 +314,6 @@ $item-weight-max-width: 48px;
} }
} }
.item-body,
.card-header { .card-header {
.health-label-short { .health-label-short {
max-width: 60px; max-width: 60px;
...@@ -326,7 +333,6 @@ $item-weight-max-width: 48px; ...@@ -326,7 +333,6 @@ $item-weight-max-width: 48px;
} }
} }
.item-body,
.card-header { .card-header {
.health-label-short { .health-label-short {
max-width: 100px; max-width: 100px;
...@@ -364,10 +370,6 @@ $item-weight-max-width: 48px; ...@@ -364,10 +370,6 @@ $item-weight-max-width: 48px;
} }
} }
.health-label-short {
display: initial;
}
.health-label-long { .health-label-long {
display: none; display: none;
} }
...@@ -411,8 +413,7 @@ $item-weight-max-width: 48px; ...@@ -411,8 +413,7 @@ $item-weight-max-width: 48px;
} }
@media only screen and (min-width: 1500px) { @media only screen and (min-width: 1500px) {
.card-header, .card-header {
.item-body {
.health-label-short { .health-label-short {
display: none; display: none;
} }
......
...@@ -12,11 +12,22 @@ export default { ...@@ -12,11 +12,22 @@ export default {
default: () => {}, default: () => {},
}, },
}, },
computed: {
hasHealthStatus() {
const { issuesOnTrack, issuesNeedingAttention, issuesAtRisk } = this.healthStatus;
const totalHealthStatuses = issuesOnTrack + issuesNeedingAttention + issuesAtRisk;
return totalHealthStatuses > 0;
},
},
}; };
</script> </script>
<template> <template>
<div ref="healthStatus" class="health-status d-inline-flex align-items-center"> <div
v-if="hasHealthStatus"
ref="healthStatus"
class="health-status d-inline-flex align-items-center"
>
<gl-tooltip :target="() => $refs.healthStatus" placement="top"> <gl-tooltip :target="() => $refs.healthStatus" placement="top">
<span <span
><strong>{{ healthStatus.issuesOnTrack }}</strong ><strong>{{ healthStatus.issuesOnTrack }}</strong
...@@ -34,36 +45,34 @@ export default { ...@@ -34,36 +45,34 @@ export default {
> >
</gl-tooltip> </gl-tooltip>
<span class="gl-label gl-label-text-dark gl-label-sm status-on-track" <span class="gl-label gl-label-text-dark gl-label-sm status-on-track mr-1"
><span class="gl-label-text"> ><span class="gl-label-text">
{{ healthStatus.issuesOnTrack }} {{ healthStatus.issuesOnTrack }}
</span></span </span></span
> >
<span class="ml-1 mr-1 mr-md-2 text-secondary health-label-long">{{ <span class="mr-1 mr-md-2 text-secondary health-label-long">{{ __('issues on track') }}</span>
__('issues on track') <span class="mr-1 mr-md-2 text-secondary text-truncate health-label-short">{{
}}</span>
<span class="ml-1 mr-1 mr-md-2 text-secondary text-truncate health-label-short">{{
__('on track') __('on track')
}}</span> }}</span>
<span class="gl-label gl-label-text-dark gl-label-sm status-needs-attention" <span class="gl-label gl-label-text-dark gl-label-sm status-needs-attention mr-1"
><span class="gl-label-text"> ><span class="gl-label-text">
{{ healthStatus.issuesNeedingAttention }} {{ healthStatus.issuesNeedingAttention }}
</span></span </span></span
> >
<span class="ml-1 mr-1 mr-md-2 text-secondary health-label-long">{{ <span class="mr-1 mr-md-2 text-secondary health-label-long">{{
__('issues need attention') __('issues need attention')
}}</span> }}</span>
<span class="ml-1 mr-1 mr-md-2 text-secondary text-truncate health-label-short">{{ <span class="mr-1 mr-md-2 text-secondary text-truncate health-label-short">{{
__('need attention') __('need attention')
}}</span> }}</span>
<span class="gl-label gl-label-text-dark gl-label-sm status-at-risk" <span class="gl-label gl-label-text-dark gl-label-sm status-at-risk mr-1"
><span class="gl-label-text"> ><span class="gl-label-text">
{{ healthStatus.issuesAtRisk }} {{ healthStatus.issuesAtRisk }}
</span></span </span></span
> >
<span class="ml-1 text-secondary health-label-long">{{ __('issues at risk') }}</span> <span class="text-secondary health-label-long">{{ __('issues at risk') }}</span>
<span class="ml-1 text-secondary text-truncate health-label-short">{{ __('at risk') }}</span> <span class="text-secondary text-truncate health-label-short">{{ __('at risk') }}</span>
</div> </div>
</template> </template>
---
title: Reduce epic health status noise in epic tree
merge_request: 31555
author:
type: changed
...@@ -5,9 +5,7 @@ import { mockEpic1 } from '../mock_data'; ...@@ -5,9 +5,7 @@ import { mockEpic1 } from '../mock_data';
import EpicHealthStatus from 'ee/related_items_tree/components/epic_health_status.vue'; import EpicHealthStatus from 'ee/related_items_tree/components/epic_health_status.vue';
const createComponent = () => { const createComponent = ({ healthStatus = mockEpic1.healthStatus } = {}) => {
const { healthStatus } = mockEpic1;
return shallowMount(EpicHealthStatus, { return shallowMount(EpicHealthStatus, {
propsData: { propsData: {
healthStatus, healthStatus,
...@@ -32,27 +30,57 @@ describe('EpicHealthStatus', () => { ...@@ -32,27 +30,57 @@ describe('EpicHealthStatus', () => {
expect(tooltip).toExist(); expect(tooltip).toExist();
}); });
it('renders with label with both short and long text', () => { describe('when no statuses are assigned', () => {
const longLabels = wrapper.findAll('.health-label-long'); it('hasHealthStatus computed property returns false', () => {
const shortLabels = wrapper.findAll('.health-label-short'); expect(wrapper.vm.hasHealthStatus).toBe(false);
});
expect(longLabels).toHaveLength(3); it('does not render health labels', () => {
expect(shortLabels).toHaveLength(3); const longLabels = wrapper.findAll('.health-label-long');
const shortLabels = wrapper.findAll('.health-label-short');
const expectedLongLabels = ['issues on track', 'issues need attention', 'issues at risk']; expect(longLabels).toHaveLength(0);
expect(shortLabels).toHaveLength(0);
});
});
expect(longLabels).toHaveLength(expectedLongLabels.length); describe('when statuses are assigned', () => {
beforeEach(() => {
wrapper = createComponent({
healthStatus: {
issuesOnTrack: 1,
issuesNeedingAttention: 0,
issuesAtRisk: 0,
},
});
});
longLabels.wrappers.forEach((longLabelWrapper, index) => { it('hasHealthStatus computed property returns false', () => {
expect(longLabelWrapper.text()).toEqual(expectedLongLabels[index]); expect(wrapper.vm.hasHealthStatus).toBe(true);
}); });
const expectedShortLabels = ['on track', 'need attention', 'at risk']; it('renders label with both short and long text', () => {
const longLabels = wrapper.findAll('.health-label-long');
const shortLabels = wrapper.findAll('.health-label-short');
expect(longLabels).toHaveLength(3);
expect(shortLabels).toHaveLength(3);
const expectedLongLabels = ['issues on track', 'issues need attention', 'issues at risk'];
expect(longLabels).toHaveLength(expectedLongLabels.length);
longLabels.wrappers.forEach((longLabelWrapper, index) => {
expect(longLabelWrapper.text()).toEqual(expectedLongLabels[index]);
});
const expectedShortLabels = ['on track', 'need attention', 'at risk'];
expect(shortLabels).toHaveLength(expectedShortLabels.length); expect(shortLabels).toHaveLength(expectedShortLabels.length);
shortLabels.wrappers.forEach((shortLabelWrapper, index) => { shortLabels.wrappers.forEach((shortLabelWrapper, index) => {
expect(shortLabelWrapper.text()).toEqual(expectedShortLabels[index]); expect(shortLabelWrapper.text()).toEqual(expectedShortLabels[index]);
});
}); });
}); });
}); });
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