Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[graph] implement k7Breadcrumbs #26591

Merged
merged 4 commits into from
Dec 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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