From efeca311c58af4fb01afb3462a71e73aaacbe619 Mon Sep 17 00:00:00 2001 From: Chris Roberson Date: Tue, 30 Oct 2018 15:02:22 -0400 Subject: [PATCH] Add onBrush functionality to APM monitoring ui graphs (#24840) (#24849) --- .../monitoring/public/views/apm/instance/index.js | 15 +++++++++++++-- .../monitoring/public/views/apm/overview/index.js | 15 +++++++++++++-- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/monitoring/public/views/apm/instance/index.js b/x-pack/plugins/monitoring/public/views/apm/instance/index.js index 55f085429977bc..d815e2f537b4b6 100644 --- a/x-pack/plugins/monitoring/public/views/apm/instance/index.js +++ b/x-pack/plugins/monitoring/public/views/apm/instance/index.js @@ -11,12 +11,14 @@ */ import React from 'react'; +import moment from 'moment'; import { find, get } from 'lodash'; import uiRoutes from'ui/routes'; import { routeInitProvider } from 'plugins/monitoring/lib/route_init'; import template from './index.html'; import { MonitoringViewBaseController } from '../../base_controller'; import { ApmServerInstance } from '../../../components/apm/instance'; +import { timefilter } from 'ui/timefilter'; uiRoutes.when('/apm/instances/:uuid', { template, @@ -45,17 +47,26 @@ uiRoutes.when('/apm/instances/:uuid', { $injector }); + function onBrush({ xaxis }) { + timefilter.setTime({ + from: moment(xaxis.from), + to: moment(xaxis.to), + mode: 'absolute', + }); + } + $scope.$watch(() => this.data, data => { title($scope.cluster, `APM - ${get(data, 'apmSummary.name')}`); - this.renderReact(data); + this.renderReact(data, onBrush); }); } - renderReact(data) { + renderReact(data, onBrush) { const component = ( ); super.renderReact(component); diff --git a/x-pack/plugins/monitoring/public/views/apm/overview/index.js b/x-pack/plugins/monitoring/public/views/apm/overview/index.js index f3ab24b4712ce4..23a4581be76145 100644 --- a/x-pack/plugins/monitoring/public/views/apm/overview/index.js +++ b/x-pack/plugins/monitoring/public/views/apm/overview/index.js @@ -5,12 +5,14 @@ */ import React from 'react'; +import moment from 'moment'; import { find } from 'lodash'; import uiRoutes from'ui/routes'; import { routeInitProvider } from 'plugins/monitoring/lib/route_init'; import template from './index.html'; import { MonitoringViewBaseController } from '../../base_controller'; import { ApmOverview } from '../../../components/apm/overview'; +import { timefilter } from 'ui/timefilter'; uiRoutes.when('/apm', { template, @@ -37,15 +39,24 @@ uiRoutes.when('/apm', { $injector }); + function onBrush({ xaxis }) { + timefilter.setTime({ + from: moment(xaxis.from), + to: moment(xaxis.to), + mode: 'absolute', + }); + } + $scope.$watch(() => this.data, data => { - this.renderReact(data); + this.renderReact(data, onBrush); }); } - renderReact(data) { + renderReact(data, onBrush) { const component = ( ); super.renderReact(component);