debian-mirror-gitlab/app/assets/javascripts/monitoring/components/graph/legend.vue

63 lines
1.6 KiB
Vue
Raw Normal View History

2018-03-17 18:26:18 +05:30
<script>
2018-05-09 12:01:36 +05:30
import TrackLine from './track_line.vue';
import TrackInfo from './track_info.vue';
2018-03-17 18:26:18 +05:30
2018-05-09 12:01:36 +05:30
export default {
components: {
TrackLine,
TrackInfo,
},
props: {
legendTitle: {
type: String,
required: true,
2018-03-17 18:26:18 +05:30
},
2018-05-09 12:01:36 +05:30
timeSeries: {
type: Array,
required: true,
},
},
methods: {
isStable(track) {
2018-03-17 18:26:18 +05:30
return {
2018-05-09 12:01:36 +05:30
'prometheus-table-row-highlight': track.trackName !== 'Canary' && track.renderCanary,
2018-03-17 18:26:18 +05:30
};
},
2018-05-09 12:01:36 +05:30
},
};
2018-03-17 18:26:18 +05:30
</script>
<template>
2018-05-09 12:01:36 +05:30
<div class="prometheus-graph-legends prepend-left-10">
<table class="prometheus-table">
<tr
2018-03-27 19:54:05 +05:30
v-for="(series, index) in timeSeries"
2018-05-09 12:01:36 +05:30
v-if="series.shouldRenderLegend"
2018-11-08 19:23:39 +05:30
:key="index"
2018-05-09 12:01:36 +05:30
:class="isStable(series)"
2018-03-17 18:26:18 +05:30
>
2018-05-09 12:01:36 +05:30
<td>
<strong v-if="series.renderCanary">{{ series.trackName }}</strong>
</td>
<track-line :track="series" />
2019-02-15 15:39:39 +05:30
<td v-if="timeSeries.length > 1" class="legend-metric-title">
<track-info v-if="series.metricTag" :track="series" />
<track-info v-else :track="series">
2018-05-09 12:01:36 +05:30
<strong>{{ legendTitle }}</strong> series {{ index + 1 }}
</track-info>
</td>
<td v-else>
<track-info :track="series">
<strong>{{ legendTitle }}</strong>
</track-info>
</td>
<template v-for="(track, trackIndex) in series.tracksLegend">
2019-02-15 15:39:39 +05:30
<track-line :key="`track-line-${trackIndex}`" :track="track" />
2018-05-09 12:01:36 +05:30
<td :key="`track-info-${trackIndex}`">
2019-02-15 15:39:39 +05:30
<track-info :track="track" class="legend-metric-title" />
2018-05-09 12:01:36 +05:30
</td>
</template>
</tr>
</table>
</div>
2018-03-17 18:26:18 +05:30
</template>