Commit 6ea8bf46 authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Equally space stage name and median

Ensures that the stage title and median
value are equally spaced in the stage table.
parent b91f153b
...@@ -51,11 +51,11 @@ ...@@ -51,11 +51,11 @@
} }
.stage-header { .stage-header {
width: 18.5%; width: 18%;
} }
.median-header { .median-header {
width: 21.5%; width: 22%;
} }
.event-header { .event-header {
......
...@@ -56,6 +56,12 @@ export default { ...@@ -56,6 +56,12 @@ export default {
editable() { editable() {
return this.canEdit; return this.canEdit;
}, },
menuOpen() {
return this.canEdit && this.isHover;
},
openMenuClasses() {
return this.menuOpen ? 'd-flex flex-row justify-content-end' : '';
},
}, },
mounted() { mounted() {
this.checkIfTitleOverflows(); this.checkIfTitleOverflows();
...@@ -86,20 +92,25 @@ export default { ...@@ -86,20 +92,25 @@ export default {
<template> <template>
<li @click="handleSelectStage" @mouseover="handleHover(true)" @mouseleave="handleHover()"> <li @click="handleSelectStage" @mouseover="handleHover(true)" @mouseleave="handleHover()">
<stage-card-list-item :is-active="isActive" :can-edit="editable"> <stage-card-list-item
:is-active="isActive"
:can-edit="editable"
class="d-flex justify-space-between"
>
<div <div
ref="title" ref="title"
class="stage-nav-item-cell stage-name p-0 pr-2 text-truncate" class="stage-nav-item-cell text-truncate w-50 pr-2"
:class="{ 'font-weight-bold': isActive }" :class="{ 'font-weight-bold': isActive }"
> >
<span v-if="isTitleOverflowing" v-gl-tooltip.hover :title="title">{{ title }}</span> <span v-if="isTitleOverflowing" v-gl-tooltip.hover :title="title">{{ title }}</span>
<span v-else>{{ title }}</span> <span v-else>{{ title }}</span>
</div> </div>
<div class="stage-nav-item-cell stage-median mr-4"> <div class="stage-nav-item-cell w-50 d-flex justify-content-between">
<div ref="median" class="w-75 align-items-start">
<span v-if="hasValue">{{ median }}</span> <span v-if="hasValue">{{ median }}</span>
<span v-else class="stage-empty">{{ __('Not enough data') }}</span> <span v-else class="stage-empty">{{ __('Not enough data') }}</span>
</div> </div>
<div v-show="canEdit && isHover" ref="dropdown" class="dropdown"> <div v-show="menuOpen" ref="dropdown" :class="[openMenuClasses]" class="dropdown w-25">
<gl-button <gl-button
:title="__('More actions')" :title="__('More actions')"
class="more-actions-toggle btn btn-transparent p-0" class="more-actions-toggle btn btn-transparent p-0"
...@@ -141,6 +152,7 @@ export default { ...@@ -141,6 +152,7 @@ export default {
</template> </template>
</ul> </ul>
</div> </div>
</div>
</stage-card-list-item> </stage-card-list-item>
</li> </li>
</template> </template>
...@@ -118,7 +118,7 @@ export default { ...@@ -118,7 +118,7 @@ export default {
description: __( description: __(
'The value lying at the midpoint of a series of observed values. E.g., between 3, 5, 9, the median is 5. Between 3, 5, 7, 8, the median is (5+7)/2 = 6.', 'The value lying at the midpoint of a series of observed values. E.g., between 3, 5, 9, the median is 5. Between 3, 5, 7, 8, the median is (5+7)/2 = 6.',
), ),
classes: 'median-header', classes: 'median-header pl-4',
}, },
{ {
title: this.stageName, title: this.stageName,
......
...@@ -7,11 +7,6 @@ describe('StageNavItem', () => { ...@@ -7,11 +7,6 @@ describe('StageNavItem', () => {
const title = 'Rad stage'; const title = 'Rad stage';
const median = 50; const median = 50;
const $sel = {
title: '.stage-name',
median: '.stage-median',
};
function createComponent(props) { function createComponent(props) {
return shallowMount(StageNavItem, { return shallowMount(StageNavItem, {
propsData: { propsData: {
...@@ -23,8 +18,8 @@ describe('StageNavItem', () => { ...@@ -23,8 +18,8 @@ describe('StageNavItem', () => {
} }
let wrapper = null; let wrapper = null;
const findStageTitle = () => wrapper.find($sel.title); const findStageTitle = () => wrapper.find({ref: 'title'});
const findStageMedian = () => wrapper.find($sel.median); const findStageMedian = () => wrapper.find({ref: 'median'});
afterEach(() => { afterEach(() => {
wrapper.destroy(); wrapper.destroy();
......
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