Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/monitoring/components/charts/time_series.vue')
-rw-r--r--app/assets/javascripts/monitoring/components/charts/time_series.vue38
1 files changed, 19 insertions, 19 deletions
diff --git a/app/assets/javascripts/monitoring/components/charts/time_series.vue b/app/assets/javascripts/monitoring/components/charts/time_series.vue
index 9041b01088c..bf40e8f448e 100644
--- a/app/assets/javascripts/monitoring/components/charts/time_series.vue
+++ b/app/assets/javascripts/monitoring/components/charts/time_series.vue
@@ -6,7 +6,7 @@ import dateFormat from 'dateformat';
import { s__, __ } from '~/locale';
import { getSvgIconPathContent } from '~/lib/utils/icon_utils';
import Icon from '~/vue_shared/components/icon.vue';
-import { chartHeight, lineTypes, lineWidths, dateFormats, tooltipTypes } from '../../constants';
+import { chartHeight, lineTypes, lineWidths, dateFormats } from '../../constants';
import { getYAxisOptions, getChartGrid, getTooltipFormatter } from './options';
import { annotationsYAxis, generateAnnotationsSeries } from './annotations';
import { makeDataSeries } from '~/helpers/monitor_helper';
@@ -20,7 +20,6 @@ const events = {
};
export default {
- tooltipTypes,
components: {
GlAreaChart,
GlLineChart,
@@ -262,6 +261,21 @@ export default {
isTooltipOfType(tooltipType, defaultType) {
return tooltipType === defaultType;
},
+ /**
+ * This method is triggered when hovered over a single markPoint.
+ *
+ * The annotations title timestamp should match the data tooltip
+ * title.
+ *
+ * @params {Object} params markPoint object
+ * @returns {Object}
+ */
+ formatAnnotationsTooltipText(params) {
+ return {
+ title: dateFormat(params.data?.tooltipData?.title, dateFormats.default),
+ content: params.data?.tooltipData?.content,
+ };
+ },
formatTooltipText(params) {
this.tooltip.title = dateFormat(params.value, dateFormats.default);
this.tooltip.content = [];
@@ -270,15 +284,10 @@ export default {
if (dataPoint.value) {
const [, yVal] = dataPoint.value;
this.tooltip.type = dataPoint.name;
- if (this.isTooltipOfType(this.tooltip.type, this.$options.tooltipTypes.deployments)) {
+ if (this.tooltip.type === 'deployments') {
const { data = {} } = dataPoint;
this.tooltip.sha = data?.tooltipData?.sha;
this.tooltip.commitUrl = data?.tooltipData?.commitUrl;
- } else if (
- this.isTooltipOfType(this.tooltip.type, this.$options.tooltipTypes.annotations)
- ) {
- const { data } = dataPoint;
- this.tooltip.content.push(data?.tooltipData?.description);
} else {
const { seriesName, color, dataIndex } = dataPoint;
@@ -356,6 +365,7 @@ export default {
:data="chartData"
:option="chartOptions"
:format-tooltip-text="formatTooltipText"
+ :format-annotations-tooltip-text="formatAnnotationsTooltipText"
:thresholds="thresholds"
:width="width"
:height="height"
@@ -364,7 +374,7 @@ export default {
@created="onChartCreated"
@updated="onChartUpdated"
>
- <template v-if="isTooltipOfType(tooltip.type, this.$options.tooltipTypes.deployments)">
+ <template v-if="tooltip.type === 'deployments'">
<template slot="tooltipTitle">
{{ __('Deployed') }}
</template>
@@ -373,16 +383,6 @@ export default {
<gl-link :href="tooltip.commitUrl">{{ tooltip.sha }}</gl-link>
</div>
</template>
- <template v-else-if="isTooltipOfType(tooltip.type, this.$options.tooltipTypes.annotations)">
- <template slot="tooltipTitle">
- <div class="text-nowrap">
- {{ tooltip.title }}
- </div>
- </template>
- <div slot="tooltipContent" class="d-flex align-items-center">
- {{ tooltip.content.join('\n') }}
- </div>
- </template>
<template v-else>
<template slot="tooltipTitle">
<div class="text-nowrap">