diff --git a/x-pack/plugins/graph/public/app.js b/x-pack/plugins/graph/public/app.js index 77ae583ad259db..b94b302b17598f 100644 --- a/x-pack/plugins/graph/public/app.js +++ b/x-pack/plugins/graph/public/app.js @@ -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) diff --git a/x-pack/plugins/graph/public/breadcrumbs.js b/x-pack/plugins/graph/public/breadcrumbs.js new file mode 100644 index 00000000000000..63887e23288f25 --- /dev/null +++ b/x-pack/plugins/graph/public/breadcrumbs.js @@ -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 + } + ]; +} diff --git a/x-pack/plugins/graph/public/templates/index.html b/x-pack/plugins/graph/public/templates/index.html index cbbaf0b149b769..eec422d8017f8f 100644 --- a/x-pack/plugins/graph/public/templates/index.html +++ b/x-pack/plugins/graph/public/templates/index.html @@ -6,10 +6,10 @@
{{ savedWorkspace.lastSavedTitle }}