Skip to content

Commit

Permalink
[Logs UI] Style improvements for log stream search strategy (#94560) (#…
Browse files Browse the repository at this point in the history
…94686)

Co-authored-by: Felix Stürmer <[email protected]>
  • Loading branch information
kibanamachine and weltenwort authored Mar 16, 2021
1 parent 515cb9c commit 68687e0
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import type {
} from '../../../../../../src/plugins/data/server';
import {
LogSourceColumnConfiguration,
LogSourceConfigurationProperties,
logSourceFieldColumnConfigurationRT,
} from '../../../common/http_api/log_sources';
import {
Expand Down Expand Up @@ -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
),
Expand All @@ -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
)
);
Expand Down Expand Up @@ -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<string[]>((accumulatedFields, logColumn) => {
if (logSourceFieldColumnConfigurationRT.is(logColumn)) {
return [...accumulatedFields, logColumn.fieldColumn.field];
Expand Down

0 comments on commit 68687e0

Please sign in to comment.