From 363d3bf2692e44528cb516bddc37e2abf9c609be Mon Sep 17 00:00:00 2001 From: John Schulz Date: Fri, 18 Oct 2019 13:29:15 -0400 Subject: [PATCH] [IM] Use EPM in variables & types (#48453) * IntegrationsManager -> EPM * integrationsManager -> epm * [iI]ntegration -> [pP]ackage. Update tests. * Don't rename integrations registry URL. * Update i18n key in x-pack/.i18nrc.json * Update path to functional test config * Add epm to recently re-enabled privileges test * Update two values recently added in main feature branch * Move/update screenshot tests --- x-pack/.i18nrc.json | 2 +- x-pack/index.js | 4 +- .../integrations_manager/common/constants.ts | 10 +-- .../integrations_manager/common/type_utils.ts | 2 +- .../integrations_manager/common/types.ts | 8 +-- .../plugins/integrations_manager/index.ts | 11 +--- .../plugins/integrations_manager/kibana.json | 2 +- ...{integration_card.tsx => package_card.tsx} | 8 +-- ...on_list_grid.tsx => package_list_grid.tsx} | 14 ++-- .../integrations_manager/public/data.ts | 24 +++---- .../public/hooks/use_links.tsx | 2 +- .../integrations_manager/public/index.ts | 2 +- .../public/screens/detail/content.tsx | 8 +-- .../public/screens/detail/header.tsx | 10 +-- .../public/screens/detail/index.tsx | 10 +-- .../public/screens/detail/overview_panel.tsx | 4 +- .../public/screens/detail/side_nav_links.tsx | 4 +- .../public/screens/home/header.tsx | 2 +- .../public/screens/home/hooks.tsx | 56 +++++++--------- .../public/screens/home/index.tsx | 65 +++++++++---------- ...h_integrations.tsx => search_packages.tsx} | 20 +++--- .../public/screens/home/search_results.tsx | 8 +-- .../integrations_manager/server/config.ts | 12 ++-- .../integrations_manager/server/index.ts | 4 +- .../server/{integrations => packages}/get.ts | 8 +-- .../{integrations => packages}/get_objects.ts | 0 .../{integrations => packages}/handlers.ts | 20 +++--- .../{integrations => packages}/index.ts | 0 .../{integrations => packages}/install.ts | 4 +- .../{integrations => packages}/remove.ts | 0 .../integrations_manager/server/plugin.ts | 12 ++-- .../server/registry/index.ts | 12 ++-- .../integrations_manager/server/routes.ts | 14 ++-- x-pack/scripts/functional_tests.js | 2 +- .../apis/features/features/features.ts | 2 +- .../apis/security/privileges.ts | 1 + .../apis/image.ts | 4 +- .../apis/index.js | 2 +- .../apis/list.ts | 4 +- .../apis/mock_http_server.d.ts | 0 .../config.ts | 4 +- 41 files changed, 181 insertions(+), 200 deletions(-) rename x-pack/legacy/plugins/integrations_manager/public/components/{integration_card.tsx => package_card.tsx} (88%) rename x-pack/legacy/plugins/integrations_manager/public/components/{integration_list_grid.tsx => package_list_grid.tsx} (80%) rename x-pack/legacy/plugins/integrations_manager/public/screens/home/{search_integrations.tsx => search_packages.tsx} (61%) rename x-pack/legacy/plugins/integrations_manager/server/{integrations => packages}/get.ts (94%) rename x-pack/legacy/plugins/integrations_manager/server/{integrations => packages}/get_objects.ts (100%) rename x-pack/legacy/plugins/integrations_manager/server/{integrations => packages}/handlers.ts (85%) rename x-pack/legacy/plugins/integrations_manager/server/{integrations => packages}/index.ts (100%) rename x-pack/legacy/plugins/integrations_manager/server/{integrations => packages}/install.ts (97%) rename x-pack/legacy/plugins/integrations_manager/server/{integrations => packages}/remove.ts (100%) rename x-pack/test/{integrations_manager_api_integration => epm_api_integration}/apis/image.ts (90%) rename x-pack/test/{integrations_manager_api_integration => epm_api_integration}/apis/index.js (87%) rename x-pack/test/{integrations_manager_api_integration => epm_api_integration}/apis/list.ts (97%) rename x-pack/test/{integrations_manager_api_integration => epm_api_integration}/apis/mock_http_server.d.ts (100%) rename x-pack/test/{integrations_manager_api_integration => epm_api_integration}/config.ts (86%) diff --git a/x-pack/.i18nrc.json b/x-pack/.i18nrc.json index 5b64aacae7828e..c3295be6f20936 100644 --- a/x-pack/.i18nrc.json +++ b/x-pack/.i18nrc.json @@ -10,6 +10,7 @@ "xpack.code": ["legacy/plugins/code", "plugins/code"], "xpack.crossClusterReplication": "legacy/plugins/cross_cluster_replication", "xpack.dashboardMode": "legacy/plugins/dashboard_mode", + "xpack.epm":"legacy/plugins/integrations_manager", "xpack.features": "plugins/features", "xpack.fileUpload": "legacy/plugins/file_upload", "xpack.graph": "legacy/plugins/graph", @@ -17,7 +18,6 @@ "xpack.idxMgmt": "legacy/plugins/index_management", "xpack.indexLifecycleMgmt": "legacy/plugins/index_lifecycle_management", "xpack.infra": "legacy/plugins/infra", - "xpack.integrationsManager":"legacy/plugins/integrations_manager", "xpack.kueryAutocomplete": "legacy/plugins/kuery_autocomplete", "xpack.lens": "legacy/plugins/lens", "xpack.licensing": "plugins/licensing", diff --git a/x-pack/index.js b/x-pack/index.js index 4738f115b670bc..62bd01cbb2dc38 100644 --- a/x-pack/index.js +++ b/x-pack/index.js @@ -43,7 +43,7 @@ import { snapshotRestore } from './legacy/plugins/snapshot_restore'; import { transform } from './legacy/plugins/transform'; import { actions } from './legacy/plugins/actions'; import { alerting } from './legacy/plugins/alerting'; -import { integrationsManager } from './legacy/plugins/integrations_manager'; +import { epm } from './legacy/plugins/integrations_manager'; import { lens } from './legacy/plugins/lens'; module.exports = function (kibana) { @@ -88,6 +88,6 @@ module.exports = function (kibana) { snapshotRestore(kibana), actions(kibana), alerting(kibana), - integrationsManager(kibana), + epm(kibana), ]; }; diff --git a/x-pack/legacy/plugins/integrations_manager/common/constants.ts b/x-pack/legacy/plugins/integrations_manager/common/constants.ts index 6df4516d5eb859..ff7bd4dec4739a 100644 --- a/x-pack/legacy/plugins/integrations_manager/common/constants.ts +++ b/x-pack/legacy/plugins/integrations_manager/common/constants.ts @@ -9,12 +9,12 @@ import manifest from '../kibana.json'; export const PLUGIN = { ID: manifest.id, - TITLE: i18n.translate('xpack.integrationsManager.pluginTitle', { - defaultMessage: 'Integrations Manager', + TITLE: i18n.translate('xpack.epm.pluginTitle', { + defaultMessage: 'Elastic Package Manager', }), - DESCRIPTION: 'Install and manage your elastic data ingest integrations', + DESCRIPTION: 'Install and manage your Elastic data ingest packages', ICON: 'merge', - CONFIG_PREFIX: 'xpack.integrationsManager', + CONFIG_PREFIX: 'xpack.epm', }; -export const SAVED_OBJECT_TYPE = 'integrations-manager'; +export const SAVED_OBJECT_TYPE = 'epm'; diff --git a/x-pack/legacy/plugins/integrations_manager/common/type_utils.ts b/x-pack/legacy/plugins/integrations_manager/common/type_utils.ts index 97b12074fdb801..a489d91dc46799 100644 --- a/x-pack/legacy/plugins/integrations_manager/common/type_utils.ts +++ b/x-pack/legacy/plugins/integrations_manager/common/type_utils.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -// Calling Object.entries(IntegrationsGroupedByStatus) gave `status: string` +// Calling Object.entries(PackagesGroupedByStatus) gave `status: string` // which causes a "string is not assignable to type InstallationStatus` error // see https://github.com/Microsoft/TypeScript/issues/20322 // and https://github.com/Microsoft/TypeScript/pull/12253#issuecomment-263132208 diff --git a/x-pack/legacy/plugins/integrations_manager/common/types.ts b/x-pack/legacy/plugins/integrations_manager/common/types.ts index 3a3f1330a8b78f..1266471122077f 100644 --- a/x-pack/legacy/plugins/integrations_manager/common/types.ts +++ b/x-pack/legacy/plugins/integrations_manager/common/types.ts @@ -76,14 +76,14 @@ export interface RegistryPackage { // Managers public HTTP response types // from API_LIST_PATTERN -export type IntegrationList = IntegrationListItem[]; +export type PackageList = PackageListItem[]; // add title here until it's a part of registry response -export type IntegrationListItem = Installable>; -export type IntegrationsGroupedByStatus = Record; +export type PackageListItem = Installable>; +export type PackagesGroupedByStatus = Record; // from API_INFO_PATTERN // add title here until it's a part of registry response -export type IntegrationInfo = Installable< +export type PackageInfo = Installable< Required & { assets: AssetsGroupedByServiceByType } >; diff --git a/x-pack/legacy/plugins/integrations_manager/index.ts b/x-pack/legacy/plugins/integrations_manager/index.ts index 13edebc5014618..e0079e04afab5a 100644 --- a/x-pack/legacy/plugins/integrations_manager/index.ts +++ b/x-pack/legacy/plugins/integrations_manager/index.ts @@ -11,11 +11,7 @@ import { LegacyPluginInitializer, LegacyPluginOptions } from 'src/legacy/types'; import { Feature } from '../../../plugins/features/server/feature'; import { PLUGIN } from './common/constants'; import manifest from './kibana.json'; -import { - CoreSetup, - Plugin as ServerPlugin, - IntegrationsManagerPluginInitializerContext, -} from './server/plugin'; +import { CoreSetup, Plugin as ServerPlugin, EPMPluginInitializerContext } from './server/plugin'; import { mappings, savedObjectSchemas } from './server/saved_objects'; import { getConfigSchema } from './server/config'; @@ -83,7 +79,7 @@ const pluginOptions: LegacyPluginOptions = { const getConfig$ = () => new BehaviorSubject(server.config().get(PLUGIN.CONFIG_PREFIX)).asObservable(); - const initializerContext: IntegrationsManagerPluginInitializerContext = { + const initializerContext: EPMPluginInitializerContext = { config: { create: getConfig$, createIfExists: getConfig$, @@ -101,5 +97,4 @@ const pluginOptions: LegacyPluginOptions = { isEnabled: false, }; -export const integrationsManager: LegacyPluginInitializer = kibana => - new kibana.Plugin(pluginOptions); +export const epm: LegacyPluginInitializer = kibana => new kibana.Plugin(pluginOptions); diff --git a/x-pack/legacy/plugins/integrations_manager/kibana.json b/x-pack/legacy/plugins/integrations_manager/kibana.json index 979c8b2e795b65..4ce30ac49a685d 100644 --- a/x-pack/legacy/plugins/integrations_manager/kibana.json +++ b/x-pack/legacy/plugins/integrations_manager/kibana.json @@ -1,5 +1,5 @@ { - "id": "integrations_manager", + "id": "epm", "version": "0.0.2", "kibanaVersion": "kibana", "requiredPlugins": ["kibana", "elasticsearch", "xpack_main"], diff --git a/x-pack/legacy/plugins/integrations_manager/public/components/integration_card.tsx b/x-pack/legacy/plugins/integrations_manager/public/components/package_card.tsx similarity index 88% rename from x-pack/legacy/plugins/integrations_manager/public/components/integration_card.tsx rename to x-pack/legacy/plugins/integrations_manager/public/components/package_card.tsx index dc3dfea1ca4bc0..cb1b8caa215383 100644 --- a/x-pack/legacy/plugins/integrations_manager/public/components/integration_card.tsx +++ b/x-pack/legacy/plugins/integrations_manager/public/components/package_card.tsx @@ -7,13 +7,13 @@ import React from 'react'; import { EuiCard, EuiIcon, ICON_TYPES } from '@elastic/eui'; import styled from 'styled-components'; import { useLinks } from '../hooks'; -import { IntegrationListItem, IntegrationInfo } from '../../common/types'; +import { PackageListItem, PackageInfo } from '../../common/types'; export interface BadgeProps { showInstalledBadge?: boolean; } -type IntegrationCardProps = (IntegrationListItem | IntegrationInfo) & BadgeProps; +type PackageCardProps = (PackageListItem | PackageInfo) & BadgeProps; // adding the `href` causes EuiCard to use a `a` instead of a `button` // `a` tags use `euiLinkColor` which results in blueish Badge text @@ -21,7 +21,7 @@ const Card = styled(EuiCard)` color: inherit; `; -export function IntegrationCard({ +export function PackageCard({ description, name, title, @@ -29,7 +29,7 @@ export function IntegrationCard({ icon: iconUrl, showInstalledBadge, status, -}: IntegrationCardProps) { +}: PackageCardProps) { const { toDetailView } = useLinks(); const url = toDetailView({ name, version }); diff --git a/x-pack/legacy/plugins/integrations_manager/public/components/integration_list_grid.tsx b/x-pack/legacy/plugins/integrations_manager/public/components/package_list_grid.tsx similarity index 80% rename from x-pack/legacy/plugins/integrations_manager/public/components/integration_list_grid.tsx rename to x-pack/legacy/plugins/integrations_manager/public/components/package_list_grid.tsx index 8d936e33a438a4..edf6d856d8e023 100644 --- a/x-pack/legacy/plugins/integrations_manager/public/components/integration_list_grid.tsx +++ b/x-pack/legacy/plugins/integrations_manager/public/components/package_list_grid.tsx @@ -5,16 +5,16 @@ */ import React, { Fragment, ReactNode } from 'react'; import { EuiFlexGrid, EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiText } from '@elastic/eui'; -import { IntegrationList, IntegrationListItem } from '../../common/types'; -import { IntegrationCard, BadgeProps } from './integration_card'; +import { PackageList, PackageListItem } from '../../common/types'; +import { PackageCard, BadgeProps } from './package_card'; type ListProps = { controls?: ReactNode; title: string; - list: IntegrationList; + list: PackageList; } & BadgeProps; -export function IntegrationListGrid({ controls, title, list, showInstalledBadge }: ListProps) { +export function PackageListGrid({ controls, title, list, showInstalledBadge }: ListProps) { const controlsContent = ; const gridContent = ; @@ -30,12 +30,12 @@ export function IntegrationListGrid({ controls, title, list, showInstalledBadge ); } -type GridItemProps = IntegrationListItem & BadgeProps; +type GridItemProps = PackageListItem & BadgeProps; function GridItem(item: GridItemProps) { return ( - + ); } @@ -61,7 +61,7 @@ function ControlsColumn({ controls, title }: ControlsColumnProps) { } type GridColumnProps = { - list: IntegrationList; + list: PackageList; } & BadgeProps; function GridColumn({ list, showInstalledBadge }: GridColumnProps) { diff --git a/x-pack/legacy/plugins/integrations_manager/public/data.ts b/x-pack/legacy/plugins/integrations_manager/public/data.ts index 07a2fa08bb3e4e..55fcbef6140cdc 100644 --- a/x-pack/legacy/plugins/integrations_manager/public/data.ts +++ b/x-pack/legacy/plugins/integrations_manager/public/data.ts @@ -15,9 +15,9 @@ import { } from '../common/routes'; import { CategorySummaryList, - IntegrationInfo, - IntegrationList, - IntegrationsGroupedByStatus, + PackageInfo, + PackageList, + PackagesGroupedByStatus, } from '../common/types'; const defaultClient: HttpHandler = (path, options?) => fetch(path, options).then(res => res.json()); @@ -35,18 +35,18 @@ export async function getCategories(): Promise { return list; } -export async function getIntegrations(params?: ListParams): Promise { +export async function getPackages(params?: ListParams): Promise { const path = getListPath(); const options = params ? { query: { ...params } } : undefined; - const list: IntegrationList = await _fetch(path, options); + const list: PackageList = await _fetch(path, options); return list; } -export async function getIntegrationsGroupedByStatus() { +export async function getPackagesGroupedByStatus() { const path = getListPath(); - const list: IntegrationList = await _fetch(path); - const initialValue: IntegrationsGroupedByStatus = { + const list: PackageList = await _fetch(path); + const initialValue: PackagesGroupedByStatus = { installed: [], not_installed: [], }; @@ -63,19 +63,19 @@ export async function getIntegrationsGroupedByStatus() { return groupedByStatus; } -export async function getIntegrationInfoByKey(pkgkey: string): Promise { +export async function getPackageInfoByKey(pkgkey: string): Promise { const path = getInfoPath(pkgkey); - const info: IntegrationInfo = await _fetch(path); + const info: PackageInfo = await _fetch(path); return info; } -export async function installIntegration(pkgkey: string) { +export async function installPackage(pkgkey: string) { const path = getInstallPath(pkgkey); return await _fetch(path); } -export async function removeIntegration(pkgkey: string) { +export async function removePackage(pkgkey: string) { const path = getRemovePath(pkgkey); return await _fetch(path); } diff --git a/x-pack/legacy/plugins/integrations_manager/public/hooks/use_links.tsx b/x-pack/legacy/plugins/integrations_manager/public/hooks/use_links.tsx index 786ec54b9c81c6..665944e98d6cab 100644 --- a/x-pack/legacy/plugins/integrations_manager/public/hooks/use_links.tsx +++ b/x-pack/legacy/plugins/integrations_manager/public/hooks/use_links.tsx @@ -11,7 +11,7 @@ import { patterns } from '../routes'; import { useCore } from '.'; import { DetailViewPanelName } from '..'; -// TODO: get this from server/integrations/handlers.ts (move elsewhere?) +// TODO: get this from server/packages/handlers.ts (move elsewhere?) // seems like part of the name@version change interface DetailParams { name: string; diff --git a/x-pack/legacy/plugins/integrations_manager/public/index.ts b/x-pack/legacy/plugins/integrations_manager/public/index.ts index 1dce24e044dfbf..934eaae6decb48 100644 --- a/x-pack/legacy/plugins/integrations_manager/public/index.ts +++ b/x-pack/legacy/plugins/integrations_manager/public/index.ts @@ -16,7 +16,7 @@ import { routes } from './routes'; // create './types' later and move there? export type DetailViewPanelName = 'overview' | 'assets' | 'data-sources'; -const REACT_APP_ROOT_ID = 'integrationsManager__root'; +const REACT_APP_ROOT_ID = 'epm__root'; const template = `
`; const getRootEl = () => document.getElementById(REACT_APP_ROOT_ID); diff --git a/x-pack/legacy/plugins/integrations_manager/public/screens/detail/content.tsx b/x-pack/legacy/plugins/integrations_manager/public/screens/detail/content.tsx index 795f82a37ce645..1b89fafc761791 100644 --- a/x-pack/legacy/plugins/integrations_manager/public/screens/detail/content.tsx +++ b/x-pack/legacy/plugins/integrations_manager/public/screens/detail/content.tsx @@ -15,7 +15,7 @@ import { EuiTitle, } from '@elastic/eui'; import { SideNavLinks } from './side_nav_links'; -import { IntegrationInfo } from '../../../common/types'; +import { PackageInfo } from '../../../common/types'; import { AssetAccordion } from '../../components/asset_accordion'; import { AssetsFacetGroup } from '../../components/assets_facet_group'; import { Requirements } from '../../components/requirements'; @@ -24,7 +24,7 @@ import { OverviewPanel } from './overview_panel'; import { useCore } from '../../hooks/use_core'; import { DEFAULT_PANEL, DetailProps } from '.'; -type ContentProps = IntegrationInfo & Pick & { hasIconPanel: boolean }; +type ContentProps = PackageInfo & Pick & { hasIconPanel: boolean }; export function Content(props: ContentProps) { const { hasIconPanel, name, panel, version } = props; const { theme } = useCore(); @@ -56,7 +56,7 @@ export function Content(props: ContentProps) { ); } -type ContentPanelProps = IntegrationInfo & Pick; +type ContentPanelProps = PackageInfo & Pick; export function ContentPanel(props: ContentPanelProps) { const { assets, panel } = props; switch (panel) { @@ -76,7 +76,7 @@ export function ContentPanel(props: ContentPanelProps) { } } -type RightColumnContentProps = IntegrationInfo & Pick; +type RightColumnContentProps = PackageInfo & Pick; function RightColumnContent(props: RightColumnContentProps) { const { assets, requirement, panel } = props; switch (panel) { diff --git a/x-pack/legacy/plugins/integrations_manager/public/screens/detail/header.tsx b/x-pack/legacy/plugins/integrations_manager/public/screens/detail/header.tsx index 4913e9fe8e3ad3..0fdc4ccfdccf6c 100644 --- a/x-pack/legacy/plugins/integrations_manager/public/screens/detail/header.tsx +++ b/x-pack/legacy/plugins/integrations_manager/public/screens/detail/header.tsx @@ -17,13 +17,13 @@ import { } from '@elastic/eui'; import styled from 'styled-components'; import { PLUGIN } from '../../../common/constants'; -import { IntegrationInfo } from '../../../common/types'; +import { PackageInfo } from '../../../common/types'; import { VersionBadge } from '../../components/version_badge'; import { IconPanel } from '../../components/icon_panel'; import { useBreadcrumbs, useCore, useLinks } from '../../hooks'; import { CenterColumn, LeftColumn, RightColumn } from './layout'; -type HeaderProps = IntegrationInfo & { iconType?: IconType }; +type HeaderProps = PackageInfo & { iconType?: IconType }; export function Header(props: HeaderProps) { const { iconType, title, version } = props; @@ -83,15 +83,15 @@ function NavButtonBack() { return ( - Browse Integrations + Browse Packages ); } -function InstallationButton({ status }: IntegrationInfo) { +function InstallationButton({ status }: PackageInfo) { const isInstalled = status === 'installed'; const iconType = isInstalled ? '' : 'plusInCircle'; - const buttonText = isInstalled ? 'Installed' : 'Add Integration'; + const buttonText = isInstalled ? 'Installed' : 'Add Package'; return ( diff --git a/x-pack/legacy/plugins/integrations_manager/public/screens/detail/index.tsx b/x-pack/legacy/plugins/integrations_manager/public/screens/detail/index.tsx index 342a715c703fb1..3029c5391c27f4 100644 --- a/x-pack/legacy/plugins/integrations_manager/public/screens/detail/index.tsx +++ b/x-pack/legacy/plugins/integrations_manager/public/screens/detail/index.tsx @@ -6,9 +6,9 @@ import React, { Fragment, useState, useEffect } from 'react'; import { EuiPage, EuiPageBody, EuiPageWidthProps, ICON_TYPES } from '@elastic/eui'; import styled from 'styled-components'; -import { IntegrationInfo } from '../../../common/types'; +import { PackageInfo } from '../../../common/types'; import { DetailViewPanelName } from '../../'; -import { getIntegrationInfoByKey } from '../../data'; +import { getPackageInfoByKey } from '../../data'; import { useCore } from '../../hooks/use_core'; import { Header } from './header'; import { Content } from './content'; @@ -21,9 +21,9 @@ export interface DetailProps { } export function Detail({ pkgkey, panel = DEFAULT_PANEL }: DetailProps) { - const [info, setInfo] = useState(null); + const [info, setInfo] = useState(null); useEffect(() => { - getIntegrationInfoByKey(pkgkey).then(response => { + getPackageInfoByKey(pkgkey).then(response => { const { title } = response; setInfo({ ...response, title }); }); @@ -35,7 +35,7 @@ export function Detail({ pkgkey, panel = DEFAULT_PANEL }: DetailProps) { return ; } -type LayoutProps = IntegrationInfo & Pick & EuiPageWidthProps; +type LayoutProps = PackageInfo & Pick & EuiPageWidthProps; export function DetailLayout(props: LayoutProps) { const { name, restrictWidth, panel } = props; const { theme } = useCore(); diff --git a/x-pack/legacy/plugins/integrations_manager/public/screens/detail/overview_panel.tsx b/x-pack/legacy/plugins/integrations_manager/public/screens/detail/overview_panel.tsx index d2765f8845d35d..c4a12d6883e258 100644 --- a/x-pack/legacy/plugins/integrations_manager/public/screens/detail/overview_panel.tsx +++ b/x-pack/legacy/plugins/integrations_manager/public/screens/detail/overview_panel.tsx @@ -5,10 +5,10 @@ */ import React, { Fragment } from 'react'; import { EuiSpacer, EuiText, EuiTitle } from '@elastic/eui'; -import { IntegrationInfo } from '../../../common/types'; +import { PackageInfo } from '../../../common/types'; import { Screenshots } from './screenshots'; -export function OverviewPanel(props: IntegrationInfo) { +export function OverviewPanel(props: PackageInfo) { const { description, screenshots } = props; return ( diff --git a/x-pack/legacy/plugins/integrations_manager/public/screens/detail/side_nav_links.tsx b/x-pack/legacy/plugins/integrations_manager/public/screens/detail/side_nav_links.tsx index 078ffca51e20e3..69caaf300b1002 100644 --- a/x-pack/legacy/plugins/integrations_manager/public/screens/detail/side_nav_links.tsx +++ b/x-pack/legacy/plugins/integrations_manager/public/screens/detail/side_nav_links.tsx @@ -7,12 +7,12 @@ import React, { Fragment } from 'react'; import { EuiButtonEmpty, EuiButtonEmptyProps } from '@elastic/eui'; import styled from 'styled-components'; -import { IntegrationInfo } from '../../../common/types'; +import { PackageInfo } from '../../../common/types'; import { entries } from '../../../common/type_utils'; import { DetailViewPanelName } from '../../'; import { useLinks } from '../../hooks'; -export type NavLinkProps = Pick & { +export type NavLinkProps = Pick & { active: DetailViewPanelName; }; diff --git a/x-pack/legacy/plugins/integrations_manager/public/screens/home/header.tsx b/x-pack/legacy/plugins/integrations_manager/public/screens/home/header.tsx index e48c07a529d5a5..44283c14ff5e75 100644 --- a/x-pack/legacy/plugins/integrations_manager/public/screens/home/header.tsx +++ b/x-pack/legacy/plugins/integrations_manager/public/screens/home/header.tsx @@ -84,7 +84,7 @@ function HeroCopy() {

Add Your Data

- Some creative copy about integrations goes here. + Some creative copy about packages goes here.
); } diff --git a/x-pack/legacy/plugins/integrations_manager/public/screens/home/hooks.tsx b/x-pack/legacy/plugins/integrations_manager/public/screens/home/hooks.tsx index 4c4a345d3cf209..bffffc5b5dff9e 100644 --- a/x-pack/legacy/plugins/integrations_manager/public/screens/home/hooks.tsx +++ b/x-pack/legacy/plugins/integrations_manager/public/screens/home/hooks.tsx @@ -5,9 +5,9 @@ */ import { useEffect, useRef, useState } from 'react'; -import { CategorySummaryList, IntegrationList } from '../../../common/types'; -import { getCategories, getIntegrations } from '../../data'; -import { LocalSearch, fieldsToSearch, searchIdField } from './search_integrations'; +import { CategorySummaryList, PackageList } from '../../../common/types'; +import { getCategories, getPackages } from '../../data'; +import { LocalSearch, fieldsToSearch, searchIdField } from './search_packages'; export function useCategories() { const [categories, setCategories] = useState([]); @@ -19,59 +19,53 @@ export function useCategories() { return [categories, setCategories] as [typeof categories, typeof setCategories]; } -export function useCategoryIntegrations(selectedCategory: string) { - const [categoryIntegrations, setCategoryIntegrations] = useState([]); +export function useCategoryPackages(selectedCategory: string) { + const [categoryPackages, setCategoryPackages] = useState([]); useEffect(() => { - getIntegrations({ category: selectedCategory }).then(setCategoryIntegrations); + getPackages({ category: selectedCategory }).then(setCategoryPackages); }, [selectedCategory]); - return [categoryIntegrations, setCategoryIntegrations] as [ - typeof categoryIntegrations, - typeof setCategoryIntegrations + return [categoryPackages, setCategoryPackages] as [ + typeof categoryPackages, + typeof setCategoryPackages ]; } -export function useAllIntegrations( - selectedCategory: string, - categoryIntegrations: IntegrationList -) { - const [allIntegrations, setAllIntegrations] = useState([]); +export function useAllPackages(selectedCategory: string, categoryPackages: PackageList) { + const [allPackages, setAllPackages] = useState([]); useEffect(() => { - if (!selectedCategory) setAllIntegrations(categoryIntegrations); - }, [selectedCategory, categoryIntegrations]); + if (!selectedCategory) setAllPackages(categoryPackages); + }, [selectedCategory, categoryPackages]); - return [allIntegrations, setAllIntegrations] as [ - typeof allIntegrations, - typeof setAllIntegrations - ]; + return [allPackages, setAllPackages] as [typeof allPackages, typeof setAllPackages]; } -export function useLocalSearch(allIntegrations: IntegrationList) { +export function useLocalSearch(allPackages: PackageList) { const localSearchRef = useRef(null); useEffect(() => { - if (!allIntegrations.length) return; + if (!allPackages.length) return; const localSearch = new LocalSearch(searchIdField); fieldsToSearch.forEach(field => localSearch.addIndex(field)); - localSearch.addDocuments(allIntegrations); + localSearch.addDocuments(allPackages); localSearchRef.current = localSearch; - }, [allIntegrations]); + }, [allPackages]); return localSearchRef; } -export function useInstalledIntegrations(allIntegrations: IntegrationList) { - const [installedIntegrations, setInstalledIntegrations] = useState([]); +export function useInstalledPackages(allPackages: PackageList) { + const [installedPackages, setInstalledPackages] = useState([]); useEffect(() => { - setInstalledIntegrations(allIntegrations.filter(({ status }) => status === 'installed')); - }, [allIntegrations]); + setInstalledPackages(allPackages.filter(({ status }) => status === 'installed')); + }, [allPackages]); - return [installedIntegrations, setInstalledIntegrations] as [ - typeof installedIntegrations, - typeof setInstalledIntegrations + return [installedPackages, setInstalledPackages] as [ + typeof installedPackages, + typeof setInstalledPackages ]; } diff --git a/x-pack/legacy/plugins/integrations_manager/public/screens/home/index.tsx b/x-pack/legacy/plugins/integrations_manager/public/screens/home/index.tsx index 88abfd19eab95c..53c63719eb029e 100644 --- a/x-pack/legacy/plugins/integrations_manager/public/screens/home/index.tsx +++ b/x-pack/legacy/plugins/integrations_manager/public/screens/home/index.tsx @@ -8,19 +8,19 @@ import { EuiHorizontalRule, EuiPage, EuiPageBody, EuiSpacer } from '@elastic/eui import styled from 'styled-components'; import { PLUGIN } from '../../../common/constants'; -import { CategorySummaryItem, IntegrationList } from '../../../common/types'; -import { IntegrationListGrid } from '../../components/integration_list_grid'; +import { CategorySummaryItem, PackageList } from '../../../common/types'; +import { PackageListGrid } from '../../components/package_list_grid'; import { useBreadcrumbs, useLinks } from '../../hooks'; import { CategoryFacets } from './category_facets'; import { Header } from './header'; import { useCategories, - useCategoryIntegrations, - useAllIntegrations, + useCategoryPackages, + useAllPackages, useLocalSearch, - useInstalledIntegrations, + useInstalledPackages, } from './hooks'; -import { SearchIntegrations } from './search_integrations'; +import { SearchPackages } from './search_packages'; export const FullBleedPage = styled(EuiPage)` padding: 0; @@ -33,20 +33,20 @@ export function Home() { const state = useHomeState(); const body = state.searchTerm ? ( - ) : ( - {state.installedIntegrations.length ? ( + {state.installedPackages.length ? ( - + ) : null} - + ); @@ -72,15 +72,10 @@ export function useHomeState() { const [searchTerm, setSearchTerm] = useState(''); const [selectedCategory, setSelectedCategory] = useState(''); const [categories, setCategories] = useCategories(); - const [categoryIntegrations, setCategoryIntegrations] = useCategoryIntegrations(selectedCategory); - const [allIntegrations, setAllIntegrations] = useAllIntegrations( - selectedCategory, - categoryIntegrations - ); - const localSearchRef = useLocalSearch(allIntegrations); - const [installedIntegrations, setInstalledIntegrations] = useInstalledIntegrations( - allIntegrations - ); + const [categoryPackages, setCategoryPackages] = useCategoryPackages(selectedCategory); + const [allPackages, setAllPackages] = useAllPackages(selectedCategory, categoryPackages); + const localSearchRef = useLocalSearch(allPackages); + const [installedPackages, setInstalledPackages] = useInstalledPackages(allPackages); return { searchTerm, @@ -89,34 +84,34 @@ export function useHomeState() { setSelectedCategory, categories, setCategories, - allIntegrations, - setAllIntegrations, - installedIntegrations, + allPackages, + setAllPackages, + installedPackages, localSearchRef, - setInstalledIntegrations, - categoryIntegrations, - setCategoryIntegrations, + setInstalledPackages, + categoryPackages, + setCategoryPackages, }; } -function InstalledIntegrations({ list }: { list: IntegrationList }) { - const title = 'Your Integrations'; +function InstalledPackages({ list }: { list: PackageList }) { + const title = 'Your Packages'; - return ; + return ; } -function AvailableIntegrations({ - allIntegrations, +function AvailablePackages({ + allPackages, categories, - categoryIntegrations, + categoryPackages, selectedCategory, setSelectedCategory, }: HomeState) { - const title = 'Available Integrations'; + const title = 'Available Packages'; const noFilter = { id: '', title: 'All', - count: allIntegrations.length, + count: allPackages.length, }; const controls = ( @@ -127,5 +122,5 @@ function AvailableIntegrations({ /> ); - return ; + return ; } diff --git a/x-pack/legacy/plugins/integrations_manager/public/screens/home/search_integrations.tsx b/x-pack/legacy/plugins/integrations_manager/public/screens/home/search_packages.tsx similarity index 61% rename from x-pack/legacy/plugins/integrations_manager/public/screens/home/search_integrations.tsx rename to x-pack/legacy/plugins/integrations_manager/public/screens/home/search_packages.tsx index ff2b46d08c1f88..8f6bef4891cb70 100644 --- a/x-pack/legacy/plugins/integrations_manager/public/screens/home/search_integrations.tsx +++ b/x-pack/legacy/plugins/integrations_manager/public/screens/home/search_packages.tsx @@ -6,32 +6,28 @@ import React from 'react'; import { Search as LocalSearch } from 'js-search'; -import { IntegrationList, IntegrationListItem } from '../../../common/types'; +import { PackageList, PackageListItem } from '../../../common/types'; import { SearchResults } from './search_results'; export { LocalSearch }; -export type SearchField = keyof IntegrationListItem; +export type SearchField = keyof PackageListItem; export const searchIdField: SearchField = 'name'; export const fieldsToSearch: SearchField[] = ['description', 'name', 'title']; -interface SearchIntegrationsProps { +interface SearchPackagesProps { searchTerm: string; localSearchRef: React.MutableRefObject; - allIntegrations: IntegrationList; + allPackages: PackageList; } -export function SearchIntegrations({ - searchTerm, - localSearchRef, - allIntegrations, -}: SearchIntegrationsProps) { +export function SearchPackages({ searchTerm, localSearchRef, allPackages }: SearchPackagesProps) { // this means the search index hasn't been built yet. - // i.e. the intial fetch of all integrations hasn't finished + // i.e. the intial fetch of all packages hasn't finished if (!localSearchRef.current) return
Still fetching matches. Try again in a moment.
; - const matches = localSearchRef.current.search(searchTerm) as IntegrationList; + const matches = localSearchRef.current.search(searchTerm) as PackageList; const matchingIds = matches.map(match => match[searchIdField]); - const filtered = allIntegrations.filter(item => matchingIds.includes(item[searchIdField])); + const filtered = allPackages.filter(item => matchingIds.includes(item[searchIdField])); return ; } diff --git a/x-pack/legacy/plugins/integrations_manager/public/screens/home/search_results.tsx b/x-pack/legacy/plugins/integrations_manager/public/screens/home/search_results.tsx index 9de7974e1aedfd..b5dd7afc80f95c 100644 --- a/x-pack/legacy/plugins/integrations_manager/public/screens/home/search_results.tsx +++ b/x-pack/legacy/plugins/integrations_manager/public/screens/home/search_results.tsx @@ -6,18 +6,18 @@ import React from 'react'; import { EuiText, EuiTitle } from '@elastic/eui'; -import { IntegrationList } from '../../../common/types'; -import { IntegrationListGrid } from '../../components/integration_list_grid'; +import { PackageList } from '../../../common/types'; +import { PackageListGrid } from '../../components/package_list_grid'; interface SearchResultsProps { term: string; - results: IntegrationList; + results: PackageList; } export function SearchResults({ term, results }: SearchResultsProps) { const title = 'Search results'; return ( - ; +export type EPMConfigSchema = TypeOf; // This is needed for the legacy plugin / NP shim setup in ../index // It has been moved here to keep the two config schemas as close together as possible. @@ -22,14 +22,14 @@ export type IntegrationsManagerConfigSchema = TypeOf; // these two config schemas from a common definition or from each other. export const getConfigSchema = (Joi: typeof JoiNamespace) => { - const IntegrationsManagerConfigSchema = Joi.object({ + const EPMConfigSchema = Joi.object({ enabled: Joi.boolean().default(true), registryUrl: Joi.string() .uri() .default(), }).default(); - return IntegrationsManagerConfigSchema; + return EPMConfigSchema; }; const DEFAULT_CONFIG = { @@ -43,10 +43,10 @@ const DEFAULT_CONFIG = { // This is meant to be only updated from the config$ Observable's subscription // (see the Plugin class constructor in server/plugin.ts) but this is not enforced. -let _config: IntegrationsManagerConfigSchema = DEFAULT_CONFIG; +let _config: EPMConfigSchema = DEFAULT_CONFIG; -export const integrationsManagerConfigStore = { - updateConfig(newConfig: IntegrationsManagerConfigSchema) { +export const epmConfigStore = { + updateConfig(newConfig: EPMConfigSchema) { _config = Object.assign({}, _config, newConfig); }, getConfig() { diff --git a/x-pack/legacy/plugins/integrations_manager/server/index.ts b/x-pack/legacy/plugins/integrations_manager/server/index.ts index d440ec0e0522d8..696e7fb3c5ffa0 100644 --- a/x-pack/legacy/plugins/integrations_manager/server/index.ts +++ b/x-pack/legacy/plugins/integrations_manager/server/index.ts @@ -3,11 +3,11 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ -import { Plugin, IntegrationsManagerPluginInitializerContext } from './plugin'; +import { Plugin, EPMPluginInitializerContext } from './plugin'; // Kibana NP needs config to be exported from here, see https://github.com/elastic/kibana/pull/45299/files#r323254805 export { config } from './config'; -export function plugin(initializerContext: IntegrationsManagerPluginInitializerContext) { +export function plugin(initializerContext: EPMPluginInitializerContext) { return new Plugin(initializerContext); } diff --git a/x-pack/legacy/plugins/integrations_manager/server/integrations/get.ts b/x-pack/legacy/plugins/integrations_manager/server/packages/get.ts similarity index 94% rename from x-pack/legacy/plugins/integrations_manager/server/integrations/get.ts rename to x-pack/legacy/plugins/integrations_manager/server/packages/get.ts index c10bb328556137..6430a405b8e157 100644 --- a/x-pack/legacy/plugins/integrations_manager/server/integrations/get.ts +++ b/x-pack/legacy/plugins/integrations_manager/server/packages/get.ts @@ -20,7 +20,7 @@ export async function getCategories() { return Registry.fetchCategories(); } -export async function getIntegrations( +export async function getPackages( options: { savedObjectsClient: SavedObjectsClientContract; } & Registry.SearchParams @@ -37,7 +37,7 @@ export async function getIntegrations( })); const results = await savedObjectsClient.bulkGet(searchObjects); const savedObjects = results.saved_objects.filter(o => !o.error); // ignore errors for now - const integrationList = registryItems + const packageList = registryItems .map(item => createInstallableFrom( item, @@ -45,10 +45,10 @@ export async function getIntegrations( ) ) .sort(sortByName); - return integrationList; + return packageList; } -export async function getIntegrationInfo(options: { +export async function getPackageInfo(options: { savedObjectsClient: SavedObjectsClientContract; pkgkey: string; }) { diff --git a/x-pack/legacy/plugins/integrations_manager/server/integrations/get_objects.ts b/x-pack/legacy/plugins/integrations_manager/server/packages/get_objects.ts similarity index 100% rename from x-pack/legacy/plugins/integrations_manager/server/integrations/get_objects.ts rename to x-pack/legacy/plugins/integrations_manager/server/packages/get_objects.ts diff --git a/x-pack/legacy/plugins/integrations_manager/server/integrations/handlers.ts b/x-pack/legacy/plugins/integrations_manager/server/packages/handlers.ts similarity index 85% rename from x-pack/legacy/plugins/integrations_manager/server/integrations/handlers.ts rename to x-pack/legacy/plugins/integrations_manager/server/packages/handlers.ts index 0cd8ef406c802f..b66a7c74618303 100644 --- a/x-pack/legacy/plugins/integrations_manager/server/integrations/handlers.ts +++ b/x-pack/legacy/plugins/integrations_manager/server/packages/handlers.ts @@ -11,10 +11,10 @@ import { SearchParams, getCategories, getClusterAccessor, - getIntegrationInfo, getImage, - getIntegrations, - installIntegration, + getPackageInfo, + getPackages, + installPackage, removeInstallation, } from './index'; import { ImageRequestParams } from '../registry'; @@ -23,7 +23,7 @@ interface Extra extends ResponseToolkit { context: PluginContext; } -interface ListIntegrationsRequest extends Request { +interface ListPackagesRequest extends Request { query: Request['query'] & SearchParams; } @@ -53,22 +53,22 @@ export async function handleGetCategories(req: Request, extra: Extra) { return getCategories(); } -export async function handleGetList(req: ListIntegrationsRequest, extra: Extra) { +export async function handleGetList(req: ListPackagesRequest, extra: Extra) { const savedObjectsClient = getClient(req); - const integrationList = await getIntegrations({ + const packageList = await getPackages({ savedObjectsClient, category: req.query.category, }); - return integrationList; + return packageList; } export async function handleGetInfo(req: PackageRequest, extra: Extra) { const { pkgkey } = req.params; const savedObjectsClient = getClient(req); - const integrationInfo = await getIntegrationInfo({ savedObjectsClient, pkgkey }); + const packageInfo = await getPackageInfo({ savedObjectsClient, pkgkey }); - return integrationInfo; + return packageInfo; } export const handleGetImage = async (req: ImageRequest, extra: Extra) => { @@ -85,7 +85,7 @@ export async function handleRequestInstall(req: InstallAssetRequest, extra: Extr const savedObjectsClient = getClient(req); const callCluster = getClusterAccessor(extra.context.esClient, req); - const object = await installIntegration({ + const object = await installPackage({ savedObjectsClient, pkgkey, asset, diff --git a/x-pack/legacy/plugins/integrations_manager/server/integrations/index.ts b/x-pack/legacy/plugins/integrations_manager/server/packages/index.ts similarity index 100% rename from x-pack/legacy/plugins/integrations_manager/server/integrations/index.ts rename to x-pack/legacy/plugins/integrations_manager/server/packages/index.ts diff --git a/x-pack/legacy/plugins/integrations_manager/server/integrations/install.ts b/x-pack/legacy/plugins/integrations_manager/server/packages/install.ts similarity index 97% rename from x-pack/legacy/plugins/integrations_manager/server/integrations/install.ts rename to x-pack/legacy/plugins/integrations_manager/server/packages/install.ts index ed17e29d2c799c..72b3118cf5af6a 100644 --- a/x-pack/legacy/plugins/integrations_manager/server/integrations/install.ts +++ b/x-pack/legacy/plugins/integrations_manager/server/packages/install.ts @@ -11,7 +11,7 @@ import * as Registry from '../registry'; import { CallESAsCurrentUser, assetUsesObjects, getInstallationObject } from './index'; import { getObjects } from './get_objects'; -export async function installIntegration(options: { +export async function installPackage(options: { savedObjectsClient: SavedObjectsClientContract; pkgkey: string; asset: AssetType; @@ -27,7 +27,7 @@ export async function installIntegration(options: { }); if (toSave.length) { - // saved those references in the integration manager's state object + // saved those references in the package manager's state object const saved = await saveInstallationReferences({ savedObjectsClient, pkgkey, diff --git a/x-pack/legacy/plugins/integrations_manager/server/integrations/remove.ts b/x-pack/legacy/plugins/integrations_manager/server/packages/remove.ts similarity index 100% rename from x-pack/legacy/plugins/integrations_manager/server/integrations/remove.ts rename to x-pack/legacy/plugins/integrations_manager/server/packages/remove.ts diff --git a/x-pack/legacy/plugins/integrations_manager/server/plugin.ts b/x-pack/legacy/plugins/integrations_manager/server/plugin.ts index bfab4f6caff8c5..124236eb5d035d 100644 --- a/x-pack/legacy/plugins/integrations_manager/server/plugin.ts +++ b/x-pack/legacy/plugins/integrations_manager/server/plugin.ts @@ -11,13 +11,13 @@ import { IClusterClient, PluginInitializerContext, } from 'src/core/server'; -import { IntegrationsManagerConfigSchema, integrationsManagerConfigStore } from './config'; +import { EPMConfigSchema, epmConfigStore } from './config'; import { PLUGIN } from '../common/constants'; import { Server } from '../common/types'; import { fetchList } from './registry'; import { routes } from './routes'; -export type IntegrationsManagerPluginInitializerContext = Pick; +export type EPMPluginInitializerContext = Pick; export interface CoreSetup { elasticsearch: _CoreSetup['elasticsearch']; @@ -31,12 +31,12 @@ export interface PluginContext { } export class Plugin { - public config$: Observable; + public config$: Observable; - constructor(initializerContext: IntegrationsManagerPluginInitializerContext) { - this.config$ = initializerContext.config.create(); + constructor(initializerContext: EPMPluginInitializerContext) { + this.config$ = initializerContext.config.create(); this.config$.subscribe(configValue => { - integrationsManagerConfigStore.updateConfig(configValue); + epmConfigStore.updateConfig(configValue); }); } public setup(core: CoreSetup) { diff --git a/x-pack/legacy/plugins/integrations_manager/server/registry/index.ts b/x-pack/legacy/plugins/integrations_manager/server/registry/index.ts index ed005c34f27b93..c9acf50b8796a9 100644 --- a/x-pack/legacy/plugins/integrations_manager/server/registry/index.ts +++ b/x-pack/legacy/plugins/integrations_manager/server/registry/index.ts @@ -18,7 +18,7 @@ import { cacheGet, cacheSet } from './cache'; import { ArchiveEntry, untarBuffer } from './extract'; import { fetchUrl, getResponseStream, getResponse } from './requests'; import { streamToBuffer } from './streams'; -import { integrationsManagerConfigStore } from '../config'; +import { epmConfigStore } from '../config'; export { ArchiveEntry } from './extract'; @@ -32,7 +32,7 @@ export interface ImageRequestParams { } export async function fetchList(params?: SearchParams): Promise { - const { registryUrl } = integrationsManagerConfigStore.getConfig(); + const { registryUrl } = epmConfigStore.getConfig(); const url = new URL(`${registryUrl}/search`); if (params && params.category) { url.searchParams.set('category', params.category); @@ -42,18 +42,18 @@ export async function fetchList(params?: SearchParams): Promise { } export async function fetchInfo(key: string): Promise { - const { registryUrl } = integrationsManagerConfigStore.getConfig(); + const { registryUrl } = epmConfigStore.getConfig(); return fetchUrl(`${registryUrl}/package/${key}`).then(JSON.parse); } export async function fetchImage(params: ImageRequestParams): Promise { - const { registryUrl } = integrationsManagerConfigStore.getConfig(); + const { registryUrl } = epmConfigStore.getConfig(); const { pkgkey, imgPath } = params; return getResponse(`${registryUrl}/package/${pkgkey}/img/${imgPath}`); } export async function fetchCategories(): Promise { - const { registryUrl } = integrationsManagerConfigStore.getConfig(); + const { registryUrl } = epmConfigStore.getConfig(); return fetchUrl(`${registryUrl}/categories`).then(JSON.parse); } @@ -111,7 +111,7 @@ async function getOrFetchArchiveBuffer(key: string): Promise { } async function fetchArchiveBuffer(key: string): Promise { - const { registryUrl } = integrationsManagerConfigStore.getConfig(); + const { registryUrl } = epmConfigStore.getConfig(); return getResponseStream(`${registryUrl}/package/${key}`).then(streamToBuffer); } diff --git a/x-pack/legacy/plugins/integrations_manager/server/routes.ts b/x-pack/legacy/plugins/integrations_manager/server/routes.ts index a25bc0e21ce033..7dfc39c9b18c37 100644 --- a/x-pack/legacy/plugins/integrations_manager/server/routes.ts +++ b/x-pack/legacy/plugins/integrations_manager/server/routes.ts @@ -6,7 +6,7 @@ import { PLUGIN } from '../common/constants'; import { ServerRoute } from '../common/types'; import * as CommonRoutes from '../common/routes'; -import * as Integrations from './integrations/handlers'; +import * as Packages from './packages/handlers'; const API_IMG_PATTERN = `${CommonRoutes.API_ROOT}/package/{pkgkey}/img/{imgPath*}`; @@ -16,36 +16,36 @@ export const routes: ServerRoute[] = [ method: 'GET', path: CommonRoutes.API_CATEGORIES_PATTERN, options: { tags: [`access:${PLUGIN.ID}`], json: { space: 2 } }, - handler: Integrations.handleGetCategories, + handler: Packages.handleGetCategories, }, { method: 'GET', path: CommonRoutes.API_LIST_PATTERN, options: { tags: [`access:${PLUGIN.ID}`], json: { space: 2 } }, - handler: Integrations.handleGetList, + handler: Packages.handleGetList, }, { method: 'GET', path: API_IMG_PATTERN, options: { tags: [`access:${PLUGIN.ID}`], json: { space: 2 } }, - handler: Integrations.handleGetImage, + handler: Packages.handleGetImage, }, { method: 'GET', path: CommonRoutes.API_INFO_PATTERN, options: { tags: [`access:${PLUGIN.ID}`], json: { space: 2 } }, - handler: Integrations.handleGetInfo, + handler: Packages.handleGetInfo, }, { method: 'GET', path: CommonRoutes.API_INSTALL_PATTERN, options: { tags: [`access:${PLUGIN.ID}`], json: { space: 2 } }, - handler: Integrations.handleRequestInstall, + handler: Packages.handleRequestInstall, }, { method: 'GET', path: CommonRoutes.API_DELETE_PATTERN, options: { tags: [`access:${PLUGIN.ID}`], json: { space: 2 } }, - handler: Integrations.handleRequestDelete, + handler: Packages.handleRequestDelete, }, ]; diff --git a/x-pack/scripts/functional_tests.js b/x-pack/scripts/functional_tests.js index f5649870d1357b..83948eab1ccaf5 100644 --- a/x-pack/scripts/functional_tests.js +++ b/x-pack/scripts/functional_tests.js @@ -34,5 +34,5 @@ require('@kbn/test').runTestsCli([ require.resolve('../test/ui_capabilities/security_only/config'), require.resolve('../test/ui_capabilities/spaces_only/config'), require.resolve('../test/upgrade_assistant_integration/config'), - require.resolve('../test/integrations_manager_api_integration/config'), + require.resolve('../test/epm_api_integration/config'), ]); diff --git a/x-pack/test/api_integration/apis/features/features/features.ts b/x-pack/test/api_integration/apis/features/features/features.ts index a8d8e381731a45..bc45fb342fad1f 100644 --- a/x-pack/test/api_integration/apis/features/features/features.ts +++ b/x-pack/test/api_integration/apis/features/features/features.ts @@ -112,7 +112,7 @@ export default function({ getService }: FtrProviderContext) { 'canvas', 'code', 'infrastructure', - 'integrations_manager', + 'epm', 'logs', 'maps', 'uptime', diff --git a/x-pack/test/api_integration/apis/security/privileges.ts b/x-pack/test/api_integration/apis/security/privileges.ts index 846d5cbdf4e1a9..34dcc5b2106cf8 100644 --- a/x-pack/test/api_integration/apis/security/privileges.ts +++ b/x-pack/test/api_integration/apis/security/privileges.ts @@ -38,6 +38,7 @@ export default function({ getService }: FtrProviderContext) { apm: ['all', 'read'], siem: ['all', 'read'], code: ['all', 'read'], + epm: ['all', 'read'], }, global: ['all', 'read'], space: ['all', 'read'], diff --git a/x-pack/test/integrations_manager_api_integration/apis/image.ts b/x-pack/test/epm_api_integration/apis/image.ts similarity index 90% rename from x-pack/test/integrations_manager_api_integration/apis/image.ts rename to x-pack/test/epm_api_integration/apis/image.ts index 80358dbf2a1298..073ae637eec5c1 100644 --- a/x-pack/test/integrations_manager_api_integration/apis/image.ts +++ b/x-pack/test/epm_api_integration/apis/image.ts @@ -29,7 +29,7 @@ export default function({ getService }: FtrProviderContext) { const fetchImage = async () => { await supertest .get( - '/api/integrations_manager/package/auditd-2.0.4/img/screenshots/auditbeat-file-integrity-dashboard.png' + '/api/epm/package/auditd-2.0.4/img/screenshots/auditbeat-file-integrity-dashboard.png' ) .set('kbn-xsrf', 'xxx') .expect('Content-Type', 'image/png') @@ -50,7 +50,7 @@ export default function({ getService }: FtrProviderContext) { const supertest = getService('supertest'); const fetchImage = async () => { await supertest - .get('/api/integrations_manager/package/auditd-2.0.4/img/icon.svg') + .get('/api/epm/package/auditd-2.0.4/img/icon.svg') .set('kbn-xsrf', 'xxx') .expect('Content-Type', 'image/svg') .expect(200); diff --git a/x-pack/test/integrations_manager_api_integration/apis/index.js b/x-pack/test/epm_api_integration/apis/index.js similarity index 87% rename from x-pack/test/integrations_manager_api_integration/apis/index.js rename to x-pack/test/epm_api_integration/apis/index.js index 7f8c8bbad503c2..4354c6a1336c41 100644 --- a/x-pack/test/integrations_manager_api_integration/apis/index.js +++ b/x-pack/test/epm_api_integration/apis/index.js @@ -5,7 +5,7 @@ */ export default function ({ loadTestFile }) { - describe('Integrations Manager Endpoints', function () { + describe('EPM Endpoints', function () { this.tags('ciGroup7'); loadTestFile(require.resolve('./list')); loadTestFile(require.resolve('./image')); diff --git a/x-pack/test/integrations_manager_api_integration/apis/list.ts b/x-pack/test/epm_api_integration/apis/list.ts similarity index 97% rename from x-pack/test/integrations_manager_api_integration/apis/list.ts rename to x-pack/test/epm_api_integration/apis/list.ts index bfa0e4a54f6ca7..59741af254167c 100644 --- a/x-pack/test/integrations_manager_api_integration/apis/list.ts +++ b/x-pack/test/epm_api_integration/apis/list.ts @@ -55,7 +55,7 @@ export default function({ getService }: FtrProviderContext) { const supertest = getService('supertest'); const fetchPackageList = async () => { const response = await supertest - .get('/api/integrations_manager/list') + .get('/api/epm/list') .set('kbn-xsrf', 'xxx') .expect(200); return response.body; @@ -108,7 +108,7 @@ export default function({ getService }: FtrProviderContext) { const supertest = getService('supertest'); const fetchPackageList = async () => { const response = await supertest - .get('/api/integrations_manager/list') + .get('/api/epm/list') .set('kbn-xsrf', 'xxx') .expect(200); return response.body; diff --git a/x-pack/test/integrations_manager_api_integration/apis/mock_http_server.d.ts b/x-pack/test/epm_api_integration/apis/mock_http_server.d.ts similarity index 100% rename from x-pack/test/integrations_manager_api_integration/apis/mock_http_server.d.ts rename to x-pack/test/epm_api_integration/apis/mock_http_server.d.ts diff --git a/x-pack/test/integrations_manager_api_integration/config.ts b/x-pack/test/epm_api_integration/config.ts similarity index 86% rename from x-pack/test/integrations_manager_api_integration/config.ts rename to x-pack/test/epm_api_integration/config.ts index de600b3db6f11e..849d3596ac3597 100644 --- a/x-pack/test/integrations_manager_api_integration/config.ts +++ b/x-pack/test/epm_api_integration/config.ts @@ -16,7 +16,7 @@ export default async function({ readConfigFile }: FtrConfigProviderContext) { supertest: xPackAPITestsConfig.get('services.supertest'), }, junit: { - reportName: 'X-Pack Integrations Manager API Integration Tests', + reportName: 'X-Pack EPM API Integration Tests', }, esTestCluster: { @@ -27,7 +27,7 @@ export default async function({ readConfigFile }: FtrConfigProviderContext) { ...xPackAPITestsConfig.get('kbnTestServer'), serverArgs: [ ...xPackAPITestsConfig.get('kbnTestServer.serverArgs'), - '--xpack.integrationsManager.registryUrl=http://localhost:6666', + '--xpack.epm.registryUrl=http://localhost:6666', ], }, };