[graph] implement k7Breadcrumbs (#26591)

* [graph] implement k7Breadcrumbs

* [graph] implement real k7Breadcrumbs

* hide workspace title in local nav in k7design
This commit is contained in:
Spencer 2018-12-04 12:10:12 -08:00 committed by GitHub
parent 53f7ed88af
commit 757f83690f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 3 deletions

View file

@ -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)

View 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
}
];
}

View file

@ -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>