Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.x] [Timelion] Move the local menu to the header (#80627) #80959

Merged
merged 1 commit into from
Oct 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/plugins/timelion/public/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import { initSavedObjectSaveAsCheckBoxDirective } from './directives/saved_objec
import { initSavedObjectFinderDirective } from './directives/saved_object_finder';
import { initTimelionTabsDirective } from './components/timelionhelp_tabs_directive';
import { initTimelionTDeprecationDirective } from './components/timelion_deprecation_directive';
import { initTimelionTopNavDirective } from './components/timelion_top_nav_directive';
import { initInputFocusDirective } from './directives/input_focus';
import { Chart } from './directives/chart/chart';
import { TimelionInterval } from './directives/timelion_interval/timelion_interval';
Expand Down Expand Up @@ -86,6 +87,7 @@ export function initTimelionApp(app, deps) {
initInputFocusDirective(app);
initTimelionTabsDirective(app, deps);
initTimelionTDeprecationDirective(app, deps);
initTimelionTopNavDirective(app, deps);
initSavedObjectFinderDirective(app, savedSheetLoader, deps.core.uiSettings);
initSavedObjectSaveAsCheckBoxDirective(app);
initCellsDirective(app);
Expand Down
15 changes: 1 addition & 14 deletions src/plugins/timelion/public/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,7 @@ import {
import { getTimeChart } from './panels/timechart/timechart';
import { Panel } from './panels/panel';

import {
configureAppAngularModule,
createTopNavDirective,
createTopNavHelper,
} from '../../kibana_legacy/public';
import { configureAppAngularModule } from '../../kibana_legacy/public';
import { TimelionPluginStartDependencies } from './plugin';
import { DataPublicPluginStart } from '../../data/public';
// @ts-ignore
Expand Down Expand Up @@ -120,11 +116,9 @@ function mountTimelionApp(appBasePath: string, element: HTMLElement, deps: Rende
function createLocalAngularModule(deps: RenderDeps) {
createLocalI18nModule();
createLocalIconModule();
createLocalTopNavModule(deps.plugins.navigation);

const dashboardAngularModule = angular.module(moduleName, [
...thirdPartyAngularDependencies,
'app/timelion/TopNav',
'app/timelion/I18n',
'app/timelion/icon',
]);
Expand All @@ -137,13 +131,6 @@ function createLocalIconModule() {
.directive('icon', (reactDirective) => reactDirective(EuiIcon));
}

function createLocalTopNavModule(navigation: TimelionPluginStartDependencies['navigation']) {
angular
.module('app/timelion/TopNav', ['react'])
.directive('kbnTopNav', createTopNavDirective)
.directive('kbnTopNavHelper', createTopNavHelper(navigation.ui));
}

function createLocalI18nModule() {
angular
.module('app/timelion/I18n', [])
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import React from 'react';

export function initTimelionTopNavDirective(app, deps) {
app.directive('timelionTopNav', function (reactDirective) {
return reactDirective(
(props) => {
const { TopNavMenu } = deps.plugins.navigation.ui;
return (
<deps.core.i18n.Context>
<TopNavMenu
appName="timelion"
showTopNavMenu
config={props.topNavMenu}
setMenuMountPoint={deps.mountParams.setHeaderActionMenu}
onQuerySubmit={props.onTimeUpdate}
screenTitle="timelion"
showDatePicker
showFilterBar={false}
showQueryInput={false}
showSaveQuery={false}
showSearchBar
useDefaultBehaviors
/>
</deps.core.i18n.Context>
);
},
[
['topNavMenu', { watchDepth: 'reference' }],
['onTimeUpdate', { watchDepth: 'reference' }],
],
{
restrict: 'E',
scope: {
topNavMenu: '=',
onTimeUpdate: '=',
},
}
);
});
}
16 changes: 1 addition & 15 deletions src/plugins/timelion/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,7 @@
</span>
</span>
<!-- Local nav. -->
<kbn-top-nav
app-name="'timelion'"
config="topNavMenu"
show-search-bar="true"
show-search-bar-inline="true"
show-filter-bar="false"
show-query-input="false"
date-range-from="model.timeRange.from"
date-range-to="model.timeRange.to"
is-refresh-paused="model.refreshInterval.pause"
refresh-interval="model.refreshInterval.value"
on-refresh-change="onRefreshChange"
on-query-submit="onTimeUpdate">
</kbn-top-nav>

<timelion-top-nav top-nav-menu="topNavMenu" on-time-update="onTimeUpdate"></timelion-top-nav>

<div class="timApp__menus">
<timelion-deprecation></timelion-deprecation>
Expand Down