-
Notifications
You must be signed in to change notification settings - Fork 8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add artifact event filters card to policy edit view on endpoint integ…
…ration fixes elastic/security-team/issues/2031
- Loading branch information
1 parent
38d25e6
commit 1ba29a4
Showing
5 changed files
with
194 additions
and
74 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
74 changes: 74 additions & 0 deletions
74
...gration/endpoint_package_custom_extension/components/fleet_event_filters_card_wrapper.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,74 @@ | ||
/* | ||
* 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 React, { memo, useMemo } from 'react'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { FormattedMessage } from '@kbn/i18n-react'; | ||
import { | ||
PackageCustomExtensionComponentProps, | ||
pagePathGetters, | ||
} from '../../../../../../../../../fleet/public'; | ||
import { getEventFiltersListPath } from '../../../../../../common/routing'; | ||
import { ListPageRouteState } from '../../../../../../../../common/endpoint/types'; | ||
import { INTEGRATIONS_PLUGIN_ID } from '../../../../../../../../../fleet/common'; | ||
|
||
import { useAppUrl } from '../../../../../../../common/lib/kibana/hooks'; | ||
import { LinkWithIcon } from './link_with_icon'; | ||
|
||
import { FleetEventFiltersCard } from './fleet_event_filters_card'; | ||
|
||
export const FleetEventFiltersCardWrapper = memo<PackageCustomExtensionComponentProps>( | ||
({ pkgkey }) => { | ||
const { getAppUrl } = useAppUrl(); | ||
const eventFiltersListUrlPath = getEventFiltersListPath(); | ||
|
||
const eventFiltersRouteState = useMemo<ListPageRouteState>(() => { | ||
const fleetPackageCustomUrlPath = `#${ | ||
pagePathGetters.integration_details_custom({ pkgkey })[1] | ||
}`; | ||
return { | ||
backButtonLabel: i18n.translate( | ||
'xpack.securitySolution.endpoint.fleetCustomExtension.backButtonLabel', | ||
{ defaultMessage: 'Back to Endpoint Integration' } | ||
), | ||
onBackButtonNavigateTo: [ | ||
INTEGRATIONS_PLUGIN_ID, | ||
{ | ||
path: fleetPackageCustomUrlPath, | ||
}, | ||
], | ||
backButtonUrl: getAppUrl({ | ||
appId: INTEGRATIONS_PLUGIN_ID, | ||
path: fleetPackageCustomUrlPath, | ||
}), | ||
}; | ||
}, [getAppUrl, pkgkey]); | ||
|
||
const customLink = useMemo( | ||
() => ( | ||
<LinkWithIcon | ||
href={getAppUrl({ | ||
path: eventFiltersListUrlPath, | ||
})} | ||
appPath={eventFiltersListUrlPath} | ||
appState={eventFiltersRouteState} | ||
data-test-subj="linkToEventFilters" | ||
> | ||
<FormattedMessage | ||
id="xpack.securitySolution.endpoint.fleetCustomExtension.manageEventFiltersLinkLabel" | ||
defaultMessage="Manage" | ||
/> | ||
</LinkWithIcon> | ||
), | ||
[getAppUrl, eventFiltersListUrlPath, eventFiltersRouteState] | ||
); | ||
|
||
return <FleetEventFiltersCard customLink={customLink} />; | ||
} | ||
); | ||
|
||
FleetEventFiltersCardWrapper.displayName = 'FleetEventFiltersCardWrapper'; |
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