Skip to content

Commit

Permalink
[graph] implement k7Breadcrumbs (#26591)
Browse files Browse the repository at this point in the history
* [graph] implement k7Breadcrumbs

* [graph] implement real k7Breadcrumbs

* hide workspace title in local nav in k7design
  • Loading branch information
Spencer committed Dec 4, 2018
1 parent 53f7ed8 commit 757f836
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 3 deletions.
7 changes: 6 additions & 1 deletion x-pack/plugins/graph/public/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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?)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
29 changes: 29 additions & 0 deletions x-pack/plugins/graph/public/breadcrumbs.js
Original file line number Diff line number Diff line change
@@ -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
}
];
}
4 changes: 2 additions & 2 deletions x-pack/plugins/graph/public/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 757f836

Please sign in to comment.