diff --git a/packages/kbn-optimizer/limits.yml b/packages/kbn-optimizer/limits.yml index 3427eee4b5c0ba..455453464e9575 100644 --- a/packages/kbn-optimizer/limits.yml +++ b/packages/kbn-optimizer/limits.yml @@ -34,7 +34,7 @@ pageLoadAssetSize: indexManagement: 140608 indexPatternManagement: 28222 infra: 184320 - fleet: 415829 + fleet: 450005 ingestPipelines: 58003 inputControlVis: 172675 inspector: 148711 @@ -87,7 +87,6 @@ pageLoadAssetSize: visDefaultEditor: 50178 visTypeMarkdown: 30896 visTypeMetric: 42790 - visTypePie: 34051 visTypeTable: 94934 visTypeTagcloud: 37575 visTypeTimelion: 68883 @@ -111,3 +110,4 @@ pageLoadAssetSize: timelines: 28613 cases: 162385 screenshotMode: 17856 + visTypePie: 35583 diff --git a/src/plugins/kibana_usage_collection/server/collectors/application_usage/schema.ts b/src/plugins/kibana_usage_collection/server/collectors/application_usage/schema.ts index e033da875080f4..1fa7d8e846c9da 100644 --- a/src/plugins/kibana_usage_collection/server/collectors/application_usage/schema.ts +++ b/src/plugins/kibana_usage_collection/server/collectors/application_usage/schema.ts @@ -142,6 +142,7 @@ export const applicationUsageSchema = { metrics: commonSchema, infra: commonSchema, // It's a forward app so we'll likely never report it fleet: commonSchema, + integrations: commonSchema, ingestManager: commonSchema, lens: commonSchema, maps: commonSchema, diff --git a/src/plugins/telemetry/schema/oss_plugins.json b/src/plugins/telemetry/schema/oss_plugins.json index 1d37c25f52fd49..7b6c4ba9788f14 100644 --- a/src/plugins/telemetry/schema/oss_plugins.json +++ b/src/plugins/telemetry/schema/oss_plugins.json @@ -3184,6 +3184,137 @@ } } }, + "integrations": { + "properties": { + "appId": { + "type": "keyword", + "_meta": { + "description": "The application being tracked" + } + }, + "viewId": { + "type": "keyword", + "_meta": { + "description": "Always `main`" + } + }, + "clicks_total": { + "type": "long", + "_meta": { + "description": "General number of clicks in the application since we started counting them" + } + }, + "clicks_7_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the application over the last 7 days" + } + }, + "clicks_30_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the application over the last 30 days" + } + }, + "clicks_90_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the application over the last 90 days" + } + }, + "minutes_on_screen_total": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen since we started counting them." + } + }, + "minutes_on_screen_7_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen over the last 7 days" + } + }, + "minutes_on_screen_30_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen over the last 30 days" + } + }, + "minutes_on_screen_90_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen over the last 90 days" + } + }, + "views": { + "type": "array", + "items": { + "properties": { + "appId": { + "type": "keyword", + "_meta": { + "description": "The application being tracked" + } + }, + "viewId": { + "type": "keyword", + "_meta": { + "description": "The application view being tracked" + } + }, + "clicks_total": { + "type": "long", + "_meta": { + "description": "General number of clicks in the application sub view since we started counting them" + } + }, + "clicks_7_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the active application sub view over the last 7 days" + } + }, + "clicks_30_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the active application sub view over the last 30 days" + } + }, + "clicks_90_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the active application sub view over the last 90 days" + } + }, + "minutes_on_screen_total": { + "type": "float", + "_meta": { + "description": "Minutes the application sub view is active and on-screen since we started counting them." + } + }, + "minutes_on_screen_7_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen active application sub view over the last 7 days" + } + }, + "minutes_on_screen_30_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen active application sub view over the last 30 days" + } + }, + "minutes_on_screen_90_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen active application sub view over the last 90 days" + } + } + } + } + } + } + }, "ingestManager": { "properties": { "appId": { diff --git a/x-pack/plugins/fleet/common/constants/plugin.ts b/x-pack/plugins/fleet/common/constants/plugin.ts index 86175d4cd24bc9..ee0e1e5caeae4d 100644 --- a/x-pack/plugins/fleet/common/constants/plugin.ts +++ b/x-pack/plugins/fleet/common/constants/plugin.ts @@ -6,3 +6,4 @@ */ export const PLUGIN_ID = 'fleet'; +export const INTEGRATIONS_PLUGIN_ID = 'integrations'; diff --git a/x-pack/plugins/fleet/dev_docs/fleet_ui_extensions.md b/x-pack/plugins/fleet/dev_docs/fleet_ui_extensions.md index a3d82356af14f8..88ca0da6c73395 100644 --- a/x-pack/plugins/fleet/dev_docs/fleet_ui_extensions.md +++ b/x-pack/plugins/fleet/dev_docs/fleet_ui_extensions.md @@ -44,7 +44,7 @@ export class Plugin { > The code above lives in `x-pack/plugins/security_solution/public/plugin.tsx` -For a list of supported Fleet UI extensions, see the `UIExtensionPoint` and associated Union types defined here: `x-pack/plugins/fleet/public/applications/fleet/types/ui_extensions.ts`. +For a list of supported Fleet UI extensions, see the `UIExtensionPoint` and associated Union types defined here: `x-pack/plugins/fleet/public/types/ui_extensions.ts`. @@ -81,4 +81,4 @@ const LinkToAgentEnroll = () => { } ``` -For a list of supported Fleet pages, see the type `AnyIntraAppRouteState` and its associated Union types in `x-pack/plugins/fleet/public/applications/fleet/types/intra_app_route_state.ts` +For a list of supported Fleet pages, see the type `AnyIntraAppRouteState` and its associated Union types in `x-pack/plugins/fleet/public/types/intra_app_route_state.ts` diff --git a/x-pack/plugins/fleet/public/applications/fleet/app.tsx b/x-pack/plugins/fleet/public/applications/fleet/app.tsx index 5327d4b7cc4a4c..1398e121c68700 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/app.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/app.tsx @@ -20,29 +20,31 @@ import type { FleetConfigType, FleetStartServices } from '../../plugin'; import { KibanaContextProvider } from '../../../../../../src/plugins/kibana_react/public'; import { EuiThemeProvider } from '../../../../../../src/plugins/kibana_react/common'; +import { PackageInstallProvider } from '../integrations/hooks'; + import { ConfigContext, FleetStatusProvider, + IntraAppStateProvider, KibanaVersionContext, sendGetPermissionsCheck, sendSetup, useBreadcrumbs, useConfig, useStartServices, + UIExtensionsContext, } from './hooks'; import { Error, Loading } from './components'; -import { IntraAppStateProvider } from './hooks/use_intra_app_state'; -import { PackageInstallProvider } from './sections/epm/hooks'; -import { PAGE_ROUTING_PATHS } from './constants'; +import type { UIExtensionsStorage } from './types'; + +import { FLEET_ROUTING_PATHS } from './constants'; import { DefaultLayout, WithoutHeaderLayout } from './layouts'; -import { EPMApp } from './sections/epm'; import { AgentPolicyApp } from './sections/agent_policy'; import { DataStreamApp } from './sections/data_stream'; import { FleetApp } from './sections/agents'; import { IngestManagerOverview } from './sections/overview'; import { ProtectedRoute } from './index'; -import type { UIExtensionsStorage } from './types'; -import { UIExtensionsContext } from './hooks/use_ui_extension'; +import { CreatePackagePolicyPage } from './sections/agent_policy/create_package_policy_page'; const ErrorLayout = ({ children }: { children: JSX.Element }) => ( @@ -236,31 +238,31 @@ export const AppRoutes = memo(() => { return ( - - - - - - + - + - + - + + + + + + ); diff --git a/x-pack/plugins/fleet/public/applications/fleet/components/index.ts b/x-pack/plugins/fleet/public/applications/fleet/components/index.ts index 1c3f8047e95fb7..ac5a78a4ea7095 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/components/index.ts +++ b/x-pack/plugins/fleet/public/applications/fleet/components/index.ts @@ -5,12 +5,7 @@ * 2.0. */ -export { Loading } from './loading'; -export { Error } from './error'; -export { Header, HeaderProps } from './header'; -export { AlphaMessaging } from './alpha_messaging'; -export { PackageIcon } from './package_icon'; -export { ContextMenuActions } from './context_menu_actions'; -export { SearchBar } from './search_bar'; -export * from './settings_flyout'; -export * from './link_and_revision'; +export * from '../../../components'; + +export * from './enrollment_instructions'; +export * from './search_bar'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/constants/index.ts b/x-pack/plugins/fleet/public/applications/fleet/constants/index.ts index bbf14dcae45fcb..aafaac157034a7 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/constants/index.ts +++ b/x-pack/plugins/fleet/public/applications/fleet/constants/index.ts @@ -5,21 +5,4 @@ * 2.0. */ -export { - PLUGIN_ID, - EPM_API_ROUTES, - AGENT_API_ROUTES, - SO_SEARCH_LIMIT, - AGENT_POLICY_SAVED_OBJECT_TYPE, - AGENT_SAVED_OBJECT_TYPE, - ENROLLMENT_API_KEYS_SAVED_OBJECT_TYPE, - PACKAGE_POLICY_SAVED_OBJECT_TYPE, - FLEET_SERVER_PACKAGE, - // Fleet Server index - AGENTS_INDEX, - ENROLLMENT_API_KEYS_INDEX, -} from '../../../../common'; - -export * from './page_paths'; - -export const INDEX_NAME = '.kibana'; +export * from '../../../constants'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/constants/page_paths.ts b/x-pack/plugins/fleet/public/applications/fleet/constants/page_paths.ts deleted file mode 100644 index 27df7a4ebf11d3..00000000000000 --- a/x-pack/plugins/fleet/public/applications/fleet/constants/page_paths.ts +++ /dev/null @@ -1,104 +0,0 @@ -/* - * 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. - */ - -export type StaticPage = - | 'base' - | 'overview' - | 'integrations' - | 'integrations_all' - | 'integrations_installed' - | 'policies' - | 'policies_list' - | 'fleet' - | 'fleet_enrollment_tokens' - | 'data_streams'; - -export type DynamicPage = - | 'integration_details_overview' - | 'integration_details_policies' - | 'integration_details_settings' - | 'integration_details_custom' - | 'integration_policy_edit' - | 'policy_details' - | 'add_integration_from_policy' - | 'add_integration_to_policy' - | 'edit_integration' - | 'fleet_agent_list' - | 'fleet_agent_details'; - -export type Page = StaticPage | DynamicPage; - -export interface DynamicPagePathValues { - [key: string]: string; -} - -export const BASE_PATH = '/app/fleet'; - -// If routing paths are changed here, please also check to see if -// `pagePathGetters()`, below, needs any modifications -export const PAGE_ROUTING_PATHS = { - overview: '/', - integrations: '/integrations/:tabId?', - integrations_all: '/integrations', - integrations_installed: '/integrations/installed', - integration_details: '/integrations/detail/:pkgkey/:panel?', - integration_details_overview: '/integrations/detail/:pkgkey/overview', - integration_details_policies: '/integrations/detail/:pkgkey/policies', - integration_details_settings: '/integrations/detail/:pkgkey/settings', - integration_details_custom: '/integrations/detail/:pkgkey/custom', - integration_policy_edit: '/integrations/edit-integration/:packagePolicyId', - policies: '/policies', - policies_list: '/policies', - policy_details: '/policies/:policyId/:tabId?', - policy_details_settings: '/policies/:policyId/settings', - add_integration_from_policy: '/policies/:policyId/add-integration', - add_integration_to_policy: '/integrations/:pkgkey/add-integration/:integration?', - edit_integration: '/policies/:policyId/edit-integration/:packagePolicyId', - fleet: '/fleet', - fleet_agent_list: '/fleet/agents', - fleet_agent_details: '/fleet/agents/:agentId/:tabId?', - fleet_agent_details_logs: '/fleet/agents/:agentId/logs', - fleet_enrollment_tokens: '/fleet/enrollment-tokens', - data_streams: '/data-streams', -}; - -export const pagePathGetters: { - [key in StaticPage]: () => string; -} & - { - [key in DynamicPage]: (values: DynamicPagePathValues) => string; - } = { - base: () => '/', - overview: () => '/', - integrations: () => '/integrations', - integrations_all: () => '/integrations', - integrations_installed: () => '/integrations/installed', - integration_details_overview: ({ pkgkey, integration }) => - `/integrations/detail/${pkgkey}/overview${integration ? `?integration=${integration}` : ''}`, - integration_details_policies: ({ pkgkey, integration }) => - `/integrations/detail/${pkgkey}/policies${integration ? `?integration=${integration}` : ''}`, - integration_details_settings: ({ pkgkey, integration }) => - `/integrations/detail/${pkgkey}/settings${integration ? `?integration=${integration}` : ''}`, - integration_details_custom: ({ pkgkey, integration }) => - `/integrations/detail/${pkgkey}/custom${integration ? `?integration=${integration}` : ''}`, - integration_policy_edit: ({ packagePolicyId }) => - `/integrations/edit-integration/${packagePolicyId}`, - policies: () => '/policies', - policies_list: () => '/policies', - policy_details: ({ policyId, tabId }) => `/policies/${policyId}${tabId ? `/${tabId}` : ''}`, - add_integration_from_policy: ({ policyId }) => `/policies/${policyId}/add-integration`, - add_integration_to_policy: ({ pkgkey, integration }) => - `/integrations/${pkgkey}/add-integration${integration ? `/${integration}` : ''}`, - edit_integration: ({ policyId, packagePolicyId }) => - `/policies/${policyId}/edit-integration/${packagePolicyId}`, - fleet: () => '/fleet', - fleet_agent_list: ({ kuery }) => `/fleet/agents${kuery ? `?kuery=${kuery}` : ''}`, - fleet_agent_details: ({ agentId, tabId, logQuery }) => - `/fleet/agents/${agentId}${tabId ? `/${tabId}` : ''}${logQuery ? `?_q=${logQuery}` : ''}`, - fleet_enrollment_tokens: () => '/fleet/enrollment-tokens', - data_streams: () => '/data-streams', -}; diff --git a/x-pack/plugins/fleet/public/applications/fleet/hooks/index.ts b/x-pack/plugins/fleet/public/applications/fleet/hooks/index.ts index f7176de302fdea..7cf16b1b7ae909 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/hooks/index.ts +++ b/x-pack/plugins/fleet/public/applications/fleet/hooks/index.ts @@ -5,21 +5,6 @@ * 2.0. */ -export { useCapabilities } from './use_capabilities'; -export { useStartServices } from './use_core'; -export { useConfig, ConfigContext } from './use_config'; -export { useKibanaVersion, KibanaVersionContext } from './use_kibana_version'; -export { licenseService, useLicense } from './use_license'; +export * from '../../../hooks'; + export { useBreadcrumbs } from './use_breadcrumbs'; -export { useLink } from './use_link'; -export { useKibanaLink } from './use_kibana_link'; -export { usePackageIconType, UsePackageIconType } from './use_package_icon_type'; -export { usePagination, Pagination, PAGE_SIZE_OPTIONS } from './use_pagination'; -export { useUrlPagination } from './use_url_pagination'; -export { useSorting } from './use_sorting'; -export { useDebounce } from './use_debounce'; -export { useUrlModal } from './use_url_modal'; -export * from './use_request'; -export * from './use_input'; -export * from './use_url_params'; -export * from './use_fleet_status'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_breadcrumbs.tsx b/x-pack/plugins/fleet/public/applications/fleet/hooks/use_breadcrumbs.tsx index e10f53741dba9b..eeb8f18d17d4f6 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_breadcrumbs.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/hooks/use_breadcrumbs.tsx @@ -9,19 +9,33 @@ import { i18n } from '@kbn/i18n'; import type { ChromeBreadcrumb } from 'src/core/public'; import type { Page, DynamicPagePathValues } from '../constants'; -import { BASE_PATH, pagePathGetters } from '../constants'; +import { FLEET_BASE_PATH, INTEGRATIONS_BASE_PATH, pagePathGetters } from '../constants'; -import { useStartServices } from './use_core'; +import { useStartServices } from './'; -const BASE_BREADCRUMB: ChromeBreadcrumb = { - href: pagePathGetters.overview(), +interface AdditionalBreadcrumbOptions { + useIntegrationsBasePath: boolean; +} + +type Breadcrumb = ChromeBreadcrumb & Partial; + +const BASE_BREADCRUMB: Breadcrumb = { + href: pagePathGetters.overview()[1], text: i18n.translate('xpack.fleet.breadcrumbs.appTitle', { defaultMessage: 'Fleet', }), }; +const INTEGRATIONS_BASE_BREADCRUMB: Breadcrumb = { + href: pagePathGetters.integrations()[1], + text: i18n.translate('xpack.fleet.breadcrumbs.integrationsAppTitle', { + defaultMessage: 'Integrations', + }), + useIntegrationsBasePath: true, +}; + const breadcrumbGetters: { - [key in Page]?: (values: DynamicPagePathValues) => ChromeBreadcrumb[]; + [key in Page]?: (values: DynamicPagePathValues) => Breadcrumb[]; } = { base: () => [BASE_BREADCRUMB], overview: () => [ @@ -32,66 +46,7 @@ const breadcrumbGetters: { }), }, ], - integrations: () => [ - BASE_BREADCRUMB, - { - text: i18n.translate('xpack.fleet.breadcrumbs.integrationsPageTitle', { - defaultMessage: 'Integrations', - }), - }, - ], - integrations_all: () => [ - BASE_BREADCRUMB, - { - href: pagePathGetters.integrations(), - text: i18n.translate('xpack.fleet.breadcrumbs.integrationsPageTitle', { - defaultMessage: 'Integrations', - }), - }, - { - text: i18n.translate('xpack.fleet.breadcrumbs.allIntegrationsPageTitle', { - defaultMessage: 'All', - }), - }, - ], - integrations_installed: () => [ - BASE_BREADCRUMB, - { - href: pagePathGetters.integrations(), - text: i18n.translate('xpack.fleet.breadcrumbs.integrationsPageTitle', { - defaultMessage: 'Integrations', - }), - }, - { - text: i18n.translate('xpack.fleet.breadcrumbs.installedIntegrationsPageTitle', { - defaultMessage: 'Installed', - }), - }, - ], - integration_details_overview: ({ pkgTitle }) => [ - BASE_BREADCRUMB, - { - href: pagePathGetters.integrations(), - text: i18n.translate('xpack.fleet.breadcrumbs.integrationsPageTitle', { - defaultMessage: 'Integrations', - }), - }, - { text: pkgTitle }, - ], - integration_policy_edit: ({ pkgTitle, pkgkey, policyName }) => [ - BASE_BREADCRUMB, - { - href: pagePathGetters.integrations(), - text: i18n.translate('xpack.fleet.breadcrumbs.integrationPageTitle', { - defaultMessage: 'Integration', - }), - }, - { - href: pagePathGetters.integration_details_policies({ pkgkey }), - text: pkgTitle, - }, - { text: policyName }, - ], + policies: () => [ BASE_BREADCRUMB, { @@ -111,7 +66,7 @@ const breadcrumbGetters: { policy_details: ({ policyName }) => [ BASE_BREADCRUMB, { - href: pagePathGetters.policies(), + href: pagePathGetters.policies()[1], text: i18n.translate('xpack.fleet.breadcrumbs.policiesPageTitle', { defaultMessage: 'Policies', }), @@ -121,13 +76,13 @@ const breadcrumbGetters: { add_integration_from_policy: ({ policyName, policyId }) => [ BASE_BREADCRUMB, { - href: pagePathGetters.policies(), + href: pagePathGetters.policies()[1], text: i18n.translate('xpack.fleet.breadcrumbs.policiesPageTitle', { defaultMessage: 'Policies', }), }, { - href: pagePathGetters.policy_details({ policyId }), + href: pagePathGetters.policy_details({ policyId })[1], text: policyName, }, { @@ -137,16 +92,11 @@ const breadcrumbGetters: { }, ], add_integration_to_policy: ({ pkgTitle, pkgkey }) => [ - BASE_BREADCRUMB, - { - href: pagePathGetters.integrations(), - text: i18n.translate('xpack.fleet.breadcrumbs.integrationsPageTitle', { - defaultMessage: 'Integrations', - }), - }, + INTEGRATIONS_BASE_BREADCRUMB, { - href: pagePathGetters.integration_details_overview({ pkgkey }), + href: pagePathGetters.integration_details_overview({ pkgkey })[1], text: pkgTitle, + useIntegrationsBasePath: true, }, { text: i18n.translate('xpack.fleet.breadcrumbs.addPackagePolicyPageTitle', { @@ -157,13 +107,13 @@ const breadcrumbGetters: { edit_integration: ({ policyName, policyId }) => [ BASE_BREADCRUMB, { - href: pagePathGetters.policies(), + href: pagePathGetters.policies()[1], text: i18n.translate('xpack.fleet.breadcrumbs.policiesPageTitle', { defaultMessage: 'Policies', }), }, { - href: pagePathGetters.policy_details({ policyId }), + href: pagePathGetters.policy_details({ policyId })[1], text: policyName, }, { @@ -191,7 +141,7 @@ const breadcrumbGetters: { fleet_agent_details: ({ agentHost }) => [ BASE_BREADCRUMB, { - href: pagePathGetters.fleet(), + href: pagePathGetters.fleet()[1], text: i18n.translate('xpack.fleet.breadcrumbs.agentsPageTitle', { defaultMessage: 'Agents', }), @@ -201,7 +151,7 @@ const breadcrumbGetters: { fleet_enrollment_tokens: () => [ BASE_BREADCRUMB, { - href: pagePathGetters.fleet(), + href: pagePathGetters.fleet()[1], text: i18n.translate('xpack.fleet.breadcrumbs.agentsPageTitle', { defaultMessage: 'Agents', }), @@ -224,10 +174,16 @@ const breadcrumbGetters: { export function useBreadcrumbs(page: Page, values: DynamicPagePathValues = {}) { const { chrome, http } = useStartServices(); - const breadcrumbs: ChromeBreadcrumb[] = + const breadcrumbs = breadcrumbGetters[page]?.(values).map((breadcrumb) => ({ ...breadcrumb, - href: breadcrumb.href ? http.basePath.prepend(`${BASE_PATH}#${breadcrumb.href}`) : undefined, + href: breadcrumb.href + ? http.basePath.prepend( + `${breadcrumb.useIntegrationsBasePath ? INTEGRATIONS_BASE_PATH : FLEET_BASE_PATH}#${ + breadcrumb.href + }` + ) + : undefined, })) || []; const docTitle: string[] = [...breadcrumbs] .reverse() diff --git a/x-pack/plugins/fleet/public/applications/fleet/layouts/default.tsx b/x-pack/plugins/fleet/public/applications/fleet/layouts/default.tsx index 4ff5243483a3a6..49836e9ed4ca68 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/layouts/default.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/layouts/default.tsx @@ -22,6 +22,7 @@ import { AlphaMessaging, SettingFlyout } from '../components'; import { useLink, useConfig, useUrlModal } from '../hooks'; interface Props { + showNav?: boolean; showSettings?: boolean; section?: Section; children?: React.ReactNode; @@ -54,6 +55,7 @@ const Nav = styled.nav` `; export const DefaultLayout: React.FunctionComponent = ({ + showNav = true, showSettings = true, section, children, @@ -76,74 +78,70 @@ export const DefaultLayout: React.FunctionComponent = ({ - + {showSettings ? ( + + + + + + ) : null} + + + + + ) : null} {children} diff --git a/x-pack/plugins/fleet/public/applications/fleet/layouts/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/layouts/index.tsx index cf84a29b84d448..71cb8d3aeeb369 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/layouts/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/layouts/index.tsx @@ -5,6 +5,6 @@ * 2.0. */ +export * from '../../../layouts'; + export { DefaultLayout } from './default'; -export { WithHeaderLayout, WithHeaderLayoutProps } from './with_header'; -export { WithoutHeaderLayout } from './without_header'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/index.ts b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/index.ts index c65157697cc864..09282a7de7cb9b 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/index.ts +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/index.ts @@ -5,12 +5,14 @@ * 2.0. */ +// TODO: Does this need to be re-exported here? +export { LinkedAgentCount } from '../../../components'; + export { AgentPolicyForm, agentPolicyFormValidation } from './agent_policy_form'; export { AgentPolicyCopyProvider } from './agent_policy_copy_provider'; export { AgentPolicyDeleteProvider } from './agent_policy_delete_provider'; export { PackagePolicyDeleteProvider } from './package_policy_delete_provider'; export { AgentPolicyYamlFlyout } from './agent_policy_yaml_flyout'; -export { LinkedAgentCount } from '../../../components/linked_agent_count'; export { ConfirmDeployAgentPolicyModal } from './confirm_deploy_modal'; export { DangerEuiContextMenuItem } from './danger_eui_context_menu_item'; export { AgentPolicyActionMenu } from './actions_menu'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/layout.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/layout.tsx index 4aaf5343638bed..d2bc49bdf00e07 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/layout.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/layout.tsx @@ -20,7 +20,7 @@ import { import { WithHeaderLayout } from '../../../../layouts'; import type { AgentPolicy, PackageInfo } from '../../../../types'; -import { PackageIcon } from '../../../../components/package_icon'; +import { PackageIcon } from '../../../../components'; import type { CreatePackagePolicyFrom } from '../types'; export const CreatePackagePolicyPageLayout: React.FunctionComponent<{ diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/multi_text_input.test.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/multi_text_input.test.tsx index 18a7357b235b9c..9c8325446678d6 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/multi_text_input.test.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/components/multi_text_input.test.tsx @@ -8,12 +8,12 @@ import React from 'react'; import { fireEvent, act } from '@testing-library/react'; -import { createTestRendererMock } from '../../../../mock'; +import { createFleetTestRendererMock } from '../../../../../../mock'; import { MultiTextInput } from './multi_text_input'; function renderInput(value = ['value1']) { - const renderer = createTestRendererMock(); + const renderer = createFleetTestRendererMock(); const mockOnChange = jest.fn(); const utils = renderer.render(); diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/index.test.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/index.test.tsx index 11c672aa0596d2..a624d8ced91803 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/index.test.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/index.test.tsx @@ -9,26 +9,27 @@ import { Route } from 'react-router-dom'; import React from 'react'; import { act } from 'react-test-renderer'; -import type { MockedFleetStartServices, TestRenderer } from '../../../mock'; -import { createTestRendererMock } from '../../../mock'; -import { PAGE_ROUTING_PATHS, pagePathGetters, PLUGIN_ID } from '../../../constants'; +import type { MockedFleetStartServices, TestRenderer } from '../../../../../mock'; +import { createFleetTestRendererMock } from '../../../../../mock'; +import { FLEET_ROUTING_PATHS, pagePathGetters, PLUGIN_ID } from '../../../constants'; import type { CreatePackagePolicyRouteState } from '../../../types'; import { CreatePackagePolicyPage } from './index'; describe('when on the package policy create page', () => { - const createPageUrlPath = pagePathGetters.add_integration_to_policy({ pkgkey: 'nginx-0.3.7' }); + const createPageUrlPath = pagePathGetters.add_integration_to_policy({ pkgkey: 'nginx-0.3.7' })[1]; + let testRenderer: TestRenderer; let renderResult: ReturnType; const render = () => (renderResult = testRenderer.render( - + )); beforeEach(() => { - testRenderer = createTestRendererMock(); + testRenderer = createFleetTestRendererMock(); mockApiCalls(testRenderer.startServices.http); testRenderer.history.push(createPageUrlPath); }); diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/index.tsx index 55861726af4661..6563918a5efb2c 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/index.tsx @@ -39,12 +39,11 @@ import { } from '../../../hooks'; import { Loading } from '../../../components'; import { ConfirmDeployAgentPolicyModal } from '../components'; -import { useIntraAppState } from '../../../hooks/use_intra_app_state'; -import { useUIExtension } from '../../../hooks/use_ui_extension'; -import { ExtensionWrapper } from '../../../components/extension_wrapper'; +import { useIntraAppState, useUIExtension } from '../../../hooks'; +import { ExtensionWrapper } from '../../../components'; import type { PackagePolicyEditExtensionComponentProps } from '../../../types'; import { PLUGIN_ID } from '../../../../../../common/constants'; -import { pkgKeyFromPackageInfo } from '../../../services/pkg_key_from_package_info'; +import { pkgKeyFromPackageInfo } from '../../../services'; import { CreatePackagePolicyPageLayout } from './components'; import type { CreatePackagePolicyFrom, PackagePolicyFormState } from './types'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/step_define_package_policy.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/step_define_package_policy.tsx index 26a31a1394f789..380e49a1d8dd97 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/step_define_package_policy.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/step_define_package_policy.tsx @@ -27,9 +27,8 @@ import type { NewPackagePolicy, RegistryVarsEntry, } from '../../../types'; -import { packageToPackagePolicy } from '../../../services'; +import { packageToPackagePolicy, pkgKeyFromPackageInfo } from '../../../services'; import { Loading } from '../../../components'; -import { pkgKeyFromPackageInfo } from '../../../services/pkg_key_from_package_info'; import { isAdvancedVar } from './services'; import type { PackagePolicyValidationResults } from './services'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/step_select_package.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/step_select_package.tsx index 80faba37e9a435..50c63274b5e85c 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/step_select_package.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/step_select_package.tsx @@ -10,7 +10,7 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import { EuiFlexGroup, EuiFlexItem, EuiSelectable, EuiSpacer } from '@elastic/eui'; -import { Error } from '../../../components'; +import { Error, PackageIcon } from '../../../components'; import type { AgentPolicy, PackageInfo, PackagePolicy, GetPackagesResponse } from '../../../types'; import { useGetOneAgentPolicy, @@ -18,8 +18,7 @@ import { useGetLimitedPackages, sendGetPackageInfoByKey, } from '../../../hooks'; -import { PackageIcon } from '../../../components/package_icon'; -import { pkgKeyFromPackageInfo } from '../../../services/pkg_key_from_package_info'; +import { pkgKeyFromPackageInfo } from '../../../services'; export const StepSelectPackage: React.FunctionComponent<{ agentPolicyId: string; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/hooks/use_agent_status.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/hooks/use_agent_status.tsx index 1147e9cf254fa3..4a92e44436fcd4 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/hooks/use_agent_status.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/hooks/use_agent_status.tsx @@ -7,10 +7,10 @@ import React from 'react'; +import type { UseRequestConfig } from '../../../../hooks'; import { useRequest } from '../../../../hooks'; import type { GetAgentStatusResponse } from '../../../../types'; import { agentRouteService } from '../../../../services'; -import type { UseRequestConfig } from '../../../../hooks/use_request/use_request'; type RequestOptions = Pick, 'pollIntervalMs'>; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/index.tsx index e96ef832240137..7138abb081a77f 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/index.tsx @@ -26,18 +26,18 @@ import type { Props as EuiTabProps } from '@elastic/eui/src/components/tabs/tab' import styled from 'styled-components'; import type { AgentPolicy, AgentPolicyDetailsDeployAgentAction } from '../../../types'; -import { PAGE_ROUTING_PATHS } from '../../../constants'; +import { FLEET_ROUTING_PATHS } from '../../../constants'; import { useGetOneAgentPolicy, useLink, useBreadcrumbs, useStartServices, useFleetStatus, + useIntraAppState, } from '../../../hooks'; import { Loading, Error } from '../../../components'; import { WithHeaderLayout } from '../../../layouts'; import { LinkedAgentCount, AgentPolicyActionMenu } from '../components'; -import { useIntraAppState } from '../../../hooks/use_intra_app_state'; import { AgentPolicyRefreshContext, useGetAgentStatus, AgentStatusRefreshContext } from './hooks'; import { PackagePoliciesView, SettingsView } from './components'; @@ -327,13 +327,13 @@ const AgentPolicyDetailsContent: React.FunctionComponent<{ agentPolicy: AgentPol return ( { return ; }} /> { return ; }} diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx index 3b9b5696ff7bdc..fb3603aaef7f4d 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx @@ -24,13 +24,14 @@ import { useBreadcrumbs, useStartServices, useConfig, + useUIExtension, sendUpdatePackagePolicy, sendGetAgentStatus, sendGetOneAgentPolicy, sendGetOnePackagePolicy, sendGetPackageInfoByKey, } from '../../../hooks'; -import { Loading, Error } from '../../../components'; +import { Loading, Error, ExtensionWrapper } from '../../../components'; import { ConfirmDeployAgentPolicyModal } from '../components'; import { CreatePackagePolicyPageLayout } from '../create_package_policy_page/components'; import type { PackagePolicyValidationResults } from '../create_package_policy_page/services'; @@ -41,11 +42,9 @@ import type { } from '../create_package_policy_page/types'; import { StepConfigurePackagePolicy } from '../create_package_policy_page/step_configure_package'; import { StepDefinePackagePolicy } from '../create_package_policy_page/step_define_package_policy'; -import { useUIExtension } from '../../../hooks/use_ui_extension'; -import { ExtensionWrapper } from '../../../components/extension_wrapper'; import type { GetOnePackagePolicyResponse } from '../../../../../../common/types/rest_spec'; import type { PackagePolicyEditExtensionComponentProps } from '../../../types'; -import { pkgKeyFromPackageInfo } from '../../../services/pkg_key_from_package_info'; +import { pkgKeyFromPackageInfo } from '../../../services'; export const EditPackagePolicyPage = memo(() => { const { diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/index.tsx index 345a4b4afa9350..c0ec811ce2bcd5 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/index.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { HashRouter as Router, Switch, Route } from 'react-router-dom'; -import { PAGE_ROUTING_PATHS } from '../../constants'; +import { FLEET_ROUTING_PATHS } from '../../constants'; import { useBreadcrumbs } from '../../hooks'; import { AgentPolicyListPage } from './list_page'; @@ -22,16 +22,16 @@ export const AgentPolicyApp: React.FunctionComponent = () => { return ( - + - + - + - + diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/index.tsx index 56b99f645f97c5..dd6611d581e89f 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/index.tsx @@ -23,7 +23,7 @@ import { i18n } from '@kbn/i18n'; import { EuiIconTip } from '@elastic/eui'; import type { Agent, AgentPolicy, AgentDetailsReassignPolicyAction } from '../../../types'; -import { PAGE_ROUTING_PATHS } from '../../../constants'; +import { FLEET_ROUTING_PATHS } from '../../../constants'; import { Loading, Error } from '../../../components'; import { useGetOneAgent, @@ -32,10 +32,10 @@ import { useBreadcrumbs, useStartServices, useKibanaVersion, + useIntraAppState, } from '../../../hooks'; import { WithHeaderLayout } from '../../../layouts'; import { AgentHealth } from '../components'; -import { useIntraAppState } from '../../../hooks/use_intra_app_state'; import { isAgentUpgradeable } from '../../../services'; import { AgentRefreshContext } from './hooks'; @@ -309,13 +309,13 @@ const AgentDetailsPageContent: React.FunctionComponent<{ return ( { return ; }} /> { return ; }} diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_policy_package_badges.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_policy_package_badges.tsx index 89ac1b4f43b5f8..605888349ab4ec 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_policy_package_badges.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_policy_package_badges.tsx @@ -14,7 +14,7 @@ import { FLEET_SERVER_PACKAGE } from '../../../../../../common/constants'; import type { PackagePolicy, PackagePolicyPackage } from '../../../types'; import { useGetOneAgentPolicy } from '../../../hooks'; -import { PackageIcon } from '../../../components/package_icon'; +import { PackageIcon } from '../../../components'; interface Props { agentPolicyId: string; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/list_layout.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/list_layout.tsx index f31ee70da21bbb..40642587c1a38f 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/list_layout.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/list_layout.tsx @@ -11,7 +11,7 @@ import { EuiText, EuiFlexGroup, EuiFlexItem, EuiButton, EuiPortal } from '@elast import type { Props as EuiTabProps } from '@elastic/eui/src/components/tabs/tab'; import { useRouteMatch } from 'react-router-dom'; -import { PAGE_ROUTING_PATHS } from '../../../constants'; +import { FLEET_ROUTING_PATHS } from '../../../constants'; import { WithHeaderLayout } from '../../../layouts'; import { useCapabilities, useLink, useGetAgentPolicies } from '../../../hooks'; import { AgentEnrollmentFlyout } from '../components'; @@ -71,7 +71,7 @@ export const ListLayout: React.FunctionComponent<{}> = ({ children }) => { ([ { name: , - isSelected: routeMatch.path === PAGE_ROUTING_PATHS.fleet_agent_list, + isSelected: routeMatch.path === FLEET_ROUTING_PATHS.fleet_agent_list, href: getHref('fleet_agent_list'), }, { @@ -81,7 +81,7 @@ export const ListLayout: React.FunctionComponent<{}> = ({ children }) => { defaultMessage="Enrollment tokens" /> ), - isSelected: routeMatch.path === PAGE_ROUTING_PATHS.fleet_enrollment_tokens, + isSelected: routeMatch.path === FLEET_ROUTING_PATHS.fleet_enrollment_tokens, href: getHref('fleet_enrollment_tokens'), }, ] as unknown) as EuiTabProps[] diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/index.tsx index 56eb4072c38478..dcb33e7662dc45 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/index.tsx @@ -9,7 +9,7 @@ import React, { useCallback, useEffect, useState } from 'react'; import { FormattedMessage } from '@kbn/i18n/react'; import { HashRouter as Router, Route, Switch, Redirect } from 'react-router-dom'; -import { PAGE_ROUTING_PATHS } from '../../constants'; +import { FLEET_ROUTING_PATHS } from '../../constants'; import { Loading, Error } from '../../components'; import { useConfig, @@ -111,14 +111,14 @@ export const FleetApp: React.FunctionComponent = () => { } + render={() => } /> - + - + {fleetServerModalVisible && ( @@ -130,7 +130,7 @@ export const FleetApp: React.FunctionComponent = () => { )} - + diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/data_stream/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/data_stream/index.tsx index fb6078ce73b70c..bc3a0229284dbd 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/data_stream/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/data_stream/index.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { HashRouter as Router, Route, Switch } from 'react-router-dom'; -import { PAGE_ROUTING_PATHS } from '../../constants'; +import { FLEET_ROUTING_PATHS } from '../../constants'; import { DataStreamListPage } from './list_page'; @@ -16,7 +16,7 @@ export const DataStreamApp: React.FunctionComponent = () => { return ( - + diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/data_stream/list_page/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/data_stream/list_page/index.tsx index f8518dc2a86685..e805fb8f6f64ef 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/data_stream/list_page/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/data_stream/list_page/index.tsx @@ -22,7 +22,7 @@ import { FormattedMessage, FormattedDate } from '@kbn/i18n/react'; import type { DataStream } from '../../../types'; import { WithHeaderLayout } from '../../../layouts'; import { useGetDataStreams, useStartServices, usePagination, useBreadcrumbs } from '../../../hooks'; -import { PackageIcon } from '../../../components/package_icon'; +import { PackageIcon } from '../../../components'; import { DataStreamRowActions } from './components/data_stream_row_actions'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/index.tsx index 712f69bf25e1d7..810334e2df9ce6 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/index.tsx @@ -6,9 +6,8 @@ */ export { IngestManagerOverview } from './overview'; -export { EPMApp } from './epm'; export { AgentPolicyApp } from './agent_policy'; export { DataStreamApp } from './data_stream'; export { FleetApp } from './agents'; -export type Section = 'overview' | 'epm' | 'agent_policy' | 'fleet' | 'data_stream'; +export type Section = 'overview' | 'agent_policy' | 'fleet' | 'data_stream'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/services/index.ts b/x-pack/plugins/fleet/public/applications/fleet/services/index.ts index 07fb04628ea2e5..434e1addfdfa27 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/services/index.ts +++ b/x-pack/plugins/fleet/public/applications/fleet/services/index.ts @@ -5,29 +5,4 @@ * 2.0. */ -export { getFlattenedObject } from '@kbn/std'; - -export { - AgentStatusKueryHelper, - agentPolicyRouteService, - packagePolicyRouteService, - dataStreamRouteService, - fleetSetupRouteService, - agentRouteService, - enrollmentAPIKeyRouteService, - epmRouteService, - setupRouteService, - outputRoutesService, - settingsRoutesService, - appRoutesService, - packageToPackagePolicy, - packageToPackagePolicyInputs, - storedPackagePoliciesToAgentInputs, - fullAgentPolicyToYaml, - isPackageLimited, - doesAgentPolicyAlreadyIncludePackage, - isValidNamespace, - LicenseService, - isAgentUpgradeable, - doesPackageHaveIntegrations, -} from '../../../../common'; +export * from '../../../services'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/types/index.ts b/x-pack/plugins/fleet/public/applications/fleet/types/index.ts index dd8b1ad2abc4db..287b3f08566dfa 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/types/index.ts +++ b/x-pack/plugins/fleet/public/applications/fleet/types/index.ts @@ -5,127 +5,4 @@ * 2.0. */ -export { - // utility function - entries, - // Object types - Agent, - AgentMetadata, - AgentPolicy, - NewAgentPolicy, - SimplifiedAgentStatus, - EnrollmentAPIKey, - PackagePolicy, - NewPackagePolicy, - UpdatePackagePolicy, - PackagePolicyInput, - NewPackagePolicyInput, - PackagePolicyInputStream, - NewPackagePolicyInputStream, - PackagePolicyConfigRecord, - PackagePolicyConfigRecordEntry, - PackagePolicyPackage, - Output, - DataStream, - // API schema - misc setup, status - GetFleetStatusResponse, - // API schemas - Agent policy - GetAgentPoliciesRequest, - GetAgentPoliciesResponse, - GetAgentPoliciesResponseItem, - GetOneAgentPolicyResponse, - GetFullAgentPolicyResponse, - CreateAgentPolicyRequest, - CreateAgentPolicyResponse, - UpdateAgentPolicyRequest, - UpdateAgentPolicyResponse, - CopyAgentPolicyRequest, - CopyAgentPolicyResponse, - DeleteAgentPolicyRequest, - DeleteAgentPolicyResponse, - // API schemas - Package policy - CreatePackagePolicyRequest, - CreatePackagePolicyResponse, - UpdatePackagePolicyRequest, - UpdatePackagePolicyResponse, - GetPackagePoliciesResponse, - // API schemas - Data streams - GetDataStreamsResponse, - // API schemas - Agents - GetAgentsResponse, - GetAgentsRequest, - GetOneAgentResponse, - PostAgentUnenrollRequest, - PostAgentUnenrollResponse, - PostBulkAgentUnenrollRequest, - PostBulkAgentUnenrollResponse, - PostAgentUpgradeRequest, - PostBulkAgentUpgradeRequest, - PostAgentUpgradeResponse, - PostBulkAgentUpgradeResponse, - GetAgentStatusRequest, - GetAgentStatusResponse, - PutAgentReassignRequest, - PutAgentReassignResponse, - PostBulkAgentReassignRequest, - PostBulkAgentReassignResponse, - PostNewAgentActionResponse, - PostNewAgentActionRequest, - // API schemas - Enrollment API Keys - GetEnrollmentAPIKeysResponse, - GetEnrollmentAPIKeysRequest, - GetOneEnrollmentAPIKeyResponse, - PostEnrollmentAPIKeyRequest, - PostEnrollmentAPIKeyResponse, - // API schemas - Outputs - GetOutputsResponse, - PutOutputRequest, - PutOutputResponse, - // API schemas - Settings - GetSettingsResponse, - PutSettingsRequest, - PutSettingsResponse, - // API schemas - app - CheckPermissionsResponse, - GenerateServiceTokenResponse, - // EPM types - AssetReference, - AssetsGroupedByServiceByType, - AssetType, - AssetTypeToParts, - CategoryId, - CategorySummaryItem, - CategorySummaryList, - ElasticsearchAssetType, - KibanaAssetType, - PackageInfo, - RegistryVarsEntry, - RegistryInput, - RegistryStream, - RegistryPolicyTemplate, - PackageList, - PackageListItem, - PackagesGroupedByStatus, - RequirementsByServiceName, - RequirementVersion, - ScreenshotItem, - ServiceName, - GetCategoriesRequest, - GetCategoriesResponse, - GetPackagesRequest, - GetPackagesResponse, - GetLimitedPackagesResponse, - GetInfoResponse, - InstallPackageResponse, - DeletePackageResponse, - DetailViewPanelName, - InstallStatus, - InstallationStatus, - Installable, - RegistryRelease, - PackageSpecCategory, -} from '../../../../common'; - -export * from './intra_app_route_state'; - -export * from './ui_extensions'; +export * from '../../../types'; diff --git a/x-pack/plugins/fleet/public/applications/integrations/app.tsx b/x-pack/plugins/fleet/public/applications/integrations/app.tsx new file mode 100644 index 00000000000000..dab369f330f456 --- /dev/null +++ b/x-pack/plugins/fleet/public/applications/integrations/app.tsx @@ -0,0 +1,230 @@ +/* + * 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, useEffect, useState } from 'react'; +import type { AppMountParameters } from 'kibana/public'; +import { EuiCode, EuiEmptyPrompt, EuiErrorBoundary, EuiPanel } from '@elastic/eui'; +import type { History } from 'history'; +import { createHashHistory } from 'history'; +import { Router, Redirect, Route, Switch } from 'react-router-dom'; +import { FormattedMessage } from '@kbn/i18n/react'; +import { i18n } from '@kbn/i18n'; +import styled from 'styled-components'; +import useObservable from 'react-use/lib/useObservable'; + +import { + ConfigContext, + FleetStatusProvider, + KibanaVersionContext, + sendGetPermissionsCheck, + sendSetup, +} from '../../hooks'; + +import type { FleetConfigType, FleetStartServices } from '../../plugin'; + +import { KibanaContextProvider } from '../../../../../../src/plugins/kibana_react/public'; +import { EuiThemeProvider } from '../../../../../../src/plugins/kibana_react/common'; + +import { INTEGRATIONS_ROUTING_PATHS } from './constants'; + +import { Error, Loading } from './components'; + +import type { UIExtensionsStorage } from './types'; + +import { EPMApp } from './sections/epm'; +import { DefaultLayout, WithoutHeaderLayout } from './layouts'; +import { PackageInstallProvider } from './hooks'; +import { useBreadcrumbs, IntraAppStateProvider, UIExtensionsContext } from './hooks'; + +const ErrorLayout = ({ children }: { children: JSX.Element }) => ( + + + {children} + + +); + +const Panel = styled(EuiPanel)` + max-width: 500px; + margin-right: auto; + margin-left: auto; +`; + +export const WithPermissionsAndSetup: React.FC = memo(({ children }) => { + useBreadcrumbs('integrations'); + + const [isPermissionsLoading, setIsPermissionsLoading] = useState(false); + const [permissionsError, setPermissionsError] = useState(); + const [isInitialized, setIsInitialized] = useState(false); + const [initializationError, setInitializationError] = useState(null); + + useEffect(() => { + (async () => { + setPermissionsError(undefined); + setIsInitialized(false); + setInitializationError(null); + try { + setIsPermissionsLoading(true); + const permissionsResponse = await sendGetPermissionsCheck(); + setIsPermissionsLoading(false); + if (permissionsResponse.data?.success) { + try { + const setupResponse = await sendSetup(); + if (setupResponse.error) { + setInitializationError(setupResponse.error); + } + } catch (err) { + setInitializationError(err); + } + setIsInitialized(true); + } else { + setPermissionsError(permissionsResponse.data?.error || 'REQUEST_ERROR'); + } + } catch (err) { + setPermissionsError('REQUEST_ERROR'); + } + })(); + }, []); + + if (isPermissionsLoading || permissionsError) { + return ( + + {isPermissionsLoading ? ( + + ) : permissionsError === 'REQUEST_ERROR' ? ( + + } + error={i18n.translate('xpack.fleet.permissionsRequestErrorMessageDescription', { + defaultMessage: 'There was a problem checking Fleet permissions', + })} + /> + ) : ( + + + {permissionsError === 'MISSING_SUPERUSER_ROLE' ? ( + + ) : ( + + )} + + } + body={ +

+ {permissionsError === 'MISSING_SUPERUSER_ROLE' ? ( + superuser }} + /> + ) : ( + + )} +

+ } + /> +
+ )} +
+ ); + } + + if (!isInitialized || initializationError) { + return ( + + {initializationError ? ( + + } + error={initializationError} + /> + ) : ( + + )} + + ); + } + + return <>{children}; +}); + +/** + * Fleet Application context all the way down to the Router, but with no permissions or setup checks + * and no routes defined + */ +export const IntegrationsAppContext: React.FC<{ + basepath: string; + startServices: FleetStartServices; + config: FleetConfigType; + history: AppMountParameters['history']; + kibanaVersion: string; + extensions: UIExtensionsStorage; + /** For testing purposes only */ + routerHistory?: History; +}> = memo( + ({ children, startServices, config, history, kibanaVersion, extensions, routerHistory }) => { + const isDarkMode = useObservable(startServices.uiSettings.get$('theme:darkMode')); + const [routerHistoryInstance] = useState(routerHistory || createHashHistory()); + + return ( + + + + + + + + + + + + {children} + + + + + + + + + + + + ); + } +); + +export const AppRoutes = memo(() => { + return ( + + + + + + + ); +}); diff --git a/x-pack/plugins/fleet/public/applications/integrations/components/index.ts b/x-pack/plugins/fleet/public/applications/integrations/components/index.ts new file mode 100644 index 00000000000000..727ecb1c991ea6 --- /dev/null +++ b/x-pack/plugins/fleet/public/applications/integrations/components/index.ts @@ -0,0 +1,7 @@ +/* + * 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. + */ +export * from '../../../components'; diff --git a/x-pack/plugins/fleet/public/applications/integrations/constants.tsx b/x-pack/plugins/fleet/public/applications/integrations/constants.tsx new file mode 100644 index 00000000000000..403a47f4b94b2f --- /dev/null +++ b/x-pack/plugins/fleet/public/applications/integrations/constants.tsx @@ -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 type { IconType } from '@elastic/eui'; + +import type { AssetType, ServiceName } from '../../types'; +import { ElasticsearchAssetType, KibanaAssetType } from '../../types'; + +export * from '../../constants'; + +// only allow Kibana assets for the kibana key, ES asssets for elasticsearch, etc +type ServiceNameToAssetTypes = Record, KibanaAssetType[]> & + Record, ElasticsearchAssetType[]>; + +export const DisplayedAssets: ServiceNameToAssetTypes = { + kibana: Object.values(KibanaAssetType), + elasticsearch: Object.values(ElasticsearchAssetType), +}; + +export const AssetTitleMap: Record = { + dashboard: 'Dashboard', + ilm_policy: 'ILM Policy', + ingest_pipeline: 'Ingest Pipeline', + transform: 'Transform', + index_pattern: 'Index Pattern', + index_template: 'Index Template', + component_template: 'Component Template', + search: 'Saved Search', + visualization: 'Visualization', + input: 'Agent input', + map: 'Map', + data_stream_ilm_policy: 'Data Stream ILM Policy', + lens: 'Lens', + security_rule: 'Security Rule', + ml_module: 'ML Module', +}; + +export const ServiceTitleMap: Record = { + kibana: 'Kibana', + elasticsearch: 'Elasticsearch', +}; + +export const AssetIcons: Record = { + dashboard: 'dashboardApp', + index_pattern: 'indexPatternApp', + search: 'searchProfilerApp', + visualization: 'visualizeApp', + map: 'emsApp', + lens: 'lensApp', + security_rule: 'securityApp', + ml_module: 'mlApp', +}; + +export const ServiceIcons: Record = { + elasticsearch: 'logoElasticsearch', + kibana: 'logoKibana', +}; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/hooks/index.tsx b/x-pack/plugins/fleet/public/applications/integrations/hooks/index.ts similarity index 55% rename from x-pack/plugins/fleet/public/applications/fleet/sections/epm/hooks/index.tsx rename to x-pack/plugins/fleet/public/applications/integrations/hooks/index.ts index 45f189afe350ab..7f758e3c472c18 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/hooks/index.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/hooks/index.ts @@ -4,13 +4,9 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ +export * from '../../../hooks'; +export { useBreadcrumbs } from './use_breadcrumbs'; export { useLinks } from './use_links'; -export { useLocalSearch, searchIdField } from './use_local_search'; -export { - PackageInstallProvider, - useUninstallPackage, - useGetPackageInstallStatus, - useInstallPackage, - useSetPackageInstallStatus, -} from './use_package_install'; +export * from './use_local_search'; +export * from './use_package_install'; diff --git a/x-pack/plugins/fleet/public/applications/integrations/hooks/use_breadcrumbs.tsx b/x-pack/plugins/fleet/public/applications/integrations/hooks/use_breadcrumbs.tsx new file mode 100644 index 00000000000000..5c1745be0c9e48 --- /dev/null +++ b/x-pack/plugins/fleet/public/applications/integrations/hooks/use_breadcrumbs.tsx @@ -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 { i18n } from '@kbn/i18n'; +import type { ChromeBreadcrumb } from 'src/core/public'; + +import type { Page, DynamicPagePathValues } from '../constants'; +import { INTEGRATIONS_BASE_PATH, pagePathGetters } from '../constants'; + +import { useStartServices } from './index'; + +const BASE_BREADCRUMB: ChromeBreadcrumb = { + href: pagePathGetters.integrations()[1], + text: i18n.translate('xpack.fleet.breadcrumbs.integrationsAppTitle', { + defaultMessage: 'Integrations', + }), +}; + +const breadcrumbGetters: { + [key in Page]?: (values: DynamicPagePathValues) => ChromeBreadcrumb[]; +} = { + integrations: () => [ + BASE_BREADCRUMB, + { + text: i18n.translate('xpack.fleet.breadcrumbs.integrationsPageTitle', { + defaultMessage: 'Integrations', + }), + }, + ], + integrations_all: () => [ + BASE_BREADCRUMB, + { + text: i18n.translate('xpack.fleet.breadcrumbs.allIntegrationsPageTitle', { + defaultMessage: 'Browse', + }), + }, + ], + integrations_installed: () => [ + BASE_BREADCRUMB, + { + text: i18n.translate('xpack.fleet.breadcrumbs.installedIntegrationsPageTitle', { + defaultMessage: 'Manage', + }), + }, + ], + integration_details_overview: ({ pkgTitle }) => [BASE_BREADCRUMB, { text: pkgTitle }], + integration_policy_edit: ({ pkgTitle, pkgkey, policyName }) => [ + BASE_BREADCRUMB, + { + href: pagePathGetters.integration_details_policies({ pkgkey })[1], + text: pkgTitle, + }, + { text: policyName }, + ], +}; + +export function useBreadcrumbs(page: Page, values: DynamicPagePathValues = {}) { + const { chrome, http } = useStartServices(); + const breadcrumbs: ChromeBreadcrumb[] = + breadcrumbGetters[page]?.(values).map((breadcrumb) => ({ + ...breadcrumb, + href: breadcrumb.href + ? http.basePath.prepend(`${INTEGRATIONS_BASE_PATH}#${breadcrumb.href}`) + : undefined, + })) || []; + const docTitle: string[] = [...breadcrumbs] + .reverse() + .map((breadcrumb) => breadcrumb.text as string); + chrome.docTitle.change(docTitle); + chrome.setBreadcrumbs(breadcrumbs); +} diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/hooks/use_links.tsx b/x-pack/plugins/fleet/public/applications/integrations/hooks/use_links.tsx similarity index 93% rename from x-pack/plugins/fleet/public/applications/fleet/sections/epm/hooks/use_links.tsx rename to x-pack/plugins/fleet/public/applications/integrations/hooks/use_links.tsx index 08bc53e4eea7f1..ae9387a0606e45 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/hooks/use_links.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/hooks/use_links.tsx @@ -8,11 +8,7 @@ import { useStartServices } from '../../../hooks/use_core'; import { PLUGIN_ID } from '../../../constants'; import { epmRouteService } from '../../../services'; -import type { - PackageSpecIcon, - PackageSpecScreenshot, - RegistryImage, -} from '../../../../../../common'; +import type { PackageSpecIcon, PackageSpecScreenshot, RegistryImage } from '../../../../common'; const removeRelativePath = (relativePath: string): string => new URL(relativePath, 'http://example.com').pathname; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/hooks/use_local_search.tsx b/x-pack/plugins/fleet/public/applications/integrations/hooks/use_local_search.tsx similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/sections/epm/hooks/use_local_search.tsx rename to x-pack/plugins/fleet/public/applications/integrations/hooks/use_local_search.tsx diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/hooks/use_package_install.tsx b/x-pack/plugins/fleet/public/applications/integrations/hooks/use_package_install.tsx similarity index 98% rename from x-pack/plugins/fleet/public/applications/fleet/sections/epm/hooks/use_package_install.tsx rename to x-pack/plugins/fleet/public/applications/integrations/hooks/use_package_install.tsx index 4f8242fe42613a..342d6b54c2613d 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/hooks/use_package_install.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/hooks/use_package_install.tsx @@ -11,7 +11,7 @@ import { useHistory } from 'react-router-dom'; import { FormattedMessage } from '@kbn/i18n/react'; import type { NotificationsStart } from 'src/core/public'; -import { toMountPoint } from '../../../../../../../../../src/plugins/kibana_react/public'; +import { toMountPoint } from '../../../../../../../src/plugins/kibana_react/public'; import type { PackageInfo } from '../../../types'; import { sendInstallPackage, sendRemovePackage, useLink } from '../../../hooks'; import { InstallStatus } from '../../../types'; diff --git a/x-pack/plugins/fleet/public/applications/integrations/index.tsx b/x-pack/plugins/fleet/public/applications/integrations/index.tsx new file mode 100644 index 00000000000000..da8959a019ce57 --- /dev/null +++ b/x-pack/plugins/fleet/public/applications/integrations/index.tsx @@ -0,0 +1,93 @@ +/* + * 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 from 'react'; +import ReactDOM from 'react-dom'; +import { Redirect, Route } from 'react-router-dom'; +import type { RouteProps } from 'react-router-dom'; + +import type { CoreStart, AppMountParameters } from 'src/core/public'; + +import type { FleetConfigType, FleetStartServices } from '../../plugin'; +import { licenseService } from '../../hooks'; +import type { UIExtensionsStorage } from '../../types'; + +import { AppRoutes, IntegrationsAppContext, WithPermissionsAndSetup } from './app'; + +export interface ProtectedRouteProps extends RouteProps { + isAllowed?: boolean; + restrictedPath?: string; +} + +export const ProtectedRoute: React.FunctionComponent = ({ + isAllowed = false, + restrictedPath = '/', + ...routeProps +}: ProtectedRouteProps) => { + return isAllowed ? : ; +}; + +interface IntegrationsAppProps { + basepath: string; + startServices: FleetStartServices; + config: FleetConfigType; + history: AppMountParameters['history']; + kibanaVersion: string; + extensions: UIExtensionsStorage; +} +const IntegrationsApp = ({ + basepath, + startServices, + config, + history, + kibanaVersion, + extensions, +}: IntegrationsAppProps) => { + return ( + + + + + + ); +}; + +export function renderApp( + startServices: FleetStartServices, + { element, appBasePath, history }: AppMountParameters, + config: FleetConfigType, + kibanaVersion: string, + extensions: UIExtensionsStorage +) { + ReactDOM.render( + , + element + ); + + return () => { + ReactDOM.unmountComponentAtNode(element); + }; +} + +export const teardownIntegrations = (coreStart: CoreStart) => { + coreStart.chrome.docTitle.reset(); + coreStart.chrome.setBreadcrumbs([]); + licenseService.stop(); +}; diff --git a/x-pack/plugins/fleet/public/applications/integrations/layouts/default.tsx b/x-pack/plugins/fleet/public/applications/integrations/layouts/default.tsx new file mode 100644 index 00000000000000..4c1ff4972b89e2 --- /dev/null +++ b/x-pack/plugins/fleet/public/applications/integrations/layouts/default.tsx @@ -0,0 +1,71 @@ +/* + * 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 } from 'react'; +import { EuiText, EuiBetaBadge } from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n/react'; + +import { useLink } from '../../../hooks'; +import type { Section } from '../sections'; + +import { HeroImage } from '../sections/epm/screens/home/header'; + +import { WithHeaderLayout } from './'; + +interface Props { + section?: Section; + children?: React.ReactNode; +} + +export const DefaultLayout: React.FunctionComponent = memo(({ section, children }) => { + const { getHref } = useLink(); + + return ( + } + leftColumn={ + +

+ {' '} + } + tooltipContent={ + + } + /> +

+
+ } + tabs={[ + { + name: ( + + ), + isSelected: section === 'browse', + href: getHref('integrations_all'), + }, + { + name: ( + + ), + isSelected: section === 'manage', + href: getHref('integrations_installed'), + }, + ]} + > + {children} +
+ ); +}); diff --git a/x-pack/plugins/fleet/public/applications/integrations/layouts/index.ts b/x-pack/plugins/fleet/public/applications/integrations/layouts/index.ts new file mode 100644 index 00000000000000..71cb8d3aeeb369 --- /dev/null +++ b/x-pack/plugins/fleet/public/applications/integrations/layouts/index.ts @@ -0,0 +1,10 @@ +/* + * 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. + */ + +export * from '../../../layouts'; + +export { DefaultLayout } from './default'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/components/assets_facet_group.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/components/assets_facet_group.tsx similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/sections/epm/components/assets_facet_group.tsx rename to x-pack/plugins/fleet/public/applications/integrations/sections/epm/components/assets_facet_group.tsx diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/components/icons.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/components/icons.tsx similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/sections/epm/components/icons.tsx rename to x-pack/plugins/fleet/public/applications/integrations/sections/epm/components/icons.tsx diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/components/package_card.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/components/package_card.tsx similarity index 96% rename from x-pack/plugins/fleet/public/applications/fleet/sections/epm/components/package_card.tsx rename to x-pack/plugins/fleet/public/applications/integrations/sections/epm/components/package_card.tsx index be76f05b0f5a14..c12e67fdb57181 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/components/package_card.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/components/package_card.tsx @@ -11,7 +11,7 @@ import { EuiCard } from '@elastic/eui'; import type { PackageListItem } from '../../../types'; import { useLink } from '../../../hooks'; -import { PackageIcon } from '../../../components/package_icon'; +import { PackageIcon } from '../../../components'; import { RELEASE_BADGE_LABEL, RELEASE_BADGE_DESCRIPTION } from './release_badge'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/components/package_list_grid.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/components/package_list_grid.tsx similarity index 98% rename from x-pack/plugins/fleet/public/applications/fleet/sections/epm/components/package_list_grid.tsx rename to x-pack/plugins/fleet/public/applications/integrations/sections/epm/components/package_list_grid.tsx index d4d2b481950f6b..7e56c25c2bbe71 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/components/package_list_grid.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/components/package_list_grid.tsx @@ -24,7 +24,7 @@ import { FormattedMessage } from '@kbn/i18n/react'; import { Loading } from '../../../components'; import type { PackageList } from '../../../types'; -import { useLocalSearch, searchIdField } from '../hooks'; +import { useLocalSearch, searchIdField } from '../../../hooks'; import { PackageCard } from './package_card'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/components/release_badge.ts b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/components/release_badge.ts similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/sections/epm/components/release_badge.ts rename to x-pack/plugins/fleet/public/applications/integrations/sections/epm/components/release_badge.ts diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/components/requirements.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/components/requirements.tsx similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/sections/epm/components/requirements.tsx rename to x-pack/plugins/fleet/public/applications/integrations/sections/epm/components/requirements.tsx diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/components/version.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/components/version.tsx similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/sections/epm/components/version.tsx rename to x-pack/plugins/fleet/public/applications/integrations/sections/epm/components/version.tsx diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/constants.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/constants.tsx similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/sections/epm/constants.tsx rename to x-pack/plugins/fleet/public/applications/integrations/sections/epm/constants.tsx diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/index.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/index.tsx similarity index 63% rename from x-pack/plugins/fleet/public/applications/fleet/sections/epm/index.tsx rename to x-pack/plugins/fleet/public/applications/integrations/sections/epm/index.tsx index cb94ddf3ddf2a3..07fd657a01708f 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/index.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/index.tsx @@ -8,9 +8,8 @@ import React from 'react'; import { Switch, Route } from 'react-router-dom'; -import { PAGE_ROUTING_PATHS } from '../../constants'; +import { INTEGRATIONS_ROUTING_PATHS } from '../../constants'; import { useBreadcrumbs } from '../../hooks'; -import { CreatePackagePolicyPage } from '../agent_policy/create_package_policy_page'; import { EPMHomePage } from './screens/home'; import { Detail } from './screens/detail'; @@ -21,16 +20,13 @@ export const EPMApp: React.FunctionComponent = () => { return ( - - - - + - + - + diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/components/icon_panel.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/components/icon_panel.tsx similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/components/icon_panel.tsx rename to x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/components/icon_panel.tsx diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/components/index.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/components/index.tsx similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/components/index.tsx rename to x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/components/index.tsx diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/components/integration_agent_policy_count.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/components/integration_agent_policy_count.tsx similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/components/integration_agent_policy_count.tsx rename to x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/components/integration_agent_policy_count.tsx diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/components/update_icon.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/components/update_icon.tsx similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/components/update_icon.tsx rename to x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/components/update_icon.tsx diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/custom/custom.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/custom/custom.tsx similarity index 79% rename from x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/custom/custom.tsx rename to x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/custom/custom.tsx index 6f76acbe187c67..ef8d21236c6704 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/custom/custom.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/custom/custom.tsx @@ -8,11 +8,10 @@ import React, { memo, useMemo } from 'react'; import { Redirect } from 'react-router-dom'; import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; -import { useUIExtension } from '../../../../../hooks/use_ui_extension'; -import { useLink } from '../../../../../hooks'; +import { useLink, useUIExtension } from '../../../../../hooks'; import type { PackageInfo } from '../../../../../types'; -import { pkgKeyFromPackageInfo } from '../../../../../services/pkg_key_from_package_info'; -import { ExtensionWrapper } from '../../../../../components/extension_wrapper'; +import { pkgKeyFromPackageInfo } from '../../../../../services'; +import { ExtensionWrapper } from '../../../../../components'; interface Props { packageInfo: PackageInfo; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/custom/index.ts b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/custom/index.ts similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/custom/index.ts rename to x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/custom/index.ts diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/index.scss b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/index.scss similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/index.scss rename to x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/index.scss diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/index.test.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/index.test.tsx similarity index 95% rename from x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/index.test.tsx rename to x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/index.test.tsx index a8e9ddf1c8f789..4063bc6371cbdc 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/index.test.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/index.test.tsx @@ -9,7 +9,7 @@ import React, { lazy, memo } from 'react'; import { Route } from 'react-router-dom'; import { act, cleanup } from '@testing-library/react'; -import { PAGE_ROUTING_PATHS, pagePathGetters } from '../../../../constants'; +import { INTEGRATIONS_ROUTING_PATHS, pagePathGetters } from '../../../../constants'; import type { GetAgentPoliciesResponse, GetFleetStatusResponse, @@ -27,26 +27,26 @@ import { fleetSetupRouteService, packagePolicyRouteService, } from '../../../../../../../common/services'; -import type { MockedFleetStartServices, TestRenderer } from '../../../../mock'; -import { createTestRendererMock } from '../../../../mock'; +import type { MockedFleetStartServices, TestRenderer } from '../../../../../../mock'; +import { createIntegrationsTestRendererMock } from '../../../../../../mock'; import { Detail } from './index'; describe('when on integration detail', () => { const pkgkey = 'nginx-0.3.7'; - const detailPageUrlPath = pagePathGetters.integration_details_overview({ pkgkey }); + const detailPageUrlPath = pagePathGetters.integration_details_overview({ pkgkey })[1]; let testRenderer: TestRenderer; let renderResult: ReturnType; let mockedApi: MockedApi; const render = () => (renderResult = testRenderer.render( - + )); beforeEach(() => { - testRenderer = createTestRendererMock(); + testRenderer = createIntegrationsTestRendererMock(); mockedApi = mockApiCalls(testRenderer.startServices.http); testRenderer.history.push(detailPageUrlPath); }); @@ -106,10 +106,12 @@ describe('when on integration detail', () => { it('should redirect if custom url is accessed', () => { act(() => { testRenderer.history.push( - pagePathGetters.integration_details_custom({ pkgkey: 'nginx-0.3.7' }) + pagePathGetters.integration_details_custom({ pkgkey: 'nginx-0.3.7' })[1] ); }); - expect(testRenderer.history.location.pathname).toEqual(detailPageUrlPath); + expect(testRenderer.history.location.pathname).toEqual( + '/app/integrations/detail/nginx-0.3.7/overview' + ); }); }); @@ -154,7 +156,7 @@ describe('when on integration detail', () => { it('should display custom content when tab is clicked', async () => { act(() => { testRenderer.history.push( - pagePathGetters.integration_details_custom({ pkgkey: 'nginx-0.3.7' }) + pagePathGetters.integration_details_custom({ pkgkey: 'nginx-0.3.7' })[1] ); }); await lazyComponentWasRendered; @@ -171,30 +173,10 @@ describe('when on integration detail', () => { 'http://localhost/mock/app/fleet#/integrations/nginx-0.3.7/add-integration' ); }); - - it('should link to create page with route state for return trip', () => { - const addButton = renderResult.getByTestId('addIntegrationPolicyButton') as HTMLAnchorElement; - act(() => addButton.click()); - expect(testRenderer.history.location.state).toEqual({ - onCancelNavigateTo: [ - 'fleet', - { - path: '#/integrations/detail/nginx-0.3.7/overview', - }, - ], - onCancelUrl: '#/integrations/detail/nginx-0.3.7/overview', - onSaveNavigateTo: [ - 'fleet', - { - path: '#/integrations/detail/nginx-0.3.7/overview', - }, - ], - }); - }); }); describe('and on the Policies Tab', () => { - const policiesTabURLPath = pagePathGetters.integration_details_policies({ pkgkey }); + const policiesTabURLPath = pagePathGetters.integration_details_policies({ pkgkey })[1]; beforeEach(() => { testRenderer.history.push(policiesTabURLPath); render(); @@ -211,7 +193,7 @@ describe('when on integration detail', () => { 'integrationNameLink' )[0] as HTMLAnchorElement; expect(firstPolicy.href).toEqual( - 'http://localhost/mock/app/fleet#/integrations/edit-integration/e8a37031-2907-44f6-89d2-98bd493f60dc' + 'http://localhost/mock/app/integrations#/edit-integration/e8a37031-2907-44f6-89d2-98bd493f60dc' ); }); @@ -747,7 +729,7 @@ On Windows, the module was tested with Nginx installed from the Chocolatey repos }, }; - http.get.mockImplementation(async (path) => { + http.get.mockImplementation(async (path: any) => { if (typeof path === 'string') { if (path === epmRouteService.getInfoPath(`nginx-0.3.7`)) { markApiCallAsHandled(); diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/index.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/index.tsx similarity index 90% rename from x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/index.tsx rename to x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/index.tsx index 05d2f53688655e..68736455b818f6 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/index.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/index.tsx @@ -6,7 +6,7 @@ */ import type { ReactEventHandler } from 'react'; import React, { useCallback, useEffect, useMemo, useState } from 'react'; -import { Redirect, Route, Switch, useHistory, useLocation, useParams } from 'react-router-dom'; +import { Redirect, Route, Switch, useLocation, useParams, useHistory } from 'react-router-dom'; import styled from 'styled-components'; import { EuiBetaBadge, @@ -24,10 +24,21 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import semverLt from 'semver/functions/lt'; -import { useUIExtension } from '../../../../hooks/use_ui_extension'; -import { PAGE_ROUTING_PATHS, PLUGIN_ID } from '../../../../constants'; +import { + useGetPackageInstallStatus, + useSetPackageInstallStatus, + useUIExtension, + useBreadcrumbs, + useStartServices, +} from '../../../../hooks'; +import { + PLUGIN_ID, + INTEGRATIONS_PLUGIN_ID, + INTEGRATIONS_ROUTING_PATHS, + pagePathGetters, +} from '../../../../constants'; import { useCapabilities, useGetPackageInfoByKey, useLink } from '../../../../hooks'; -import { pkgKeyFromPackageInfo } from '../../../../services/pkg_key_from_package_info'; +import { pkgKeyFromPackageInfo } from '../../../../services'; import type { CreatePackagePolicyRouteState, DetailViewPanelName, @@ -35,11 +46,9 @@ import type { } from '../../../../types'; import { InstallStatus } from '../../../../types'; import { Error, Loading } from '../../../../components'; -import { useBreadcrumbs } from '../../../../hooks'; import type { WithHeaderLayoutProps } from '../../../../layouts'; import { WithHeaderLayout } from '../../../../layouts'; import { RELEASE_BADGE_DESCRIPTION, RELEASE_BADGE_LABEL } from '../../components/release_badge'; -import { useGetPackageInstallStatus, useSetPackageInstallStatus } from '../../hooks'; import { IntegrationAgentPolicyCount, UpdateIcon, IconPanel, LoadingIconPanel } from './components'; import { OverviewPage } from './overview'; @@ -71,12 +80,13 @@ function Breadcrumbs({ packageTitle }: { packageTitle: string }) { export function Detail() { const { pkgkey, panel } = useParams(); - const { getHref, getPath } = useLink(); + const { getHref } = useLink(); const hasWriteCapabilites = useCapabilities().write; const history = useHistory(); const { pathname, search, hash } = useLocation(); const queryParams = useMemo(() => new URLSearchParams(search), [search]); const integration = useMemo(() => queryParams.get('integration'), [queryParams]); + const services = useStartServices(); // Package info state const [packageInfo, setPackageInfo] = useState(null); @@ -203,7 +213,7 @@ export function Detail() { }); const redirectToPath: CreatePackagePolicyRouteState['onSaveNavigateTo'] & CreatePackagePolicyRouteState['onCancelNavigateTo'] = [ - PLUGIN_ID, + INTEGRATIONS_PLUGIN_ID, { path: currentPath, }, @@ -214,15 +224,19 @@ export function Detail() { onCancelUrl: currentPath, }; - history.push({ - pathname: getPath('add_integration_to_policy', { - pkgkey, - ...(integration ? { integration } : {}), - }), + const path = pagePathGetters.add_integration_to_policy({ + pkgkey, + ...(integration ? { integration } : {}), + })[1]; + + services.application.navigateToApp(PLUGIN_ID, { + // Necessary because of Fleet's HashRouter. Can be changed when + // https://github.com/elastic/kibana/issues/96134 is resolved + path: `#${path}`, state: redirectBackRouteState, }); }, - [getPath, history, hash, pathname, search, pkgkey, integration] + [history, hash, pathname, search, pkgkey, integration, services.application] ); const headerRightContent = useMemo( @@ -401,7 +415,9 @@ export function Detail() { tabs={headerTabs} tabsClassName="fleet__epm__shiftNavTabs" > - {integrationInfo ? : null} + {integrationInfo || packageInfo ? ( + + ) : null} {packageInfoError ? ( ) : ( - + - + - + - + - + )} diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/overview/details.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/overview/details.tsx similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/overview/details.tsx rename to x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/overview/details.tsx diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/overview/index.ts b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/overview/index.ts similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/overview/index.ts rename to x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/overview/index.ts diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/overview/markdown_renderers.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/overview/markdown_renderers.tsx similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/overview/markdown_renderers.tsx rename to x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/overview/markdown_renderers.tsx diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/overview/overview.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/overview/overview.tsx similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/overview/overview.tsx rename to x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/overview/overview.tsx diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/overview/readme.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/overview/readme.tsx similarity index 94% rename from x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/overview/readme.tsx rename to x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/overview/readme.tsx index d92b4ce598fd26..240b3c7bf7442c 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/overview/readme.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/overview/readme.tsx @@ -9,8 +9,7 @@ import { EuiLoadingContent, EuiText } from '@elastic/eui'; import React, { Fragment, useEffect, useState } from 'react'; import ReactMarkdown from 'react-markdown'; -import { useLinks } from '../../../hooks'; -import { sendGetFileByPath } from '../../../../../hooks'; +import { useLinks, sendGetFileByPath } from '../../../../../hooks'; import { markdownRenderers } from './markdown_renderers'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/overview/screenshots.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/overview/screenshots.tsx similarity index 98% rename from x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/overview/screenshots.tsx rename to x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/overview/screenshots.tsx index 6df3a082ecb93d..a2a765cf411659 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/overview/screenshots.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/overview/screenshots.tsx @@ -10,7 +10,7 @@ import { FormattedMessage } from '@kbn/i18n/react'; import { EuiFlexGroup, EuiFlexItem, EuiImage, EuiText, EuiPagination } from '@elastic/eui'; import type { ScreenshotItem } from '../../../../../types'; -import { useLinks } from '../../../hooks'; +import { useLinks } from '../../../../../hooks'; interface ScreenshotProps { images: ScreenshotItem[]; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/policies/index.ts b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/policies/index.ts similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/policies/index.ts rename to x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/policies/index.ts diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/policies/package_policies.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/policies/package_policies.tsx similarity index 96% rename from x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/policies/package_policies.tsx rename to x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/policies/package_policies.tsx index b14551098e688a..d5dce6334762c0 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/policies/package_policies.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/policies/package_policies.tsx @@ -13,11 +13,10 @@ import { i18n } from '@kbn/i18n'; import { FormattedRelative, FormattedMessage } from '@kbn/i18n/react'; import { InstallStatus } from '../../../../../types'; -import { useLink, useUrlPagination } from '../../../../../hooks'; +import { useLink, useUrlPagination, useGetPackageInstallStatus } from '../../../../../hooks'; import { PACKAGE_POLICY_SAVED_OBJECT_TYPE } from '../../../../../constants'; import { AgentPolicySummaryLine } from '../../../../../components'; -import { LinkedAgentCount } from '../../../../../components/linked_agent_count'; -import { useGetPackageInstallStatus } from '../../../hooks'; +import { LinkedAgentCount } from '../../../../../components'; import type { PackagePolicyAndAgentPolicy } from './use_package_policies_with_agent_policy'; import { usePackagePoliciesWithAgentPolicy } from './use_package_policies_with_agent_policy'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/policies/persona.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/policies/persona.tsx similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/policies/persona.tsx rename to x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/policies/persona.tsx diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/policies/use_package_policies_with_agent_policy.ts b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/policies/use_package_policies_with_agent_policy.ts similarity index 95% rename from x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/policies/use_package_policies_with_agent_policy.ts rename to x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/policies/use_package_policies_with_agent_policy.ts index f32047860717c3..aae43a1acd5689 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/policies/use_package_policies_with_agent_policy.ts +++ b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/policies/use_package_policies_with_agent_policy.ts @@ -15,9 +15,8 @@ import type { } from '../../../../../types'; import { agentPolicyRouteService } from '../../../../../services'; import { AGENT_POLICY_SAVED_OBJECT_TYPE } from '../../../../../constants'; -import { useGetPackagePolicies } from '../../../../../hooks'; -import { useConditionalRequest } from '../../../../../hooks/use_request/use_request'; -import type { SendConditionalRequestConfig } from '../../../../../hooks/use_request/use_request'; +import { useGetPackagePolicies, useConditionalRequest } from '../../../../../hooks'; +import type { SendConditionalRequestConfig } from '../../../../../hooks'; export interface PackagePolicyEnriched extends PackagePolicy { _agentPolicy: GetAgentPoliciesResponseItem | undefined; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/settings/confirm_package_install.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/settings/confirm_package_install.tsx similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/settings/confirm_package_install.tsx rename to x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/settings/confirm_package_install.tsx diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/settings/confirm_package_uninstall.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/settings/confirm_package_uninstall.tsx similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/settings/confirm_package_uninstall.tsx rename to x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/settings/confirm_package_uninstall.tsx diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/settings/index.ts b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/settings/index.ts similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/settings/index.ts rename to x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/settings/index.ts diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/settings/installation_button.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/settings/installation_button.tsx similarity index 96% rename from x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/settings/installation_button.tsx rename to x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/settings/installation_button.tsx index 5edb695188a2dd..8cf8466e6d9b0b 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/settings/installation_button.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/settings/installation_button.tsx @@ -11,8 +11,12 @@ import { FormattedMessage } from '@kbn/i18n/react'; import type { PackageInfo } from '../../../../../types'; import { InstallStatus } from '../../../../../types'; -import { useCapabilities } from '../../../../../hooks'; -import { useUninstallPackage, useGetPackageInstallStatus, useInstallPackage } from '../../../hooks'; +import { + useCapabilities, + useUninstallPackage, + useGetPackageInstallStatus, + useInstallPackage, +} from '../../../../../hooks'; import { ConfirmPackageUninstall } from './confirm_package_uninstall'; import { ConfirmPackageInstall } from './confirm_package_install'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/settings/settings.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/settings/settings.tsx similarity index 98% rename from x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/settings/settings.tsx rename to x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/settings/settings.tsx index f01364fc781574..995423ea91f968 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/settings/settings.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/settings/settings.tsx @@ -14,9 +14,8 @@ import { EuiTitle, EuiFlexGroup, EuiFlexItem, EuiText, EuiSpacer } from '@elasti import type { PackageInfo } from '../../../../../types'; import { InstallStatus } from '../../../../../types'; -import { useGetPackagePolicies } from '../../../../../hooks'; +import { useGetPackagePolicies, useGetPackageInstallStatus } from '../../../../../hooks'; import { PACKAGE_POLICY_SAVED_OBJECT_TYPE } from '../../../../../constants'; -import { useGetPackageInstallStatus } from '../../../hooks'; import { UpdateIcon } from '../components'; import { InstallationButton } from './installation_button'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/home/category_facets.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/home/category_facets.tsx similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/home/category_facets.tsx rename to x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/home/category_facets.tsx diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/home/header.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/home/header.tsx similarity index 94% rename from x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/home/header.tsx rename to x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/home/header.tsx index 54ee34e9021a57..55d058a2d7900e 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/home/header.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/home/header.tsx @@ -11,8 +11,7 @@ import styled from 'styled-components'; import { EuiFlexGroup, EuiFlexItem, EuiImage, EuiText } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; -import { useLinks } from '../../hooks'; -import { useStartServices } from '../../../../hooks'; +import { useLinks, useStartServices } from '../../../../hooks'; export const HeroCopy = memo(() => { return ( diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/home/index.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/home/index.tsx similarity index 80% rename from x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/home/index.tsx rename to x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/home/index.tsx index 922628e7b68b13..6c635d5d0c9c00 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/home/index.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/home/index.tsx @@ -6,62 +6,32 @@ */ import React, { memo, useState, useMemo } from 'react'; -import { useRouteMatch, Switch, Route, useLocation, useHistory } from 'react-router-dom'; +import { Switch, Route, useLocation, useHistory } from 'react-router-dom'; import semverLt from 'semver/functions/lt'; -import type { Props as EuiTabProps } from '@elastic/eui/src/components/tabs/tab'; import { i18n } from '@kbn/i18n'; import { installationStatuses } from '../../../../../../../common/constants'; -import { PAGE_ROUTING_PATHS } from '../../../../constants'; -import { useLink, useGetCategories, useGetPackages, useBreadcrumbs } from '../../../../hooks'; +import { INTEGRATIONS_ROUTING_PATHS } from '../../../../constants'; +import { useGetCategories, useGetPackages, useBreadcrumbs } from '../../../../hooks'; import { doesPackageHaveIntegrations } from '../../../../services'; -import { WithHeaderLayout } from '../../../../layouts'; +import { DefaultLayout } from '../../../../layouts'; import type { CategorySummaryItem, PackageList } from '../../../../types'; import { PackageListGrid } from '../../components/package_list_grid'; import { CategoryFacets } from './category_facets'; -import { HeroCopy, HeroImage } from './header'; export const EPMHomePage: React.FC = memo(() => { - const { - params: { tabId }, - } = useRouteMatch<{ tabId?: string }>(); - const { getHref } = useLink(); - return ( - } - rightColumn={} - tabs={ - ([ - { - id: 'all_packages', - name: i18n.translate('xpack.fleet.epmList.allTabText', { - defaultMessage: 'All integrations', - }), - href: getHref('integrations_all'), - isSelected: tabId !== 'installed', - }, - { - id: 'installed_packages', - name: i18n.translate('xpack.fleet.epmList.installedTabText', { - defaultMessage: 'Installed integrations', - }), - href: getHref('integrations_installed'), - isSelected: tabId === 'installed', - }, - ] as unknown) as EuiTabProps[] - } - > + - + - + - + ); }); diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/policy/index.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/policy/index.tsx similarity index 80% rename from x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/policy/index.tsx rename to x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/policy/index.tsx index b8963b8e39514d..cb95634de4c076 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/policy/index.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/policy/index.tsx @@ -8,7 +8,8 @@ import React, { memo } from 'react'; import { useRouteMatch } from 'react-router-dom'; -import { EditPackagePolicyForm } from '../../../agent_policy/edit_package_policy_page'; +// TODO: Needs to be moved +import { EditPackagePolicyForm } from '../../../../../fleet/sections/agent_policy/edit_package_policy_page'; export const Policy = memo(() => { const { diff --git a/x-pack/plugins/fleet/public/applications/integrations/sections/index.ts b/x-pack/plugins/fleet/public/applications/integrations/sections/index.ts new file mode 100644 index 00000000000000..caa399a6cb8852 --- /dev/null +++ b/x-pack/plugins/fleet/public/applications/integrations/sections/index.ts @@ -0,0 +1,8 @@ +/* + * 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. + */ + +export type Section = 'manage' | 'browse'; diff --git a/x-pack/plugins/fleet/public/applications/integrations/services/index.ts b/x-pack/plugins/fleet/public/applications/integrations/services/index.ts new file mode 100644 index 00000000000000..dffc2027c19a77 --- /dev/null +++ b/x-pack/plugins/fleet/public/applications/integrations/services/index.ts @@ -0,0 +1,7 @@ +/* + * 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. + */ +export * from '../../../services'; diff --git a/x-pack/plugins/fleet/public/applications/integrations/types/index.ts b/x-pack/plugins/fleet/public/applications/integrations/types/index.ts new file mode 100644 index 00000000000000..87e3ed4da55ea3 --- /dev/null +++ b/x-pack/plugins/fleet/public/applications/integrations/types/index.ts @@ -0,0 +1,7 @@ +/* + * 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. + */ +export * from '../../../types'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/components/alpha_flyout.tsx b/x-pack/plugins/fleet/public/components/alpha_flyout.tsx similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/components/alpha_flyout.tsx rename to x-pack/plugins/fleet/public/components/alpha_flyout.tsx diff --git a/x-pack/plugins/fleet/public/applications/fleet/components/alpha_messaging.tsx b/x-pack/plugins/fleet/public/components/alpha_messaging.tsx similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/components/alpha_messaging.tsx rename to x-pack/plugins/fleet/public/components/alpha_messaging.tsx diff --git a/x-pack/plugins/fleet/public/applications/fleet/components/context_menu_actions.tsx b/x-pack/plugins/fleet/public/components/context_menu_actions.tsx similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/components/context_menu_actions.tsx rename to x-pack/plugins/fleet/public/components/context_menu_actions.tsx diff --git a/x-pack/plugins/fleet/public/applications/fleet/components/error.tsx b/x-pack/plugins/fleet/public/components/error.tsx similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/components/error.tsx rename to x-pack/plugins/fleet/public/components/error.tsx diff --git a/x-pack/plugins/fleet/public/applications/fleet/components/extension_wrapper.tsx b/x-pack/plugins/fleet/public/components/extension_wrapper.tsx similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/components/extension_wrapper.tsx rename to x-pack/plugins/fleet/public/components/extension_wrapper.tsx diff --git a/x-pack/plugins/fleet/public/applications/fleet/components/header.tsx b/x-pack/plugins/fleet/public/components/header.tsx similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/components/header.tsx rename to x-pack/plugins/fleet/public/components/header.tsx diff --git a/x-pack/plugins/fleet/public/applications/fleet/components/home_integration/index.tsx b/x-pack/plugins/fleet/public/components/home_integration/index.tsx similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/components/home_integration/index.tsx rename to x-pack/plugins/fleet/public/components/home_integration/index.tsx diff --git a/x-pack/plugins/fleet/public/applications/fleet/components/home_integration/tutorial_directory_header_link.tsx b/x-pack/plugins/fleet/public/components/home_integration/tutorial_directory_header_link.tsx similarity index 95% rename from x-pack/plugins/fleet/public/applications/fleet/components/home_integration/tutorial_directory_header_link.tsx rename to x-pack/plugins/fleet/public/components/home_integration/tutorial_directory_header_link.tsx index 106df8a9afb1dc..819fa03e2b6de9 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/components/home_integration/tutorial_directory_header_link.tsx +++ b/x-pack/plugins/fleet/public/components/home_integration/tutorial_directory_header_link.tsx @@ -10,7 +10,7 @@ import { FormattedMessage } from '@kbn/i18n/react'; import { EuiButtonEmpty } from '@elastic/eui'; import type { TutorialDirectoryHeaderLinkComponent } from 'src/plugins/home/public'; -import { RedirectAppLinks } from '../../../../../../../../src/plugins/kibana_react/public'; +import { RedirectAppLinks } from '../../../../../../src/plugins/kibana_react/public'; import { useLink, useCapabilities, useStartServices } from '../../hooks'; import { tutorialDirectoryNoticeState$ } from './tutorial_directory_notice'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/components/home_integration/tutorial_directory_notice.tsx b/x-pack/plugins/fleet/public/components/home_integration/tutorial_directory_notice.tsx similarity index 98% rename from x-pack/plugins/fleet/public/applications/fleet/components/home_integration/tutorial_directory_notice.tsx rename to x-pack/plugins/fleet/public/components/home_integration/tutorial_directory_notice.tsx index 4e8123a4fadec9..5e4357d95235b8 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/components/home_integration/tutorial_directory_notice.tsx +++ b/x-pack/plugins/fleet/public/components/home_integration/tutorial_directory_notice.tsx @@ -20,7 +20,7 @@ import { } from '@elastic/eui'; import type { TutorialDirectoryNoticeComponent } from 'src/plugins/home/public'; -import { RedirectAppLinks } from '../../../../../../../../src/plugins/kibana_react/public'; +import { RedirectAppLinks } from '../../../../../../src/plugins/kibana_react/public'; import { sendPutSettings, useGetSettings, diff --git a/x-pack/plugins/fleet/public/applications/fleet/components/home_integration/tutorial_module_notice.tsx b/x-pack/plugins/fleet/public/components/home_integration/tutorial_module_notice.tsx similarity index 97% rename from x-pack/plugins/fleet/public/applications/fleet/components/home_integration/tutorial_module_notice.tsx rename to x-pack/plugins/fleet/public/components/home_integration/tutorial_module_notice.tsx index 51870b482c3f29..f5b76de46e3a44 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/components/home_integration/tutorial_module_notice.tsx +++ b/x-pack/plugins/fleet/public/components/home_integration/tutorial_module_notice.tsx @@ -11,7 +11,7 @@ import { EuiText, EuiLink, EuiSpacer } from '@elastic/eui'; import type { TutorialModuleNoticeComponent } from 'src/plugins/home/public'; import { useGetPackages, useLink, useCapabilities } from '../../hooks'; -import { pkgKeyFromPackageInfo } from '../../services/pkg_key_from_package_info'; +import { pkgKeyFromPackageInfo } from '../../services'; const TutorialModuleNotice: TutorialModuleNoticeComponent = memo(({ moduleName }) => { const { getHref } = useLink(); diff --git a/x-pack/plugins/fleet/public/components/index.ts b/x-pack/plugins/fleet/public/components/index.ts new file mode 100644 index 00000000000000..6db18c0e73a141 --- /dev/null +++ b/x-pack/plugins/fleet/public/components/index.ts @@ -0,0 +1,17 @@ +/* + * 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. + */ +export { Loading } from './loading'; +export { Error } from './error'; +export { PackageIcon } from './package_icon'; +export { ContextMenuActions } from './context_menu_actions'; +export { LinkedAgentCount } from './linked_agent_count'; +export { ExtensionWrapper } from './extension_wrapper'; +export { AlphaMessaging } from './alpha_messaging'; +export { AlphaFlyout } from './alpha_flyout'; +export { HeaderProps, Header } from './header'; +export * from './link_and_revision'; +export * from './settings_flyout'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/components/link_and_revision.tsx b/x-pack/plugins/fleet/public/components/link_and_revision.tsx similarity index 97% rename from x-pack/plugins/fleet/public/applications/fleet/components/link_and_revision.tsx rename to x-pack/plugins/fleet/public/components/link_and_revision.tsx index 41ef63b23b564e..dd36e4b1e239c7 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/components/link_and_revision.tsx +++ b/x-pack/plugins/fleet/public/components/link_and_revision.tsx @@ -11,7 +11,7 @@ import { FormattedMessage } from '@kbn/i18n/react'; import type { CSSProperties } from 'react'; import React, { memo } from 'react'; -import type { AgentPolicy } from '../../../../common/types'; +import type { AgentPolicy } from '../../common/types'; import { useLink } from '../hooks'; const MIN_WIDTH: CSSProperties = { minWidth: 0 }; const NO_WRAP_WHITE_SPACE: CSSProperties = { whiteSpace: 'nowrap' }; diff --git a/x-pack/plugins/fleet/public/applications/fleet/components/linked_agent_count.tsx b/x-pack/plugins/fleet/public/components/linked_agent_count.tsx similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/components/linked_agent_count.tsx rename to x-pack/plugins/fleet/public/components/linked_agent_count.tsx diff --git a/x-pack/plugins/fleet/public/applications/fleet/components/loading.tsx b/x-pack/plugins/fleet/public/components/loading.tsx similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/components/loading.tsx rename to x-pack/plugins/fleet/public/components/loading.tsx diff --git a/x-pack/plugins/fleet/public/applications/fleet/components/package_icon.tsx b/x-pack/plugins/fleet/public/components/package_icon.tsx similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/components/package_icon.tsx rename to x-pack/plugins/fleet/public/components/package_icon.tsx diff --git a/x-pack/plugins/fleet/public/applications/fleet/components/settings_flyout/confirm_modal.tsx b/x-pack/plugins/fleet/public/components/settings_flyout/confirm_modal.tsx similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/components/settings_flyout/confirm_modal.tsx rename to x-pack/plugins/fleet/public/components/settings_flyout/confirm_modal.tsx diff --git a/x-pack/plugins/fleet/public/applications/fleet/components/settings_flyout/hosts_input.test.tsx b/x-pack/plugins/fleet/public/components/settings_flyout/hosts_input.test.tsx similarity index 95% rename from x-pack/plugins/fleet/public/applications/fleet/components/settings_flyout/hosts_input.test.tsx rename to x-pack/plugins/fleet/public/components/settings_flyout/hosts_input.test.tsx index f441cfd951ba9a..bd475acbb4feb6 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/components/settings_flyout/hosts_input.test.tsx +++ b/x-pack/plugins/fleet/public/components/settings_flyout/hosts_input.test.tsx @@ -8,12 +8,12 @@ import React from 'react'; import { fireEvent, act } from '@testing-library/react'; -import { createTestRendererMock } from '../../mock'; +import { createFleetTestRendererMock } from '../../mock'; import { HostsInput } from './hosts_input'; function renderInput(value = ['http://host1.com']) { - const renderer = createTestRendererMock(); + const renderer = createFleetTestRendererMock(); const mockOnChange = jest.fn(); const utils = renderer.render( diff --git a/x-pack/plugins/fleet/public/applications/fleet/components/settings_flyout/hosts_input.tsx b/x-pack/plugins/fleet/public/components/settings_flyout/hosts_input.tsx similarity index 98% rename from x-pack/plugins/fleet/public/applications/fleet/components/settings_flyout/hosts_input.tsx rename to x-pack/plugins/fleet/public/components/settings_flyout/hosts_input.tsx index 6c87a983f58a4a..c99cad93b7ec67 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/components/settings_flyout/hosts_input.tsx +++ b/x-pack/plugins/fleet/public/components/settings_flyout/hosts_input.tsx @@ -27,7 +27,7 @@ import { import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import type { EuiTheme } from '../../../../../../../../src/plugins/kibana_react/common'; +import type { EuiTheme } from '../../../../../../src/plugins/kibana_react/common'; interface Props { id: string; diff --git a/x-pack/plugins/fleet/public/applications/fleet/components/settings_flyout/index.tsx b/x-pack/plugins/fleet/public/components/settings_flyout/index.tsx similarity index 98% rename from x-pack/plugins/fleet/public/applications/fleet/components/settings_flyout/index.tsx rename to x-pack/plugins/fleet/public/components/settings_flyout/index.tsx index ea2e795d5fabbb..6e09310823b325 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/components/settings_flyout/index.tsx +++ b/x-pack/plugins/fleet/public/components/settings_flyout/index.tsx @@ -35,9 +35,10 @@ import { useGetSettings, useInput, sendPutSettings, + useGetOutputs, + sendPutOutput, } from '../../hooks'; -import { useGetOutputs, sendPutOutput } from '../../hooks/use_request/outputs'; -import { isDiffPathProtocol } from '../../../../../common/'; +import { isDiffPathProtocol } from '../../../common'; import { SettingsConfirmModal } from './confirm_modal'; import type { SettingsConfirmModalProps } from './confirm_modal'; diff --git a/x-pack/plugins/fleet/public/constants/index.ts b/x-pack/plugins/fleet/public/constants/index.ts new file mode 100644 index 00000000000000..a7cc2726eace1d --- /dev/null +++ b/x-pack/plugins/fleet/public/constants/index.ts @@ -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 + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export { + PLUGIN_ID, + INTEGRATIONS_PLUGIN_ID, + EPM_API_ROUTES, + AGENT_API_ROUTES, + SO_SEARCH_LIMIT, + AGENT_POLICY_SAVED_OBJECT_TYPE, + AGENT_SAVED_OBJECT_TYPE, + ENROLLMENT_API_KEYS_SAVED_OBJECT_TYPE, + PACKAGE_POLICY_SAVED_OBJECT_TYPE, + FLEET_SERVER_PACKAGE, + // Fleet Server index + AGENTS_INDEX, + ENROLLMENT_API_KEYS_INDEX, +} from '../../common/constants'; + +export * from './page_paths'; + +export const INDEX_NAME = '.kibana'; diff --git a/x-pack/plugins/fleet/public/constants/page_paths.ts b/x-pack/plugins/fleet/public/constants/page_paths.ts new file mode 100644 index 00000000000000..4ff71cf162e22a --- /dev/null +++ b/x-pack/plugins/fleet/public/constants/page_paths.ts @@ -0,0 +1,133 @@ +/* + * 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. + */ + +export type StaticPage = + | 'base' + | 'overview' + | 'integrations' + | 'integrations_all' + | 'integrations_installed' + | 'policies' + | 'policies_list' + | 'fleet' + | 'fleet_enrollment_tokens' + | 'data_streams'; + +export type DynamicPage = + | 'integration_details_overview' + | 'integration_details_policies' + | 'integration_details_settings' + | 'integration_details_custom' + | 'integration_policy_edit' + | 'policy_details' + | 'add_integration_from_policy' + | 'add_integration_to_policy' + | 'edit_integration' + | 'fleet_agent_list' + | 'fleet_agent_details'; + +export type Page = StaticPage | DynamicPage; + +export interface DynamicPagePathValues { + [key: string]: string; +} + +export const FLEET_BASE_PATH = '/app/fleet'; +export const INTEGRATIONS_BASE_PATH = '/app/integrations'; + +// If routing paths are changed here, please also check to see if +// `pagePathGetters()`, below, needs any modifications +export const FLEET_ROUTING_PATHS = { + overview: '/', + policies: '/policies', + policies_list: '/policies', + policy_details: '/policies/:policyId/:tabId?', + policy_details_settings: '/policies/:policyId/settings', + add_integration_from_policy: '/policies/:policyId/add-integration', + add_integration_to_policy: '/integrations/:pkgkey/add-integration/:integration?', + edit_integration: '/policies/:policyId/edit-integration/:packagePolicyId', + fleet: '/fleet', + fleet_agent_list: '/fleet/agents', + fleet_agent_details: '/fleet/agents/:agentId/:tabId?', + fleet_agent_details_logs: '/fleet/agents/:agentId/logs', + fleet_enrollment_tokens: '/fleet/enrollment-tokens', + data_streams: '/data-streams', +}; + +export const INTEGRATIONS_ROUTING_PATHS = { + integrations: '/:tabId', + integrations_all: '/browse', + integrations_installed: '/installed', + integration_details: '/detail/:pkgkey/:panel?', + integration_details_overview: '/detail/:pkgkey/overview', + integration_details_policies: '/detail/:pkgkey/policies', + integration_details_settings: '/detail/:pkgkey/settings', + integration_details_custom: '/detail/:pkgkey/custom', + integration_policy_edit: '/edit-integration/:packagePolicyId', +}; + +export const pagePathGetters: { + [key in StaticPage]: () => [string, string]; +} & + { + [key in DynamicPage]: (values: DynamicPagePathValues) => [string, string]; + } = { + base: () => [FLEET_BASE_PATH, '/'], + overview: () => [FLEET_BASE_PATH, '/'], + integrations: () => [INTEGRATIONS_BASE_PATH, '/'], + integrations_all: () => [INTEGRATIONS_BASE_PATH, '/browse'], + integrations_installed: () => [INTEGRATIONS_BASE_PATH, '/installed'], + integration_details_overview: ({ pkgkey, integration }) => [ + INTEGRATIONS_BASE_PATH, + `/detail/${pkgkey}/overview${integration ? `?integration=${integration}` : ''}`, + ], + integration_details_policies: ({ pkgkey, integration }) => [ + INTEGRATIONS_BASE_PATH, + `/detail/${pkgkey}/policies${integration ? `?integration=${integration}` : ''}`, + ], + integration_details_settings: ({ pkgkey, integration }) => [ + INTEGRATIONS_BASE_PATH, + `/detail/${pkgkey}/settings${integration ? `?integration=${integration}` : ''}`, + ], + integration_details_custom: ({ pkgkey, integration }) => [ + INTEGRATIONS_BASE_PATH, + `/detail/${pkgkey}/custom${integration ? `?integration=${integration}` : ''}`, + ], + integration_policy_edit: ({ packagePolicyId }) => [ + INTEGRATIONS_BASE_PATH, + `/edit-integration/${packagePolicyId}`, + ], + policies: () => [FLEET_BASE_PATH, '/policies'], + policies_list: () => [FLEET_BASE_PATH, '/policies'], + policy_details: ({ policyId, tabId }) => [ + FLEET_BASE_PATH, + `/policies/${policyId}${tabId ? `/${tabId}` : ''}`, + ], + add_integration_from_policy: ({ policyId }) => [ + FLEET_BASE_PATH, + `/policies/${policyId}/add-integration`, + ], + add_integration_to_policy: ({ pkgkey, integration }) => [ + FLEET_BASE_PATH, + `/integrations/${pkgkey}/add-integration${integration ? `/${integration}` : ''}`, + ], + edit_integration: ({ policyId, packagePolicyId }) => [ + FLEET_BASE_PATH, + `/policies/${policyId}/edit-integration/${packagePolicyId}`, + ], + fleet: () => [FLEET_BASE_PATH, '/fleet'], + fleet_agent_list: ({ kuery }) => [ + FLEET_BASE_PATH, + `/fleet/agents${kuery ? `?kuery=${kuery}` : ''}`, + ], + fleet_agent_details: ({ agentId, tabId, logQuery }) => [ + FLEET_BASE_PATH, + `/fleet/agents/${agentId}${tabId ? `/${tabId}` : ''}${logQuery ? `?_q=${logQuery}` : ''}`, + ], + fleet_enrollment_tokens: () => [FLEET_BASE_PATH, '/fleet/enrollment-tokens'], + data_streams: () => [FLEET_BASE_PATH, '/data-streams'], +}; diff --git a/x-pack/plugins/fleet/public/hooks/index.ts b/x-pack/plugins/fleet/public/hooks/index.ts new file mode 100644 index 00000000000000..0b413f72094d9d --- /dev/null +++ b/x-pack/plugins/fleet/public/hooks/index.ts @@ -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 + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export { useCapabilities } from './use_capabilities'; +export { useStartServices } from './use_core'; +export { useConfig, ConfigContext } from './use_config'; +export { useKibanaVersion, KibanaVersionContext } from './use_kibana_version'; +export { licenseService, useLicense } from './use_license'; +export { useLink } from './use_link'; +export { useKibanaLink } from './use_kibana_link'; +export { usePackageIconType, UsePackageIconType } from './use_package_icon_type'; +export { usePagination, Pagination, PAGE_SIZE_OPTIONS } from './use_pagination'; +export { useUrlPagination } from './use_url_pagination'; +export { useSorting } from './use_sorting'; +export { useDebounce } from './use_debounce'; +export { useUrlModal } from './use_url_modal'; +export * from './use_request'; +export * from './use_input'; +export * from './use_url_params'; +export * from './use_fleet_status'; +export * from './use_ui_extension'; +export * from './use_intra_app_state'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_capabilities.ts b/x-pack/plugins/fleet/public/hooks/use_capabilities.ts similarity index 88% rename from x-pack/plugins/fleet/public/applications/fleet/hooks/use_capabilities.ts rename to x-pack/plugins/fleet/public/hooks/use_capabilities.ts index a0449ee8ab0cd4..2da74f61ebe00f 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_capabilities.ts +++ b/x-pack/plugins/fleet/public/hooks/use_capabilities.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { useStartServices } from './'; +import { useStartServices } from './use_core'; export function useCapabilities() { const core = useStartServices(); diff --git a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_config.ts b/x-pack/plugins/fleet/public/hooks/use_config.ts similarity index 90% rename from x-pack/plugins/fleet/public/applications/fleet/hooks/use_config.ts rename to x-pack/plugins/fleet/public/hooks/use_config.ts index b72860efcc9ecc..db86ed66bba60e 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_config.ts +++ b/x-pack/plugins/fleet/public/hooks/use_config.ts @@ -7,7 +7,7 @@ import React, { useContext } from 'react'; -import type { FleetConfigType } from '../../../plugin'; +import type { FleetConfigType } from '../plugin'; export const ConfigContext = React.createContext(null); diff --git a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_core.ts b/x-pack/plugins/fleet/public/hooks/use_core.ts similarity index 77% rename from x-pack/plugins/fleet/public/applications/fleet/hooks/use_core.ts rename to x-pack/plugins/fleet/public/hooks/use_core.ts index 30b3a5da94e1c4..be4a21a094bd44 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_core.ts +++ b/x-pack/plugins/fleet/public/hooks/use_core.ts @@ -5,8 +5,8 @@ * 2.0. */ -import type { FleetStartServices } from '../../../plugin'; -import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; +import type { FleetStartServices } from '../plugin'; +import { useKibana } from '../../../../../src/plugins/kibana_react/public'; export function useStartServices(): FleetStartServices { const { services } = useKibana(); diff --git a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_debounce.tsx b/x-pack/plugins/fleet/public/hooks/use_debounce.tsx similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/hooks/use_debounce.tsx rename to x-pack/plugins/fleet/public/hooks/use_debounce.tsx diff --git a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_fleet_status.tsx b/x-pack/plugins/fleet/public/hooks/use_fleet_status.tsx similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/hooks/use_fleet_status.tsx rename to x-pack/plugins/fleet/public/hooks/use_fleet_status.tsx diff --git a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_input.ts b/x-pack/plugins/fleet/public/hooks/use_input.ts similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/hooks/use_input.ts rename to x-pack/plugins/fleet/public/hooks/use_input.ts diff --git a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_intra_app_state.tsx b/x-pack/plugins/fleet/public/hooks/use_intra_app_state.tsx similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/hooks/use_intra_app_state.tsx rename to x-pack/plugins/fleet/public/hooks/use_intra_app_state.tsx diff --git a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_kibana_link.ts b/x-pack/plugins/fleet/public/hooks/use_kibana_link.ts similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/hooks/use_kibana_link.ts rename to x-pack/plugins/fleet/public/hooks/use_kibana_link.ts diff --git a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_kibana_version.ts b/x-pack/plugins/fleet/public/hooks/use_kibana_version.ts similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/hooks/use_kibana_version.ts rename to x-pack/plugins/fleet/public/hooks/use_kibana_version.ts diff --git a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_license.ts b/x-pack/plugins/fleet/public/hooks/use_license.ts similarity index 83% rename from x-pack/plugins/fleet/public/applications/fleet/hooks/use_license.ts rename to x-pack/plugins/fleet/public/hooks/use_license.ts index fece509ed74854..f5b16c5f3aafc5 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_license.ts +++ b/x-pack/plugins/fleet/public/hooks/use_license.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { LicenseService } from '../../../../common/services/license'; +import { LicenseService } from '../../common/services'; export const licenseService = new LicenseService(); diff --git a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_link.ts b/x-pack/plugins/fleet/public/hooks/use_link.ts similarity index 59% rename from x-pack/plugins/fleet/public/applications/fleet/hooks/use_link.ts rename to x-pack/plugins/fleet/public/hooks/use_link.ts index 5c31f6fc4158e0..df6f45af31d56b 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_link.ts +++ b/x-pack/plugins/fleet/public/hooks/use_link.ts @@ -5,24 +5,31 @@ * 2.0. */ -import { BASE_PATH, pagePathGetters, PLUGIN_ID } from '../constants'; +import { pagePathGetters, PLUGIN_ID } from '../constants'; import type { StaticPage, DynamicPage, DynamicPagePathValues } from '../constants'; import { useStartServices } from './'; -const getPath = (page: StaticPage | DynamicPage, values: DynamicPagePathValues = {}): string => { +const getSeparatePaths = ( + page: StaticPage | DynamicPage, + values: DynamicPagePathValues = {} +): [string, string] => { return values ? pagePathGetters[page](values) : pagePathGetters[page as StaticPage](); }; export const useLink = () => { const core = useStartServices(); return { - getPath, + getPath: (page: StaticPage | DynamicPage, values: DynamicPagePathValues = {}): string => { + const [basePath, path] = getSeparatePaths(page, values); + + return `${basePath}${path}`; + }, getAssetsPath: (path: string) => core.http.basePath.prepend(`/plugins/${PLUGIN_ID}/assets/${path}`), getHref: (page: StaticPage | DynamicPage, values?: DynamicPagePathValues) => { - const path = getPath(page, values); - return core.http.basePath.prepend(`${BASE_PATH}#${path}`); + const [basePath, path] = getSeparatePaths(page, values); + return core.http.basePath.prepend(`${basePath}#${path}`); }, }; }; diff --git a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_package_icon_type.ts b/x-pack/plugins/fleet/public/hooks/use_package_icon_type.ts similarity index 93% rename from x-pack/plugins/fleet/public/applications/fleet/hooks/use_package_icon_type.ts rename to x-pack/plugins/fleet/public/hooks/use_package_icon_type.ts index 5701dd100bfed9..c194d9914acffd 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_package_icon_type.ts +++ b/x-pack/plugins/fleet/public/hooks/use_package_icon_type.ts @@ -9,7 +9,9 @@ import { useEffect, useState } from 'react'; import { ICON_TYPES } from '@elastic/eui'; import type { PackageInfo, PackageListItem } from '../types'; -import { useLinks } from '../sections/epm/hooks'; + +// TODO: Determine whether this can be relocated +import { useLinks as useEPMLinks } from '../applications/integrations/hooks'; import { sendGetPackageInfoByKey } from './index'; @@ -32,7 +34,7 @@ export const usePackageIconType = ({ icons: paramIcons, tryApi = false, }: UsePackageIconType) => { - const { toPackageImage } = useLinks(); + const { toPackageImage } = useEPMLinks(); const [iconList, setIconList] = useState(); const [iconType, setIconType] = useState(''); // FIXME: use `empty` icon during initialization - see: https://github.com/elastic/kibana/issues/60622 const cacheKey = `${packageName}-${version}${integrationName ? `-${integrationName}` : ''}`; diff --git a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_pagination.tsx b/x-pack/plugins/fleet/public/hooks/use_pagination.tsx similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/hooks/use_pagination.tsx rename to x-pack/plugins/fleet/public/hooks/use_pagination.tsx diff --git a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_request/agent_policy.ts b/x-pack/plugins/fleet/public/hooks/use_request/agent_policy.ts similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/hooks/use_request/agent_policy.ts rename to x-pack/plugins/fleet/public/hooks/use_request/agent_policy.ts diff --git a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_request/agents.ts b/x-pack/plugins/fleet/public/hooks/use_request/agents.ts similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/hooks/use_request/agents.ts rename to x-pack/plugins/fleet/public/hooks/use_request/agents.ts diff --git a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_request/app.ts b/x-pack/plugins/fleet/public/hooks/use_request/app.ts similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/hooks/use_request/app.ts rename to x-pack/plugins/fleet/public/hooks/use_request/app.ts diff --git a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_request/data_stream.ts b/x-pack/plugins/fleet/public/hooks/use_request/data_stream.ts similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/hooks/use_request/data_stream.ts rename to x-pack/plugins/fleet/public/hooks/use_request/data_stream.ts diff --git a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_request/enrollment_api_keys.ts b/x-pack/plugins/fleet/public/hooks/use_request/enrollment_api_keys.ts similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/hooks/use_request/enrollment_api_keys.ts rename to x-pack/plugins/fleet/public/hooks/use_request/enrollment_api_keys.ts diff --git a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_request/epm.ts b/x-pack/plugins/fleet/public/hooks/use_request/epm.ts similarity index 97% rename from x-pack/plugins/fleet/public/applications/fleet/hooks/use_request/epm.ts rename to x-pack/plugins/fleet/public/hooks/use_request/epm.ts index 3f3d2299fdebff..e209c50de057a9 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_request/epm.ts +++ b/x-pack/plugins/fleet/public/hooks/use_request/epm.ts @@ -16,7 +16,7 @@ import type { InstallPackageResponse, DeletePackageResponse, } from '../../types'; -import type { GetStatsResponse } from '../../../../../common'; +import type { GetStatsResponse } from '../../../common'; import { useRequest, sendRequest } from './use_request'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_request/index.ts b/x-pack/plugins/fleet/public/hooks/use_request/index.ts similarity index 88% rename from x-pack/plugins/fleet/public/applications/fleet/hooks/use_request/index.ts rename to x-pack/plugins/fleet/public/hooks/use_request/index.ts index 23358e0397e11a..2973d2dcd3fc8e 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_request/index.ts +++ b/x-pack/plugins/fleet/public/hooks/use_request/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -export { setHttpClient, sendRequest, useRequest } from './use_request'; +export * from './use_request'; export * from './agent_policy'; export * from './package_policy'; export * from './data_stream'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_request/outputs.ts b/x-pack/plugins/fleet/public/hooks/use_request/outputs.ts similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/hooks/use_request/outputs.ts rename to x-pack/plugins/fleet/public/hooks/use_request/outputs.ts diff --git a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_request/package_policy.ts b/x-pack/plugins/fleet/public/hooks/use_request/package_policy.ts similarity index 97% rename from x-pack/plugins/fleet/public/applications/fleet/hooks/use_request/package_policy.ts rename to x-pack/plugins/fleet/public/hooks/use_request/package_policy.ts index 89eab44a14461a..5057b6f51b2c5b 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_request/package_policy.ts +++ b/x-pack/plugins/fleet/public/hooks/use_request/package_policy.ts @@ -18,7 +18,7 @@ import type { GetPackagePoliciesRequest, GetPackagePoliciesResponse, GetOnePackagePolicyResponse, -} from '../../../../../common/types/rest_spec'; +} from '../../../common/types/rest_spec'; import { sendRequest, useRequest } from './use_request'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_request/settings.ts b/x-pack/plugins/fleet/public/hooks/use_request/settings.ts similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/hooks/use_request/settings.ts rename to x-pack/plugins/fleet/public/hooks/use_request/settings.ts diff --git a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_request/setup.ts b/x-pack/plugins/fleet/public/hooks/use_request/setup.ts similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/hooks/use_request/setup.ts rename to x-pack/plugins/fleet/public/hooks/use_request/setup.ts diff --git a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_request/use_request.ts b/x-pack/plugins/fleet/public/hooks/use_request/use_request.ts similarity index 92% rename from x-pack/plugins/fleet/public/applications/fleet/hooks/use_request/use_request.ts rename to x-pack/plugins/fleet/public/hooks/use_request/use_request.ts index b42c6e68fb499c..138c291a7226e2 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_request/use_request.ts +++ b/x-pack/plugins/fleet/public/hooks/use_request/use_request.ts @@ -11,16 +11,16 @@ import type { HttpSetup } from 'src/core/public'; import { sendRequest as _sendRequest, useRequest as _useRequest, -} from '../../../../../../../../src/plugins/es_ui_shared/public'; +} from '../../../../../../src/plugins/es_ui_shared/public'; import type { SendRequestConfig, SendRequestResponse, UseRequestConfig, -} from '../../../../../../../../src/plugins/es_ui_shared/public'; +} from '../../../../../../src/plugins/es_ui_shared/public'; let httpClient: HttpSetup; -export type { UseRequestConfig } from '../../../../../../../../src/plugins/es_ui_shared/public'; +export type { UseRequestConfig } from '../../../../../../src/plugins/es_ui_shared/public'; /** * @internal diff --git a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_sorting.tsx b/x-pack/plugins/fleet/public/hooks/use_sorting.tsx similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/hooks/use_sorting.tsx rename to x-pack/plugins/fleet/public/hooks/use_sorting.tsx diff --git a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_ui_extension.ts b/x-pack/plugins/fleet/public/hooks/use_ui_extension.ts similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/hooks/use_ui_extension.ts rename to x-pack/plugins/fleet/public/hooks/use_ui_extension.ts diff --git a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_url_modal.ts b/x-pack/plugins/fleet/public/hooks/use_url_modal.ts similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/hooks/use_url_modal.ts rename to x-pack/plugins/fleet/public/hooks/use_url_modal.ts diff --git a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_url_pagination.ts b/x-pack/plugins/fleet/public/hooks/use_url_pagination.ts similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/hooks/use_url_pagination.ts rename to x-pack/plugins/fleet/public/hooks/use_url_pagination.ts diff --git a/x-pack/plugins/fleet/public/applications/fleet/hooks/use_url_params.ts b/x-pack/plugins/fleet/public/hooks/use_url_params.ts similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/hooks/use_url_params.ts rename to x-pack/plugins/fleet/public/hooks/use_url_params.ts diff --git a/x-pack/plugins/fleet/public/index.ts b/x-pack/plugins/fleet/public/index.ts index 0304b7b56181c8..f563f008dbeb60 100644 --- a/x-pack/plugins/fleet/public/index.ts +++ b/x-pack/plugins/fleet/public/index.ts @@ -15,9 +15,9 @@ export const plugin = (initializerContext: PluginInitializerContext) => { return new FleetPlugin(initializerContext); }; -export type { NewPackagePolicy } from './applications/fleet/types'; -export * from './applications/fleet/types/intra_app_route_state'; -export * from './applications/fleet/types/ui_extensions'; +export type { NewPackagePolicy } from './types'; +export * from './types/intra_app_route_state'; +export * from './types/ui_extensions'; -export { pagePathGetters } from './applications/fleet/constants'; -export { pkgKeyFromPackageInfo } from './applications/fleet/services/pkg_key_from_package_info'; +export { pagePathGetters } from './constants'; +export { pkgKeyFromPackageInfo } from './services'; diff --git a/x-pack/plugins/fleet/public/layouts/index.ts b/x-pack/plugins/fleet/public/layouts/index.ts new file mode 100644 index 00000000000000..e6e366654a866b --- /dev/null +++ b/x-pack/plugins/fleet/public/layouts/index.ts @@ -0,0 +1,9 @@ +/* + * 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. + */ + +export { WithHeaderLayout, WithHeaderLayoutProps } from './with_header'; +export { WithoutHeaderLayout } from './without_header'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/layouts/with_header.tsx b/x-pack/plugins/fleet/public/layouts/with_header.tsx similarity index 90% rename from x-pack/plugins/fleet/public/applications/fleet/layouts/with_header.tsx rename to x-pack/plugins/fleet/public/layouts/with_header.tsx index bb561ab82acaa6..71f9b598c64288 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/layouts/with_header.tsx +++ b/x-pack/plugins/fleet/public/layouts/with_header.tsx @@ -5,13 +5,13 @@ * 2.0. */ -import React, { Fragment } from 'react'; +import React from 'react'; import { EuiPageBody, EuiSpacer } from '@elastic/eui'; import type { HeaderProps } from '../components'; import { Header } from '../components'; -import { Page, ContentWrapper } from './without_header'; +import { Page, ContentWrapper, Wrapper } from './without_header'; export interface WithHeaderLayoutProps extends HeaderProps { restrictWidth?: number; @@ -27,7 +27,7 @@ export const WithHeaderLayout: React.FC = ({ 'data-test-subj': dataTestSubj, ...rest }) => ( - +
= ({ - + ); diff --git a/x-pack/plugins/fleet/public/applications/fleet/layouts/without_header.tsx b/x-pack/plugins/fleet/public/layouts/without_header.tsx similarity index 84% rename from x-pack/plugins/fleet/public/applications/fleet/layouts/without_header.tsx rename to x-pack/plugins/fleet/public/layouts/without_header.tsx index 38b6198e088c53..220ee592d7d07a 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/layouts/without_header.tsx +++ b/x-pack/plugins/fleet/public/layouts/without_header.tsx @@ -5,16 +5,19 @@ * 2.0. */ -import React, { Fragment } from 'react'; +import React from 'react'; import styled from 'styled-components'; import { EuiPage, EuiPageBody, EuiSpacer } from '@elastic/eui'; +export const Wrapper = styled.div` + background-color: ${(props) => props.theme.eui.euiColorEmptyShade}; +`; + export const Page = styled(EuiPage)` background: ${(props) => props.theme.eui.euiColorEmptyShade}; width: 100%; align-self: center; - margin-left: 0; - margin-right: 0; + margin: auto; flex: 1; `; @@ -28,7 +31,7 @@ interface Props { } export const WithoutHeaderLayout: React.FC = ({ restrictWidth, children }) => ( - + @@ -37,5 +40,5 @@ export const WithoutHeaderLayout: React.FC = ({ restrictWidth, children } - + ); diff --git a/x-pack/plugins/fleet/public/applications/fleet/mock/create_test_renderer.tsx b/x-pack/plugins/fleet/public/mock/create_test_renderer.tsx similarity index 64% rename from x-pack/plugins/fleet/public/applications/fleet/mock/create_test_renderer.tsx rename to x-pack/plugins/fleet/public/mock/create_test_renderer.tsx index c1fa1422fa8aba..71c9650709ee2c 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/mock/create_test_renderer.tsx +++ b/x-pack/plugins/fleet/public/mock/create_test_renderer.tsx @@ -11,9 +11,10 @@ import React, { memo } from 'react'; import type { RenderOptions, RenderResult } from '@testing-library/react'; import { render as reactRender, act } from '@testing-library/react'; -import { ScopedHistory } from '../../../../../../../src/core/public'; -import { FleetAppContext } from '../app'; -import type { FleetConfigType } from '../../../plugin'; +import { ScopedHistory } from '../../../../../src/core/public'; +import { FleetAppContext } from '../applications/fleet/app'; +import { IntegrationsAppContext } from '../applications/integrations/app'; +import type { FleetConfigType } from '../plugin'; import type { UIExtensionsStorage } from '../types'; import { createConfigurationMock } from './plugin_configuration'; @@ -42,7 +43,7 @@ export interface TestRenderer { render: UiRender; } -export const createTestRendererMock = (): TestRenderer => { +export const createFleetTestRendererMock = (): TestRenderer => { const basePath = '/mock'; const extensions: UIExtensionsStorage = {}; const startServices = createStartServices(basePath); @@ -82,3 +83,44 @@ export const createTestRendererMock = (): TestRenderer => { return testRendererMocks; }; + +export const createIntegrationsTestRendererMock = (): TestRenderer => { + const basePath = '/mock'; + const extensions: UIExtensionsStorage = {}; + const startServices = createStartServices(basePath); + const testRendererMocks: TestRenderer = { + history: createHashHistory(), + mountHistory: new ScopedHistory(createMemoryHistory({ initialEntries: [basePath] }), basePath), + startServices, + config: createConfigurationMock(), + startInterface: createStartMock(extensions), + kibanaVersion: '8.0.0', + AppWrapper: memo(({ children }) => { + return ( + + {children} + + ); + }), + render: (ui, options) => { + let renderResponse: RenderResult; + act(() => { + renderResponse = reactRender(ui, { + wrapper: testRendererMocks.AppWrapper, + ...options, + }); + }); + return renderResponse!; + }, + }; + + return testRendererMocks; +}; diff --git a/x-pack/plugins/fleet/public/applications/fleet/mock/fleet_start_services.tsx b/x-pack/plugins/fleet/public/mock/fleet_start_services.tsx similarity index 89% rename from x-pack/plugins/fleet/public/applications/fleet/mock/fleet_start_services.tsx rename to x-pack/plugins/fleet/public/mock/fleet_start_services.tsx index ab75962c344df7..675eaaa1905eac 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/mock/fleet_start_services.tsx +++ b/x-pack/plugins/fleet/public/mock/fleet_start_services.tsx @@ -9,9 +9,9 @@ import React from 'react'; import { I18nProvider } from '@kbn/i18n/react'; import type { MockedKeys } from '@kbn/utility-types/jest'; -import { coreMock } from '../../../../../../../src/core/public/mocks'; -import type { IStorage } from '../../../../../../../src/plugins/kibana_utils/public'; -import { Storage } from '../../../../../../../src/plugins/kibana_utils/public'; +import { coreMock } from '../../../../../src/core/public/mocks'; +import type { IStorage } from '../../../../../src/plugins/kibana_utils/public'; +import { Storage } from '../../../../../src/plugins/kibana_utils/public'; import { setHttpClient } from '../hooks/use_request'; import { createStartDepsMock } from './plugin_dependencies'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/mock/index.ts b/x-pack/plugins/fleet/public/mock/index.ts similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/mock/index.ts rename to x-pack/plugins/fleet/public/mock/index.ts diff --git a/x-pack/plugins/fleet/public/applications/fleet/mock/plugin_configuration.ts b/x-pack/plugins/fleet/public/mock/plugin_configuration.ts similarity index 90% rename from x-pack/plugins/fleet/public/applications/fleet/mock/plugin_configuration.ts rename to x-pack/plugins/fleet/public/mock/plugin_configuration.ts index a9ad6b1bd87941..097b6aa98c0674 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/mock/plugin_configuration.ts +++ b/x-pack/plugins/fleet/public/mock/plugin_configuration.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { FleetConfigType } from '../../../plugin'; +import type { FleetConfigType } from '../plugin'; export const createConfigurationMock = (): FleetConfigType => { return { diff --git a/x-pack/plugins/fleet/public/applications/fleet/mock/plugin_dependencies.ts b/x-pack/plugins/fleet/public/mock/plugin_dependencies.ts similarity index 74% rename from x-pack/plugins/fleet/public/applications/fleet/mock/plugin_dependencies.ts rename to x-pack/plugins/fleet/public/mock/plugin_dependencies.ts index d7725830afb41c..16fa34e2d0b3d7 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/mock/plugin_dependencies.ts +++ b/x-pack/plugins/fleet/public/mock/plugin_dependencies.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { dataPluginMock } from '../../../../../../../src/plugins/data/public/mocks'; -import { licensingMock } from '../../../../../licensing/public/mocks'; -import { homePluginMock } from '../../../../../../../src/plugins/home/public/mocks'; +import { dataPluginMock } from '../../../../../src/plugins/data/public/mocks'; +import { licensingMock } from '../../../licensing/public/mocks'; +import { homePluginMock } from '../../../../../src/plugins/home/public/mocks'; import type { MockedFleetSetupDeps, MockedFleetStartDeps } from './types'; diff --git a/x-pack/plugins/fleet/public/applications/fleet/mock/plugin_interfaces.ts b/x-pack/plugins/fleet/public/mock/plugin_interfaces.ts similarity index 100% rename from x-pack/plugins/fleet/public/applications/fleet/mock/plugin_interfaces.ts rename to x-pack/plugins/fleet/public/mock/plugin_interfaces.ts diff --git a/x-pack/plugins/fleet/public/applications/fleet/mock/types.ts b/x-pack/plugins/fleet/public/mock/types.ts similarity index 83% rename from x-pack/plugins/fleet/public/applications/fleet/mock/types.ts rename to x-pack/plugins/fleet/public/mock/types.ts index b1a1ddc4a582f6..5071eb71fece1c 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/mock/types.ts +++ b/x-pack/plugins/fleet/public/mock/types.ts @@ -7,12 +7,7 @@ import type { MockedKeys } from '@kbn/utility-types/jest'; -import type { - FleetSetupDeps, - FleetStart, - FleetStartDeps, - FleetStartServices, -} from '../../../plugin'; +import type { FleetSetupDeps, FleetStart, FleetStartDeps, FleetStartServices } from '../plugin'; export type MockedFleetStartServices = MockedKeys; diff --git a/x-pack/plugins/fleet/public/mocks.ts b/x-pack/plugins/fleet/public/mocks.ts index 305b229e1adb29..92b002a4376496 100644 --- a/x-pack/plugins/fleet/public/mocks.ts +++ b/x-pack/plugins/fleet/public/mocks.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { createStartMock } from './applications/fleet/mock'; +import { createStartMock } from './mock'; export const fleetMock = { createStartMock, diff --git a/x-pack/plugins/fleet/public/plugin.ts b/x-pack/plugins/fleet/public/plugin.ts index f7951191f89146..f9515ca925a4ab 100644 --- a/x-pack/plugins/fleet/public/plugin.ts +++ b/x-pack/plugins/fleet/public/plugin.ts @@ -24,24 +24,21 @@ import type { HomePublicPluginSetup } from '../../../../src/plugins/home/public' import { Storage } from '../../../../src/plugins/kibana_utils/public'; import type { LicensingPluginSetup } from '../../licensing/public'; import type { CloudSetup } from '../../cloud/public'; -import { PLUGIN_ID, setupRouteService, appRoutesService } from '../common'; +import { PLUGIN_ID, INTEGRATIONS_PLUGIN_ID, setupRouteService, appRoutesService } from '../common'; import type { CheckPermissionsResponse, PostIngestSetupResponse } from '../common'; import type { FleetConfigType } from '../common/types'; -import { BASE_PATH } from './applications/fleet/constants'; -import { licenseService } from './applications/fleet/hooks/use_license'; -import { setHttpClient } from './applications/fleet/hooks/use_request/use_request'; +import { FLEET_BASE_PATH } from './constants'; +import { licenseService } from './hooks'; +import { setHttpClient } from './hooks/use_request'; import { TutorialDirectoryNotice, TutorialDirectoryHeaderLink, TutorialModuleNotice, -} from './applications/fleet/components/home_integration'; -import { createExtensionRegistrationCallback } from './applications/fleet/services/ui_extensions'; -import type { - UIExtensionRegistrationCallback, - UIExtensionsStorage, -} from './applications/fleet/types'; +} from './components/home_integration'; +import { createExtensionRegistrationCallback } from './services/ui_extensions'; +import type { UIExtensionRegistrationCallback, UIExtensionsStorage } from './types'; export { FleetConfigType } from '../common/types'; @@ -96,6 +93,36 @@ export class FleetPlugin implements Plugin { + const [coreStartServices, startDepsServices] = (await core.getStartServices()) as [ + CoreStart, + FleetStartDeps, + FleetStart + ]; + const startServices: FleetStartServices = { + ...coreStartServices, + ...startDepsServices, + storage: this.storage, + }; + const { renderApp, teardownIntegrations } = await import('./applications/integrations'); + const unmount = renderApp(startServices, params, config, kibanaVersion, extensions); + + return () => { + unmount(); + teardownIntegrations(startServices); + }; + }, + }); + // Register main Fleet app core.application.register({ id: PLUGIN_ID, @@ -156,7 +183,7 @@ export class FleetPlugin implements Plugin { const handleCreatePolicyClick = useNavigateToAppEventHandler( 'fleet', { - path: `#/integrations${ - endpointPackageVersion ? `/endpoint-${endpointPackageVersion}/add-integration` : '' + path: `#/policies/add-integration${ + endpointPackageVersion ? `/endpoint-${endpointPackageVersion}` : '' }`, state: { onCancelNavigateTo: [ diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 236108ccda8a3c..7de2952246857c 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -8955,7 +8955,6 @@ "xpack.fleet.alphaMessging.closeFlyoutLabel": "閉じる", "xpack.fleet.appNavigation.agentsLinkText": "エージェント", "xpack.fleet.appNavigation.dataStreamsLinkText": "データストリーム", - "xpack.fleet.appNavigation.epmLinkText": "統合", "xpack.fleet.appNavigation.overviewLinkText": "概要", "xpack.fleet.appNavigation.policiesLinkText": "ポリシー", "xpack.fleet.appNavigation.sendFeedbackButton": "フィードバックを送信", @@ -8971,7 +8970,6 @@ "xpack.fleet.breadcrumbs.editPackagePolicyPageTitle": "統合の編集", "xpack.fleet.breadcrumbs.enrollmentTokensPageTitle": "登録トークン", "xpack.fleet.breadcrumbs.installedIntegrationsPageTitle": "インストール済み", - "xpack.fleet.breadcrumbs.integrationPageTitle": "統合", "xpack.fleet.breadcrumbs.integrationsPageTitle": "統合", "xpack.fleet.breadcrumbs.overviewPageTitle": "概要", "xpack.fleet.breadcrumbs.policiesPageTitle": "ポリシー", @@ -9144,9 +9142,7 @@ "xpack.fleet.epm.versionLabel": "バージョン", "xpack.fleet.epmList.allFilterLinkText": "すべて", "xpack.fleet.epmList.allPackagesFilterLinkText": "すべて", - "xpack.fleet.epmList.allTabText": "すべての統合", "xpack.fleet.epmList.allTitle": "カテゴリで参照", - "xpack.fleet.epmList.installedTabText": "インストールされている統合", "xpack.fleet.epmList.installedTitle": "インストールされている統合", "xpack.fleet.epmList.noPackagesFoundPlaceholder": "パッケージが見つかりません", "xpack.fleet.epmList.searchPackagesPlaceholder": "統合を検索", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 0e3edc387bbe9b..75ddbe2115cdb7 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -9033,7 +9033,6 @@ "xpack.fleet.alphaMessging.closeFlyoutLabel": "关闭", "xpack.fleet.appNavigation.agentsLinkText": "代理", "xpack.fleet.appNavigation.dataStreamsLinkText": "数据流", - "xpack.fleet.appNavigation.epmLinkText": "集成", "xpack.fleet.appNavigation.overviewLinkText": "概览", "xpack.fleet.appNavigation.policiesLinkText": "策略", "xpack.fleet.appNavigation.sendFeedbackButton": "发送反馈", @@ -9049,7 +9048,6 @@ "xpack.fleet.breadcrumbs.editPackagePolicyPageTitle": "编辑集成", "xpack.fleet.breadcrumbs.enrollmentTokensPageTitle": "注册令牌", "xpack.fleet.breadcrumbs.installedIntegrationsPageTitle": "已安装", - "xpack.fleet.breadcrumbs.integrationPageTitle": "集成", "xpack.fleet.breadcrumbs.integrationsPageTitle": "集成", "xpack.fleet.breadcrumbs.overviewPageTitle": "概览", "xpack.fleet.breadcrumbs.policiesPageTitle": "策略", @@ -9229,9 +9227,7 @@ "xpack.fleet.epm.versionLabel": "版本", "xpack.fleet.epmList.allFilterLinkText": "全部", "xpack.fleet.epmList.allPackagesFilterLinkText": "全部", - "xpack.fleet.epmList.allTabText": "所有集成", "xpack.fleet.epmList.allTitle": "按类别浏览", - "xpack.fleet.epmList.installedTabText": "已安装集成", "xpack.fleet.epmList.installedTitle": "已安装集成", "xpack.fleet.epmList.noPackagesFoundPlaceholder": "未找到任何软件包", "xpack.fleet.epmList.searchPackagesPlaceholder": "搜索集成", diff --git a/x-pack/test/fleet_functional/page_objects/overview_page.ts b/x-pack/test/fleet_functional/page_objects/overview_page.ts index ca58acd0a7b6a3..2fd351184c7fe9 100644 --- a/x-pack/test/fleet_functional/page_objects/overview_page.ts +++ b/x-pack/test/fleet_functional/page_objects/overview_page.ts @@ -9,7 +9,7 @@ import { FtrProviderContext } from '../ftr_provider_context'; import { PLUGIN_ID } from '../../../plugins/fleet/common'; // NOTE: import path below should be the deep path to the actual module - else we get CI errors -import { pagePathGetters } from '../../../plugins/fleet/public/applications/fleet/constants/page_paths'; +import { pagePathGetters } from '../../../plugins/fleet/public/constants/page_paths'; export function OverviewPage({ getService, getPageObjects }: FtrProviderContext) { const pageObjects = getPageObjects(['common']); @@ -18,7 +18,7 @@ export function OverviewPage({ getService, getPageObjects }: FtrProviderContext) return { async navigateToOverview() { await pageObjects.common.navigateToApp(PLUGIN_ID, { - hash: pagePathGetters.overview(), + hash: pagePathGetters.overview()[1], }); }, diff --git a/x-pack/test/security_solution_endpoint/page_objects/fleet_integrations_page.ts b/x-pack/test/security_solution_endpoint/page_objects/fleet_integrations_page.ts index 791fed94249669..5abc842ddc9c90 100644 --- a/x-pack/test/security_solution_endpoint/page_objects/fleet_integrations_page.ts +++ b/x-pack/test/security_solution_endpoint/page_objects/fleet_integrations_page.ts @@ -6,10 +6,10 @@ */ import { FtrProviderContext } from '../ftr_provider_context'; -import { PLUGIN_ID } from '../../../plugins/fleet/common'; +import { INTEGRATIONS_PLUGIN_ID } from '../../../plugins/fleet/common'; // NOTE: import path below should be the deep path to the actual module - else we get CI errors -import { pagePathGetters } from '../../../plugins/fleet/public/applications/fleet/constants/page_paths'; +import { pagePathGetters } from '../../../plugins/fleet/public/constants/page_paths'; export function FleetIntegrations({ getService, getPageObjects }: FtrProviderContext) { const pageObjects = getPageObjects(['common']); @@ -17,8 +17,8 @@ export function FleetIntegrations({ getService, getPageObjects }: FtrProviderCon return { async navigateToIntegrationDetails(pkgkey: string) { - await pageObjects.common.navigateToApp(PLUGIN_ID, { - hash: pagePathGetters.integration_details_overview({ pkgkey }), + await pageObjects.common.navigateToApp(INTEGRATIONS_PLUGIN_ID, { + hash: pagePathGetters.integration_details_overview({ pkgkey })[1], }); }, diff --git a/x-pack/test/security_solution_endpoint/services/endpoint_policy.ts b/x-pack/test/security_solution_endpoint/services/endpoint_policy.ts index ec1cde2193dfd3..2b7702b399f17f 100644 --- a/x-pack/test/security_solution_endpoint/services/endpoint_policy.ts +++ b/x-pack/test/security_solution_endpoint/services/endpoint_policy.ts @@ -22,7 +22,7 @@ import { policyFactory } from '../../../plugins/security_solution/common/endpoin import { Immutable } from '../../../plugins/security_solution/common/endpoint/types'; // NOTE: import path below should be the deep path to the actual module - else we get CI errors -import { pkgKeyFromPackageInfo } from '../../../plugins/fleet/public/applications/fleet/services/pkg_key_from_package_info'; +import { pkgKeyFromPackageInfo } from '../../../plugins/fleet/public/services/pkg_key_from_package_info'; const INGEST_API_ROOT = '/api/fleet'; const INGEST_API_AGENT_POLICIES = `${INGEST_API_ROOT}/agent_policies`;