Skip to content

Commit

Permalink
Add new config option to control the amount of items in listing pages (
Browse files Browse the repository at this point in the history
…#11674) (#11945)

* Add new config option to control the amount of items in listing pages
* Add a warning message when the limit is reached.
  • Loading branch information
cjcenizal authored May 21, 2017
1 parent ae81b82 commit c9b0d45
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@
class="kuiViewContent kuiViewContent--constrainedWidth"
data-test-subj="dashboardLandingPage"
>
<div class="kuiViewContentItem kuiVerticalRhythm" ng-if="listingController.showLimitError">
<div class="kuiInfoPanel kuiInfoPanel--warning">
<div class="kuiInfoPanelBody">
<div class="kuiInfoPanelBody__message">
You have {{ listingController.totalItems }} dashboards, but your "listingLimit" setting prevents the table below from displaying more than {{ listingController.listingLimit }}. You can change this setting under <a kbn-href="#/management/kibana/settings" class="kuiLink">Advanced Settings</a>.
</div>
</div>
</div>
</div>
<!-- ControlledTable -->
<div class="kuiViewContentItem kuiControlledTable kuiVerticalRhythm">
<!-- ToolBar -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export function DashboardListingController($injector, $scope) {
const pagerFactory = $injector.get('pagerFactory');
const Private = $injector.get('Private');
const timefilter = $injector.get('timefilter');
const config = $injector.get('config');

timefilter.enabled = false;

Expand Down Expand Up @@ -45,10 +46,13 @@ export function DashboardListingController($injector, $scope) {
const fetchItems = () => {
this.isFetchingItems = true;

dashboardService.find(this.filter)
dashboardService.find(this.filter, config.get('savedObjects:listingLimit'))
.then(result => {
this.isFetchingItems = false;
this.items = result.hits;
this.totalItems = result.total;
this.showLimitError = result.total > config.get('savedObjects:listingLimit');
this.listingLimit = config.get('savedObjects:listingLimit');
calculateItemsOnPage();
});
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@
</kbn-top-nav>

<div class="kuiViewContent kuiViewContent--constrainedWidth">
<div class="kuiViewContentItem kuiVerticalRhythm" ng-if="listingController.showLimitError">
<div class="kuiInfoPanel kuiInfoPanel--warning">
<div class="kuiInfoPanelBody">
<div class="kuiInfoPanelBody__message">
You have {{ listingController.totalItems }} visualizations, but your "listingLimit" setting prevents the table below from displaying more than {{ listingController.listingLimit }}. You can change this setting under <a kbn-href="#/management/kibana/settings" class="kuiLink">Advanced Settings</a>.
</div>
</div>
</div>
</div>
<!-- ControlledTable -->
<div class="kuiViewContentItem kuiControlledTable kuiVerticalRhythm">
<!-- ToolBar -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export function VisualizeListingController($injector) {
const pagerFactory = $injector.get('pagerFactory');
const Private = $injector.get('Private');
const timefilter = $injector.get('timefilter');
const config = $injector.get('config');

timefilter.enabled = false;

Expand Down Expand Up @@ -44,10 +45,13 @@ export function VisualizeListingController($injector) {
const fetchItems = () => {
this.isFetchingItems = true;

visualizationService.find(this.filter)
visualizationService.find(this.filter, config.get('savedObjects:listingLimit'))
.then(result => {
this.isFetchingItems = false;
this.items = result.hits;
this.totalItems = result.total;
this.showLimitError = result.total > config.get('savedObjects:listingLimit');
this.listingLimit = config.get('savedObjects:listingLimit');
calculateItemsOnPage();
});
};
Expand Down
5 changes: 5 additions & 0 deletions src/ui/settings/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,11 @@ export default function defaultSettingsProvider() {
value: 5,
description: 'Number of objects to show per page in the load dialog'
},
'savedObjects:listingLimit': {
type: 'number',
value: 1000,
description: 'Number of objects to fetch for the listing pages'
},
'timepicker:timeDefaults': {
type: 'json',
value:
Expand Down

0 comments on commit c9b0d45

Please sign in to comment.