Skip to content

Commit d7e0e53

Browse files
committed
feat: show label in report view
Signed-off-by: Olivier Vernin <olivier@vernin.me>
1 parent 5d81aa0 commit d7e0e53

1 file changed

Lines changed: 113 additions & 0 deletions

File tree

src/components/pipeline/report.vue

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,45 @@
7171
</v-col>
7272
</v-row>
7373

74+
<!-- Show labels -->
75+
<v-row v-if="pipeline.Pipeline.Labels && Object.keys(pipeline.Pipeline.Labels).length > 0">
76+
<v-col>
77+
<v-card variant="flat">
78+
<v-card-text class="labels-card">
79+
<div class="labels-header">Labels</div>
80+
<div class="labels-list">
81+
<div
82+
v-for="([key, value]) in sortedLabels"
83+
:key="key"
84+
class="label-row"
85+
>
86+
<div class="label-key-wrap">
87+
<v-icon
88+
size="18"
89+
color="grey-darken-1"
90+
class="label-icon"
91+
>
92+
mdi-label-outline
93+
</v-icon>
94+
<span class="label-key">{{ key }}</span>
95+
</div>
96+
<div class="label-value">{{ value }}</div>
97+
</div>
98+
</div>
99+
</v-card-text>
100+
</v-card>
101+
</v-col>
102+
</v-row>
103+
<v-row v-else>
104+
<v-col>
105+
<v-card variant="flat">
106+
<v-card-text>
107+
<p class="text-grey">No labels</p>
108+
</v-card-text>
109+
</v-card>
110+
</v-col>
111+
</v-row>
112+
74113
<!-- Show link to latest report -->
75114
<v-row
76115
v-if="latestReportByID"
@@ -268,6 +307,17 @@ export default {
268307
this.cancelAutoUpdate();
269308
},
270309
310+
computed: {
311+
sortedLabels() {
312+
const labels = this.pipeline?.Pipeline?.Labels
313+
if (!labels) {
314+
return []
315+
}
316+
317+
return Object.entries(labels).sort(([leftKey], [rightKey]) => leftKey.localeCompare(rightKey))
318+
},
319+
},
320+
271321
methods: {
272322
formatDate(rawDate) {
273323
if (!rawDate) {
@@ -441,4 +491,67 @@ export default {
441491
.metadata-table thead tr {
442492
background-color: rgba(0, 0, 0, 0.02);
443493
}
494+
495+
.labels-card {
496+
padding-top: 20px;
497+
}
498+
499+
.labels-header {
500+
font-size: 1.05rem;
501+
font-weight: 700;
502+
letter-spacing: 0.02em;
503+
margin-bottom: 12px;
504+
}
505+
506+
.labels-list {
507+
display: flex;
508+
flex-direction: column;
509+
gap: 10px;
510+
}
511+
512+
.label-row {
513+
display: flex;
514+
align-items: center;
515+
justify-content: space-between;
516+
gap: 16px;
517+
padding: 14px 16px;
518+
border-radius: 12px;
519+
background: linear-gradient(90deg, rgba(0, 0, 0, 0.03), rgba(0, 0, 0, 0.01));
520+
border: 1px solid rgba(0, 0, 0, 0.06);
521+
}
522+
523+
.label-key-wrap {
524+
display: flex;
525+
align-items: center;
526+
gap: 8px;
527+
min-width: 0;
528+
}
529+
530+
.label-icon {
531+
flex-shrink: 0;
532+
}
533+
534+
.label-key {
535+
font-weight: 700;
536+
color: rgba(0, 0, 0, 0.78);
537+
word-break: break-word;
538+
}
539+
540+
.label-value {
541+
font-weight: 500;
542+
color: rgba(0, 0, 0, 0.64);
543+
text-align: right;
544+
word-break: break-word;
545+
}
546+
547+
@media (max-width: 700px) {
548+
.label-row {
549+
flex-direction: column;
550+
align-items: flex-start;
551+
}
552+
553+
.label-value {
554+
text-align: left;
555+
}
556+
}
444557
</style>

0 commit comments

Comments
 (0)