[graph] implement k7Breadcrumbs (#26591)
* [graph] implement k7Breadcrumbs * [graph] implement real k7Breadcrumbs * hide workspace title in local nav in k7design
This commit is contained in:
parent
53f7ed88af
commit
757f83690f
|
@ -26,6 +26,7 @@ import { KibanaParsedUrl } from 'ui/url/kibana_parsed_url';
|
|||
import { XPackInfoProvider } from 'plugins/xpack_main/services/xpack_info';
|
||||
|
||||
import appTemplate from './templates/index.html';
|
||||
import { getHomeBreadcrumbs, getWorkspaceBreadcrumbs } from './breadcrumbs';
|
||||
|
||||
import './angular-venn-simple.js';
|
||||
import gws from './graphClientWorkspace.js';
|
||||
|
@ -72,6 +73,7 @@ if (uiRoutes.enable) {
|
|||
uiRoutes
|
||||
.when('/home', {
|
||||
template: appTemplate,
|
||||
k7Breadcrumbs: getHomeBreadcrumbs,
|
||||
resolve: {
|
||||
//Copied from example found in wizard.js ( Kibana TODO - can't
|
||||
// IndexPatternsProvider abstract these implementation details better?)
|
||||
|
@ -95,6 +97,7 @@ uiRoutes
|
|||
})
|
||||
.when('/workspace/:id', {
|
||||
template: appTemplate,
|
||||
k7Breadcrumbs: getWorkspaceBreadcrumbs,
|
||||
resolve: {
|
||||
savedWorkspace: function (savedGraphWorkspaces, courier, $route, i18n) {
|
||||
return savedGraphWorkspaces.get($route.current.params.id)
|
||||
|
@ -135,7 +138,9 @@ uiRoutes
|
|||
|
||||
|
||||
//======== Controller for basic UI ==================
|
||||
app.controller('graphuiPlugin', function ($scope, $route, $interval, $http, kbnUrl, Private, Promise, confirmModal, kbnBaseUrl, i18n) {
|
||||
app.controller('graphuiPlugin', function ($scope, $route, $http, kbnUrl, Private, Promise, confirmModal, kbnBaseUrl, i18n, config) {
|
||||
|
||||
config.bindToScope($scope, 'k7design');
|
||||
|
||||
function handleSuccess(data) {
|
||||
return checkLicense(Private, Promise, kbnBaseUrl)
|
||||
|
|
29
x-pack/plugins/graph/public/breadcrumbs.js
Normal file
29
x-pack/plugins/graph/public/breadcrumbs.js
Normal file
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
export function getHomeBreadcrumbs() {
|
||||
return [
|
||||
{
|
||||
text: i18n.translate('xpack.graph.home.breadcrumb', {
|
||||
defaultMessage: 'Graph'
|
||||
}),
|
||||
href: '#/home'
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
export function getWorkspaceBreadcrumbs($route) {
|
||||
const { savedWorkspace } = $route.current.locals;
|
||||
|
||||
return [
|
||||
...getHomeBreadcrumbs(),
|
||||
{
|
||||
text: savedWorkspace.title
|
||||
}
|
||||
];
|
||||
}
|
|
@ -6,10 +6,10 @@
|
|||
<!-- Title. -->
|
||||
<div data-transclude-slot="topLeftCorner" class="kuiLocalTitle">
|
||||
<strong
|
||||
ng-if="savedWorkspace.lastSavedTitle"
|
||||
ng-if="!k7design && savedWorkspace.lastSavedTitle"
|
||||
>{{ savedWorkspace.lastSavedTitle }}</strong>
|
||||
<strong
|
||||
ng-if="!savedWorkspace.lastSavedTitle"
|
||||
ng-if="!k7design && !savedWorkspace.lastSavedTitle"
|
||||
i18n-id="xpack.graph.topNavMenu.defaultNewWorkspaceTitle"
|
||||
i18n-default-message="New Graph Workspace"
|
||||
></strong>
|
||||
|
|
Loading…
Reference in a new issue