Skip to content

Commit

Permalink
Add onBrush functionality to APM monitoring ui graphs (#24840) (#24850)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisronline authored Oct 30, 2018
1 parent 10d1274 commit 1c14d04
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
15 changes: 13 additions & 2 deletions x-pack/plugins/monitoring/public/views/apm/instance/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 = (
<ApmServerInstance
summary={data.apmSummary || {}}
metrics={data.metrics || {}}
onBrush={onBrush}
/>
);
super.renderReact(component);
Expand Down
15 changes: 13 additions & 2 deletions x-pack/plugins/monitoring/public/views/apm/overview/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 = (
<ApmOverview
{...data}
onBrush={onBrush}
/>
);
super.renderReact(component);
Expand Down

0 comments on commit 1c14d04

Please sign in to comment.