diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-25 09:06:06 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-25 09:06:06 +0000 |
commit | 0ccbbf166fb77f59989f05ae9bba31952d218583 (patch) | |
tree | b7b180c52b02c3909d508e5821faed978b08a177 /app/assets/javascripts/monitoring/components/charts/time_series.vue | |
parent | 8f8838a1d9d045fd75cfa70c4f7daa4f080084e9 (diff) | |
download | gitlab-ce-0ccbbf166fb77f59989f05ae9bba31952d218583.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/monitoring/components/charts/time_series.vue')
-rw-r--r-- | app/assets/javascripts/monitoring/components/charts/time_series.vue | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/app/assets/javascripts/monitoring/components/charts/time_series.vue b/app/assets/javascripts/monitoring/components/charts/time_series.vue index 78fe575717a..434debb67f5 100644 --- a/app/assets/javascripts/monitoring/components/charts/time_series.vue +++ b/app/assets/javascripts/monitoring/components/charts/time_series.vue @@ -1,17 +1,15 @@ <script> import { s__, __ } from '~/locale'; -import { GlLink, GlButton, GlTooltip } from '@gitlab/ui'; +import { GlLink, GlButton, GlTooltip, GlResizeObserverDirective } from '@gitlab/ui'; import { GlAreaChart, GlLineChart, GlChartSeriesLabel } from '@gitlab/ui/dist/charts'; import dateFormat from 'dateformat'; -import { debounceByAnimationFrame, roundOffFloat } from '~/lib/utils/common_utils'; +import { roundOffFloat } from '~/lib/utils/common_utils'; import { getSvgIconPathContent } from '~/lib/utils/icon_utils'; import Icon from '~/vue_shared/components/icon.vue'; import { chartHeight, graphTypes, lineTypes, symbolSizes, dateFormats } from '../../constants'; import { makeDataSeries } from '~/helpers/monitor_helper'; import { graphDataValidatorForValues } from '../../utils'; -let debouncedResize; - export default { components: { GlAreaChart, @@ -22,6 +20,9 @@ export default { GlLink, Icon, }, + directives: { + GlResizeObserverDirective, + }, inheritAttrs: false, props: { graphData: { @@ -29,10 +30,6 @@ export default { required: true, validator: graphDataValidatorForValues.bind(null, false), }, - containerWidth: { - type: Number, - required: true, - }, deploymentData: { type: Array, required: false, @@ -206,21 +203,13 @@ export default { return `${this.graphData.y_label}`; }, }, - watch: { - containerWidth: 'onResize', - }, mounted() { const graphTitleEl = this.$refs.graphTitle; if (graphTitleEl && graphTitleEl.scrollWidth > graphTitleEl.offsetWidth) { this.showTitleTooltip = true; } }, - beforeDestroy() { - window.removeEventListener('resize', debouncedResize); - }, created() { - debouncedResize = debounceByAnimationFrame(this.onResize); - window.addEventListener('resize', debouncedResize); this.setSvg('rocket'); this.setSvg('scroll-handle'); }, @@ -276,7 +265,7 @@ export default { </script> <template> - <div class="prometheus-graph"> + <div v-gl-resize-observer-directive="onResize" class="prometheus-graph"> <div class="prometheus-graph-header"> <h5 ref="graphTitle" |