Skip to content

Commit

Permalink
Merge branch 'master' into fix/elastic#1962
Browse files Browse the repository at this point in the history
  • Loading branch information
stormpython committed Jan 14, 2015
2 parents 23d047d + 77cd2fb commit d64a224
Show file tree
Hide file tree
Showing 12 changed files with 122 additions and 58 deletions.
4 changes: 2 additions & 2 deletions src/kibana/plugins/dashboard/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<button ng-click="configTemplate.toggle('share')"><i class="fa fa-external-link"></i></button>
</kbn-tooltip>
<kbn-tooltip text="Add Visualization" placement="bottom" append-to-body="1">
<button ng-click="configTemplate.toggle('add')"><i class="fa fa-plus-circle"></i></button>
<button ng-click="configTemplate.toggle('pickVis')"><i class="fa fa-plus-circle"></i></button>
</kbn-tooltip>
</div>
</navbar>
Expand All @@ -53,7 +53,7 @@

<div ng-show="!state.panels.length" class="text-center start-screen">
<h2>Ready to get started?</h2>
<p>Click the <a class="btn btn-xs navbtn-inverse" ng-click="configTemplate.open('add')"><i class="fa fa-plus-circle"></i></a> button in the menu bar above to add a visualization to the dashboard. <br/>If you haven't setup a visualization yet visit the <a href="#/visualize">"Visualize"</a> tab to create your first visualization.</p>
<p>Click the <a class="btn btn-xs navbtn-inverse" ng-click="configTemplate.open('pickVis')"><i class="fa fa-plus-circle"></i></a> button in the menu bar above to add a visualization to the dashboard. <br/>If you haven't setup a visualization yet visit the <a href="#/visualize">"Visualize"</a> tab to create your first visualization.</p>
</div>

<dashboard-grid></dashboard-grid>
Expand Down
73 changes: 35 additions & 38 deletions src/kibana/plugins/kibana/kibana.html
Original file line number Diff line number Diff line change
@@ -1,47 +1,44 @@
<kbn-notifications list="notifList"></kbn-notifications>
<div class="content" style="display: none;">
<nav ng-hide="appEmbedded" bindonce class="navbar navbar-inverse navbar-static-top">
<div class="container-fluid">

<div class="navbar-header">
<button ng-click="showCollapsed = !showCollapsed" type="button" class="navbar-toggle">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<span class="navbar-brand visible-xs">{{ activeApp.name }}
<span ng-show="httpActive.length" class="spinner"></span>
</span>
</div>
<div class="navbar-header">
<button ng-click="showCollapsed = !showCollapsed" type="button" class="navbar-toggle">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<span class="navbar-brand visible-xs">{{ activeApp.name }}
<span ng-show="httpActive.length" class="spinner"></span>
</span>
</div>

<!-- Full navbar -->
<div collapse="!showCollapsed" class="navbar-collapse" id="kibana-primary-navbar">
<ul class="nav navbar-nav">
<li ng-repeat="app in apps.inOrder | filter:{show: true}" ng-class="{active: app.active}">
<a ng-href="#{{app.active ? app.id : app.lastPath}}" bo-text="app.name"></a>
</li>
</ul>
<!-- Full navbar -->
<div collapse="!showCollapsed" class="navbar-collapse" id="kibana-primary-navbar">
<ul class="nav navbar-nav">
<li ng-repeat="app in apps.inOrder | filter:{show: true}" ng-class="{active: activeApp === app}">
<a ng-href="#{{app.lastPath}}" bo-text="app.name"></a>
</li>
</ul>

<ul class="nav navbar-nav navbar-right navbar-timepicker">
<li ng-show="httpActive.length" class="navbar-text">
<div class="spinner"></div>
</li>
<ul class="nav navbar-nav navbar-right navbar-timepicker">
<li ng-show="httpActive.length" class="navbar-text">
<div class="spinner"></div>
</li>

<li ng-if="setupComplete" ng-show="timefilter.enabled" class="navbar-timepicker-container">
<a ng-click="toggleTimepicker()">
<span ng-show="timefilter.refreshInterval.value > 0" class="navbar-timepicker-auto-refresh-desc">
{{timefilter.refreshInterval.display}}
<i class="fa fa-rotate-right"></i>
</span>
<span class="navbar-timepicker-timefilter-desc">
<pretty-duration from="timefilter.time.from" to="timefilter.time.to"></pretty-duration>
<i class="fa fa-clock-o"></i>
</span>
</a>
</li>
</ul>
</div>
<li ng-if="setupComplete" ng-show="timefilter.enabled" class="navbar-timepicker-container">
<a ng-click="toggleTimepicker()">
<span ng-show="timefilter.refreshInterval.value > 0" class="navbar-timepicker-auto-refresh-desc">
{{timefilter.refreshInterval.display}}
<i class="fa fa-rotate-right"></i>
</span>
<span class="navbar-timepicker-timefilter-desc">
<pretty-duration from="timefilter.time.from" to="timefilter.time.to"></pretty-duration>
<i class="fa fa-clock-o"></i>
</span>
</a>
</li>
</ul>
<!-- /Full navbar -->
</div>
</nav>
Expand Down
2 changes: 1 addition & 1 deletion src/kibana/plugins/metric_vis/metric_vis_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ define(function (require) {
var agg = $scope.vis.aggs[0];
metric.label = agg.makeLabel();
if (agg.type.name === 'count') metric.value = resp.hits.total;
else metric.value = resp.aggregations[agg.id].value;
else metric.value = agg.fieldFormatter()(resp.aggregations[agg.id].value);
}
});
});
Expand Down
1 change: 0 additions & 1 deletion src/kibana/plugins/settings/sections/indices/_edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ define(function (require) {

var notify = new Notifier();
var $state = $scope.state = new AppState();
var popularityHtml = require('text!plugins/settings/sections/indices/_popularity.html');
var refreshKibanaIndex = Private(require('plugins/settings/sections/indices/_refresh_kibana_index'));

$scope.indexPattern = $route.current.locals.indexPattern;
Expand Down
8 changes: 8 additions & 0 deletions src/kibana/plugins/settings/sections/indices/_field_name.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<span>{{field.displayName}}</span>
&nbsp;
<span
ng-if="indexPattern.timeFieldName === field.name"
tooltip="This field represents the time that events occurred."
class="label label-default">
<i class="fa fa-clock-o"></i>
</span>
6 changes: 6 additions & 0 deletions src/kibana/plugins/settings/sections/indices/_field_type.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<span>{{field.type}}</span>
<i
ng-if="field.type == 'conflict'"
tooltip="The type of this field changes across indices. It is unavailable for many analysis functions."
class="fa fa-warning text-color-warning">
</i>
18 changes: 16 additions & 2 deletions src/kibana/plugins/settings/sections/indices/_indexed_fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ define(function (require) {

require('modules').get('apps/settings')
.directive('indexedFields', function () {
var popularityHtml = require('text!plugins/settings/sections/indices/_popularity.html');
var nameHtml = require('text!plugins/settings/sections/indices/_field_name.html');
var typeHtml = require('text!plugins/settings/sections/indices/_field_type.html');
var popularityHtml = require('text!plugins/settings/sections/indices/_field_popularity.html');

return {
restrict: 'E',
Expand Down Expand Up @@ -46,7 +48,19 @@ define(function (require) {
$scope.showPopularityControls(field);
}

return [field.name, field.type, field.analyzed, field.indexed,
return [
{
markup: nameHtml,
scope: childScope,
value: field.displayName
},
{
markup: typeHtml,
scope: childScope,
value: field.type
},
field.analyzed,
field.indexed,
{
markup: popularityHtml,
scope: childScope,
Expand Down
3 changes: 3 additions & 0 deletions src/kibana/plugins/visualize/editor/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ define(function (require) {
$scope.fetch();
});

// Without this manual emission, we'd miss filters and queries that were on the $state initially
$state.emit('fetch_with_changes');

$scope.$listen(timefilter, 'update', _.bindKey($scope, 'fetch'));

$scope.$on('ready:vis', function () {
Expand Down
4 changes: 4 additions & 0 deletions src/kibana/styles/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ notifications {
margin-bottom: 0px!important;
}

#kibana-primary-navbar {
margin-right: 15px;
}

[ng-click], [clip-copy], [href], [confirm-click] {
cursor: pointer;
}
Expand Down
28 changes: 14 additions & 14 deletions src/kibana/utils/config_template.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
define(function (require) {
var _ = require('lodash');

function ConfigTemplate(templates) {
var template = this;
template.current = null;
template.toggle = _.partial(update, null);
template.open = _.partial(update, true);
template.close = _.partial(update, false);

template.toggle = function (name) {
var toSwitch = templates[name];
if (template.current === toSwitch) {
template.current = null;
return false;
} else {
template.current = toSwitch;
return true;
}
};
function update(newState, name) {
var toUpdate = templates[name];
var curState = template.current === toUpdate;
if (newState == null) newState = !curState;

template.close = function (name) {
var toClose = templates[name];
if (template.current === toClose) {
if (newState) {
template.current = toUpdate;
} else {
template.current = null;
}
};

return newState;
}

template.toString = function () {
return template.current;
Expand Down
33 changes: 33 additions & 0 deletions test/unit/specs/plugins/metric_vis/metric_vis_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,27 @@ define(function (require) {
schema: 'metric',
makeLabel: function () {
return 'Average bytes';
},
fieldFormatter: function () {
return function (val) {
return val;
};
}
}]
};

var fieldFormatterVis = {
aggs: [{
id: 'agg',
type: {name: 'average'},
schema: 'metric',
makeLabel: function () {
return 'Average bytes';
},
fieldFormatter: function () {
return function (val) {
return val.toFixed(3);
};
}
}]
};
Expand Down Expand Up @@ -57,5 +78,17 @@ define(function (require) {
expect($scope.metric.label).to.be('Average bytes');
expect($scope.metric.value).to.be($scope.esResponse.aggregations.agg.value);
});

it('should use the field formatter', function () {
expect($scope.metric.label).to.not.be.ok();
expect($scope.metric.value).to.not.be.ok();

$scope.vis = fieldFormatterVis;
$scope.esResponse = {hits: {total: 4826}, aggregations: {agg: {value: 1234.12345}}};
$scope.$digest();

expect($scope.metric.label).to.be('Average bytes');
expect($scope.metric.value).to.be($scope.esResponse.aggregations.agg.value.toFixed(3));
});
});
});

0 comments on commit d64a224

Please sign in to comment.