Skip to content

Commit 10358d6

Browse files
🌊 Streams: Move datepicker into chart panel on overview page (elastic#217014)
This PR moves the datepicker on the overview page into the chart panel to claim some additional vertical screen space and to make it clearer what the stats on top of the page mean: <img width="1016" alt="Screenshot 2025-04-03 at 14 58 27" src="https://github.com/user-attachments/assets/b0100a3e-e9c4-419e-9803-45558b8a0fad" /> It also refactors the code a bit and reduces prop drilling in some areas. --------- Co-authored-by: kibanamachine <[email protected]>
1 parent 6a0c173 commit 10358d6

File tree

9 files changed

+223
-286
lines changed

9 files changed

+223
-286
lines changed

x-pack/platform/plugins/shared/streams_app/public/components/data_management/stream_detail_lifecycle/ilm_link.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,19 @@
77

88
import React from 'react';
99
import { EuiLink } from '@elastic/eui';
10-
import { IlmLocatorParams } from '@kbn/index-lifecycle-management-common-shared';
11-
import { LocatorPublic } from '@kbn/share-plugin/common';
10+
import { ILM_LOCATOR_ID, IlmLocatorParams } from '@kbn/index-lifecycle-management-common-shared';
1211
import { IngestStreamLifecycleILM } from '@kbn/streams-schema';
1312
import { i18n } from '@kbn/i18n';
13+
import { useKibana } from '../../../hooks/use_kibana';
1414

15-
export function IlmLink({
16-
ilmLocator,
17-
lifecycle,
18-
}: {
19-
ilmLocator?: LocatorPublic<IlmLocatorParams>;
20-
lifecycle: IngestStreamLifecycleILM;
21-
}) {
15+
export function IlmLink({ lifecycle }: { lifecycle: IngestStreamLifecycleILM }) {
16+
const {
17+
dependencies: {
18+
start: { share },
19+
},
20+
} = useKibana();
21+
22+
const ilmLocator = share.url.locators.get<IlmLocatorParams>(ILM_LOCATOR_ID);
2223
return (
2324
<EuiLink
2425
target="_blank"

x-pack/platform/plugins/shared/streams_app/public/components/data_management/stream_detail_lifecycle/ilm_summary.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ import {
2828
formatNumber,
2929
useEuiTheme,
3030
} from '@elastic/eui';
31-
import { LocatorPublic } from '@kbn/share-plugin/common';
32-
import { IlmLocatorParams } from '@kbn/index-lifecycle-management-common-shared';
3331
import { useStreamsAppFetch } from '../../../hooks/use_streams_app_fetch';
3432
import { useKibana } from '../../../hooks/use_kibana';
3533
import { orderIlmPhases, parseDurationInSeconds } from './helpers';
@@ -39,11 +37,9 @@ import { useIlmPhasesColorAndDescription } from './hooks/use_ilm_phases_color_an
3937
export function IlmSummary({
4038
definition,
4139
lifecycle,
42-
ilmLocator,
4340
}: {
4441
definition: IngestStreamGetResponse;
4542
lifecycle: IngestStreamLifecycleILM;
46-
ilmLocator?: LocatorPublic<IlmLocatorParams>;
4743
}) {
4844
const {
4945
dependencies: {
@@ -104,7 +100,7 @@ export function IlmSummary({
104100
</EuiFlexItem>
105101

106102
<EuiFlexItem grow={false}>
107-
<IlmLink lifecycle={lifecycle} ilmLocator={ilmLocator} />
103+
<IlmLink lifecycle={lifecycle} />
108104
</EuiFlexItem>
109105
</EuiFlexGroup>
110106
</EuiPanel>

x-pack/platform/plugins/shared/streams_app/public/components/data_management/stream_detail_lifecycle/index.tsx

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,7 @@ import {
1616
isUnwiredStreamGetResponse,
1717
isWiredStreamGetResponse,
1818
} from '@kbn/streams-schema';
19-
import {
20-
ILM_LOCATOR_ID,
21-
IlmLocatorParams,
22-
PolicyFromES,
23-
} from '@kbn/index-lifecycle-management-common-shared';
19+
import { PolicyFromES } from '@kbn/index-lifecycle-management-common-shared';
2420
import { i18n } from '@kbn/i18n';
2521
import { useAbortController } from '@kbn/react-hooks';
2622
import { useKibana } from '../../../hooks/use_kibana';
@@ -98,7 +94,6 @@ export function StreamDetailLifecycle({
9894
core: { http, notifications },
9995
dependencies: {
10096
start: {
101-
share,
10297
streams: { streamsRepositoryClient },
10398
},
10499
},
@@ -122,8 +117,6 @@ export function StreamDetailLifecycle({
122117

123118
const { signal } = useAbortController();
124119

125-
const ilmLocator = share.url.locators.get<IlmLocatorParams>(ILM_LOCATOR_ID);
126-
127120
const getIlmPolicies = () =>
128121
http.get<PolicyFromES[]>('/api/index_lifecycle_management/policies', {
129122
signal,
@@ -177,7 +170,6 @@ export function StreamDetailLifecycle({
177170
updateLifecycle={updateLifecycle}
178171
getIlmPolicies={getIlmPolicies}
179172
updateInProgress={updateInProgress}
180-
ilmLocator={ilmLocator}
181173
/>
182174

183175
<EuiPanel grow={false} hasShadow={false} hasBorder paddingSize="s">
@@ -190,7 +182,6 @@ export function StreamDetailLifecycle({
190182
<RetentionMetadata
191183
definition={definition}
192184
lifecycleActions={lifecycleActions}
193-
ilmLocator={ilmLocator}
194185
openEditModal={(action) => setOpenEditModal(action)}
195186
isLoadingStats={isLoadingStats}
196187
stats={stats}
@@ -218,11 +209,7 @@ export function StreamDetailLifecycle({
218209
{isIlmLifecycle(definition.effective_lifecycle) ? (
219210
<EuiFlexItem grow={3}>
220211
<EuiPanel grow={true} hasShadow={false} hasBorder paddingSize="s">
221-
<IlmSummary
222-
definition={definition}
223-
lifecycle={definition.effective_lifecycle}
224-
ilmLocator={ilmLocator}
225-
/>
212+
<IlmSummary definition={definition} lifecycle={definition.effective_lifecycle} />
226213
</EuiPanel>
227214
</EuiFlexItem>
228215
) : null}

x-pack/platform/plugins/shared/streams_app/public/components/data_management/stream_detail_lifecycle/metadata.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
* 2.0.
66
*/
77

8-
import { IlmLocatorParams } from '@kbn/index-lifecycle-management-common-shared';
9-
import { LocatorPublic } from '@kbn/share-plugin/common';
108
import {
119
IngestStreamGetResponse,
1210
isDisabledLifecycle,
@@ -42,15 +40,13 @@ import { formatIngestionRate } from './helpers/format_bytes';
4240

4341
export function RetentionMetadata({
4442
definition,
45-
ilmLocator,
4643
lifecycleActions,
4744
openEditModal,
4845
stats,
4946
isLoadingStats,
5047
statsError,
5148
}: {
5249
definition: IngestStreamGetResponse;
53-
ilmLocator?: LocatorPublic<IlmLocatorParams>;
5450
lifecycleActions: Array<{ name: string; action: LifecycleEditAction }>;
5551
openEditModal: (action: LifecycleEditAction) => void;
5652
stats?: DataStreamStats;
@@ -99,7 +95,7 @@ export function RetentionMetadata({
9995

10096
const ilmLink = isIlmLifecycle(lifecycle) ? (
10197
<EuiBadge color="hollow">
102-
<IlmLink lifecycle={lifecycle} ilmLocator={ilmLocator} />
98+
<IlmLink lifecycle={lifecycle} />
10399
</EuiBadge>
104100
) : null;
105101

x-pack/platform/plugins/shared/streams_app/public/components/data_management/stream_detail_lifecycle/modal.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77

88
import React, { useEffect, useMemo, useState } from 'react';
99
import {
10+
ILM_LOCATOR_ID,
1011
IlmLocatorParams,
1112
Phases,
1213
PolicyFromES,
1314
} from '@kbn/index-lifecycle-management-common-shared';
14-
import { LocatorPublic } from '@kbn/share-plugin/common';
1515
import {
1616
IngestStreamGetResponse,
1717
IngestStreamLifecycle,
@@ -55,6 +55,7 @@ import {
5555
import { i18n } from '@kbn/i18n';
5656
import { useBoolean } from '@kbn/react-hooks';
5757
import useToggle from 'react-use/lib/useToggle';
58+
import { useKibana } from '../../../hooks/use_kibana';
5859
import { rolloverCondition } from './helpers/rollover_condition';
5960
import { useStreamsAppRouter } from '../../../hooks/use_streams_app_router';
6061
import { useWiredStreams } from '../../../hooks/use_wired_streams';
@@ -69,7 +70,6 @@ interface ModalOptions {
6970
getIlmPolicies: () => Promise<PolicyFromES[]>;
7071
definition: IngestStreamGetResponse;
7172
updateInProgress: boolean;
72-
ilmLocator?: LocatorPublic<IlmLocatorParams>;
7373
}
7474

7575
export function EditLifecycleModal({
@@ -231,9 +231,15 @@ function IlmModal({
231231
updateLifecycle,
232232
updateInProgress,
233233
getIlmPolicies,
234-
ilmLocator,
235234
definition,
236235
}: ModalOptions) {
236+
const {
237+
dependencies: {
238+
start: { share },
239+
},
240+
} = useKibana();
241+
242+
const ilmLocator = share.url.locators.get<IlmLocatorParams>(ILM_LOCATOR_ID);
237243
const existingLifecycle = definition.stream.ingest.lifecycle;
238244
const [selectedPolicy, setSelectedPolicy] = useState(
239245
isIlmLifecycle(existingLifecycle) ? existingLifecycle.ilm.policy : undefined

x-pack/platform/plugins/shared/streams_app/public/components/esql_chart/controlled_esql_chart.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ export function ControlledEsqlChart<T extends string>({
171171
id="y-axis"
172172
ticks={3}
173173
position={Position.Left}
174+
hide
174175
tickFormat={yTickFormat}
175176
labelFormat={yLabelFormat}
176177
/>

0 commit comments

Comments
 (0)