-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Streams landing page improvements #215629
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
thomheymann
merged 20 commits into
elastic:main
from
thomheymann:180-streams-landing-page-improvements
Mar 27, 2025
Merged
Changes from 16 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
13a159f
wip
thomheymann 2b3f1e8
Merge branch 'main' of https://github.com/elastic/kibana into 180-str…
thomheymann 952320a
wip
thomheymann 3ad551c
Merge branch 'main' of https://github.com/elastic/kibana into 180-str…
thomheymann 6d4387b
wip
thomheymann d1c8fd4
Merge branch 'main' of https://github.com/elastic/kibana into 180-str…
thomheymann 86a7103
wip
thomheymann 8859e61
.
thomheymann e9d5155
Merge branch 'main' of https://github.com/elastic/kibana into 180-str…
thomheymann d84d13e
[CI] Auto-commit changed files from 'node scripts/styled_components_m…
kibanamachine ee504ae
remove unused translations
thomheymann d1a5bdd
Merge branch '180-streams-landing-page-improvements' of https://githu…
thomheymann 46df32f
Added suggestions from code and design review
thomheymann 11d1db8
Merge branch 'main' of https://github.com/elastic/kibana into 180-str…
thomheymann 10f1774
Timefilter provider
thomheymann 58221a0
Fix broken charts
thomheymann 5d030f9
Remove delay for rendering loading states
thomheymann e52f9b9
Merge branch 'main' of https://github.com/elastic/kibana into 180-str…
thomheymann 128bc5c
Increase default pagination
thomheymann 5d2387d
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
158 changes: 158 additions & 0 deletions
158
...atform/plugins/shared/streams_app/public/components/stream_list_view/documents_column.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,158 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
|
|
||
| import React from 'react'; | ||
| import { | ||
| EuiFlexGroup, | ||
| EuiFlexItem, | ||
| EuiI18nNumber, | ||
| EuiSkeletonRectangle, | ||
| EuiDelayRender, | ||
| } from '@elastic/eui'; | ||
| import { euiThemeVars } from '@kbn/ui-theme'; | ||
| import { css } from '@emotion/css'; | ||
| import { | ||
| BarSeries, | ||
| Chart, | ||
| ScaleType, | ||
| Settings, | ||
| LIGHT_THEME, | ||
| DARK_THEME, | ||
| niceTimeFormatter, | ||
| Tooltip, | ||
| TooltipStickTo, | ||
| type SettingsProps, | ||
| } from '@elastic/charts'; | ||
| import { i18n } from '@kbn/i18n'; | ||
| import { useEuiTheme } from '@elastic/eui'; | ||
| import { useStreamsAppFetch } from '../../hooks/use_streams_app_fetch'; | ||
| import { useKibana } from '../../hooks/use_kibana'; | ||
| import { esqlResultToTimeseries } from '../../util/esql_result_to_timeseries'; | ||
| import { useTimeFilter } from '../../hooks/use_timefilter'; | ||
|
|
||
| export function DocumentsColumn({ | ||
| indexPattern, | ||
| numDataPoints, | ||
| }: { | ||
| indexPattern: string; | ||
| numDataPoints: number; | ||
| }) { | ||
| const { | ||
| dependencies: { | ||
| start: { | ||
| streams: { streamsRepositoryClient }, | ||
| }, | ||
| }, | ||
| } = useKibana(); | ||
|
|
||
| const { absoluteTimeRange } = useTimeFilter(); | ||
| const minInterval = Math.floor((absoluteTimeRange.end - absoluteTimeRange.start) / numDataPoints); | ||
|
|
||
| const histogramQueryFetch = useStreamsAppFetch( | ||
| async ({ signal }) => { | ||
| return streamsRepositoryClient.fetch('POST /internal/streams/esql', { | ||
| params: { | ||
| body: { | ||
| operationName: 'get_doc_count_for_stream', | ||
| query: `FROM ${indexPattern} | STATS doc_count = COUNT(*) BY @timestamp = BUCKET(@timestamp, ${minInterval} ms)`, | ||
| start: absoluteTimeRange.start, | ||
| end: absoluteTimeRange.end, | ||
| }, | ||
| }, | ||
| signal, | ||
| }); | ||
| }, | ||
| [streamsRepositoryClient, indexPattern, absoluteTimeRange, minInterval] | ||
| ); | ||
|
|
||
| const allTimeseries = React.useMemo( | ||
| () => | ||
| esqlResultToTimeseries({ | ||
| result: histogramQueryFetch, | ||
| metricNames: ['doc_count'], | ||
| }), | ||
| [histogramQueryFetch] | ||
| ); | ||
|
|
||
| const docCount = allTimeseries.reduce( | ||
| (acc, series) => acc + series.data.reduce((acc2, item) => acc2 + (item.doc_count || 0), 0), | ||
| 0 | ||
| ); | ||
|
|
||
| const xFormatter = niceTimeFormatter([absoluteTimeRange.start, absoluteTimeRange.end]); | ||
|
|
||
| return ( | ||
| <EuiFlexGroup | ||
| alignItems="center" | ||
| gutterSize="m" | ||
| className={css` | ||
| height: ${euiThemeVars.euiSizeXL}; | ||
| white-space: nowrap; | ||
| `} | ||
| > | ||
| {histogramQueryFetch.loading ? ( | ||
| <EuiDelayRender delay={300}> | ||
| <EuiFlexItem> | ||
| <EuiSkeletonRectangle isLoading width="100%" height={euiThemeVars.euiFontSizeS} /> | ||
| </EuiFlexItem> | ||
| <EuiFlexItem> | ||
| <EuiSkeletonRectangle isLoading width="100%" height={euiThemeVars.euiSizeL} /> | ||
| </EuiFlexItem> | ||
| </EuiDelayRender> | ||
| ) : ( | ||
| <> | ||
| <EuiFlexItem | ||
| className={css` | ||
| text-align: right; | ||
| `} | ||
| > | ||
| <EuiI18nNumber value={docCount} /> | ||
| </EuiFlexItem> | ||
| <EuiFlexItem | ||
| className={css` | ||
| border-bottom: 1px solid ${euiThemeVars.euiColorLightestShade}; | ||
| `} | ||
| > | ||
| <Chart size={{ width: '100%', height: euiThemeVars.euiSizeL }}> | ||
| <SettingsWithTheme | ||
| xDomain={{ min: absoluteTimeRange.start, max: absoluteTimeRange.end, minInterval }} | ||
| noResults={<div />} | ||
| /> | ||
| <Tooltip | ||
| stickTo={TooltipStickTo.Middle} | ||
| headerFormatter={({ value }) => xFormatter(value)} | ||
| /> | ||
| {allTimeseries.map((serie) => ( | ||
| <BarSeries | ||
| key={serie.id} | ||
| id={serie.id} | ||
| xScaleType={ScaleType.Time} | ||
| yScaleType={ScaleType.Linear} | ||
| xAccessor="x" | ||
| yAccessors={['doc_count']} | ||
| data={serie.data} | ||
| /> | ||
| ))} | ||
| </Chart> | ||
| </EuiFlexItem> | ||
| </> | ||
| )} | ||
| </EuiFlexGroup> | ||
| ); | ||
| } | ||
|
|
||
| function SettingsWithTheme(props: SettingsProps) { | ||
| const { colorMode } = useEuiTheme(); | ||
| return ( | ||
| <Settings | ||
| locale={i18n.getLocale()} | ||
| baseTheme={colorMode === 'LIGHT' ? LIGHT_THEME : DARK_THEME} | ||
| theme={{ background: { color: 'transparent' } }} | ||
| {...props} | ||
| /> | ||
| ); | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't matter for the classic streams, but there is a detail here we need to think about for wired streams - should we show the count for the stream and its children or just for the current layer? @LucaWintergerst any opinions here?