-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Uptime] Fix/host connected components #56969
Changes from 7 commits
999fa8a
5de2432
8c59a1c
2349f0d
ca1ace9
7500bf3
ecf1ee3
933ba07
2e6db84
2f1f47d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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); |
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); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
*/ | ||
|
||
import React from 'react'; | ||
import { MonitorSummary } from '../../../../common/graphql/types'; | ||
import { MonitorSummary } from '../../../../../../common/graphql/types'; | ||
import { shallowWithIntl } from 'test_utils/enzyme_helpers'; | ||
import { IntegrationGroup } from '../integration_group'; | ||
|
||
|
@@ -26,12 +26,12 @@ describe('IntegrationGroup', () => { | |
it('will not display APM links when APM is unavailable', () => { | ||
const component = shallowWithIntl( | ||
<IntegrationGroup | ||
basePath="foo" | ||
dateRangeStart="now-12m" | ||
dateRangeEnd="now-1m" | ||
isApmAvailable={false} | ||
isInfraAvailable={true} | ||
isLogsAvailable={true} | ||
// basePath="foo" | ||
// dateRangeStart="now-12m" | ||
// dateRangeEnd="now-1m" | ||
// isApmAvailable={false} | ||
// isInfraAvailable={true} | ||
// isLogsAvailable={true} | ||
summary={summary} | ||
/> | ||
); | ||
|
@@ -41,12 +41,12 @@ describe('IntegrationGroup', () => { | |
it('will not display infra links when infra is unavailable', () => { | ||
const component = shallowWithIntl( | ||
<IntegrationGroup | ||
basePath="foo" | ||
dateRangeStart="now-12m" | ||
dateRangeEnd="now-1m" | ||
isApmAvailable={true} | ||
isInfraAvailable={false} | ||
isLogsAvailable={true} | ||
// basePath="foo" | ||
// dateRangeStart="now-12m" | ||
// dateRangeEnd="now-1m" | ||
// isApmAvailable={true} | ||
// isInfraAvailable={false} | ||
// isLogsAvailable={true} | ||
summary={summary} | ||
/> | ||
); | ||
|
@@ -56,12 +56,12 @@ describe('IntegrationGroup', () => { | |
it('will not display logging links when logging is unavailable', () => { | ||
const component = shallowWithIntl( | ||
<IntegrationGroup | ||
basePath="foo" | ||
dateRangeStart="now-12m" | ||
dateRangeEnd="now-1m" | ||
isApmAvailable={true} | ||
isInfraAvailable={true} | ||
isLogsAvailable={false} | ||
// basePath="foo" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto to deleting the code. |
||
// dateRangeStart="now-12m" | ||
// dateRangeEnd="now-1m" | ||
// isApmAvailable={true} | ||
// isInfraAvailable={true} | ||
// isLogsAvailable={false} | ||
summary={summary} | ||
/> | ||
); | ||
|
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.
Delete this code if it's not longer needed.
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.
done