diff --git a/frontend/src/lib/components/ServiceLogsInner.svelte b/frontend/src/lib/components/ServiceLogsInner.svelte index 9769e82fca..9b358adf80 100644 --- a/frontend/src/lib/components/ServiceLogsInner.svelte +++ b/frontend/src/lib/components/ServiceLogsInner.svelte @@ -15,6 +15,9 @@ import AnsiUp from 'ansi_up' import { scroll_into_view_if_needed_polyfill } from './multiselect/utils' import SplitPanesOrColumnOnMobile from './splitPanes/SplitPanesOrColumnOnMobile.svelte' + import Select from './apps/svelte-select/lib/Select.svelte' + import { SELECT_INPUT_DEFAULT_STYLE } from '$lib/defaults' + import DarkModeObserver from './DarkModeObserver.svelte' export let searchTerm: string export let queryParseErrors: string[] = [] @@ -319,10 +322,13 @@ const buckets = res['buckets'] sumOtherDocCount = res['sum_other_doc_count'] countsPerHost = new Map(buckets.map(({ key, doc_count }) => [key, doc_count])) - countsPerHost = buckets.reduce((acc: any, { key, doc_count }) => { - acc[key] = { doc_count } - return acc - }, {} as Record) + countsPerHost = buckets.reduce( + (acc: any, { key, doc_count }) => { + acc[key] = { doc_count } + return acc + }, + {} as Record + ) queryParseErrors = countLogsResponse.query_parse_errors ?? [] loadingLogCounts = false } @@ -376,7 +382,7 @@ let ret = {} for (const hk of Object.keys(countsPerHost)) { - let u = hk.split(",") + let u = hk.split(',') let [mode, wg, hn] = [u[0], u[1], u[2]] if (!ret[mode]) { @@ -392,8 +398,23 @@ return ret } + + function getSelectItems(allLogs: ByMode, countsPerHost: any): { label: string; value: any }[] { + return Object.entries(allLogsOrQueryResults(allLogs, countsPerHost)).flatMap(([mode, o1]) => + Object.entries(o1).flatMap(([wg, o2]) => + Object.keys(o2).map((hn) => ({ + label: hn, + value: [mode, wg, hn] + })) + ) + ) + } + + let darkMode = false + + @@ -436,7 +457,7 @@ month: '2-digit', hour: '2-digit', minute: '2-digit' - }) + }) : 'min datetime'} disabled /> @@ -476,7 +497,7 @@ month: '2-digit', hour: '2-digit', minute: '2-digit' - }) + }) : 'max datetime'} disabled /> @@ -548,6 +569,24 @@ > {/if} +
+