-
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.
[Synthetics UI] Add pagination and date filtering to test runs table (#…
…144029) Co-authored-by: Shahzad <shahzad.muhammad@elastic.co>
- Loading branch information
Showing
11 changed files
with
320 additions
and
186 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
61 changes: 61 additions & 0 deletions
61
.../synthetics/public/apps/synthetics/components/monitor_details/hooks/use_monitor_pings.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,61 @@ | ||
/* | ||
* 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 { useEffect } from 'react'; | ||
import { useDispatch, useSelector } from 'react-redux'; | ||
|
||
import { useSelectedMonitor } from './use_selected_monitor'; | ||
import { useSelectedLocation } from './use_selected_location'; | ||
import { getMonitorRecentPingsAction, selectMonitorPingsMetadata } from '../../../state'; | ||
|
||
interface UseMonitorPingsProps { | ||
pageSize?: number; | ||
pageIndex?: number; | ||
from?: string; | ||
to?: string; | ||
} | ||
|
||
export const useMonitorPings = (props?: UseMonitorPingsProps) => { | ||
const dispatch = useDispatch(); | ||
|
||
const { monitor } = useSelectedMonitor(); | ||
const location = useSelectedLocation(); | ||
|
||
const monitorId = monitor?.id; | ||
const locationLabel = location?.label; | ||
|
||
useEffect(() => { | ||
if (monitorId && locationLabel) { | ||
dispatch( | ||
getMonitorRecentPingsAction.get({ | ||
monitorId, | ||
locationId: locationLabel, | ||
size: props?.pageSize, | ||
pageIndex: props?.pageIndex, | ||
from: props?.from, | ||
to: props?.to, | ||
}) | ||
); | ||
} | ||
}, [ | ||
dispatch, | ||
monitorId, | ||
locationLabel, | ||
props?.pageSize, | ||
props?.pageIndex, | ||
props?.from, | ||
props?.to, | ||
]); | ||
|
||
const { total, data: pings, loading } = useSelector(selectMonitorPingsMetadata); | ||
|
||
return { | ||
loading, | ||
total, | ||
pings, | ||
}; | ||
}; |
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.