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

Fix/move append nav controls #6645

Merged
merged 16 commits into from
Mar 29, 2016
Merged
Show file tree
Hide file tree
Changes from 6 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
2 changes: 1 addition & 1 deletion src/plugins/kibana/public/dashboard/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
ng-click="configTemplate.toggle('options');">
<span>Options</span>
</button>
<div class="chrome-actions"kbn-chrome-append-nav-controls></div>
<kbn-global-timepicker></kbn-global-timepicker>
</div>
</navbar>
<config config-template="configTemplate" config-object="opts"></config>
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/kibana/public/discover/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
ng-click="configTemplate.toggle('share');">
<span>Share</span>
</button>
<div class="chrome-actions" kbn-chrome-append-nav-controls></div>
<kbn-global-timepicker></kbn-global-timepicker>
</div>
</navbar>
<config
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/kibana/public/visualize/editor/editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
aria-label="Refresh">
<span>Refresh</span>
</button>
<div class="chrome-actions"kbn-chrome-append-nav-controls></div>
<kbn-global-timepicker></kbn-global-timepicker>
</div>
</navbar>
<config
Expand Down
1 change: 0 additions & 1 deletion src/ui/public/autoload/modules.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'angular';
import 'ui/chrome';
import 'ui/chrome/context';
import 'ui/bind';
import 'ui/bound_to_config_obj';
import 'ui/config';
Expand Down
47 changes: 47 additions & 0 deletions src/ui/public/chrome/__tests__/kbn_loading_indicator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import ngMock from 'ng_mock';
import expect from 'expect.js';
import uiModules from 'ui/modules';
import $ from 'jquery';

import '../directives/kbn_loading_indicator';


describe('kbnLoadingIndicator', function () {
let compile;

beforeEach(() => {
ngMock.module('kibana');
ngMock.inject(function ($compile, $rootScope) {
compile = function (hasActiveConnections) {
$rootScope.chrome = {
httpActive: (hasActiveConnections ? [1] : [])
};
const $el = $('<div kbn-loading-indicator><div id="other-content"></div></div>');
$rootScope.$apply();
$compile($el)($rootScope);
return $el;
};
});

});

it('injects a loading .spinner into the element', function () {
const $el = compile();
expect($el.find('.spinner')).to.have.length(1);
});
// Doesn't work...
xit('applies the ng-hide class when there are no connections', function () {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xit? Is this some kind of alias for it.skip?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops this slipped past me i'll remove this.

const $el = compile(false);
expect($el.find('.spinner.ng-hide')).to.have.length(1);
});
it('applies removes ng-hide class when there are connections', function () {
const $el = compile(true);
expect($el.find('.spinner.ng-hide')).to.have.length(0);
});

it('doesn\'t modify the contents of what the elment already has', function () {
const $el = compile();
expect($el.find('#other-content')).to.have.length(1);
});

});
26 changes: 5 additions & 21 deletions src/ui/public/chrome/chrome.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="content" chrome-context >
<!-- TODO: These config dropdowns shouldn't be hard coded -->
<nav class="app-links-wrapper">
<nav class="app-links-wrapper" ng-show="chrome.getVisible()">
<li
ng-if="!chrome.getBrand('logo') && !chrome.getBrand('smallLogo')"
aria-label="{{ chrome.getAppTitle() }} Logo"
Expand All @@ -21,28 +21,12 @@

<app-switcher>
</app-switcher>
<div class="bottom-apps hide app-links">
<div class="app-link">
<a href="http://elastic.co">
<div class="app-icon">
<i class="fa fa-gear"></i>
</div>
<div class="app-title">settings</div>
</a>
</div>
<div class="app-link">
<a href="http://elastic.co">
<div class="app-icon">
<i class="fa fa-user"></i>
</div>
<div class="app-title">Jon Doe</div>
<div class="app-title">Logout</div>
</a>
</div>
<div class="bottom-apps">
<div class="chrome-actions app-links" kbn-chrome-append-nav-controls></div>
</div>
</nav>

<div class="app-wrapper">
<div class="app-wrapper" ng-class="{ 'hidden-chrome': !chrome.getVisible() }">
<div class="app-wrapper-panel">
<kbn-notifications list="notifList"></kbn-notifications>
<nav
Expand Down Expand Up @@ -80,7 +64,7 @@
</div>
<!-- /Full navbar -->
</nav>
<div class="application" ng-class="'tab-' + chrome.getFirstPathSegment() + ' ' + chrome.getApplicationClasses()" ng-view></div>
<div class="application" ng-class="'tab-' + chrome.getFirstPathSegment() + ' ' + chrome.getApplicationClasses()" ng-view kbn-loading-indicator></div>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The loading indicator is absolute positioned anyway, not sure if you need the complexity you have in place to keep it an attr instead of an element, and the testing to make sure it doesn't modify existing content. Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above.

</div>
</div>
</div>
30 changes: 0 additions & 30 deletions src/ui/public/chrome/context.js

This file was deleted.

1 change: 0 additions & 1 deletion src/ui/public/chrome/directives/active_http_spinner.html

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ body { overflow-x: hidden; }
margin: 0 auto;
background-color: #fff;

&.hidden-chrome { left: 0; }
&-panel {
.flex-parent(@shrink: 0);
box-shadow: -4px 0px 3px rgba(0,0,0,0.2);
Expand Down Expand Up @@ -84,7 +85,6 @@ body { overflow-x: hidden; }

.app-icon {
float: left;
filter: invert(100%);
font-weight: bold;
text-align: center;
font-size: 1.7em;
Expand All @@ -95,6 +95,11 @@ body { overflow-x: hidden; }
> img {
height: 18px;
margin-top: 8px;
filter: invert(100%);
}
> i {
color: #fff;
line-height: @app-icon-height
}
}

Expand Down Expand Up @@ -128,7 +133,7 @@ body { overflow-x: hidden; }
text-decoration: none;
}
img {
filter: invert(100%);
filter: none;
}
}

Expand Down
8 changes: 1 addition & 7 deletions src/ui/public/chrome/directives/append_nav_controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ import $ from 'jquery';

import chromeNavControlsRegistry from 'ui/registry/chrome_nav_controls';
import UiModules from 'ui/modules';
import spinnerHtml from './active_http_spinner.html';

const spinner = {
name: 'active http requests',
template: spinnerHtml
};

export default function (chrome, internals) {

Expand All @@ -19,7 +13,7 @@ export default function (chrome, internals) {
const parts = [$element.html()];
const controls = Private(chromeNavControlsRegistry);

for (const control of [spinner, ...controls.inOrder]) {
for (const control of controls.inOrder) {
parts.unshift(
`<!-- nav control ${control.name} -->`,
control.template
Expand Down
1 change: 1 addition & 0 deletions src/ui/public/chrome/directives/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'ui/directives/config';
import './app_switcher';
import kbnChromeProv from './kbn_chrome';
import kbnChromeNavControlsProv from './append_nav_controls';
import courierLoadingIndicator from './kbn_loading_indicator';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't need to be named does it?


export default function (chrome, internals) {
kbnChromeProv(chrome, internals);
Expand Down
17 changes: 17 additions & 0 deletions src/ui/public/chrome/directives/kbn_loading_indicator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import UiModules from 'ui/modules';
import angular from 'angular';

const spinnerTemplate = '<div class="spinner" ng-show="chrome.httpActive.length"></div>';

UiModules
.get('ui/kibana')
.directive('kbnLoadingIndicator', function ($compile) {
return {
restrict: 'AC',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you get rid of the C here? This is only used as an attribute and only in one place right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, do you need a link function or can you just use template: if you changed this to an E instead of an A?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't use the E because we want to append it to the app wrapper, which already has the apps replacing in it. I will remove the C.

link: function (scope, $el) {
const $loadingEl = angular.element(spinnerTemplate);
$el.append($loadingEl);
$compile($loadingEl)(scope);
}
};
});
111 changes: 1 addition & 110 deletions src/ui/public/images/kibana.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/ui/public/styles/base.less
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ a {

.kibana-nav-actions {
margin-left: auto;
line-height: 20px;

.button-group > :last-child {
border-radius: 0;
Expand Down
1 change: 1 addition & 0 deletions src/ui/public/styles/spinner.less
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
right: 0;
height: 2px;
position: absolute;
z-index: 10;
visibility: visible;
display: block;
animation: move 2s linear infinite;
Expand Down
Loading