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

Table styling tweaks #1

Merged
merged 3 commits into from
Nov 4, 2014
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
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ define(function (require) {
if (group) {
table.aggConfig = agg;
table.key = key;
table.title = agg.makeLabel() + ': ' + key;
table.title = agg.makeLabel() + ': ' + table.fieldFormat(key);
}

var parent = this.splitStack[0];
Expand Down
11 changes: 11 additions & 0 deletions src/kibana/components/agg_response/tabify/_table_group.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
define(function (require) {
return function TableGroupProvider() {
var _ = require('lodash');

/**
* Simple object that wraps multiple tables. It contains information about the aggConfig
* and bucket that created this group and a list of the tables within it.
Expand All @@ -11,6 +13,15 @@ define(function (require) {
this.tables = [];
}

TableGroup.prototype.field = function () {
return this.aggConfig && this.aggConfig.params && this.aggConfig.params.field;
};

TableGroup.prototype.fieldFormat = function () {
var field = this.field();
return field ? field.format.convert : _.identity;
};

return TableGroup;
};
});
7 changes: 1 addition & 6 deletions src/kibana/directives/paginate.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,7 @@ define(function (require) {
// this directive is automatically added by paginate if not found within it's $el
return {
restrict: 'E',
template: require('text!partials/paginate_controls.html'),
link: function ($scope, $el) {
$scope.$watch('page.count > 1', function (show) {
$el.toggle(show);
});
}
template: require('text!partials/paginate_controls.html')
};
});

Expand Down
47 changes: 27 additions & 20 deletions src/kibana/partials/paginate_controls.html
Original file line number Diff line number Diff line change
@@ -1,30 +1,37 @@
<ul class="pagination pagination-sm">
<li ng-class="{disabled: page.first}">
<a ng-click="paginate.goToPage(page.prev)">«</a>
</li>
<div class="pagination-other-pages">
<ul class="pagination-other-pages-list pagination-sm" ng-if="page.count > 1">
<li ng-class="{disabled: page.first}">
<a ng-click="paginate.goToPage(page.prev)">«</a>
</li>

<li ng-if="!otherPages.containsFirst">
<a ng-click="paginate.goToPage(1)">1...</a>
</li>
<li ng-if="!otherPages.containsFirst">
<a ng-click="paginate.goToPage(1)">1...</a>
</li>

<li
ng-repeat="other in otherPages"
ng-class="{ active: other.number === page.number }">
<a ng-click="paginate.goToPage(other)">{{other.number}}</a>
</li>
<li
ng-repeat="other in otherPages"
ng-class="{ active: other.number === page.number }">
<a ng-click="paginate.goToPage(other)">{{other.number}}</a>
</li>

<li ng-if="!otherPages.containsLast">
<a ng-click="paginate.goToPage(page.count)">...{{page.count}}</a>
</li>
<li ng-if="!otherPages.containsLast">
<a ng-click="paginate.goToPage(page.count)">...{{page.count}}</a>
</li>

<li ng-class="{disabled: page.last}">
<a ng-click="paginate.goToPage(page.next)">»</a>
</li>
</ul>
<li ng-class="{disabled: page.last}">
<a ng-click="paginate.goToPage(page.next)">»</a>
</li>
</ul>
</div>

<form class="form-inline pagination-size">
<div class="form-group">
<label>Page Size</label>
<input type="number" ng-model="paginate.perPage">
<select ng-model="paginate.perPage">
<option>10</option>
<option>25</option>
<option>100</option>
<option value="0">All</option>
</select>
</div>
</form>
10 changes: 6 additions & 4 deletions src/kibana/plugins/table_vis/table_vis.less
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.TableVis {
min-width: 55%;
max-width: 100%;
margin: 20px auto;
}
width: 100%;

kbn-agg-table-group > .table > tbody > tr > td {
border-top: 0px;
}
}
14 changes: 9 additions & 5 deletions src/kibana/styles/_pagination.less
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,20 @@ paginate {
padding: 5px 5px 10px;
text-align: center;

.pagination {
.pagination-other-pages {
.flex(1, 0, auto);
.display(flex);
.justify-content(center);

// override some bootstrap styles
margin: 0 auto;

> li {
&-list {
.flex(0, 0, auto);
.display(flex);
margin: 0;
list-style: none;

> li {
.flex(0, 0, auto);
}
}
}

Expand Down