Add new config option to control the amount of items in listing pages (#11674)

* Add new config option to control the amount of items in listing pages
* Add a warning message when the limit is reached.
This commit is contained in:
trevan 2017-05-20 22:02:00 -06:00 committed by CJ Cenizal
parent 1689fd89da
commit 7557c8f563
5 changed files with 33 additions and 2 deletions

View file

@ -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 -->

View file

@ -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;
@ -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();
});
};

View file

@ -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 -->

View file

@ -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;
@ -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();
});
};

View file

@ -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: