Skip to content

Commit ab17374

Browse files
Merge branch 'master' into dev/drilldowns/url-drilldown-helpers
2 parents 2b14a9f + dd33002 commit ab17374

File tree

35 files changed

+6607
-1011
lines changed

35 files changed

+6607
-1011
lines changed

src/plugins/timelion/public/app.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import { initSavedObjectSaveAsCheckBoxDirective } from './directives/saved_objec
4444
import { initSavedObjectFinderDirective } from './directives/saved_object_finder';
4545
import { initTimelionTabsDirective } from './components/timelionhelp_tabs_directive';
4646
import { initTimelionTDeprecationDirective } from './components/timelion_deprecation_directive';
47+
import { initTimelionTopNavDirective } from './components/timelion_top_nav_directive';
4748
import { initInputFocusDirective } from './directives/input_focus';
4849
import { Chart } from './directives/chart/chart';
4950
import { TimelionInterval } from './directives/timelion_interval/timelion_interval';
@@ -86,6 +87,7 @@ export function initTimelionApp(app, deps) {
8687
initInputFocusDirective(app);
8788
initTimelionTabsDirective(app, deps);
8889
initTimelionTDeprecationDirective(app, deps);
90+
initTimelionTopNavDirective(app, deps);
8991
initSavedObjectFinderDirective(app, savedSheetLoader, deps.core.uiSettings);
9092
initSavedObjectSaveAsCheckBoxDirective(app);
9193
initCellsDirective(app);

src/plugins/timelion/public/application.ts

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,7 @@ import {
3636
import { getTimeChart } from './panels/timechart/timechart';
3737
import { Panel } from './panels/panel';
3838

39-
import {
40-
configureAppAngularModule,
41-
createTopNavDirective,
42-
createTopNavHelper,
43-
} from '../../kibana_legacy/public';
39+
import { configureAppAngularModule } from '../../kibana_legacy/public';
4440
import { TimelionPluginStartDependencies } from './plugin';
4541
import { DataPublicPluginStart } from '../../data/public';
4642
// @ts-ignore
@@ -120,11 +116,9 @@ function mountTimelionApp(appBasePath: string, element: HTMLElement, deps: Rende
120116
function createLocalAngularModule(deps: RenderDeps) {
121117
createLocalI18nModule();
122118
createLocalIconModule();
123-
createLocalTopNavModule(deps.plugins.navigation);
124119

125120
const dashboardAngularModule = angular.module(moduleName, [
126121
...thirdPartyAngularDependencies,
127-
'app/timelion/TopNav',
128122
'app/timelion/I18n',
129123
'app/timelion/icon',
130124
]);
@@ -137,13 +131,6 @@ function createLocalIconModule() {
137131
.directive('icon', (reactDirective) => reactDirective(EuiIcon));
138132
}
139133

140-
function createLocalTopNavModule(navigation: TimelionPluginStartDependencies['navigation']) {
141-
angular
142-
.module('app/timelion/TopNav', ['react'])
143-
.directive('kbnTopNav', createTopNavDirective)
144-
.directive('kbnTopNavHelper', createTopNavHelper(navigation.ui));
145-
}
146-
147134
function createLocalI18nModule() {
148135
angular
149136
.module('app/timelion/I18n', [])
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
import React from 'react';
20+
21+
export function initTimelionTopNavDirective(app, deps) {
22+
app.directive('timelionTopNav', function (reactDirective) {
23+
return reactDirective(
24+
(props) => {
25+
const { TopNavMenu } = deps.plugins.navigation.ui;
26+
return (
27+
<deps.core.i18n.Context>
28+
<TopNavMenu
29+
appName="timelion"
30+
showTopNavMenu
31+
config={props.topNavMenu}
32+
setMenuMountPoint={deps.mountParams.setHeaderActionMenu}
33+
onQuerySubmit={props.onTimeUpdate}
34+
screenTitle="timelion"
35+
showDatePicker
36+
showFilterBar={false}
37+
showQueryInput={false}
38+
showSaveQuery={false}
39+
showSearchBar
40+
useDefaultBehaviors
41+
/>
42+
</deps.core.i18n.Context>
43+
);
44+
},
45+
[
46+
['topNavMenu', { watchDepth: 'reference' }],
47+
['onTimeUpdate', { watchDepth: 'reference' }],
48+
],
49+
{
50+
restrict: 'E',
51+
scope: {
52+
topNavMenu: '=',
53+
onTimeUpdate: '=',
54+
},
55+
}
56+
);
57+
});
58+
}

src/plugins/timelion/public/index.html

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,7 @@
1111
</span>
1212
</span>
1313
<!-- Local nav. -->
14-
<kbn-top-nav
15-
app-name="'timelion'"
16-
config="topNavMenu"
17-
show-search-bar="true"
18-
show-search-bar-inline="true"
19-
show-filter-bar="false"
20-
show-query-input="false"
21-
date-range-from="model.timeRange.from"
22-
date-range-to="model.timeRange.to"
23-
is-refresh-paused="model.refreshInterval.pause"
24-
refresh-interval="model.refreshInterval.value"
25-
on-refresh-change="onRefreshChange"
26-
on-query-submit="onTimeUpdate">
27-
</kbn-top-nav>
28-
14+
<timelion-top-nav top-nav-menu="topNavMenu" on-time-update="onTimeUpdate"></timelion-top-nav>
2915

3016
<div class="timApp__menus">
3117
<timelion-deprecation></timelion-deprecation>

x-pack/plugins/apm/public/components/app/ServiceMap/Controls.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { useUrlParams } from '../../../hooks/useUrlParams';
1414
import { getAPMHref } from '../../shared/Links/apm/APMLink';
1515
import { APMQueryParams } from '../../shared/Links/url_helpers';
1616
import { CytoscapeContext } from './Cytoscape';
17-
import { getAnimationOptions, getNodeHeight } from './cytoscapeOptions';
17+
import { getAnimationOptions, getNodeHeight } from './cytoscape_options';
1818

1919
const ControlsContainer = styled('div')`
2020
left: ${({ theme }) => theme.eui.gutterTypes.gutterMedium};

x-pack/plugins/apm/public/components/app/ServiceMap/Cytoscape.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import React, {
1717
useState,
1818
} from 'react';
1919
import { useTheme } from '../../../hooks/useTheme';
20-
import { getCytoscapeOptions } from './cytoscapeOptions';
20+
import { getCytoscapeOptions } from './cytoscape_options';
2121
import { useCytoscapeEventHandlers } from './use_cytoscape_event_handlers';
2222

2323
cytoscape.use(dagre);

x-pack/plugins/apm/public/components/app/ServiceMap/Popover/AnomalyDetection.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { useTheme } from '../../../../hooks/useTheme';
2222
import { fontSize, px } from '../../../../style/variables';
2323
import { asInteger, asDuration } from '../../../../../common/utils/formatters';
2424
import { MLJobLink } from '../../../shared/Links/MachineLearningLinks/MLJobLink';
25-
import { popoverWidth } from '../cytoscapeOptions';
25+
import { popoverWidth } from '../cytoscape_options';
2626
import { TRANSACTION_REQUEST } from '../../../../../common/transaction_types';
2727
import {
2828
getSeverity,

x-pack/plugins/apm/public/components/app/ServiceMap/Popover/Contents.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import React, { MouseEvent } from 'react';
1515
import { Buttons } from './Buttons';
1616
import { Info } from './Info';
1717
import { ServiceStatsFetcher } from './ServiceStatsFetcher';
18-
import { popoverWidth } from '../cytoscapeOptions';
18+
import { popoverWidth } from '../cytoscape_options';
1919

2020
interface ContentsProps {
2121
isService: boolean;

x-pack/plugins/apm/public/components/app/ServiceMap/Popover/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import cytoscape from 'cytoscape';
1818
import { useTheme } from '../../../../hooks/useTheme';
1919
import { SERVICE_NAME } from '../../../../../common/elasticsearch_fieldnames';
2020
import { CytoscapeContext } from '../Cytoscape';
21-
import { getAnimationOptions } from '../cytoscapeOptions';
21+
import { getAnimationOptions } from '../cytoscape_options';
2222
import { Contents } from './Contents';
2323

2424
interface PopoverProps {

x-pack/plugins/apm/public/components/app/ServiceMap/cytoscapeOptions.ts renamed to x-pack/plugins/apm/public/components/app/ServiceMap/cytoscape_options.ts

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,18 @@
55
*/
66
import cytoscape from 'cytoscape';
77
import { CSSProperties } from 'react';
8-
import {
9-
getServiceHealthStatusColor,
10-
ServiceHealthStatus,
11-
} from '../../../../common/service_health_status';
8+
import { EuiTheme } from '../../../../../observability/public';
9+
import { ServiceAnomalyStats } from '../../../../common/anomaly_detection';
1210
import {
1311
SERVICE_NAME,
1412
SPAN_DESTINATION_SERVICE_RESOURCE,
1513
} from '../../../../common/elasticsearch_fieldnames';
16-
import { EuiTheme } from '../../../../../observability/public';
14+
import {
15+
getServiceHealthStatusColor,
16+
ServiceHealthStatus,
17+
} from '../../../../common/service_health_status';
18+
import { FETCH_STATUS } from '../../../hooks/useFetcher';
1719
import { defaultIcon, iconForNode } from './icons';
18-
import { ServiceAnomalyStats } from '../../../../common/anomaly_detection';
1920

2021
export const popoverWidth = 280;
2122

@@ -104,6 +105,11 @@ function isService(el: cytoscape.NodeSingular) {
104105
const getStyle = (theme: EuiTheme): cytoscape.Stylesheet[] => {
105106
const lineColor = theme.eui.euiColorMediumShade;
106107
return [
108+
{
109+
selector: 'core',
110+
// @ts-expect-error DefinitelyTyped does not recognize 'active-bg-opacity'
111+
style: { 'active-bg-opacity': 0 },
112+
},
107113
{
108114
selector: 'node',
109115
style: {
@@ -226,7 +232,10 @@ const getStyle = (theme: EuiTheme): cytoscape.Stylesheet[] => {
226232

227233
// The CSS styles for the div containing the cytoscape element. Makes a
228234
// background grid of dots.
229-
export const getCytoscapeDivStyle = (theme: EuiTheme): CSSProperties => ({
235+
export const getCytoscapeDivStyle = (
236+
theme: EuiTheme,
237+
status: FETCH_STATUS
238+
): CSSProperties => ({
230239
background: `linear-gradient(
231240
90deg,
232241
${theme.eui.euiPageBackgroundColor}
@@ -242,6 +251,7 @@ linear-gradient(
242251
center,
243252
${theme.eui.euiColorLightShade}`,
244253
backgroundSize: `${theme.eui.euiSizeL} ${theme.eui.euiSizeL}`,
254+
cursor: `${status === FETCH_STATUS.LOADING ? 'wait' : 'grab'}`,
245255
margin: `-${theme.eui.gutterTypes.gutterLarge}`,
246256
marginTop: 0,
247257
});

0 commit comments

Comments
 (0)