From cbdab120275e449102668f77462517541cb2fb84 Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Mon, 11 Jul 2016 11:07:27 -0700 Subject: [PATCH 1/6] Refactor app-switcher to use app-switcher-link directive. Former-commit-id: 01f38688586f203d3883916844d98709636e9e6d --- .../directives/app_switcher/app_switcher.html | 35 ++++++------------- .../app_switcher_link/app_switcher_link.html | 28 +++++++++++++++ .../app_switcher_link/app_switcher_link.js | 21 +++++++++++ src/ui/public/chrome/directives/index.js | 1 + 4 files changed, 60 insertions(+), 25 deletions(-) create mode 100644 src/ui/public/chrome/directives/app_switcher_link/app_switcher_link.html create mode 100644 src/ui/public/chrome/directives/app_switcher_link/app_switcher_link.js 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 3a70738dcb73b..7d8291bc26ae5 100644 --- a/src/ui/public/chrome/directives/app_switcher/app_switcher.html +++ b/src/ui/public/chrome/directives/app_switcher/app_switcher.html @@ -1,26 +1,11 @@ - + diff --git a/src/ui/public/chrome/directives/app_switcher_link/app_switcher_link.html b/src/ui/public/chrome/directives/app_switcher_link/app_switcher_link.html new file mode 100644 index 0000000000000..8d91540bf2a36 --- /dev/null +++ b/src/ui/public/chrome/directives/app_switcher_link/app_switcher_link.html @@ -0,0 +1,28 @@ + diff --git a/src/ui/public/chrome/directives/app_switcher_link/app_switcher_link.js b/src/ui/public/chrome/directives/app_switcher_link/app_switcher_link.js new file mode 100644 index 0000000000000..d3b4586c17149 --- /dev/null +++ b/src/ui/public/chrome/directives/app_switcher_link/app_switcher_link.js @@ -0,0 +1,21 @@ + +import appSwitcherLinkTemplate from './app_switcher_link.html'; +import uiModules from 'ui/modules'; + +const module = uiModules.get('kibana'); + +module.directive('appSwitcherLink', function () { + return { + restrict: 'E', + scope: { + isActive: '=appSwitcherLinkIsActive', + isDisabled: '=appSwitcherLinkIsDisabled', + tooltip: '=appSwitcherLinkTooltip', + onClick: '&appSwitcherLinkOnClick', + href: '=appSwitcherLinkHref', + icon: '=appSwitcherLinkIcon', + title: '=appSwitcherLinkTitle' + }, + template: appSwitcherLinkTemplate + }; +}); diff --git a/src/ui/public/chrome/directives/index.js b/src/ui/public/chrome/directives/index.js index c39bb921d3a5b..7be137eb52539 100644 --- a/src/ui/public/chrome/directives/index.js +++ b/src/ui/public/chrome/directives/index.js @@ -1,4 +1,5 @@ import './app_switcher'; +import './app_switcher_link'; import kbnChromeProv from './kbn_chrome'; import kbnChromeNavControlsProv from './append_nav_controls'; import './kbn_loading_indicator'; From f3284ee19b807f98aa758cccbfe3df8f5e621070 Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Mon, 11 Jul 2016 11:34:50 -0700 Subject: [PATCH 2/6] Refactor app-switcher and app-switcher-link LESS. Remove app-links class. Former-commit-id: 0d0399935b46d1ac2d7afccf52c92148b6eb7ae7 --- src/ui/public/chrome/chrome.html | 2 +- .../directives/app_switcher/app_switcher.js | 2 +- .../directives/app_switcher/app_switcher.less | 78 ------------------- .../app_switcher_link/app_switcher_link.html | 22 +++--- .../app_switcher_link/app_switcher_link.js | 1 + .../app_switcher_link/app_switcher_link.less | 70 +++++++++++++++++ src/ui/public/styles/variables/for-theme.less | 1 - 7 files changed, 86 insertions(+), 90 deletions(-) create mode 100644 src/ui/public/chrome/directives/app_switcher_link/app_switcher_link.less diff --git a/src/ui/public/chrome/chrome.html b/src/ui/public/chrome/chrome.html index 419615d665dda..42b78e7ee7f39 100644 --- a/src/ui/public/chrome/chrome.html +++ b/src/ui/public/chrome/chrome.html @@ -26,7 +26,7 @@
- +
diff --git a/src/ui/public/chrome/directives/app_switcher/app_switcher.js b/src/ui/public/chrome/directives/app_switcher/app_switcher.js index 9119e0bf63828..3181f88d62cdc 100644 --- a/src/ui/public/chrome/directives/app_switcher/app_switcher.js +++ b/src/ui/public/chrome/directives/app_switcher/app_switcher.js @@ -1,7 +1,7 @@ import DomLocationProvider from 'ui/dom_location'; import { parse } from 'url'; import { bindKey } from 'lodash'; -import '../app_switcher/app_switcher.less'; +import './app_switcher.less'; import uiModules from 'ui/modules'; import appSwitcherTemplate from './app_switcher.html'; 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 e1cc894fd3a27..0d22b23c0aa0a 100644 --- a/src/ui/public/chrome/directives/app_switcher/app_switcher.less +++ b/src/ui/public/chrome/directives/app_switcher/app_switcher.less @@ -70,81 +70,3 @@ body { overflow-x: hidden; } .flex-parent(@shrink: 0); box-shadow: -4px 0px 3px rgba(0,0,0,0.2); } - -.app-links { - text-align: justify; - - .app-link { - width: @as-open-width; - height: @app-icon-height; - line-height: @app-line-height; - - > a { - display: block; - height: 100%; - color: #ebf7fa; - } - - &.is-app-switcher-app-link-disabled { - opacity: 0.5; - - .app-link__anchor { - cursor: default; - } - } - - .app-icon { - float: left; - font-weight: bold; - text-align: center; - font-size: 1.7em; - display: inline-block; - height: @app-icon-height; - width: @as-closed-width; - - > img { - height: 18px; - margin-top: 8px; - filter: invert(100%); - } - > i { - color: #fff; - line-height: @app-icon-height - } - } - - .app-icon-missing { - float: left; - text-align: center; - font-size: 1.7em; - display: inline-block; - height: @app-icon-height; - line-height: @app-icon-height; - width: @as-closed-width; - background-position: center; - background-size: contain; - background-repeat: no-repeat; - } - - .app-title { - width: calc(@as-open-width - @as-closed-width); - display: inline-block; - float: right; - font-size: 0.9em; - text-align: left; - padding-left: 3px; - line-height: @app-icon-height; - white-space: nowrap; - } - - &:hover, - &.active { - background-color: @app-links-active-background; - > a { - color: @white; - text-decoration: none; - } - } - } - -} diff --git a/src/ui/public/chrome/directives/app_switcher_link/app_switcher_link.html b/src/ui/public/chrome/directives/app_switcher_link/app_switcher_link.html index 8d91540bf2a36..14ef6455d2fdf 100644 --- a/src/ui/public/chrome/directives/app_switcher_link/app_switcher_link.html +++ b/src/ui/public/chrome/directives/app_switcher_link/app_switcher_link.html @@ -1,5 +1,5 @@