Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.x] Add new config option to control the amount of items in listing pages (#11674) #11945

Merged
merged 1 commit into from
May 21, 2017
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 @@ -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