Skip to content

Commit

Permalink
Add setting to configure the default context size
Browse files Browse the repository at this point in the history
The new setting `context:defaultSize` allows for customization of the
initial number of rows displayed when viewing an entry's context.
  • Loading branch information
weltenwort committed Dec 5, 2016
1 parent 1bb189d commit e10f458
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions docs/management/advanced-options.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,4 @@ Markdown.
`notifications:lifetime:error`:: Specifies the duration in milliseconds for error notification displays. The default value is 300000. Set this field to `Infinity` to disable error notifications.
`notifications:lifetime:warning`:: Specifies the duration in milliseconds for warning notification displays. The default value is 10000. Set this field to `Infinity` to disable warning notifications.
`notifications:lifetime:info`:: Specifies the duration in milliseconds for information notification displays. The default value is 5000. Set this field to `Infinity` to disable information notifications.
`context:defaultSize`:: Specifies the initial number of surrounding entries to display in the context view. The default value is 5.
8 changes: 4 additions & 4 deletions src/core_plugins/kibana/public/context/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ uiRoutes
});


function ContextAppRouteController($routeParams, $scope, AppState, indexPattern) {
this.state = new AppState(createDefaultAppState());
function ContextAppRouteController($routeParams, $scope, AppState, config, indexPattern) {
this.state = new AppState(createDefaultAppState(config));
$scope.$watchGroup([
'contextAppRoute.state.columns',
'contextAppRoute.state.size',
Expand All @@ -34,9 +34,9 @@ function ContextAppRouteController($routeParams, $scope, AppState, indexPattern)
this.indexPattern = indexPattern;
}

function createDefaultAppState() {
function createDefaultAppState(config) {
return {
columns: ['_source'],
size: 5,
size: parseInt(config.get('context:defaultSize'), 10),
};
}
6 changes: 5 additions & 1 deletion src/ui/settings/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,10 @@ export default function defaultSettingsProvider() {
description: 'The URL can sometimes grow to be too large for some browsers to ' +
'handle. To counter-act this we are testing if storing parts of the URL in ' +
'sessions storage could help. Please let us know how it goes!'
}
},
'context:defaultSize': {
value: 5,
description: 'The number of surrounding entries to show in the context view',
},
};
};

0 comments on commit e10f458

Please sign in to comment.