forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Uptime] Fix/host connected components (elastic#56969)
* added test for pages * fixed types * moved redux logic to connected * comment * update type * type fix
- Loading branch information
Showing
23 changed files
with
183 additions
and
178 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
26 changes: 26 additions & 0 deletions
26
...ck/legacy/plugins/uptime/public/components/connected/monitor/drawer_popover_container.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,26 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { connect } from 'react-redux'; | ||
import { AppState } from '../../../state'; | ||
import { isIntegrationsPopupOpen } from '../../../state/selectors'; | ||
import { PopoverState, toggleIntegrationsPopover } from '../../../state/actions'; | ||
import { MonitorListActionsPopoverComponent } from '../../functional/monitor_list/monitor_list_drawer'; | ||
|
||
const mapStateToProps = (state: AppState) => ({ | ||
popoverState: isIntegrationsPopupOpen(state), | ||
}); | ||
|
||
const mapDispatchToProps = (dispatch: any) => ({ | ||
togglePopoverIsVisible: (popoverState: PopoverState) => { | ||
return dispatch(toggleIntegrationsPopover(popoverState)); | ||
}, | ||
}); | ||
|
||
export const MonitorListActionsPopover = connect( | ||
mapStateToProps, | ||
mapDispatchToProps | ||
)(MonitorListActionsPopoverComponent); |
49 changes: 49 additions & 0 deletions
49
x-pack/legacy/plugins/uptime/public/components/connected/monitor/list_drawer_container.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,49 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import React, { useEffect } from 'react'; | ||
import { connect } from 'react-redux'; | ||
import { AppState } from '../../../state'; | ||
import { getMonitorDetails } from '../../../state/selectors'; | ||
import { MonitorDetailsActionPayload } from '../../../state/actions/types'; | ||
import { fetchMonitorDetails } from '../../../state/actions/monitor'; | ||
import { MonitorListDrawerComponent } from '../../functional/monitor_list/monitor_list_drawer/monitor_list_drawer'; | ||
import { useUrlParams } from '../../../hooks'; | ||
import { MonitorSummary } from '../../../../common/graphql/types'; | ||
import { MonitorDetails } from '../../../../common/runtime_types/monitor'; | ||
|
||
interface ContainerProps { | ||
summary: MonitorSummary; | ||
monitorDetails: MonitorDetails; | ||
loadMonitorDetails: typeof fetchMonitorDetails; | ||
} | ||
|
||
const Container: React.FC<ContainerProps> = ({ summary, loadMonitorDetails, monitorDetails }) => { | ||
const monitorId = summary?.monitor_id; | ||
|
||
const [getUrlParams] = useUrlParams(); | ||
const { dateRangeStart: dateStart, dateRangeEnd: dateEnd } = getUrlParams(); | ||
|
||
useEffect(() => { | ||
loadMonitorDetails({ | ||
dateStart, | ||
dateEnd, | ||
monitorId, | ||
}); | ||
}, [dateStart, dateEnd, monitorId, loadMonitorDetails]); | ||
return <MonitorListDrawerComponent monitorDetails={monitorDetails} summary={summary} />; | ||
}; | ||
|
||
const mapStateToProps = (state: AppState, { summary }: any) => ({ | ||
monitorDetails: getMonitorDetails(state, summary), | ||
}); | ||
|
||
const mapDispatchToProps = (dispatch: any) => ({ | ||
loadMonitorDetails: (actionPayload: MonitorDetailsActionPayload) => | ||
dispatch(fetchMonitorDetails(actionPayload)), | ||
}); | ||
|
||
export const MonitorListDrawer = connect(mapStateToProps, mapDispatchToProps)(Container); |
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
61 changes: 59 additions & 2 deletions
61
...apshots__/integration_group.test.tsx.snap → ...apshots__/integration_group.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
File renamed without changes.
2 changes: 0 additions & 2 deletions
2
...onitor_list/monitor_list_drawer/__tests__/__snapshots__/monitor_list_drawer.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
File renamed without changes.
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.