-
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
[Endpoint] Add Endpoint empty states for onboarding #69626
Changes from 18 commits
f9982f1
a319fc1
d203642
08afb5a
899f0cf
4316454
08bbc88
6260e5e
1c55b23
f5e3999
eb4b259
b9129eb
a93a1fa
3206882
439e8e9
e683508
7f656f8
71690bf
310b8ef
3529c1c
f364e74
8399f0e
18dd954
9689d04
d425f46
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 | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -3,8 +3,8 @@ | |||||||||
* 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, { useMemo, useState } from 'react'; | ||||||||||
import { Redirect, useRouteMatch, Switch, Route, useHistory } from 'react-router-dom'; | ||||||||||
import React, { useMemo, useState, useCallback } from 'react'; | ||||||||||
import { Redirect, useRouteMatch, Switch, Route, useHistory, useLocation } from 'react-router-dom'; | ||||||||||
import { i18n } from '@kbn/i18n'; | ||||||||||
import { FormattedMessage, FormattedDate } from '@kbn/i18n/react'; | ||||||||||
import { | ||||||||||
|
@@ -21,14 +21,16 @@ import { | |||||||||
} from '@elastic/eui'; | ||||||||||
import { Props as EuiTabProps } from '@elastic/eui/src/components/tabs/tab'; | ||||||||||
import styled from 'styled-components'; | ||||||||||
import { AgentConfig } from '../../../types'; | ||||||||||
import queryString from 'query-string'; | ||||||||||
import { AgentConfig, AgentConfigDetailsDeployAgentAction } from '../../../types'; | ||||||||||
import { PAGE_ROUTING_PATHS } from '../../../constants'; | ||||||||||
import { useGetOneAgentConfig, useLink, useBreadcrumbs } from '../../../hooks'; | ||||||||||
import { useGetOneAgentConfig, useLink, useBreadcrumbs, useCore } from '../../../hooks'; | ||||||||||
import { Loading } from '../../../components'; | ||||||||||
import { WithHeaderLayout } from '../../../layouts'; | ||||||||||
import { ConfigRefreshContext, useGetAgentStatus, AgentStatusRefreshContext } from './hooks'; | ||||||||||
import { LinkedAgentCount, AgentConfigActionMenu } from '../components'; | ||||||||||
import { ConfigDatasourcesView, ConfigSettingsView } from './components'; | ||||||||||
import { useIntraAppState } from '../../../hooks/use_intra_app_state'; | ||||||||||
|
||||||||||
const Divider = styled.div` | ||||||||||
width: 0; | ||||||||||
|
@@ -48,7 +50,13 @@ export const AgentConfigDetailsPage: React.FunctionComponent = () => { | |||||||||
const [redirectToAgentConfigList] = useState<boolean>(false); | ||||||||||
const agentStatusRequest = useGetAgentStatus(configId); | ||||||||||
const { refreshAgentStatus } = agentStatusRequest; | ||||||||||
const { | ||||||||||
application: { navigateToApp }, | ||||||||||
} = useCore(); | ||||||||||
const routeState = useIntraAppState<AgentConfigDetailsDeployAgentAction>(); | ||||||||||
const agentStatus = agentStatusRequest.data?.results; | ||||||||||
const openEnrollmentFlyoutOpenByDefault = | ||||||||||
queryString.parse(useLocation().search).openEnrollmentFlyout === 'true'; | ||||||||||
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. Can we use
Suggested change
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. FYI - If I remember correctly, the last time I tried to use URLSearchParams I had issues in the Jest UT environment because I think 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. I just pulled in the |
||||||||||
|
||||||||||
const headerLeftContent = useMemo( | ||||||||||
() => ( | ||||||||||
|
@@ -95,6 +103,12 @@ export const AgentConfigDetailsPage: React.FunctionComponent = () => { | |||||||||
[getHref, agentConfig, configId] | ||||||||||
); | ||||||||||
|
||||||||||
const enrollmentCancelClickHandler = useCallback(() => { | ||||||||||
if (routeState && routeState.onDoneNavigateTo) { | ||||||||||
navigateToApp(routeState.onDoneNavigateTo[0], routeState.onDoneNavigateTo[1]); | ||||||||||
} | ||||||||||
}, [routeState, navigateToApp]); | ||||||||||
|
||||||||||
const headerRightContent = useMemo( | ||||||||||
() => ( | ||||||||||
<EuiFlexGroup justifyContent={'flexEnd'} direction="row"> | ||||||||||
|
@@ -155,6 +169,12 @@ export const AgentConfigDetailsPage: React.FunctionComponent = () => { | |||||||||
onCopySuccess={(newAgentConfig: AgentConfig) => { | ||||||||||
history.push(getPath('configuration_details', { configId: newAgentConfig.id })); | ||||||||||
}} | ||||||||||
enrollmentFlyoutOpenByDefault={openEnrollmentFlyoutOpenByDefault} | ||||||||||
onCancelEnrollment={ | ||||||||||
routeState && routeState.onDoneNavigateTo | ||||||||||
? enrollmentCancelClickHandler | ||||||||||
: undefined | ||||||||||
} | ||||||||||
/> | ||||||||||
), | ||||||||||
}, | ||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,17 @@ export interface CreateDatasourceRouteState { | |
onCancelUrl?: string; | ||
} | ||
|
||
/** | ||
* Supported routing state for the agent config details page routes with deploy agents action | ||
*/ | ||
export interface AgentConfigDetailsDeployAgentAction { | ||
/** On cancel, navigate to the given app */ | ||
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. Update comment (remove "cancel") |
||
onDoneNavigateTo?: Parameters<ApplicationStart['navigateToApp']>; | ||
} | ||
|
||
/** | ||
* All possible Route states. | ||
*/ | ||
export type AnyIntraAppRouteState = CreateDatasourceRouteState; | ||
export type AnyIntraAppRouteState = | ||
| CreateDatasourceRouteState | ||
| AgentConfigDetailsDeployAgentAction; |
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.
maybe move the parsing of the hash to line 31 since it would mean it only gets parsed once