Commit cee39799 authored by Fatih Acet's avatar Fatih Acet

Merge branch 'jivanvl-update-heatmap-component' into 'master'

Update the heatmap chart component

See merge request gitlab-org/gitlab!23927
parents 2d0cf663 693020b2
<script>
import { GlResizeObserverDirective } from '@gitlab/ui';
import { GlHeatmap } from '@gitlab/ui/dist/charts';
import dateformat from 'dateformat';
import PrometheusHeader from '../shared/prometheus_header.vue';
import ResizableChartContainer from '~/vue_shared/components/resizable_chart/resizable_chart_container.vue';
import { graphDataValidatorForValues } from '../../utils';
export default {
components: {
GlHeatmap,
ResizableChartContainer,
PrometheusHeader,
},
directives: {
GlResizeObserverDirective,
},
props: {
graphData: {
type: Object,
required: true,
validator: graphDataValidatorForValues.bind(null, false),
},
containerWidth: {
type: Number,
required: true,
},
},
data() {
return {
width: 0,
};
},
computed: {
chartData() {
......@@ -52,22 +55,27 @@ export default {
return this.graphData.metrics[0];
},
},
methods: {
onResize() {
if (this.$refs.heatmapChart) return;
const { width } = this.$refs.heatmapChart.$el.getBoundingClientRect();
this.width = width;
},
},
};
</script>
<template>
<div class="prometheus-graph col-12 col-lg-6">
<div v-gl-resize-observer-directive="onResize" class="prometheus-graph col-12 col-lg-6">
<prometheus-header :graph-title="graphData.title" />
<resizable-chart-container>
<gl-heatmap
ref="heatmapChart"
v-bind="$attrs"
:data-series="chartData"
:x-axis-name="xAxisName"
:y-axis-name="yAxisName"
:x-axis-labels="xAxisLabels"
:y-axis-labels="yAxisLabels"
:width="containerWidth"
/>
</resizable-chart-container>
<gl-heatmap
ref="heatmapChart"
v-bind="$attrs"
:data-series="chartData"
:x-axis-name="xAxisName"
:y-axis-name="yAxisName"
:x-axis-labels="xAxisLabels"
:y-axis-labels="yAxisLabels"
:width="width"
/>
</div>
</template>
......@@ -116,7 +116,6 @@ export default {
<monitor-heatmap-chart
v-else-if="isPanelType('heatmap') && graphDataHasMetrics"
:graph-data="graphData"
:container-width="dashboardWidth"
/>
<monitor-column-chart
v-else-if="isPanelType('column') && graphDataHasMetrics"
......
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