[timelion] implement k7Breadcrumbs (#26729)
* [timelion] implement k7Breadcrumbs * [timelion] show "Create" breadcrumb by default
This commit is contained in:
parent
511128144d
commit
2d8026a600
|
@ -14,4 +14,5 @@
|
|||
|
||||
.timApp__stats {
|
||||
font-weight: $euiFontWeightRegular;
|
||||
color: $euiColorMediumShade
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ import { notify, fatalError, toastNotifications } from 'ui/notify';
|
|||
import { timezoneProvider } from 'ui/vis/lib/timezone';
|
||||
import { recentlyAccessed } from 'ui/persisted_log';
|
||||
import { timefilter } from 'ui/timefilter';
|
||||
import { getSavedSheetBreadcrumbs, getCreateBreadcrumbs } from './breadcrumbs';
|
||||
|
||||
// import the uiExports that we want to "use"
|
||||
import 'uiExports/fieldFormats';
|
||||
|
@ -57,6 +58,11 @@ require('ui/routes')
|
|||
.when('/:id?', {
|
||||
template: require('plugins/timelion/index.html'),
|
||||
reloadOnSearch: false,
|
||||
k7Breadcrumbs: ($injector, $route) => $injector.invoke(
|
||||
$route.current.params.id
|
||||
? getSavedSheetBreadcrumbs
|
||||
: getCreateBreadcrumbs
|
||||
),
|
||||
resolve: {
|
||||
savedSheet: function (redirectWhenMissing, savedSheets, $route) {
|
||||
return savedSheets.get($route.current.params.id)
|
||||
|
@ -73,6 +79,9 @@ require('ui/routes')
|
|||
'search': '/'
|
||||
}));
|
||||
}
|
||||
},
|
||||
controller($scope, config) {
|
||||
config.bindToScope($scope, 'k7design');
|
||||
}
|
||||
});
|
||||
|
||||
|
|
48
src/legacy/core_plugins/timelion/public/breadcrumbs.js
Normal file
48
src/legacy/core_plugins/timelion/public/breadcrumbs.js
Normal file
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* 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 { i18n } from '@kbn/i18n';
|
||||
|
||||
const ROOT_BREADCRUMB = {
|
||||
text: i18n.translate('timelion.breadcrumbs.root', {
|
||||
defaultMessage: 'Timelion'
|
||||
}),
|
||||
href: '#'
|
||||
};
|
||||
|
||||
export function getCreateBreadcrumbs() {
|
||||
return [
|
||||
ROOT_BREADCRUMB,
|
||||
{
|
||||
text: i18n.translate('timelion.breadcrumbs.create', {
|
||||
defaultMessage: 'Create'
|
||||
}),
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
export function getSavedSheetBreadcrumbs($route) {
|
||||
const { savedSheet } = $route.current.locals;
|
||||
return [
|
||||
ROOT_BREADCRUMB,
|
||||
{
|
||||
text: savedSheet.title,
|
||||
}
|
||||
];
|
||||
}
|
|
@ -4,12 +4,15 @@
|
|||
<!-- Transcluded elements. -->
|
||||
<div data-transclude-slots>
|
||||
<div data-transclude-slot="topLeftCorner">
|
||||
<span class="kuiLocalTitle" ng-show="opts.savedSheet.id">
|
||||
{{opts.savedSheet.lastSavedTitle}}
|
||||
|
||||
<span class="fa fa-bolt" ng-click="showStats = !showStats"></span>
|
||||
|
||||
<span class="timApp__stats" ng-show="showStats">
|
||||
<span class="kuiLocalTitle">
|
||||
<span ng-show="opts.savedSheet.id && !k7design">
|
||||
{{opts.savedSheet.lastSavedTitle}}
|
||||
|
||||
<span class="fa fa-bolt" ng-click="showStats = !showStats"></span>
|
||||
|
||||
</span>
|
||||
|
||||
<span class="timApp__stats" ng-show="stats && (showStats || k7design)">
|
||||
<span
|
||||
i18n-id="timelion.topNavMenu.statsDescription"
|
||||
i18n-default-message="Query Time {queryTime}ms / Processing Time {processingTime}ms"
|
||||
|
|
Loading…
Reference in a new issue