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

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

Merged
merged 3 commits into from
May 21, 2017
Merged
Show file tree
Hide file tree
Changes from 2 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 Management &gt; Advanced Settings.
Copy link
Contributor

@cjcenizal cjcenizal May 20, 2017

Choose a reason for hiding this comment

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

I just realized we should probably just link directly to the Advanced Settings page. Can we change the last sentence to:

You can change this setting under <a kbn-href="#/management/kibana/settings" class="kuiLink">Advanced Settings</a>.

image

</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 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 @@ -44,10 +45,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 Management &gt; Advanced Settings.
</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 @@ -211,6 +211,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