From 68687e0a2dd5b3e68f20cc2ffa45cfa9f905390a Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Tue, 16 Mar 2021 10:48:54 -0400 Subject: [PATCH] [Logs UI] Style improvements for log stream search strategy (#94560) (#94686) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Felix Stürmer --- .../log_entries/log_entries_search_strategy.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/x-pack/plugins/infra/server/services/log_entries/log_entries_search_strategy.ts b/x-pack/plugins/infra/server/services/log_entries/log_entries_search_strategy.ts index bf7e497385f9a..190464ab6d5c1 100644 --- a/x-pack/plugins/infra/server/services/log_entries/log_entries_search_strategy.ts +++ b/x-pack/plugins/infra/server/services/log_entries/log_entries_search_strategy.ts @@ -20,7 +20,6 @@ import type { } from '../../../../../../src/plugins/data/server'; import { LogSourceColumnConfiguration, - LogSourceConfigurationProperties, logSourceFieldColumnConfigurationRT, } from '../../../common/http_api/log_sources'; import { @@ -107,7 +106,10 @@ export const logEntriesSearchStrategyProvider = ({ params.size + 1, configuration.fields.timestamp, configuration.fields.tiebreaker, - getRequiredFields(configuration, messageFormattingRules, params.columns), + getRequiredFields( + params.columns ?? configuration.logColumns, + messageFormattingRules + ), params.query, params.highlightPhrase ), @@ -131,7 +133,7 @@ export const logEntriesSearchStrategyProvider = ({ .slice(0, request.params.size) .map( getLogEntryFromHit( - request.params.columns ? request.params.columns : configuration.logColumns, + request.params.columns ?? configuration.logColumns, messageFormattingRules ) ); @@ -257,12 +259,9 @@ function getResponseCursors(entries: LogEntry[]) { const VIEW_IN_CONTEXT_FIELDS = ['log.file.path', 'host.name', 'container.id']; const getRequiredFields = ( - configuration: LogSourceConfigurationProperties, - messageFormattingRules: CompiledLogMessageFormattingRule, - columnOverrides?: LogSourceColumnConfiguration[] + columns: LogSourceColumnConfiguration[], + messageFormattingRules: CompiledLogMessageFormattingRule ): string[] => { - const columns = columnOverrides ? columnOverrides : configuration.logColumns; - const fieldsFromColumns = columns.reduce((accumulatedFields, logColumn) => { if (logSourceFieldColumnConfigurationRT.is(logColumn)) { return [...accumulatedFields, logColumn.fieldColumn.field];