Skip to content

Commit

Permalink
added charts to micropanel in table
Browse files Browse the repository at this point in the history
  • Loading branch information
Rashid Khan committed Aug 20, 2013
1 parent 2e74275 commit eba4214
Show file tree
Hide file tree
Showing 8 changed files with 185 additions and 167 deletions.
2 changes: 1 addition & 1 deletion common/css/bootstrap.dark.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion common/css/bootstrap.light.min.css

Large diffs are not rendered by default.

317 changes: 159 additions & 158 deletions common/lib/angular.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<div class="navbar navbar-static-top">
<div class="navbar-inner">
<div class="container-fluid">
<p class="navbar-text pull-right"><small><strong>Kibana 3</strong> <small>milestone 3</small></small></p>
<p class="navbar-text pull-right version"><strong>Kibana 3</strong> milestone 3</p>
<span class="brand">{{dashboard.current.title}}</span>
<div class="brand"><i class='icon-cog pointer' ng-show='dashboard.current.editable' bs-modal="'partials/dasheditor.html'"></i></div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion js/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
};

kbn.to_percent = function(number,outof) {
return Math.round((number/outof)*10000)/100 + "%";
return Math.floor((number/outof)*10000)/100 + "%";
};

kbn.addslashes = function(str) {
Expand Down
14 changes: 10 additions & 4 deletions panels/table/micropanel.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,27 @@ <h4>
<i class="pointer icon-ban-circle" ng-click="fieldExists(micropanel.field,'mustNot');dismiss();"></i>
<br><small>{{micropanel.count}} events in the table set</small>
</h4>
<table style="width:480px" class='table table-bordered table-striped table-condensed'>
<table style="width:100%" class='table table-striped table-condensed'>
<thead>
<th>{{micropanel.field}}</th>
<th>Action</th>
<th>Count</th>
<th style="text-align:right">Count</th>
</thead>
<tbody>
<tr ng-repeat='field in micropanel.values'>
<td>{{{true: "__blank__",false:field[0]}[field[0] == ""]|tableTruncate:panel.trimFactor:3}}</td>
<td>
<td style="width:40px">
<i class="pointer icon-search" ng-click="build_search(micropanel.field,field[0]);dismiss();"></i>
<i class="pointer icon-ban-circle" ng-click="build_search(micropanel.field,field[0],true);dismiss();"></i>
</td>
<td>{{field[1]}}</td>
<td class="progress" style="width:100px;position:relative">
<div bs-tooltip="percent(field[1],data.length)" class="bar {{micropanelColor($index)}}" ng-style="{width: percent(field[1],data.length)}"></div>
<span style="position:absolute;right:10px;">{{field[1]}}</span>
</td>
</tr>
</tbody>
</table>
<div class="progress">
<div ng-repeat='field in micropanel.values' bs-tooltip="field[0]+' ('+percent(field[1],data.length)+')'" class="bar {{micropanelColor($index)}}" ng-style="{width: percent(field[1],data.length)};"></div>
</div>
<span ng-repeat='(field,count) in micropanel.related'><a ng-click="toggle_field(field)">{{field}}</a> ({{Math.round((count / micropanel.count) * 100)}}%), </span>
7 changes: 7 additions & 0 deletions panels/table/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ angular.module('kibana.table', [])
$scope.get_data();
};

$scope.percent = kbn.to_percent;

$scope.toggle_micropanel = function(field) {
var docs = _.pluck($scope.data,'_source');
$scope.micropanel = {
Expand All @@ -80,6 +82,11 @@ angular.module('kibana.table', [])
};
};

$scope.micropanelColor = function(index) {
var _c = ['bar-success','bar-warning','bar-danger','bar-info','bar-primary'];
return index > _c.length ? '' : _c[index];
};

$scope.set_sort = function(field) {
if($scope.panel.sort[0] === field) {
$scope.panel.sort[1] = $scope.panel.sort[1] === 'asc' ? 'desc' : 'asc';
Expand Down
6 changes: 5 additions & 1 deletion vendor/bootstrap/less/overrides.less
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
font-size: 12px;
}

.version {
font-size: 85%;
}

.legend {
color: @black;
}
Expand Down Expand Up @@ -129,7 +133,7 @@
}

.popover {
max-width: 500px;
max-width: 480px;
}

.modal {
Expand Down

3 comments on commit eba4214

@olej-a
Copy link

@olej-a olej-a commented on eba4214 Aug 20, 2013

Choose a reason for hiding this comment

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

Check pull request olej-a@1907371 - Display microanalysis panel directly from table row detail.

Prefered micropanel may be with % values, but it is detail only.

I see displaced count value for each row. Tested on Firefox 23.0.1

micro-new2
micro-new

@rashidkpc
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah thanks, will fix. I I just noticed that the hover for percentage wasn't working too

@olej-a
Copy link

@olej-a olej-a commented on eba4214 Aug 20, 2013

Choose a reason for hiding this comment

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

Percentage hover works OK for me

Please sign in to comment.