From 72ef16fd515d0393d9910e486c2b98cf55d997ef Mon Sep 17 00:00:00 2001 From: spalger Date: Mon, 25 Jan 2016 19:23:09 -0700 Subject: [PATCH 01/18] [uiExports][chrome] support uiExports.links --- src/plugins/kibana/index.js | 34 ++++++++++++++++++- src/ui/index.js | 2 +- src/ui/public/chrome/api/apps.js | 6 ++-- src/ui/public/chrome/api/nav.js | 22 +++++++++--- .../directives/app_switcher/app_switcher.html | 2 +- src/ui/ui_app.js | 19 ++++++++--- src/ui/ui_exports.js | 17 +++++++--- src/ui/ui_nav_link.js | 16 +++++++++ src/ui/ui_nav_link_collection.js | 29 ++++++++++++++++ 9 files changed, 127 insertions(+), 20 deletions(-) create mode 100644 src/ui/ui_nav_link.js create mode 100644 src/ui/ui_nav_link_collection.js diff --git a/src/plugins/kibana/index.js b/src/plugins/kibana/index.js index 5f128990282bb..c5b6578b61072 100644 --- a/src/plugins/kibana/index.js +++ b/src/plugins/kibana/index.js @@ -14,6 +14,7 @@ module.exports = function (kibana) { uiExports: { app: { title: 'Kibana', + listed: false, description: 'the kibana you know and love', //icon: 'plugins/kibana/settings/sections/about/barcode.svg', main: 'plugins/kibana/kibana', @@ -30,8 +31,39 @@ module.exports = function (kibana) { return { kbnDefaultAppId: config.get('kibana.defaultAppId') }; + }, + }, + + links: [ + { + title: 'Discover', + order: -1003, + url: '/app/kibana#/discover', + description: 'interactively explore your data', + icon: 'plugins/kibana/settings/sections/about/barcode.svg', + }, + { + title: 'Visualize', + order: -1002, + url: '/app/kibana#/visualize', + description: 'design data visualizations', + icon: 'plugins/kibana/settings/sections/about/barcode.svg', + }, + { + title: 'Dashboard', + order: -1001, + url: '/app/kibana#/dashboard', + description: 'compose visualizations for much win', + icon: 'plugins/kibana/settings/sections/about/barcode.svg', + }, + { + title: 'Settings', + order: 1000, + url: '/app/kibana#/settings', + description: 'define index patterns, change config, and more', + icon: 'plugins/kibana/settings/sections/about/barcode.svg', } - } + ] }, init: function (server, options) { diff --git a/src/ui/index.js b/src/ui/index.js index 4bdf12b7870f9..1b57cfe617ff8 100644 --- a/src/ui/index.js +++ b/src/ui/index.js @@ -71,7 +71,7 @@ module.exports = async (kbnServer, server, config) => { server.decorate('reply', 'renderApp', function (app) { const payload = { app: app, - nav: uiExports.apps, + nav: uiExports.navLinks.inOrder, version: kbnServer.version, buildNum: config.get('pkg.buildNum'), buildSha: config.get('pkg.buildSha'), diff --git a/src/ui/public/chrome/api/apps.js b/src/ui/public/chrome/api/apps.js index 35342d660f654..65f1f5af5df5a 100644 --- a/src/ui/public/chrome/api/apps.js +++ b/src/ui/public/chrome/api/apps.js @@ -3,8 +3,8 @@ const { resolve } = require('url'); module.exports = function (chrome, internals) { - if (internals.app) { - internals.app.url = resolve(window.location.href, internals.app.url); + if (internals.app && internals.app.navLink) { + internals.app.navLink.url = resolve(window.location.href, internals.app.navLink.url); } internals.appUrlStore = internals.appUrlStore || window.sessionStorage; @@ -35,7 +35,7 @@ module.exports = function (chrome, internals) { }; chrome.getAppUrl = function () { - return get(internals, ['app', 'url']); + return get(internals, ['app', 'navLink', 'url']); }; chrome.getInjected = function (name, def) { diff --git a/src/ui/public/chrome/api/nav.js b/src/ui/public/chrome/api/nav.js index 3290010911513..068d992c2e4e0 100644 --- a/src/ui/public/chrome/api/nav.js +++ b/src/ui/public/chrome/api/nav.js @@ -34,12 +34,24 @@ export default function (chrome, internals) { }); }; - internals.trackPossibleSubUrl = function (url) { - for (const link of internals.nav) { - if (startsWith(url, link.url)) { - link.lastSubUrl = url; - internals.appUrlStore.setItem(`lastSubUrl:${link.url}`, url); + internals.navTrackers = []; + chrome.addNavigationTracker = function (url, handler) { + internals.navTrackers.push({ + url, handler + }); + }; + + internals.trackPossibleSubUrl = function (url, persist) { + for (const tracker of internals.navTrackers) { + if (startsWith(url, tracker.url)) { + if (persist) { + tracker.lastSubUrl = url; + internals.appUrlStore.setItem(`lastSubUrl:${tracker.url}`, url); + } + tracker.active = true; } + + tracker.handler(tracker.active, tracker.lastSubUrl); } }; diff --git a/src/ui/public/chrome/directives/app_switcher/app_switcher.html b/src/ui/public/chrome/directives/app_switcher/app_switcher.html index 7613cb03142b4..89ae849628bc3 100644 --- a/src/ui/public/chrome/directives/app_switcher/app_switcher.html +++ b/src/ui/public/chrome/directives/app_switcher/app_switcher.html @@ -1,7 +1,7 @@ diff --git a/src/ui/public/chrome/directives/app_switcher/app_switcher.less b/src/ui/public/chrome/directives/app_switcher/app_switcher.less index d178bf48174a1..13db3bcd43c97 100644 --- a/src/ui/public/chrome/directives/app_switcher/app_switcher.less +++ b/src/ui/public/chrome/directives/app_switcher/app_switcher.less @@ -47,7 +47,6 @@ body { overflow-x: hidden; } } .app-wrapper { .real-flex-parent(); - box-shadow: -4px 0px 3px rgba(0,0,0,0.2); position: absolute; transition: transform @transition-time; transition-delay: @transition-delay; @@ -59,6 +58,11 @@ body { overflow-x: hidden; } margin: 0 auto; background-color: #fff; + &-panel { + .flex-parent(@shrink: 0); + box-shadow: -4px 0px 3px rgba(0,0,0,0.2); + } + .navbar-right { margin-right: 0; } From e7c98c07db64fec740aac291e24f22e3f9da075b Mon Sep 17 00:00:00 2001 From: Rashid Khan Date: Tue, 9 Feb 2016 10:09:13 -0700 Subject: [PATCH 18/18] Fix icons in firefox --- .../directives/app_switcher/app_switcher.html | 2 +- .../directives/app_switcher/app_switcher.less | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/ui/public/chrome/directives/app_switcher/app_switcher.html b/src/ui/public/chrome/directives/app_switcher/app_switcher.html index 1d9c625a3ecc2..382e35b8a4023 100644 --- a/src/ui/public/chrome/directives/app_switcher/app_switcher.html +++ b/src/ui/public/chrome/directives/app_switcher/app_switcher.html @@ -9,7 +9,7 @@ ng-href="{{ link.active ? link.url : (link.lastSubUrl || link.url) }}" data-test-subj="appLink"> -
+
{{ link.title[0] }}
{{ link.title }}
diff --git a/src/ui/public/chrome/directives/app_switcher/app_switcher.less b/src/ui/public/chrome/directives/app_switcher/app_switcher.less index 13db3bcd43c97..643ef969c7418 100644 --- a/src/ui/public/chrome/directives/app_switcher/app_switcher.less +++ b/src/ui/public/chrome/directives/app_switcher/app_switcher.less @@ -84,20 +84,22 @@ body { overflow-x: hidden; } &:hover { background-color: lighten(@app-links-wrapper-background, 7.5%); } + .app-icon { float: left; + filter: invert(100%); font-weight: bold; text-align: center; font-size: 1.7em; display: inline-block; height: @app-icon-height; width: @as-closed-width; - background-color: @white; - mask-position: center; - mask-size: 60% 60%; - mask-repeat: no-repeat; > i { } + + > img { + height: 20px; + } } .app-icon-missing { @@ -128,6 +130,9 @@ body { overflow-x: hidden; } color: #333; text-decoration: none; } + img { + filter: invert(100%); + } } }