-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Infra UI] Add date picker to asset details (#164450)
closes: #160378 ## Summary This PR adds a date-picker to the Asset Details (full page and flyout) **Flyout** <img width="1435" alt="image" src="https://github.com/elastic/kibana/assets/2767137/a1adb3b0-b3d5-4ca3-9076-6dafd44eebbc"> **Full page view** <img width="1422" alt="image" src="https://github.com/elastic/kibana/assets/2767137/ad14764b-fdc2-4773-b8d0-7f2e271d89a5"> **Setting a date range** https://github.com/elastic/kibana/assets/2767137/4c41d9ee-6c18-45af-9bda-3cae6f372b7b **Brush event filter** https://github.com/elastic/kibana/assets/2767137/5830dcd7-7d66-45ed-a463-15bb79607f2a ### Bonus The uptime link was removed since the UI won't work. ### How to test - Start a local Kibana instance - Start metricbeat with system module enabled - Navigate to `Infrastructure` > `Hosts` - Click on a host name and check if the new Node Details page opened - Check if the date range is set with the same date range from the Host Detail view - Navigate to `Infrastructure` > `Hosts` - Open the flyout - Click on Open as page and check if the new Node Details page opened with the same date range from the Host Detail view - Navigate to Infrastructure > Inventory - With Show: Host selected, click on a waffle item to open the flyout, click on Open as page and check if the new Node Details page opened with the same date range from the Inventory UI Validate if the date picker value is applied to all tabs that have the component (Overview, Metadata, Processes, Logs, Anomalies) Validate if the date range changes when selecting a time range in the charts (in the flyout, the date range from the Hosts View must not change) --------- Co-authored-by: Kibana Machine <[email protected]>
- Loading branch information
1 parent
4b88b10
commit c7dd76d
Showing
32 changed files
with
667 additions
and
500 deletions.
There are no files selected for viewing
This file contains 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 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 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
37 changes: 37 additions & 0 deletions
37
x-pack/plugins/infra/public/components/asset_details/date_picker/date_picker.tsx
This file contains 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,37 @@ | ||
/* | ||
* 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 { EuiSuperDatePicker, type OnTimeChangeProps } from '@elastic/eui'; | ||
import React, { useCallback } from 'react'; | ||
import { useAssetDetailsStateContext } from '../hooks/use_asset_details_state'; | ||
import { useDateRangeProviderContext } from '../hooks/use_date_range'; | ||
|
||
export const DatePicker = () => { | ||
const { onTabsStateChange } = useAssetDetailsStateContext(); | ||
const { dateRange, setDateRange } = useDateRangeProviderContext(); | ||
const onTimeChange = useCallback( | ||
({ start, end, isInvalid }: OnTimeChangeProps) => { | ||
if (!isInvalid) { | ||
setDateRange({ from: start, to: end }); | ||
if (onTabsStateChange) { | ||
onTabsStateChange({ dateRange: { from: start, to: end } }); | ||
} | ||
} | ||
}, | ||
[onTabsStateChange, setDateRange] | ||
); | ||
|
||
return ( | ||
<EuiSuperDatePicker | ||
start={dateRange.from} | ||
end={dateRange.to} | ||
updateButtonProps={{ iconOnly: true }} | ||
onTimeChange={onTimeChange} | ||
width="full" | ||
/> | ||
); | ||
}; |
This file contains 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 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 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 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 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 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
Oops, something went wrong.