Skip to content

Commit df3d0a2

Browse files
committed
Tree view: Fix misalignment of job details triangle at larger font sizes
1 parent 896f14b commit df3d0a2

File tree

2 files changed

+19
-16
lines changed

2 files changed

+19
-16
lines changed

src/components/cylc/tree/TreeItem.vue

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
4141
<!-- the node value -->
4242
<!-- TODO: revisit these values that can be replaced by constants later (and in other components too). -->
4343
<slot name="cyclepoint" v-if="node.type === 'cycle'">
44-
<div :class="getNodeDataClass()" @click="nodeClicked">
44+
<div :class="nodeDataClass" @click="nodeClicked">
4545
<!-- NOTE: cycle point nodes don't have any data associated with them
4646
at present so we must use the root family node for the task icon.
4747
We don't use this for the v-cylc-object as that would set the node
@@ -56,7 +56,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
5656
</div>
5757
</slot>
5858
<slot name="family-proxy" v-else-if="node.type === 'family'">
59-
<div :class="getNodeDataClass()" @click="nodeClicked">
59+
<div :class="nodeDataClass" @click="nodeClicked">
6060
<Task
6161
v-cylc-object="node"
6262
:key="node.id"
@@ -66,7 +66,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
6666
</div>
6767
</slot>
6868
<slot name="task-proxy" v-else-if="node.type === 'task'">
69-
<div :class="getNodeDataClass()" @click="nodeClicked">
69+
<div :class="nodeDataClass" @click="nodeClicked">
7070
<!-- Task summary -->
7171
<Task
7272
v-cylc-object="node"
@@ -89,7 +89,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
8989
</div>
9090
</slot>
9191
<slot name="job" v-else-if="node.type === 'job'">
92-
<div :class="getNodeDataClass()" @click="nodeClicked">
92+
<div :class="nodeDataClass" @click="nodeClicked">
9393
<Job
9494
v-cylc-object="node"
9595
:key="node.id"
@@ -184,7 +184,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
184184
name="node"
185185
v-else
186186
>
187-
<div :class="getNodeDataClass()">
187+
<div :class="nodeDataClass">
188188
<span
189189
v-if="node && node.node"
190190
@click="nodeClicked"
@@ -263,6 +263,9 @@ const passthroughEvents = [
263263
'tree-item-clicked'
264264
]
265265
266+
/** Margin between expand/collapse btn & node content */
267+
const nodeContentPad = 6 // px
268+
266269
export default {
267270
name: 'TreeItem',
268271
@@ -383,10 +386,14 @@ export default {
383386
expanded: this.isExpanded
384387
}
385388
},
389+
nodeDataClass () {
390+
return ['node-data', `node-data-${this.node.type}`]
391+
},
386392
expandCollapseBtnStyle () {
387393
return {
388394
// set visibility 'hidden' to ensure element takes up space
389-
visibility: this.hasChildren ? null : 'hidden'
395+
visibility: this.hasChildren ? null : 'hidden',
396+
marginRight: `${nodeContentPad}px`,
390397
}
391398
},
392399
/**
@@ -402,7 +409,7 @@ export default {
402409
/** Make the job details triangle point to the job icon */
403410
leafTriangleStyle () {
404411
return {
405-
'margin-left': `${this.nodeIndentation}px`
412+
'margin-left': `${this.nodeIndentation + nodeContentPad}px`
406413
}
407414
},
408415
jobMessageOutputs () {
@@ -453,12 +460,6 @@ export default {
453460
nodeClicked (e) {
454461
this.$emit('tree-item-clicked', this)
455462
},
456-
getNodeDataClass () {
457-
const classes = {}
458-
classes['node-data'] = true
459-
classes[`node-data-${this.node.type}`] = true
460-
return classes
461-
},
462463
latestJob
463464
}
464465
}

src/styles/cylc/_tree.scss

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ $line-height: 1.8em;
3131
*/
3232
$visible-outputs: 5;
3333

34+
/* Task/job icon size. */
35+
$icon-size: 1.2em;
36+
3437
@mixin active-state() {
3538
background-color: $active-color;
3639
&:hover {
@@ -70,7 +73,6 @@ $visible-outputs: 5;
7073
}
7174

7275
.node-data {
73-
margin-left: 6px;
7476
display: flex;
7577
flex-wrap: nowrap;
7678
.node-summary {
@@ -83,14 +85,14 @@ $visible-outputs: 5;
8385
.c-task, .c-job {
8486
display: flex;
8587
align-items: center;
86-
font-size: 1.2em;
88+
font-size: $icon-size;
8789
}
8890
}
8991
.type {
9092
margin-right: 10px;
9193
}
9294

93-
$arrow-size: 15px;
95+
$arrow-size: calc($icon-size / 2);
9496
$leaf-background-color: map-get(settings.$grey, 'lighten-3');
9597

9698
.leaf {

0 commit comments

Comments
 (0)