Skip to content
This repository has been archived by the owner on Mar 31, 2024. It is now read-only.

move app switcher to a sidebar #10

Merged
merged 1 commit into from
Jan 26, 2016
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
74 changes: 0 additions & 74 deletions src/ui/public/chrome/chrome.html

This file was deleted.

26 changes: 12 additions & 14 deletions src/ui/public/chrome/directives/app_switcher/app_switcher.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
<div class="app-links">
<div
class="app-link"
ng-repeat="link in switcher.getNavLinks()"
ng-class="{ active: link.active }">
<div
class="app-link"
ng-repeat="link in switcher.getNavLinks()"
ng-class="{ active: link.active }">

<a
ng-click="switcher.ensureNavigation($event, link)"
ng-href="{{ link.active ? link.url : (link.lastSubUrl || link.url) }}"
data-test-subj="appLink">
<a
ng-click="switcher.ensureNavigation($event, link)"
ng-href="{{ link.active ? link.url : (link.lastSubUrl || link.url) }}"
data-test-subj="appLink">

<div ng-if="link.icon" ng-style="{ 'background-image': 'url(../' + link.icon + ')' }" class="app-icon"></div>
<div ng-if="!link.icon" class="app-icon app-icon-missing">{{ link.title[0] }}</div>
<div ng-if="link.icon" ng-style="{ 'background-image': 'url(../' + link.icon + ')' }" class="app-icon"></div>
<div ng-if="!link.icon" class="app-icon app-icon-missing">{{ link.title[0] }}</div>

<div class="app-title">{{ link.title }}</div>
</a>
</div>
<div class="app-title">{{ link.title }}</div>
</a>
</div>
4 changes: 2 additions & 2 deletions src/ui/public/chrome/directives/app_switcher/app_switcher.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var parse = require('url').parse;
var bindKey = require('lodash').bindKey;

require('../app_switcher/app_switcher.less');
require('./app_switcher.less');
var DomLocationProvider = require('ui/domLocation');

require('ui/modules')
Expand Down Expand Up @@ -39,7 +39,7 @@ require('ui/modules')
};
}];
})
.directive('appSwitcher', function () {
.directive('kbnAppSwitcher', function () {
return {
restrict: 'E',
template: require('./app_switcher.html'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
@app-icon-size: 48px;
@app-icon-padding: 10px;

.app-links {
text-align: justify;
kbn-app-switcher {
display: flex;
flex-direction: column;
align-items: center;

.app-link {
display: inline-block;
Expand Down Expand Up @@ -52,7 +54,5 @@
text-decoration: underline;
}
}

}

}
5 changes: 5 additions & 0 deletions src/ui/public/chrome/directives/kbn_chrome/kbn_chrome.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<kbn-notifications list="notifList"></kbn-notifications>
<div class="content">
<kbn-app-switcher></kbn-app-switcher>
<kbn-app-container ng-view></kbn-app-container>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import $ from 'jquery';

import UiModules from 'ui/modules';
import ConfigTemplate from 'ui/ConfigTemplate';
import kbnChromeHtml from './kbn_chrome.html';
import './kbn_chrome.less';

export default function (chrome, internals) {

Expand All @@ -10,8 +12,8 @@ export default function (chrome, internals) {
.directive('kbnChrome', function ($rootScope) {
return {
template($el) {
const $content = $(require('ui/chrome/chrome.html'));
const $app = $content.find('.application');
const $content = $(kbnChromeHtml);
const $app = $content.find('kbn-app-container');

if (internals.rootController) {
$app.attr('ng-controller', internals.rootController);
Expand Down Expand Up @@ -46,9 +48,6 @@ export default function (chrome, internals) {
// and some local values
$scope.httpActive = $http.pendingRequests;
$scope.notifList = require('ui/notify')._notifs;
$scope.appSwitcherTemplate = new ConfigTemplate({
switcher: '<app-switcher></app-switcher>'
});

return chrome;
}
Expand Down
73 changes: 73 additions & 0 deletions src/ui/public/chrome/directives/kbn_chrome/kbn_chrome.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
@import (reference) "~ui/styles/variables";

@app-icon-size: 48px;
@app-icon-padding: 10px;

body[kbn-chrome] {
> .content {
display: flex;
flex-direction: row;
overflow: hidden;

kbn-app-container {
display: flex;
flex: 1 1 auto;
flex-direction: column;
}

kbn-app-switcher {
flex: 0 0 auto;
display: flex;
flex-direction: column;
align-items: center;

.app-link {
display: inline-block;
vertical-align: top;
text-align: left;
width: @app-icon-size + (@app-icon-padding * 2);
margin: 0px 10px;
padding: @app-icon-padding;
border-radius: @border-radius-base;

.app-icon {
display: block;
height: @app-icon-size;
width: @app-icon-size;
background-position: center;
background-size: contain;
border-radius: @border-radius-base;
background-color: @gray-light;
width: 100%;

&-missing {
text-align: center;
font-size: 2.7em;
font-weight: bold;
font-family: @font-family-sans-serif;
color: #fff;
}
}

.app-title {
color: @text-color;
font-size: 0.9em;
width: 100%;
text-align: center;
margin-top: 3px;
}

&:hover .app-title {
text-decoration: underline;
}

&.active {
background: @gray-lighter;
.app-title {
text-decoration: underline;
}
}
}
}
}
}