Skip to content

Commit

Permalink
[Chrome] Append nav controls changes
Browse files Browse the repository at this point in the history
  • Loading branch information
panda01 committed Mar 14, 2016
1 parent aa7f9af commit f3653a1
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 127 deletions.
3 changes: 2 additions & 1 deletion src/plugins/kibana/public/dashboard/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
ng-click="configTemplate.toggle('options');">
<span>Options</span>
</button>
<div class="chrome-actions"kbn-chrome-append-nav-controls></div>
<kbn-loading-indicator></kbn-loading-indicator>
<kbn-global-timepicker></kbn-global-timepicker>
</div>
</navbar>
<config config-template="configTemplate" config-object="opts"></config>
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/kibana/public/discover/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
ng-click="configTemplate.toggle('share');">
<span>Share</span>
</button>
<div class="chrome-actions" kbn-chrome-append-nav-controls></div>
<kbn-loading-indicator></kbn-loading-indicator>
<kbn-global-timepicker></kbn-global-timepicker>
</div>
</navbar>
<config
Expand Down
3 changes: 2 additions & 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,8 @@
aria-label="Refresh">
<span>Refresh</span>
</button>
<div class="chrome-actions"kbn-chrome-append-nav-controls></div>
<kbn-loading-indicator></kbn-loading-indicator>
<kbn-global-timepicker></kbn-global-timepicker>
</div>
</navbar>
<config
Expand Down
1 change: 1 addition & 0 deletions src/ui/public/chrome/chrome.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<app-switcher>
</app-switcher>
<div class="bottom-apps hide app-links">
<div class="chrome-actions" kbn-chrome-append-nav-controls></div>
<div class="app-link">
<a href="http://elastic.co">
<div class="app-icon">
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';

export default function (chrome, internals) {
kbnChromeProv(chrome, internals);
Expand Down
12 changes: 12 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,12 @@
import UiModules from 'ui/modules';

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

UiModules
.get('ui/kibana')
.directive('kbnLoadingIndicator', function() {
return {
restrict: 'E',
template: spinnerTemplate
}
});
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 @@ -144,6 +144,7 @@ a {
padding-bottom: 0;
.kibana-nav-actions {
margin-left: auto;
line-height: 20px;
}
.kibana-nav-info {
line-height: 30px;
Expand Down
27 changes: 20 additions & 7 deletions src/ui/public/timepicker/toggle.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
import UiModules from 'ui/modules';
import chromeNavControlsRegistry from 'ui/registry/chrome_nav_controls';
import { once, clone } from 'lodash';

import toggleHtml from './toggle.html';

// TODO: the chrome-context directive is currently responsible for several variables
// on scope used by this template. We need to get rid of that directive and move that
// logic here
UiModules
.get('kibana')
.directive('kbnGlobalTimepicker', function(timefilter, globalState) {
const listenForUpdates = once($scope => {
$scope.$listen(timefilter, 'update', (newVal, oldVal) => {
globalState.time = clone(timefilter.time);
globalState.refreshInterval = clone(timefilter.refreshInterval);
globalState.save();
});
});

chromeNavControlsRegistry.register(function () {
return {
name: 'timepicker toggle',
order: 100,
template: toggleHtml
template: toggleHtml,
link: function($scope, $el, attrs) {
listenForUpdates($scope);

$scope.timefilter = timefilter;
$scope.toggleRefresh = () => {
timefilter.refreshInterval.pause = !timefilter.refreshInterval.pause;
};
},
};
});

0 comments on commit f3653a1

Please sign in to comment.