Add setting to hide the 'Time' column in discover and saved searches. (#28436)

This commit is contained in:
Luke Elmers 2019-01-09 17:12:47 -07:00 committed by GitHub
parent 1ba322c4a8
commit 65b5c5cc9f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 20 additions and 5 deletions

View file

@ -39,6 +39,7 @@ document.
`discover:sort:defaultOrder`:: Controls the default sort direction for time based index patterns in the Discover app.
`doc_table:highlight`:: Highlight results in Discover and Saved Searches Dashboard. Highlighting makes request slow when
working on big documents. Set this property to `false` to disable highlighting.
`doc_table:hideTimeColumn`:: Hide the 'Time' column in Discover and in all Saved Searches on Dashboards.
`search:includeFrozen`:: Will include {ref}/frozen-indices.html[frozen indices] in results if enabled. Searching through frozen indices
might increase the search time.
`courier:maxSegmentCount`:: Kibana splits requests in the Discover app into segments to limit the size of requests sent to

View file

@ -371,7 +371,8 @@ function discoverController(
}
const timeFieldName = $scope.indexPattern.timeFieldName;
const fields = timeFieldName ? [timeFieldName, ...selectedFields] : selectedFields;
const hideTimeColumn = config.get('doc_table:hideTimeColumn');
const fields = (timeFieldName && !hideTimeColumn) ? [timeFieldName, ...selectedFields] : selectedFields;
return {
searchFields: fields,
selectFields: fields

View file

@ -267,6 +267,16 @@ export function getUiSettingDefaults() {
}),
category: ['discover'],
},
'doc_table:hideTimeColumn': {
name: i18n.translate('kbn.advancedSettings.docTableHideTimeColumnTitle', {
defaultMessage: 'Hide \'Time\' column',
}),
value: false,
description: i18n.translate('kbn.advancedSettings.docTableHideTimeColumnText', {
defaultMessage: 'Hide the \'Time\' column in Discover and in all Saved Searches on Dashboards.',
}),
category: ['discover'],
},
'courier:maxSegmentCount': {
name: i18n.translate('kbn.advancedSettings.courier.maxSegmentCountTitle', {
defaultMessage: 'Maximum segment count',

View file

@ -1,7 +1,7 @@
<tr>
<td width="1%"></td>
<th
ng-if="indexPattern.timeFieldName"
ng-if="indexPattern.timeFieldName && !hideTimeColumn"
data-test-subj="docTableHeaderField"
scope="col"
>

View file

@ -36,7 +36,9 @@ module.directive('kbnTableHeader', function (shortDotsFilter) {
onMoveColumn: '=?',
},
template: headerHtml,
controller: function ($scope) {
controller: function ($scope, config) {
$scope.hideTimeColumn = config.get('doc_table:hideTimeColumn');
$scope.isSortableColumn = function isSortableColumn(columnName) {
return (
!!$scope.indexPattern

View file

@ -45,7 +45,7 @@ const MIN_LINE_LENGTH = 20;
* <tr ng-repeat="row in rows" kbn-table-row="row"></tr>
* ```
*/
module.directive('kbnTableRow', function ($compile, $httpParamSerializer, kbnUrl) {
module.directive('kbnTableRow', function ($compile, $httpParamSerializer, kbnUrl, config) {
const cellTemplate = _.template(noWhiteSpace(require('ui/doc_table/components/table_row/cell.html')));
const truncateByHeightTemplate = _.template(noWhiteSpace(require('ui/partials/truncate_by_height.html')));
@ -139,7 +139,8 @@ module.directive('kbnTableRow', function ($compile, $httpParamSerializer, kbnUrl
];
const mapping = indexPattern.fields.byName;
if (indexPattern.timeFieldName) {
const hideTimeColumn = config.get('doc_table:hideTimeColumn');
if (indexPattern.timeFieldName && !hideTimeColumn) {
newHtmls.push(cellTemplate({
timefield: true,
formatted: _displayField(row, indexPattern.timeFieldName),