diff --git a/test/functional/page_objects/common_page.ts b/test/functional/page_objects/common_page.ts index 75a15cc16db2e..aa781135b3686 100644 --- a/test/functional/page_objects/common_page.ts +++ b/test/functional/page_objects/common_page.ts @@ -192,6 +192,7 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo public async navigateToUrlWithBrowserHistory( appName: string, subUrl?: string, + search?: string, { basePath = '', ensureCurrentUrl = true, @@ -203,6 +204,7 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo const appConfig = { // subUrl following the basePath, assumes no hashes. Ex: 'app/endpoint/management' pathname: `${basePath}${config.get(['apps', appName]).pathname}${subUrl}`, + search, }; await this.navigate({ diff --git a/x-pack/.i18nrc.json b/x-pack/.i18nrc.json index 310cda5a97dc9..ba066ec797341 100644 --- a/x-pack/.i18nrc.json +++ b/x-pack/.i18nrc.json @@ -16,7 +16,7 @@ "xpack.grokDebugger": "legacy/plugins/grokdebugger", "xpack.idxMgmt": "legacy/plugins/index_management", "xpack.indexLifecycleMgmt": "legacy/plugins/index_lifecycle_management", - "xpack.infra": "legacy/plugins/infra", + "xpack.infra": "plugins/infra", "xpack.data": "plugins/data_enhanced", "xpack.lens": "legacy/plugins/lens", "xpack.licensing": "plugins/licensing", diff --git a/x-pack/legacy/plugins/apm/public/components/app/ErrorGroupDetails/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/ErrorGroupDetails/index.tsx index a247390704e72..d79f2a4ed481d 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/ErrorGroupDetails/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/ErrorGroupDetails/index.tsx @@ -25,7 +25,7 @@ import { DetailView } from './DetailView'; import { ErrorDistribution } from './Distribution'; import { useLocation } from '../../../hooks/useLocation'; import { useUrlParams } from '../../../hooks/useUrlParams'; -import { useTrackPageview } from '../../../../../infra/public'; +import { useTrackPageview } from '../../../../../../../plugins/observability/public'; const Titles = styled.div` margin-bottom: ${px(units.plus)}; diff --git a/x-pack/legacy/plugins/apm/public/components/app/ErrorGroupOverview/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/ErrorGroupOverview/index.tsx index 2daf5e55d4e72..9f7ff65d37d36 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/ErrorGroupOverview/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/ErrorGroupOverview/index.tsx @@ -17,7 +17,7 @@ import { useFetcher } from '../../../hooks/useFetcher'; import { ErrorDistribution } from '../ErrorGroupDetails/Distribution'; import { ErrorGroupList } from './List'; import { useUrlParams } from '../../../hooks/useUrlParams'; -import { useTrackPageview } from '../../../../../infra/public'; +import { useTrackPageview } from '../../../../../../../plugins/observability/public'; import { PROJECTION } from '../../../../common/projections/typings'; import { LocalUIFilters } from '../../shared/LocalUIFilters'; diff --git a/x-pack/legacy/plugins/apm/public/components/app/ServiceOverview/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/ServiceOverview/index.tsx index b522736c80f9b..762c10c0f48a7 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/ServiceOverview/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/ServiceOverview/index.tsx @@ -14,7 +14,7 @@ import { useFetcher } from '../../../hooks/useFetcher'; import { NoServicesMessage } from './NoServicesMessage'; import { ServiceList } from './ServiceList'; import { useUrlParams } from '../../../hooks/useUrlParams'; -import { useTrackPageview } from '../../../../../infra/public'; +import { useTrackPageview } from '../../../../../../../plugins/observability/public'; import { PROJECTION } from '../../../../common/projections/typings'; import { LocalUIFilters } from '../../shared/LocalUIFilters'; import { useApmPluginContext } from '../../../hooks/useApmPluginContext'; diff --git a/x-pack/legacy/plugins/apm/public/components/app/Settings/AgentConfigurations/AddEditFlyout/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/Settings/AgentConfigurations/AddEditFlyout/index.tsx index e1cb07be3d378..b58d0b28e6d24 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/Settings/AgentConfigurations/AddEditFlyout/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/Settings/AgentConfigurations/AddEditFlyout/index.tsx @@ -34,6 +34,7 @@ import { isRumAgentName } from '../../../../../../common/agent_name'; import { ALL_OPTION_VALUE } from '../../../../../../common/agent_configuration_constants'; import { saveConfig } from './saveConfig'; import { useApmPluginContext } from '../../../../../hooks/useApmPluginContext'; +import { useUiTracker } from '../../../../../../../../../plugins/observability/public'; const defaultSettings = { TRANSACTION_SAMPLE_RATE: '1.0', @@ -59,6 +60,9 @@ export function AddEditFlyout({ const callApmApiFromHook = useCallApmApi(); + // get a telemetry UI event tracker + const trackApmEvent = useUiTracker({ app: 'apm' }); + // config conditions (service) const [serviceName, setServiceName] = useState( selectedConfig ? selectedConfig.service.name || ALL_OPTION_VALUE : '' @@ -133,7 +137,8 @@ export function AddEditFlyout({ transactionMaxSpans, configurationId: selectedConfig ? selectedConfig.id : undefined, agentName, - toasts + toasts, + trackApmEvent }); setIsSaving(false); onSaved(); diff --git a/x-pack/legacy/plugins/apm/public/components/app/Settings/AgentConfigurations/AddEditFlyout/saveConfig.ts b/x-pack/legacy/plugins/apm/public/components/app/Settings/AgentConfigurations/AddEditFlyout/saveConfig.ts index 7ca221d642b08..a0c7c97e012a4 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/Settings/AgentConfigurations/AddEditFlyout/saveConfig.ts +++ b/x-pack/legacy/plugins/apm/public/components/app/Settings/AgentConfigurations/AddEditFlyout/saveConfig.ts @@ -7,12 +7,12 @@ import { i18n } from '@kbn/i18n'; import { NotificationsStart } from 'kibana/public'; import { APMClient } from '../../../../../services/rest/createCallApmApi'; -import { trackEvent } from '../../../../../../../infra/public/hooks/use_track_metric'; import { isRumAgentName } from '../../../../../../common/agent_name'; import { getOptionLabel, omitAllOption } from '../../../../../../common/agent_configuration_constants'; +import { UiTracker } from '../../../../../../../../../plugins/observability/public'; interface Settings { transaction_sample_rate: number; @@ -29,7 +29,8 @@ export async function saveConfig({ transactionMaxSpans, configurationId, agentName, - toasts + toasts, + trackApmEvent }: { callApmApi: APMClient; serviceName: string; @@ -40,8 +41,9 @@ export async function saveConfig({ configurationId?: string; agentName?: string; toasts: NotificationsStart['toasts']; + trackApmEvent: UiTracker; }) { - trackEvent({ app: 'apm', name: 'save_agent_configuration' }); + trackApmEvent({ metric: 'save_agent_configuration' }); try { const settings: Settings = { diff --git a/x-pack/legacy/plugins/apm/public/components/app/Settings/AgentConfigurations/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/Settings/AgentConfigurations/index.tsx index 9e95cfd0fad7f..8812cccd2edaf 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/Settings/AgentConfigurations/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/Settings/AgentConfigurations/index.tsx @@ -18,7 +18,7 @@ import { isEmpty } from 'lodash'; import { useFetcher } from '../../../../hooks/useFetcher'; import { AgentConfigurationListAPIResponse } from '../../../../../server/lib/settings/agent_configuration/list_configurations'; import { AgentConfigurationList } from './AgentConfigurationList'; -import { useTrackPageview } from '../../../../../../infra/public'; +import { useTrackPageview } from '../../../../../../../../plugins/observability/public'; import { AddEditFlyout } from './AddEditFlyout'; export type Config = AgentConfigurationListAPIResponse[0]; diff --git a/x-pack/legacy/plugins/apm/public/components/app/TraceOverview/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/TraceOverview/index.tsx index dd3e2d13826dc..3bdcc3231cddc 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/TraceOverview/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/TraceOverview/index.tsx @@ -9,7 +9,7 @@ import React, { useMemo } from 'react'; import { FETCH_STATUS, useFetcher } from '../../../hooks/useFetcher'; import { TraceList } from './TraceList'; import { useUrlParams } from '../../../hooks/useUrlParams'; -import { useTrackPageview } from '../../../../../infra/public'; +import { useTrackPageview } from '../../../../../../../plugins/observability/public'; import { LocalUIFilters } from '../../shared/LocalUIFilters'; import { PROJECTION } from '../../../../common/projections/typings'; diff --git a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/index.tsx index 9d6639b000762..a6712becf7968 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/index.tsx @@ -26,7 +26,7 @@ import { useUrlParams } from '../../../hooks/useUrlParams'; import { FETCH_STATUS } from '../../../hooks/useFetcher'; import { TransactionBreakdown } from '../../shared/TransactionBreakdown'; import { ChartsSyncContextProvider } from '../../../context/ChartsSyncContext'; -import { useTrackPageview } from '../../../../../infra/public'; +import { useTrackPageview } from '../../../../../../../plugins/observability/public'; import { PROJECTION } from '../../../../common/projections/typings'; import { LocalUIFilters } from '../../shared/LocalUIFilters'; import { HeightRetainer } from '../../shared/HeightRetainer'; diff --git a/x-pack/legacy/plugins/apm/public/components/app/TransactionOverview/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/TransactionOverview/index.tsx index 2cf01f8b40a09..73824f235ab02 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/TransactionOverview/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/TransactionOverview/index.tsx @@ -27,7 +27,7 @@ import { getHasMLJob } from '../../../services/rest/ml'; import { history } from '../../../utils/history'; import { useLocation } from '../../../hooks/useLocation'; import { ChartsSyncContextProvider } from '../../../context/ChartsSyncContext'; -import { useTrackPageview } from '../../../../../infra/public'; +import { useTrackPageview } from '../../../../../../../plugins/observability/public'; import { fromQuery, toQuery } from '../../shared/Links/url_helpers'; import { LocalUIFilters } from '../../shared/LocalUIFilters'; import { PROJECTION } from '../../../../common/projections/typings'; diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/InfraLink.test.tsx b/x-pack/legacy/plugins/apm/public/components/shared/Links/InfraLink.test.tsx index 42022a3741495..0b39aa9ada756 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/Links/InfraLink.test.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/Links/InfraLink.test.tsx @@ -11,13 +11,15 @@ import { InfraLink } from './InfraLink'; test('InfraLink produces the correct URL', async () => { const href = await getRenderedHref( - () => , + () => ( + + ), { search: '?rangeFrom=now-5h&rangeTo=now-2h' } as Location ); expect(href).toMatchInlineSnapshot( - `"/basepath/app/infra#/some/path?time=1554687198"` + `"/basepath/app/metrics/some/path?time=1554687198"` ); }); diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/InfraLink.tsx b/x-pack/legacy/plugins/apm/public/components/shared/Links/InfraLink.tsx index e4f3557a2ce51..7efe5cb96cfbd 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/Links/InfraLink.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/Links/InfraLink.tsx @@ -5,12 +5,12 @@ */ import { EuiLink, EuiLinkAnchorProps } from '@elastic/eui'; -import { compact } from 'lodash'; import React from 'react'; import url from 'url'; import { fromQuery } from './url_helpers'; import { useApmPluginContext } from '../../../hooks/useApmPluginContext'; import { AppMountContextBasePath } from '../../../context/ApmPluginContext'; +import { InfraAppId } from '../../../../../../../plugins/infra/public'; interface InfraQueryParams { time?: number; @@ -20,29 +20,32 @@ interface InfraQueryParams { } interface Props extends EuiLinkAnchorProps { + app: InfraAppId; path?: string; query: InfraQueryParams; children?: React.ReactNode; } export const getInfraHref = ({ + app, basePath, query, path }: { + app: InfraAppId; basePath: AppMountContextBasePath; query: InfraQueryParams; path?: string; }) => { const nextSearch = fromQuery(query); return url.format({ - pathname: basePath.prepend('/app/infra'), - hash: compact([path, nextSearch]).join('?') + pathname: basePath.prepend(`/app/${app}${path || ''}`), + search: nextSearch }); }; -export function InfraLink({ path, query = {}, ...rest }: Props) { +export function InfraLink({ app, path, query = {}, ...rest }: Props) { const { core } = useApmPluginContext(); - const href = getInfraHref({ basePath: core.http.basePath, query, path }); + const href = getInfraHref({ app, basePath: core.http.basePath, query, path }); return ; } diff --git a/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/__test__/sections.test.ts b/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/__test__/sections.test.ts index 52c2d27eabb82..9f07bd508c95c 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/__test__/sections.test.ts +++ b/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/__test__/sections.test.ts @@ -10,7 +10,9 @@ import { AppMountContextBasePath } from '../../../../context/ApmPluginContext'; describe('Transaction action menu', () => { const basePath = ({ - prepend: jest.fn() + prepend: (url: string) => { + return `some-basepath${url}`; + } } as unknown) as AppMountContextBasePath; const date = '2020-02-06T11:00:00.000Z'; const timestamp = { us: new Date(date).getTime() }; @@ -40,7 +42,7 @@ describe('Transaction action menu', () => { key: 'traceLogs', label: 'Trace logs', href: - '#/link-to/logs?time=1580986800&filter=trace.id:%22123%22%20OR%20123', + 'some-basepath/app/logs/link-to/logs?time=1580986800&filter=trace.id:%22123%22%20OR%20123', condition: true } ] @@ -54,7 +56,7 @@ describe('Transaction action menu', () => { key: 'sampleDocument', label: 'View sample document', href: - '#/discover?_g=(refreshInterval:(pause:true,value:\'0\'),time:(from:now-24h,to:now))&_a=(index:apm_static_index_pattern_id,interval:auto,query:(language:kuery,query:\'processor.event:"transaction" AND transaction.id:"123" AND trace.id:"123"\'))', + 'some-basepath/app/kibana#/discover?_g=(refreshInterval:(pause:true,value:\'0\'),time:(from:now-24h,to:now))&_a=(index:apm_static_index_pattern_id,interval:auto,query:(language:kuery,query:\'processor.event:"transaction" AND transaction.id:"123" AND trace.id:"123"\'))', condition: true } ] @@ -89,14 +91,15 @@ describe('Transaction action menu', () => { { key: 'podLogs', label: 'Pod logs', - href: '#/link-to/pod-logs/123?time=1580986800', + href: + 'some-basepath/app/logs/link-to/pod-logs/123?time=1580986800', condition: true }, { key: 'podMetrics', label: 'Pod metrics', href: - '#/link-to/pod-detail/123?from=1580986500000&to=1580987100000', + 'some-basepath/app/metrics/link-to/pod-detail/123?from=1580986500000&to=1580987100000', condition: true } ] @@ -110,7 +113,7 @@ describe('Transaction action menu', () => { key: 'traceLogs', label: 'Trace logs', href: - '#/link-to/logs?time=1580986800&filter=trace.id:%22123%22%20OR%20123', + 'some-basepath/app/logs/link-to/logs?time=1580986800&filter=trace.id:%22123%22%20OR%20123', condition: true } ] @@ -124,7 +127,7 @@ describe('Transaction action menu', () => { key: 'sampleDocument', label: 'View sample document', href: - '#/discover?_g=(refreshInterval:(pause:true,value:\'0\'),time:(from:now-24h,to:now))&_a=(index:apm_static_index_pattern_id,interval:auto,query:(language:kuery,query:\'processor.event:"transaction" AND transaction.id:"123" AND trace.id:"123"\'))', + 'some-basepath/app/kibana#/discover?_g=(refreshInterval:(pause:true,value:\'0\'),time:(from:now-24h,to:now))&_a=(index:apm_static_index_pattern_id,interval:auto,query:(language:kuery,query:\'processor.event:"transaction" AND transaction.id:"123" AND trace.id:"123"\'))', condition: true } ] @@ -158,14 +161,15 @@ describe('Transaction action menu', () => { { key: 'hostLogs', label: 'Host logs', - href: '#/link-to/host-logs/foo?time=1580986800', + href: + 'some-basepath/app/logs/link-to/host-logs/foo?time=1580986800', condition: true }, { key: 'hostMetrics', label: 'Host metrics', href: - '#/link-to/host-detail/foo?from=1580986500000&to=1580987100000', + 'some-basepath/app/metrics/link-to/host-detail/foo?from=1580986500000&to=1580987100000', condition: true } ] @@ -179,7 +183,7 @@ describe('Transaction action menu', () => { key: 'traceLogs', label: 'Trace logs', href: - '#/link-to/logs?time=1580986800&filter=trace.id:%22123%22%20OR%20123', + 'some-basepath/app/logs/link-to/logs?time=1580986800&filter=trace.id:%22123%22%20OR%20123', condition: true } ] @@ -193,7 +197,7 @@ describe('Transaction action menu', () => { key: 'sampleDocument', label: 'View sample document', href: - '#/discover?_g=(refreshInterval:(pause:true,value:\'0\'),time:(from:now-24h,to:now))&_a=(index:apm_static_index_pattern_id,interval:auto,query:(language:kuery,query:\'processor.event:"transaction" AND transaction.id:"123" AND trace.id:"123"\'))', + 'some-basepath/app/kibana#/discover?_g=(refreshInterval:(pause:true,value:\'0\'),time:(from:now-24h,to:now))&_a=(index:apm_static_index_pattern_id,interval:auto,query:(language:kuery,query:\'processor.event:"transaction" AND transaction.id:"123" AND trace.id:"123"\'))', condition: true } ] diff --git a/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/sections.ts b/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/sections.ts index 77445a2600960..31efdb6355563 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/sections.ts +++ b/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/sections.ts @@ -82,6 +82,7 @@ export const getSections = ({ { defaultMessage: 'Pod logs' } ), href: getInfraHref({ + app: 'logs', basePath, path: `/link-to/pod-logs/${podId}`, query: { time } @@ -95,6 +96,7 @@ export const getSections = ({ { defaultMessage: 'Pod metrics' } ), href: getInfraHref({ + app: 'metrics', basePath, path: `/link-to/pod-detail/${podId}`, query: infraMetricsQuery @@ -111,6 +113,7 @@ export const getSections = ({ { defaultMessage: 'Container logs' } ), href: getInfraHref({ + app: 'logs', basePath, path: `/link-to/container-logs/${containerId}`, query: { time } @@ -124,6 +127,7 @@ export const getSections = ({ { defaultMessage: 'Container metrics' } ), href: getInfraHref({ + app: 'metrics', basePath, path: `/link-to/container-detail/${containerId}`, query: infraMetricsQuery @@ -140,6 +144,7 @@ export const getSections = ({ { defaultMessage: 'Host logs' } ), href: getInfraHref({ + app: 'logs', basePath, path: `/link-to/host-logs/${hostName}`, query: { time } @@ -153,6 +158,7 @@ export const getSections = ({ { defaultMessage: 'Host metrics' } ), href: getInfraHref({ + app: 'metrics', basePath, path: `/link-to/host-detail/${hostName}`, query: infraMetricsQuery @@ -169,6 +175,7 @@ export const getSections = ({ { defaultMessage: 'Trace logs' } ), href: getInfraHref({ + app: 'logs', basePath, path: `/link-to/logs`, query: { diff --git a/x-pack/legacy/plugins/apm/public/components/shared/TransactionBreakdown/TransactionBreakdownGraph/index.tsx b/x-pack/legacy/plugins/apm/public/components/shared/TransactionBreakdown/TransactionBreakdownGraph/index.tsx index c4e7ed86df8b7..a964b425073b5 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/TransactionBreakdown/TransactionBreakdownGraph/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/TransactionBreakdown/TransactionBreakdownGraph/index.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import React from 'react'; +import React, { useMemo } from 'react'; import numeral from '@elastic/numeral'; import { throttle } from 'lodash'; import { NOT_AVAILABLE_LABEL } from '../../../../../common/i18n'; @@ -14,7 +14,7 @@ import { TransactionLineChart } from '../../charts/TransactionCharts/Transaction import { asPercent } from '../../../../utils/formatters'; import { unit } from '../../../../style/variables'; import { isValidCoordinateValue } from '../../../../utils/isValidCoordinateValue'; -import { trackEvent } from '../../../../../../infra/public/hooks/use_track_metric'; +import { useUiTracker } from '../../../../../../../../plugins/observability/public'; interface Props { timeseries: TimeSeries[]; @@ -30,13 +30,14 @@ const formatTooltipValue = (coordinate: Coordinate) => { : NOT_AVAILABLE_LABEL; }; -const trackHoverBreakdownChart = throttle( - () => trackEvent({ app: 'apm', name: 'hover_breakdown_chart' }), - 60000 -); - const TransactionBreakdownGraph: React.FC = props => { const { timeseries } = props; + const trackApmEvent = useUiTracker({ app: 'apm' }); + const handleHover = useMemo( + () => + throttle(() => trackApmEvent({ metric: 'hover_breakdown_chart' }), 60000), + [trackApmEvent] + ); return ( = props => { yMax={1} height={unit * 12} stacked={true} - onHover={trackHoverBreakdownChart} + onHover={handleHover} /> ); }; diff --git a/x-pack/legacy/plugins/apm/public/components/shared/TransactionBreakdown/TransactionBreakdownKpiList.tsx b/x-pack/legacy/plugins/apm/public/components/shared/TransactionBreakdown/TransactionBreakdownKpiList.tsx index 0e31cfff9a295..91f5f4e0a7176 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/TransactionBreakdown/TransactionBreakdownKpiList.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/TransactionBreakdown/TransactionBreakdownKpiList.tsx @@ -13,8 +13,10 @@ import { EuiIcon } from '@elastic/eui'; import styled from 'styled-components'; -import { InfraFormatterType } from '../../../../../infra/public/lib/lib'; -import { FORMATTERS } from '../../../../../infra/public/utils/formatters'; +import { + FORMATTERS, + InfraFormatterType +} from '../../../../../../../plugins/infra/public'; interface TransactionBreakdownKpi { name: string; diff --git a/x-pack/legacy/plugins/apm/public/components/shared/TransactionBreakdown/index.tsx b/x-pack/legacy/plugins/apm/public/components/shared/TransactionBreakdown/index.tsx index d8b7c5059ec62..85f5f83fb920e 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/TransactionBreakdown/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/TransactionBreakdown/index.tsx @@ -10,8 +10,8 @@ import { useTransactionBreakdown } from '../../../hooks/useTransactionBreakdown' import { TransactionBreakdownHeader } from './TransactionBreakdownHeader'; import { TransactionBreakdownKpiList } from './TransactionBreakdownKpiList'; import { TransactionBreakdownGraph } from './TransactionBreakdownGraph'; -import { trackEvent } from '../../../../../infra/public/hooks/use_track_metric'; import { FETCH_STATUS } from '../../../hooks/useFetcher'; +import { useUiTracker } from '../../../../../../../plugins/observability/public'; const emptyMessage = i18n.translate('xpack.apm.transactionBreakdown.noData', { defaultMessage: 'No data within this time range.' @@ -21,11 +21,9 @@ const TransactionBreakdown: React.FC<{ initialIsOpen?: boolean; }> = ({ initialIsOpen }) => { const [showChart, setShowChart] = useState(!!initialIsOpen); - const { data, status } = useTransactionBreakdown(); - + const trackApmEvent = useUiTracker({ app: 'apm' }); const { kpis, timeseries } = data; - const noHits = data.kpis.length === 0 && status === FETCH_STATUS.SUCCESS; const showEmptyMessage = noHits && !showChart; @@ -38,9 +36,9 @@ const TransactionBreakdown: React.FC<{ onToggleClick={() => { setShowChart(!showChart); if (showChart) { - trackEvent({ app: 'apm', name: 'hide_breakdown_chart' }); + trackApmEvent({ metric: 'hide_breakdown_chart' }); } else { - trackEvent({ app: 'apm', name: 'show_breakdown_chart' }); + trackApmEvent({ metric: 'show_breakdown_chart' }); } }} /> diff --git a/x-pack/legacy/plugins/apm/public/new-platform/plugin.tsx b/x-pack/legacy/plugins/apm/public/new-platform/plugin.tsx index 50f20ac017c5d..8e46ba5d18c1b 100644 --- a/x-pack/legacy/plugins/apm/public/new-platform/plugin.tsx +++ b/x-pack/legacy/plugins/apm/public/new-platform/plugin.tsx @@ -36,6 +36,7 @@ import { getConfigFromInjectedMetadata } from './getConfigFromInjectedMetadata'; import { setHelpExtension } from './setHelpExtension'; import { toggleAppLinkInNav } from './toggleAppLinkInNav'; import { setReadonlyBadge } from './updateBadge'; +import { KibanaContextProvider } from '../../../../../../src/plugins/kibana_react/public'; import { Permission } from '../components/app/Permission'; export const REACT_APP_ROOT_ID = 'react-apm-root'; @@ -133,21 +134,23 @@ export class ApmPlugin ReactDOM.render( - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + , document.getElementById(REACT_APP_ROOT_ID) ); diff --git a/x-pack/legacy/plugins/infra/index.ts b/x-pack/legacy/plugins/infra/index.ts index 4ab2cde082498..6ef273924a346 100644 --- a/x-pack/legacy/plugins/infra/index.ts +++ b/x-pack/legacy/plugins/infra/index.ts @@ -3,115 +3,23 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ - -import { i18n } from '@kbn/i18n'; -import JoiNamespace from 'joi'; -import { resolve } from 'path'; -import { PluginInitializerContext } from 'src/core/server'; -import { UsageCollectionSetup } from 'src/plugins/usage_collection/server'; -import KbnServer from 'src/legacy/server/kbn_server'; -import { getConfigSchema } from './server/kibana.index'; -import { savedObjectMappings } from './server/saved_objects'; -import { plugin, InfraServerPluginDeps } from './server/new_platform_index'; -import { InfraSetup } from '../../../plugins/infra/server'; -import { PluginSetupContract as FeaturesPluginSetup } from '../../../plugins/features/server'; -import { SpacesPluginSetup } from '../../../plugins/spaces/server'; -import { VisTypeTimeseriesSetup } from '../../../../src/plugins/vis_type_timeseries/server'; -import { APMPluginContract } from '../../../plugins/apm/server'; -import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/utils'; - -export const APP_ID = 'infra'; +import { Root } from 'joi'; +import { savedObjectMappings } from '../../../plugins/infra/server'; export function infra(kibana: any) { return new kibana.Plugin({ - id: APP_ID, + id: 'infra', configPrefix: 'xpack.infra', - publicDir: resolve(__dirname, 'public'), - require: ['kibana', 'elasticsearch', 'metrics'], + require: ['kibana', 'elasticsearch'], uiExports: { - app: { - description: i18n.translate('xpack.infra.infrastructureDescription', { - defaultMessage: 'Explore your metrics', - }), - icon: 'plugins/infra/images/infra_mono_white.svg', - main: 'plugins/infra/app', - title: i18n.translate('xpack.infra.infrastructureTitle', { - defaultMessage: 'Metrics', - }), - listed: false, - url: `/app/${APP_ID}#/infrastructure`, - }, - styleSheetPaths: resolve(__dirname, 'public/index.scss'), - home: ['plugins/infra/legacy_register_feature'], - links: [ - { - description: i18n.translate('xpack.infra.linkInfrastructureDescription', { - defaultMessage: 'Explore your metrics', - }), - icon: 'plugins/infra/images/infra_mono_white.svg', - euiIconType: 'metricsApp', - id: 'infra:home', - order: 8000, - title: i18n.translate('xpack.infra.linkInfrastructureTitle', { - defaultMessage: 'Metrics', - }), - url: `/app/${APP_ID}#/infrastructure`, - category: DEFAULT_APP_CATEGORIES.observability, - }, - { - description: i18n.translate('xpack.infra.linkLogsDescription', { - defaultMessage: 'Explore your logs', - }), - icon: 'plugins/infra/images/logging_mono_white.svg', - euiIconType: 'logsApp', - id: 'infra:logs', - order: 8001, - title: i18n.translate('xpack.infra.linkLogsTitle', { - defaultMessage: 'Logs', - }), - url: `/app/${APP_ID}#/logs`, - category: DEFAULT_APP_CATEGORIES.observability, - }, - ], mappings: savedObjectMappings, }, - config(Joi: typeof JoiNamespace) { - return getConfigSchema(Joi); - }, - init(legacyServer: any) { - const { newPlatform } = legacyServer as KbnServer; - const { core, plugins } = newPlatform.setup; - - const infraSetup = (plugins.infra as unknown) as InfraSetup; // chef's kiss - - const initContext = ({ - config: infraSetup.__legacy.config, - } as unknown) as PluginInitializerContext; - // NP_TODO: Use real types from the other plugins as they are migrated - const pluginDeps: InfraServerPluginDeps = { - home: legacyServer.newPlatform.setup.plugins.home, - usageCollection: plugins.usageCollection as UsageCollectionSetup, - indexPatterns: { - indexPatternsServiceFactory: legacyServer.indexPatternsServiceFactory, - }, - metrics: plugins.metrics as VisTypeTimeseriesSetup, - spaces: plugins.spaces as SpacesPluginSetup, - features: plugins.features as FeaturesPluginSetup, - apm: plugins.apm as APMPluginContract, - }; - - const infraPluginInstance = plugin(initContext); - infraPluginInstance.setup(core, pluginDeps); - - // NP_TODO: EVERYTHING BELOW HERE IS LEGACY - - const libs = infraPluginInstance.getLibs(); - - // NP_NOTE: Left here for now for legacy plugins to consume - legacyServer.expose( - 'defineInternalSourceConfiguration', - libs.sources.defineInternalSourceConfiguration.bind(libs.sources) - ); + config(Joi: Root) { + return Joi.object({ + enabled: Joi.boolean().default(true), + }) + .unknown() + .default(); }, }); } diff --git a/x-pack/legacy/plugins/infra/package.json b/x-pack/legacy/plugins/infra/package.json deleted file mode 100644 index 7aa8cb9b5269a..0000000000000 --- a/x-pack/legacy/plugins/infra/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "author": "Elastic", - "name": "infra", - "version": "7.0.0", - "private": true, - "license": "Elastic-License", - "scripts": { - "build-graphql-types": "node scripts/generate_types_from_graphql.js" - }, - "devDependencies": { - "@types/boom": "7.2.1", - "@types/lodash": "^4.14.110" - }, - "dependencies": { - "@types/color": "^3.0.0", - "boom": "7.3.0", - "lodash": "^4.17.15" - } -} diff --git a/x-pack/legacy/plugins/infra/public/app.ts b/x-pack/legacy/plugins/infra/public/app.ts deleted file mode 100644 index 7a13d3a59cc0d..0000000000000 --- a/x-pack/legacy/plugins/infra/public/app.ts +++ /dev/null @@ -1,56 +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; - * you may not use this file except in compliance with the Elastic License. - */ - -// NP_TODO: This app.ts layer is needed until we migrate 100% to the NP. -// This is so other plugins can import from our public/index file without trying to -// actually mount and run our application. Once in the NP this won't be an issue -// as the NP will look for an export named "plugin" and run that from the index file. - -import { npStart, npSetup } from 'ui/new_platform'; -import { PluginInitializerContext } from 'kibana/public'; -import chrome from 'ui/chrome'; -// @ts-ignore -import { uiModules } from 'ui/modules'; -import uiRoutes from 'ui/routes'; -// @ts-ignore -import { timezoneProvider } from 'ui/vis/lib/timezone'; -import { plugin } from './new_platform_index'; - -const ROOT_ELEMENT_ID = 'react-infra-root'; -export { ROOT_ELEMENT_ID }; - -const { core, plugins } = npStart; -const __LEGACY = { - uiModules, - uiRoutes, - timezoneProvider, -}; -// This will be moved to core.application.register when the new platform -// migration is complete. -// @ts-ignore -chrome.setRootTemplate(` -
-`); - -const checkForRoot = () => { - return new Promise(resolve => { - const ready = !!document.getElementById(ROOT_ELEMENT_ID); - if (ready) { - resolve(); - } else { - setTimeout(() => resolve(checkForRoot()), 10); - } - }); -}; - -checkForRoot().then(() => { - const pluginInstance = plugin({} as PluginInitializerContext); - pluginInstance.setup(npSetup.core, { home: npSetup.plugins.home }); - pluginInstance.start(core, plugins, __LEGACY); -}); diff --git a/x-pack/legacy/plugins/infra/public/hooks/use_track_metric.tsx b/x-pack/legacy/plugins/infra/public/hooks/use_track_metric.tsx deleted file mode 100644 index c5945ab808202..0000000000000 --- a/x-pack/legacy/plugins/infra/public/hooks/use_track_metric.tsx +++ /dev/null @@ -1,89 +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; - * you may not use this file except in compliance with the Elastic License. - */ - -import { useEffect } from 'react'; -import { - createUiStatsReporter, - UiStatsMetricType, - METRIC_TYPE, -} from '../../../../../../src/legacy/core_plugins/ui_metric/public'; - -/** - * Note: The UI Metric plugin will take care of sending this data to the telemetry server. - * You can find these metrics stored at: - * stack_stats.kibana.plugins.ui_metric.{app}.{metric}(__delayed_{n}ms)? - * which will be an array of objects each containing a key, representing the metric, and - * a value, which will be a counter - */ - -type ObservabilityApp = 'infra_metrics' | 'infra_logs' | 'apm' | 'uptime'; - -const trackerCache = new Map>(); - -function getTrackerForApp(app: string) { - const cached = trackerCache.get(app); - if (cached) { - return cached; - } - - const tracker = createUiStatsReporter(app); - trackerCache.set(app, tracker); - - return tracker; -} - -interface TrackOptions { - app: ObservabilityApp; - metricType?: UiStatsMetricType; - delay?: number; // in ms -} -type EffectDeps = unknown[]; - -type TrackMetricOptions = TrackOptions & { metric: string }; - -export { METRIC_TYPE }; -export function useTrackMetric( - { app, metric, metricType = METRIC_TYPE.COUNT, delay = 0 }: TrackMetricOptions, - effectDependencies: EffectDeps = [] -) { - useEffect(() => { - let decoratedMetric = metric; - if (delay > 0) { - decoratedMetric += `__delayed_${delay}ms`; - } - const trackUiMetric = getTrackerForApp(app); - const id = setTimeout(() => trackUiMetric(metricType, decoratedMetric), Math.max(delay, 0)); - return () => clearTimeout(id); - - // the dependencies are managed externally - // eslint-disable-next-line react-hooks/exhaustive-deps - }, effectDependencies); -} - -/** - * useTrackPageview is a convenience wrapper for tracking a pageview - * Its metrics will be found at: - * stack_stats.kibana.plugins.ui_metric.{app}.pageview__{path}(__delayed_{n}ms)? - */ -type TrackPageviewProps = TrackOptions & { path: string }; - -export function useTrackPageview( - { path, ...rest }: TrackPageviewProps, - effectDependencies: EffectDeps = [] -) { - useTrackMetric({ ...rest, metric: `pageview__${path}` }, effectDependencies); -} - -interface TrackEventProps { - app: ObservabilityApp; - name: string; - metricType?: UiStatsMetricType; -} - -export function trackEvent({ app, name, metricType = METRIC_TYPE.CLICK }: TrackEventProps) { - const trackUiMetric = getTrackerForApp(app); - trackUiMetric(metricType, `event__${name}`); -} diff --git a/x-pack/legacy/plugins/infra/public/index.ts b/x-pack/legacy/plugins/infra/public/index.ts deleted file mode 100644 index 5e68ca85681fe..0000000000000 --- a/x-pack/legacy/plugins/infra/public/index.ts +++ /dev/null @@ -1,14 +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; - * you may not use this file except in compliance with the Elastic License. - */ - -// NP_NOTE: Whilst we are in the transition period of the NP migration, this index file -// is exclusively for our static code exports that other plugins (e.g. APM) use. -// When we switch over to the real NP, and an export of "plugin" is expected and called, -// we can do away with the middle "app.ts" layer. The "app.ts" layer is needed for now, -// and needs to be situated differently to this index file, so that our code for setting the root template -// and attempting to start the app doesn't try to run just because another plugin is importing from this file. - -export { useTrackPageview } from './hooks/use_track_metric'; diff --git a/x-pack/legacy/plugins/infra/public/legacy_register_feature.ts b/x-pack/legacy/plugins/infra/public/legacy_register_feature.ts deleted file mode 100644 index 7b10a1e062f75..0000000000000 --- a/x-pack/legacy/plugins/infra/public/legacy_register_feature.ts +++ /dev/null @@ -1,15 +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; - * you may not use this file except in compliance with the Elastic License. - */ - -import { npSetup } from 'ui/new_platform'; -import { featureCatalogueEntries } from './feature_catalogue_entry'; - -const { - plugins: { home }, -} = npSetup; - -home.featureCatalogue.register(featureCatalogueEntries.metrics); -home.featureCatalogue.register(featureCatalogueEntries.logs); diff --git a/x-pack/legacy/plugins/infra/public/new_platform_plugin.ts b/x-pack/legacy/plugins/infra/public/new_platform_plugin.ts deleted file mode 100644 index f438b65794653..0000000000000 --- a/x-pack/legacy/plugins/infra/public/new_platform_plugin.ts +++ /dev/null @@ -1,74 +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; - * you may not use this file except in compliance with the Elastic License. - */ -import { CoreStart, CoreSetup, PluginInitializerContext } from 'kibana/public'; -import { InMemoryCache, IntrospectionFragmentMatcher } from 'apollo-cache-inmemory'; -import ApolloClient from 'apollo-client'; -import { ApolloLink } from 'apollo-link'; -import { HttpLink } from 'apollo-link-http'; -import { withClientState } from 'apollo-link-state'; -import { startApp } from './apps/start_app'; -import { InfraFrontendLibs } from './lib/lib'; -import introspectionQueryResultData from './graphql/introspection.json'; -import { InfraKibanaObservableApiAdapter } from './lib/adapters/observable_api/kibana_observable_api'; -import { HomePublicPluginSetup } from '../../../../../src/plugins/home/public'; -import { featureCatalogueEntries } from './feature_catalogue_entry'; - -type ClientPlugins = any; -type LegacyDeps = any; -interface InfraPluginSetupDependencies { - home: HomePublicPluginSetup; -} - -export class Plugin { - constructor(context: PluginInitializerContext) {} - - setup(core: CoreSetup, { home }: InfraPluginSetupDependencies) { - home.featureCatalogue.register(featureCatalogueEntries.metrics); - home.featureCatalogue.register(featureCatalogueEntries.logs); - } - - start(core: CoreStart, plugins: ClientPlugins, __LEGACY: LegacyDeps) { - startApp(this.composeLibs(core, plugins, __LEGACY), core, plugins); - } - - composeLibs(core: CoreStart, plugins: ClientPlugins, legacy: LegacyDeps) { - const cache = new InMemoryCache({ - addTypename: false, - fragmentMatcher: new IntrospectionFragmentMatcher({ - introspectionQueryResultData, - }), - }); - - const observableApi = new InfraKibanaObservableApiAdapter({ - basePath: core.http.basePath.get(), - }); - - const graphQLOptions = { - cache, - link: ApolloLink.from([ - withClientState({ - cache, - resolvers: {}, - }), - new HttpLink({ - credentials: 'same-origin', - headers: { - 'kbn-xsrf': true, - }, - uri: `${core.http.basePath.get()}/api/infra/graphql`, - }), - ]), - }; - - const apolloClient = new ApolloClient(graphQLOptions); - - const libs: InfraFrontendLibs = { - apolloClient, - observableApi, - }; - return libs; - } -} diff --git a/x-pack/legacy/plugins/infra/public/routes.tsx b/x-pack/legacy/plugins/infra/public/routes.tsx deleted file mode 100644 index fd69c6e842448..0000000000000 --- a/x-pack/legacy/plugins/infra/public/routes.tsx +++ /dev/null @@ -1,66 +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; - * you may not use this file except in compliance with the Elastic License. - */ - -import { History } from 'history'; -import React from 'react'; -import { Route, Router, Switch } from 'react-router-dom'; - -import { NotFoundPage } from './pages/404'; -import { InfrastructurePage } from './pages/infrastructure'; -import { LinkToPage } from './pages/link_to'; -import { LogsPage } from './pages/logs'; -import { MetricDetail } from './pages/metrics'; -import { RedirectWithQueryParams } from './utils/redirect_with_query_params'; -import { useKibana } from '../../../../../src/plugins/kibana_react/public'; - -interface RouterProps { - history: History; -} - -export const PageRouter: React.FC = ({ history }) => { - const uiCapabilities = useKibana().services.application?.capabilities; - return ( - - - {uiCapabilities?.infrastructure?.show && ( - - )} - {uiCapabilities?.infrastructure?.show && ( - - )} - {uiCapabilities?.infrastructure?.show && ( - - )} - {uiCapabilities?.infrastructure?.show && ( - - )} - {uiCapabilities?.infrastructure?.show && ( - - )} - {uiCapabilities?.infrastructure?.show && ( - - )} - {uiCapabilities?.logs?.show && ( - - )} - {uiCapabilities?.logs?.show && } - {uiCapabilities?.infrastructure?.show && ( - - )} - - - - - ); -}; diff --git a/x-pack/legacy/plugins/infra/public/utils/fetch.ts b/x-pack/legacy/plugins/infra/public/utils/fetch.ts deleted file mode 100644 index 50afc64bb5b78..0000000000000 --- a/x-pack/legacy/plugins/infra/public/utils/fetch.ts +++ /dev/null @@ -1,17 +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; - * you may not use this file except in compliance with the Elastic License. - */ - -import axios from 'axios'; -const FETCH_TIMEOUT = 30000; - -export const fetch = axios.create({ - headers: { - Accept: 'application/json', - 'Content-Type': 'application/json', - 'kbn-xsrf': 'professionally-crafted-string-of-text', - }, - timeout: FETCH_TIMEOUT, -}); diff --git a/x-pack/legacy/plugins/infra/public/utils/use_kibana_injected_var.ts b/x-pack/legacy/plugins/infra/public/utils/use_kibana_injected_var.ts deleted file mode 100644 index 4afcb4fd88430..0000000000000 --- a/x-pack/legacy/plugins/infra/public/utils/use_kibana_injected_var.ts +++ /dev/null @@ -1,18 +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; - * you may not use this file except in compliance with the Elastic License. - */ - -import { npSetup } from 'ui/new_platform'; - -/** - * This hook provides access to the "injected variables" provided by the - * platform. While it doesn't need to be a hook right now, it has been written - * as one in order to keep the API stable despite the upcoming injection - * through the context after the new platform migration. - */ -export const useKibanaInjectedVar = (name: string, defaultValue?: unknown) => { - const injectedMetadata = npSetup.core.injectedMetadata; - return injectedMetadata.getInjectedVar(name, defaultValue); -}; diff --git a/x-pack/legacy/plugins/infra/server/new_platform_index.ts b/x-pack/legacy/plugins/infra/server/new_platform_index.ts deleted file mode 100644 index e59897a6b241d..0000000000000 --- a/x-pack/legacy/plugins/infra/server/new_platform_index.ts +++ /dev/null @@ -1,15 +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; - * you may not use this file except in compliance with the Elastic License. - */ - -import { PluginInitializerContext } from 'src/core/server'; -import { InfraServerPlugin, InfraPluginSetup } from './new_platform_plugin'; -import { config, InfraConfig } from '../../../../plugins/infra/server'; -import { InfraServerPluginDeps } from './lib/adapters/framework'; -export { config, InfraConfig, InfraServerPluginDeps, InfraPluginSetup }; - -export function plugin(context: PluginInitializerContext) { - return new InfraServerPlugin(context); -} diff --git a/x-pack/legacy/plugins/infra/server/new_platform_plugin.ts b/x-pack/legacy/plugins/infra/server/new_platform_plugin.ts deleted file mode 100644 index d3c6f7a5f70a1..0000000000000 --- a/x-pack/legacy/plugins/infra/server/new_platform_plugin.ts +++ /dev/null @@ -1,137 +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; - * you may not use this file except in compliance with the Elastic License. - */ -import { CoreSetup, PluginInitializerContext } from 'src/core/server'; -import { i18n } from '@kbn/i18n'; -import { Server } from 'hapi'; -import { InfraConfig } from '../../../../plugins/infra/server'; -import { initInfraServer } from './infra_server'; -import { InfraBackendLibs, InfraDomainLibs } from './lib/infra_types'; -import { FrameworkFieldsAdapter } from './lib/adapters/fields/framework_fields_adapter'; -import { KibanaFramework } from './lib/adapters/framework/kibana_framework_adapter'; -import { InfraKibanaLogEntriesAdapter } from './lib/adapters/log_entries/kibana_log_entries_adapter'; -import { KibanaMetricsAdapter } from './lib/adapters/metrics/kibana_metrics_adapter'; -import { InfraElasticsearchSourceStatusAdapter } from './lib/adapters/source_status'; -import { InfraFieldsDomain } from './lib/domains/fields_domain'; -import { InfraLogEntriesDomain } from './lib/domains/log_entries_domain'; -import { InfraMetricsDomain } from './lib/domains/metrics_domain'; -import { LogEntryCategoriesAnalysis, LogEntryRateAnalysis } from './lib/log_analysis'; -import { InfraSnapshot } from './lib/snapshot'; -import { InfraSourceStatus } from './lib/source_status'; -import { InfraSources } from './lib/sources'; -import { InfraServerPluginDeps } from './lib/adapters/framework'; -import { METRICS_FEATURE, LOGS_FEATURE } from './features'; -import { UsageCollector } from './usage/usage_collector'; -import { APP_ID } from '../index'; -import { InfraStaticSourceConfiguration } from './lib/sources/types'; - -export interface KbnServer extends Server { - usage: any; -} - -const logsSampleDataLinkLabel = i18n.translate('xpack.infra.sampleDataLinkLabel', { - defaultMessage: 'Logs', -}); - -export interface InfraPluginSetup { - defineInternalSourceConfiguration: ( - sourceId: string, - sourceProperties: InfraStaticSourceConfiguration - ) => void; -} - -const DEFAULT_CONFIG: InfraConfig = { - enabled: true, - query: { - partitionSize: 75, - partitionFactor: 1.2, - }, -}; - -export class InfraServerPlugin { - public config: InfraConfig = DEFAULT_CONFIG; - public libs: InfraBackendLibs | undefined; - - constructor(context: PluginInitializerContext) { - const config$ = context.config.create(); - config$.subscribe(configValue => { - this.config = { - ...DEFAULT_CONFIG, - enabled: configValue.enabled, - query: { - ...DEFAULT_CONFIG.query, - ...configValue.query, - }, - }; - }); - } - - getLibs() { - if (!this.libs) { - throw new Error('libs not set up yet'); - } - return this.libs; - } - - setup(core: CoreSetup, plugins: InfraServerPluginDeps) { - const framework = new KibanaFramework(core, this.config, plugins); - const sources = new InfraSources({ - config: this.config, - }); - const sourceStatus = new InfraSourceStatus( - new InfraElasticsearchSourceStatusAdapter(framework), - { - sources, - } - ); - const snapshot = new InfraSnapshot({ sources, framework }); - const logEntryCategoriesAnalysis = new LogEntryCategoriesAnalysis({ framework }); - const logEntryRateAnalysis = new LogEntryRateAnalysis({ framework }); - - // TODO: separate these out individually and do away with "domains" as a temporary group - const domainLibs: InfraDomainLibs = { - fields: new InfraFieldsDomain(new FrameworkFieldsAdapter(framework), { - sources, - }), - logEntries: new InfraLogEntriesDomain(new InfraKibanaLogEntriesAdapter(framework), { - sources, - }), - metrics: new InfraMetricsDomain(new KibanaMetricsAdapter(framework)), - }; - - this.libs = { - configuration: this.config, - framework, - logEntryCategoriesAnalysis, - logEntryRateAnalysis, - snapshot, - sources, - sourceStatus, - ...domainLibs, - }; - - plugins.features.registerFeature(METRICS_FEATURE); - plugins.features.registerFeature(LOGS_FEATURE); - - plugins.home.sampleData.addAppLinksToSampleDataset('logs', [ - { - path: `/app/${APP_ID}#/logs`, - label: logsSampleDataLinkLabel, - icon: 'logsApp', - }, - ]); - - initInfraServer(this.libs); - - // Telemetry - UsageCollector.registerUsageCollector(plugins.usageCollection); - - return { - defineInternalSourceConfiguration(sourceId, sourceProperties) { - sources.defineInternalSourceConfiguration(sourceId, sourceProperties); - }, - } as InfraPluginSetup; - } -} diff --git a/x-pack/legacy/plugins/infra/server/routes/metrics_explorer/types.ts b/x-pack/legacy/plugins/infra/server/routes/metrics_explorer/types.ts deleted file mode 100644 index f4c5e26c5c6d1..0000000000000 --- a/x-pack/legacy/plugins/infra/server/routes/metrics_explorer/types.ts +++ /dev/null @@ -1,36 +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; - * you may not use this file except in compliance with the Elastic License. - */ - -import * as rt from 'io-ts'; -import { - metricsExplorerMetricRT, - metricsExplorerPageInfoRT, - metricsExplorerColumnRT, - metricsExplorerRowRT, - metricsExplorerSeriesRT, - metricsExplorerRequestBodyRT, - metricsExplorerResponseRT, - metricsExplorerAggregationRT, - metricsExplorerColumnTypeRT, -} from '../../../common/http_api'; - -export type MetricsExplorerAggregation = rt.TypeOf; - -export type MetricsExplorerColumnType = rt.TypeOf; - -export type MetricsExplorerMetric = rt.TypeOf; - -export type MetricsExplorerPageInfo = rt.TypeOf; - -export type MetricsExplorerColumn = rt.TypeOf; - -export type MetricsExplorerRow = rt.TypeOf; - -export type MetricsExplorerSeries = rt.TypeOf; - -export type MetricsExplorerRequestBody = rt.TypeOf; - -export type MetricsExplorerResponse = rt.TypeOf; diff --git a/x-pack/legacy/plugins/infra/tsconfig.json b/x-pack/legacy/plugins/infra/tsconfig.json deleted file mode 100644 index 0a26f297882e4..0000000000000 --- a/x-pack/legacy/plugins/infra/tsconfig.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../../tsconfig.json", -} \ No newline at end of file diff --git a/x-pack/legacy/plugins/monitoring/public/components/logs/__snapshots__/logs.test.js.snap b/x-pack/legacy/plugins/monitoring/public/components/logs/__snapshots__/logs.test.js.snap index de02fb10a5937..a8eebdaf6aa39 100644 --- a/x-pack/legacy/plugins/monitoring/public/components/logs/__snapshots__/logs.test.js.snap +++ b/x-pack/legacy/plugins/monitoring/public/components/logs/__snapshots__/logs.test.js.snap @@ -13,7 +13,7 @@ exports[`Logs should render a link to filter by cluster uuid 1`] = ` values={ Object { "link": Logs , @@ -37,7 +37,7 @@ exports[`Logs should render a link to filter by cluster uuid and index uuid 1`] values={ Object { "link": Logs , @@ -61,7 +61,7 @@ exports[`Logs should render a link to filter by cluster uuid and node uuid 1`] = values={ Object { "link": Logs , @@ -287,7 +287,7 @@ exports[`Logs should render normally 1`] = ` values={ Object { "link": Logs , diff --git a/x-pack/legacy/plugins/monitoring/public/components/logs/logs.js b/x-pack/legacy/plugins/monitoring/public/components/logs/logs.js index 744ebb5a7ceb4..3590199048352 100644 --- a/x-pack/legacy/plugins/monitoring/public/components/logs/logs.js +++ b/x-pack/legacy/plugins/monitoring/public/components/logs/logs.js @@ -110,7 +110,7 @@ const clusterColumns = [ ]; function getLogsUiLink(clusterUuid, nodeId, indexUuid) { - const base = `${chrome.getBasePath()}/app/infra#/link-to/${INFRA_SOURCE_ID}/logs`; + const base = `${chrome.getBasePath()}/app/logs/link-to/${INFRA_SOURCE_ID}/logs`; const params = []; if (clusterUuid) { diff --git a/x-pack/legacy/plugins/uptime/public/lib/helper/observability_integration/__tests__/__snapshots__/get_infra_href.test.ts.snap b/x-pack/legacy/plugins/uptime/public/lib/helper/observability_integration/__tests__/__snapshots__/get_infra_href.test.ts.snap index 5094aab1226a1..e79eb50d384a8 100644 --- a/x-pack/legacy/plugins/uptime/public/lib/helper/observability_integration/__tests__/__snapshots__/get_infra_href.test.ts.snap +++ b/x-pack/legacy/plugins/uptime/public/lib/helper/observability_integration/__tests__/__snapshots__/get_infra_href.test.ts.snap @@ -1,19 +1,19 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`getInfraHref getInfraContainerHref creates a link for valid parameters 1`] = `"foo/app/infra#/link-to/container-detail/test-container-id"`; +exports[`getInfraHref getInfraContainerHref creates a link for valid parameters 1`] = `"foo/app/metrics/link-to/container-detail/test-container-id"`; -exports[`getInfraHref getInfraContainerHref does not specify a base path when none is available 1`] = `"/app/infra#/link-to/container-detail/test-container-id"`; +exports[`getInfraHref getInfraContainerHref does not specify a base path when none is available 1`] = `"/app/metrics/link-to/container-detail/test-container-id"`; -exports[`getInfraHref getInfraContainerHref returns the first item when multiple container ids are supplied 1`] = `"bar/app/infra#/link-to/container-detail/test-container-id"`; +exports[`getInfraHref getInfraContainerHref returns the first item when multiple container ids are supplied 1`] = `"bar/app/metrics/link-to/container-detail/test-container-id"`; -exports[`getInfraHref getInfraIpHref creates a link for valid parameters 1`] = `"bar/app/infra#/infrastructure/inventory?waffleFilter=(expression:'host.ip%20%3A%20151.101.202.217',kind:kuery)"`; +exports[`getInfraHref getInfraIpHref creates a link for valid parameters 1`] = `"bar/app/metrics/inventory?waffleFilter=(expression:'host.ip%20%3A%20151.101.202.217',kind:kuery)"`; -exports[`getInfraHref getInfraIpHref does not specify a base path when none is available 1`] = `"/app/infra#/infrastructure/inventory?waffleFilter=(expression:'host.ip%20%3A%20151.101.202.217',kind:kuery)"`; +exports[`getInfraHref getInfraIpHref does not specify a base path when none is available 1`] = `"/app/metrics/inventory?waffleFilter=(expression:'host.ip%20%3A%20151.101.202.217',kind:kuery)"`; -exports[`getInfraHref getInfraIpHref returns a url for ors between multiple ips 1`] = `"foo/app/infra#/infrastructure/inventory?waffleFilter=(expression:'host.ip%20%3A%20152.151.23.192%20or%20host.ip%20%3A%20151.101.202.217',kind:kuery)"`; +exports[`getInfraHref getInfraIpHref returns a url for ors between multiple ips 1`] = `"foo/app/metrics/inventory?waffleFilter=(expression:'host.ip%20%3A%20152.151.23.192%20or%20host.ip%20%3A%20151.101.202.217',kind:kuery)"`; -exports[`getInfraHref getInfraKubernetesHref creates a link for valid parameters 1`] = `"foo/app/infra#/link-to/pod-detail/test-pod-uid"`; +exports[`getInfraHref getInfraKubernetesHref creates a link for valid parameters 1`] = `"foo/app/metrics/link-to/pod-detail/test-pod-uid"`; -exports[`getInfraHref getInfraKubernetesHref does not specify a base path when none is available 1`] = `"/app/infra#/link-to/pod-detail/test-pod-uid"`; +exports[`getInfraHref getInfraKubernetesHref does not specify a base path when none is available 1`] = `"/app/metrics/link-to/pod-detail/test-pod-uid"`; -exports[`getInfraHref getInfraKubernetesHref selects the first pod uid when there are multiple 1`] = `"/app/infra#/link-to/pod-detail/test-pod-uid"`; +exports[`getInfraHref getInfraKubernetesHref selects the first pod uid when there are multiple 1`] = `"/app/metrics/link-to/pod-detail/test-pod-uid"`; diff --git a/x-pack/legacy/plugins/uptime/public/lib/helper/observability_integration/__tests__/__snapshots__/get_logging_href.test.ts.snap b/x-pack/legacy/plugins/uptime/public/lib/helper/observability_integration/__tests__/__snapshots__/get_logging_href.test.ts.snap index 67402d16d9a27..cfac6ce133c8a 100644 --- a/x-pack/legacy/plugins/uptime/public/lib/helper/observability_integration/__tests__/__snapshots__/get_logging_href.test.ts.snap +++ b/x-pack/legacy/plugins/uptime/public/lib/helper/observability_integration/__tests__/__snapshots__/get_logging_href.test.ts.snap @@ -1,13 +1,13 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`getLoggingHref creates a container href with base path when present 1`] = `"bar/app/infra#/logs?logFilter=(expression:'container.id%20:%20test-container-id',kind:kuery)"`; +exports[`getLoggingHref creates a container href with base path when present 1`] = `"bar/app/logs?logFilter=(expression:'container.id%20:%20test-container-id',kind:kuery)"`; -exports[`getLoggingHref creates a container href without a base path if it's an empty string 1`] = `"/app/infra#/logs?logFilter=(expression:'container.id%20:%20test-container-id',kind:kuery)"`; +exports[`getLoggingHref creates a container href without a base path if it's an empty string 1`] = `"/app/logs?logFilter=(expression:'container.id%20:%20test-container-id',kind:kuery)"`; -exports[`getLoggingHref creates a pod href with base path when present 1`] = `"bar/app/infra#/logs?logFilter=(expression:'pod.uid%20:%20test-pod-id',kind:kuery)"`; +exports[`getLoggingHref creates a pod href with base path when present 1`] = `"bar/app/logs?logFilter=(expression:'pod.uid%20:%20test-pod-id',kind:kuery)"`; -exports[`getLoggingHref creates a pod href without a base path when it's an empty string 1`] = `"/app/infra#/logs?logFilter=(expression:'pod.uid%20:%20test-pod-id',kind:kuery)"`; +exports[`getLoggingHref creates a pod href without a base path when it's an empty string 1`] = `"/app/logs?logFilter=(expression:'pod.uid%20:%20test-pod-id',kind:kuery)"`; -exports[`getLoggingHref creates an ip href with base path when present 1`] = `"bar/app/infra#/logs?logFilter=(expression:'pod.uid%20:%20test-pod-id',kind:kuery)"`; +exports[`getLoggingHref creates an ip href with base path when present 1`] = `"bar/app/logs?logFilter=(expression:'pod.uid%20:%20test-pod-id',kind:kuery)"`; -exports[`getLoggingHref creates an ip href without a base path when it's an empty string 1`] = `"/app/infra#/logs?logFilter=(expression:'host.ip%20%3A%20151.101.202.217',kind:kuery)"`; +exports[`getLoggingHref creates an ip href without a base path when it's an empty string 1`] = `"/app/logs?logFilter=(expression:'host.ip%20%3A%20151.101.202.217',kind:kuery)"`; diff --git a/x-pack/legacy/plugins/uptime/public/lib/helper/observability_integration/get_infra_href.ts b/x-pack/legacy/plugins/uptime/public/lib/helper/observability_integration/get_infra_href.ts index 12b51bbad0074..73065be395c76 100644 --- a/x-pack/legacy/plugins/uptime/public/lib/helper/observability_integration/get_infra_href.ts +++ b/x-pack/legacy/plugins/uptime/public/lib/helper/observability_integration/get_infra_href.ts @@ -17,7 +17,10 @@ export const getInfraContainerHref = ( return undefined; } const ret = !Array.isArray(value) ? value : value[0]; - return addBasePath(basePath, `/app/infra#/link-to/container-detail/${encodeURIComponent(ret)}`); + return addBasePath( + basePath, + `/app/metrics/link-to/container-detail/${encodeURIComponent(ret)}` + ); }; return buildHref(summary.state.checks || [], 'container.id', getHref); }; @@ -31,7 +34,7 @@ export const getInfraKubernetesHref = ( return undefined; } const ret = !Array.isArray(value) ? value : value[0]; - return addBasePath(basePath, `/app/infra#/link-to/pod-detail/${encodeURIComponent(ret)}`); + return addBasePath(basePath, `/app/metrics/link-to/pod-detail/${encodeURIComponent(ret)}`); }; return buildHref(summary.state.checks || [], 'kubernetes.pod.uid', getHref); @@ -46,7 +49,7 @@ export const getInfraIpHref = (summary: MonitorSummary, basePath: string) => { const expression = encodeURIComponent(`host.ip : ${value}`); return addBasePath( basePath, - `/app/infra#/infrastructure/inventory?waffleFilter=(expression:'${expression}',kind:kuery)` + `/app/metrics/inventory?waffleFilter=(expression:'${expression}',kind:kuery)` ); } const ips = value.reduce( @@ -57,9 +60,7 @@ export const getInfraIpHref = (summary: MonitorSummary, basePath: string) => { ? undefined : addBasePath( basePath, - `/app/infra#/infrastructure/inventory?waffleFilter=(expression:'${encodeURIComponent( - ips - )}',kind:kuery)` + `/app/metrics/inventory?waffleFilter=(expression:'${encodeURIComponent(ips)}',kind:kuery)` ); }; return buildHref(summary.state.checks || [], 'monitor.ip', getHref); diff --git a/x-pack/legacy/plugins/uptime/public/lib/helper/observability_integration/get_logging_href.ts b/x-pack/legacy/plugins/uptime/public/lib/helper/observability_integration/get_logging_href.ts index b2235231028fc..b97b5a34855fb 100644 --- a/x-pack/legacy/plugins/uptime/public/lib/helper/observability_integration/get_logging_href.ts +++ b/x-pack/legacy/plugins/uptime/public/lib/helper/observability_integration/get_logging_href.ts @@ -19,7 +19,7 @@ export const getLoggingContainerHref = ( const ret = !Array.isArray(value) ? value : value[0]; return addBasePath( basePath, - `/app/infra#/logs?logFilter=${encodeURI(`(expression:'container.id : ${ret}',kind:kuery)`)}` + `/app/logs?logFilter=${encodeURI(`(expression:'container.id : ${ret}',kind:kuery)`)}` ); }; return buildHref(summary.state.checks || [], 'container.id', getHref); @@ -33,7 +33,7 @@ export const getLoggingKubernetesHref = (summary: MonitorSummary, basePath: stri const ret = !Array.isArray(value) ? value : value[0]; return addBasePath( basePath, - `/app/infra#/logs?logFilter=${encodeURI(`(expression:'pod.uid : ${ret}',kind:kuery)`)}` + `/app/logs?logFilter=${encodeURI(`(expression:'pod.uid : ${ret}',kind:kuery)`)}` ); }; return buildHref(summary.state.checks || [], 'kubernetes.pod.uid', getHref); @@ -47,9 +47,7 @@ export const getLoggingIpHref = (summary: MonitorSummary, basePath: string) => { const ret = !Array.isArray(value) ? value : value[0]; return addBasePath( basePath, - `/app/infra#/logs?logFilter=(expression:'${encodeURIComponent( - `host.ip : ${ret}` - )}',kind:kuery)` + `/app/logs?logFilter=(expression:'${encodeURIComponent(`host.ip : ${ret}`)}',kind:kuery)` ); }; return buildHref(summary.state.checks || [], 'monitor.ip', getHref); diff --git a/x-pack/legacy/plugins/uptime/public/pages/monitor.tsx b/x-pack/legacy/plugins/uptime/public/pages/monitor.tsx index 1d45c7b7ab99b..380cc041ae87e 100644 --- a/x-pack/legacy/plugins/uptime/public/pages/monitor.tsx +++ b/x-pack/legacy/plugins/uptime/public/pages/monitor.tsx @@ -10,7 +10,7 @@ import { useParams } from 'react-router-dom'; import { MonitorCharts, PingList } from '../components/functional'; import { UptimeRefreshContext, UptimeThemeContext } from '../contexts'; import { useUptimeTelemetry, useUrlParams, UptimePage } from '../hooks'; -import { useTrackPageview } from '../../../infra/public'; +import { useTrackPageview } from '../../../../../plugins/observability/public'; import { MonitorStatusDetails } from '../components/connected'; export const MonitorPage = () => { diff --git a/x-pack/legacy/plugins/uptime/public/pages/overview.tsx b/x-pack/legacy/plugins/uptime/public/pages/overview.tsx index 5360d66f87e99..cf3631eda042a 100644 --- a/x-pack/legacy/plugins/uptime/public/pages/overview.tsx +++ b/x-pack/legacy/plugins/uptime/public/pages/overview.tsx @@ -15,7 +15,7 @@ import { } from '../components/functional'; import { useUrlParams, useUptimeTelemetry, UptimePage } from '../hooks'; import { stringifyUrlParams } from '../lib/helper/stringify_url_params'; -import { useTrackPageview } from '../../../infra/public'; +import { useTrackPageview } from '../../../../../plugins/observability/public'; import { DataPublicPluginSetup, IIndexPattern } from '../../../../../../src/plugins/data/public'; import { UptimeThemeContext } from '../contexts'; import { FilterGroup, KueryBar } from '../components/connected'; diff --git a/x-pack/legacy/plugins/infra/README.md b/x-pack/plugins/infra/README.md similarity index 100% rename from x-pack/legacy/plugins/infra/README.md rename to x-pack/plugins/infra/README.md diff --git a/x-pack/legacy/plugins/infra/common/color_palette.test.ts b/x-pack/plugins/infra/common/color_palette.test.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/color_palette.test.ts rename to x-pack/plugins/infra/common/color_palette.test.ts diff --git a/x-pack/legacy/plugins/infra/common/color_palette.ts b/x-pack/plugins/infra/common/color_palette.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/color_palette.ts rename to x-pack/plugins/infra/common/color_palette.ts diff --git a/x-pack/legacy/plugins/infra/common/ecs_allowed_list.test.ts b/x-pack/plugins/infra/common/ecs_allowed_list.test.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/ecs_allowed_list.test.ts rename to x-pack/plugins/infra/common/ecs_allowed_list.test.ts diff --git a/x-pack/legacy/plugins/infra/common/ecs_allowed_list.ts b/x-pack/plugins/infra/common/ecs_allowed_list.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/ecs_allowed_list.ts rename to x-pack/plugins/infra/common/ecs_allowed_list.ts diff --git a/x-pack/legacy/plugins/infra/common/errors/index.ts b/x-pack/plugins/infra/common/errors/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/errors/index.ts rename to x-pack/plugins/infra/common/errors/index.ts diff --git a/x-pack/legacy/plugins/infra/common/errors/metrics.ts b/x-pack/plugins/infra/common/errors/metrics.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/errors/metrics.ts rename to x-pack/plugins/infra/common/errors/metrics.ts diff --git a/x-pack/legacy/plugins/infra/common/graphql/root/index.ts b/x-pack/plugins/infra/common/graphql/root/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/graphql/root/index.ts rename to x-pack/plugins/infra/common/graphql/root/index.ts diff --git a/x-pack/legacy/plugins/infra/common/graphql/root/schema.gql.ts b/x-pack/plugins/infra/common/graphql/root/schema.gql.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/graphql/root/schema.gql.ts rename to x-pack/plugins/infra/common/graphql/root/schema.gql.ts diff --git a/x-pack/legacy/plugins/infra/common/graphql/shared/fragments.gql_query.ts b/x-pack/plugins/infra/common/graphql/shared/fragments.gql_query.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/graphql/shared/fragments.gql_query.ts rename to x-pack/plugins/infra/common/graphql/shared/fragments.gql_query.ts diff --git a/x-pack/legacy/plugins/infra/common/graphql/shared/index.ts b/x-pack/plugins/infra/common/graphql/shared/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/graphql/shared/index.ts rename to x-pack/plugins/infra/common/graphql/shared/index.ts diff --git a/x-pack/legacy/plugins/infra/common/graphql/shared/schema.gql.ts b/x-pack/plugins/infra/common/graphql/shared/schema.gql.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/graphql/shared/schema.gql.ts rename to x-pack/plugins/infra/common/graphql/shared/schema.gql.ts diff --git a/x-pack/legacy/plugins/infra/common/graphql/types.ts b/x-pack/plugins/infra/common/graphql/types.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/graphql/types.ts rename to x-pack/plugins/infra/common/graphql/types.ts diff --git a/x-pack/legacy/plugins/infra/common/http_api/index.ts b/x-pack/plugins/infra/common/http_api/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/http_api/index.ts rename to x-pack/plugins/infra/common/http_api/index.ts diff --git a/x-pack/legacy/plugins/infra/common/http_api/inventory_meta_api.ts b/x-pack/plugins/infra/common/http_api/inventory_meta_api.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/http_api/inventory_meta_api.ts rename to x-pack/plugins/infra/common/http_api/inventory_meta_api.ts diff --git a/x-pack/plugins/infra/common/http_api/ip_to_hostname/index.ts b/x-pack/plugins/infra/common/http_api/ip_to_hostname/index.ts new file mode 100644 index 0000000000000..4ebd5fdda6f99 --- /dev/null +++ b/x-pack/plugins/infra/common/http_api/ip_to_hostname/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; + * you may not use this file except in compliance with the Elastic License. + */ + +export interface IpToHostResponse { + host: string; +} diff --git a/x-pack/legacy/plugins/infra/common/http_api/log_analysis/index.ts b/x-pack/plugins/infra/common/http_api/log_analysis/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/http_api/log_analysis/index.ts rename to x-pack/plugins/infra/common/http_api/log_analysis/index.ts diff --git a/x-pack/legacy/plugins/infra/common/http_api/log_analysis/results/index.ts b/x-pack/plugins/infra/common/http_api/log_analysis/results/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/http_api/log_analysis/results/index.ts rename to x-pack/plugins/infra/common/http_api/log_analysis/results/index.ts diff --git a/x-pack/legacy/plugins/infra/common/http_api/log_analysis/results/log_entry_categories.ts b/x-pack/plugins/infra/common/http_api/log_analysis/results/log_entry_categories.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/http_api/log_analysis/results/log_entry_categories.ts rename to x-pack/plugins/infra/common/http_api/log_analysis/results/log_entry_categories.ts diff --git a/x-pack/legacy/plugins/infra/common/http_api/log_analysis/results/log_entry_category_datasets.ts b/x-pack/plugins/infra/common/http_api/log_analysis/results/log_entry_category_datasets.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/http_api/log_analysis/results/log_entry_category_datasets.ts rename to x-pack/plugins/infra/common/http_api/log_analysis/results/log_entry_category_datasets.ts diff --git a/x-pack/legacy/plugins/infra/common/http_api/log_analysis/results/log_entry_rate.ts b/x-pack/plugins/infra/common/http_api/log_analysis/results/log_entry_rate.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/http_api/log_analysis/results/log_entry_rate.ts rename to x-pack/plugins/infra/common/http_api/log_analysis/results/log_entry_rate.ts diff --git a/x-pack/legacy/plugins/infra/common/http_api/log_analysis/validation/index.ts b/x-pack/plugins/infra/common/http_api/log_analysis/validation/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/http_api/log_analysis/validation/index.ts rename to x-pack/plugins/infra/common/http_api/log_analysis/validation/index.ts diff --git a/x-pack/legacy/plugins/infra/common/http_api/log_analysis/validation/log_entry_rate_indices.ts b/x-pack/plugins/infra/common/http_api/log_analysis/validation/log_entry_rate_indices.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/http_api/log_analysis/validation/log_entry_rate_indices.ts rename to x-pack/plugins/infra/common/http_api/log_analysis/validation/log_entry_rate_indices.ts diff --git a/x-pack/legacy/plugins/infra/common/http_api/log_entries/common.ts b/x-pack/plugins/infra/common/http_api/log_entries/common.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/http_api/log_entries/common.ts rename to x-pack/plugins/infra/common/http_api/log_entries/common.ts diff --git a/x-pack/legacy/plugins/infra/common/http_api/log_entries/entries.ts b/x-pack/plugins/infra/common/http_api/log_entries/entries.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/http_api/log_entries/entries.ts rename to x-pack/plugins/infra/common/http_api/log_entries/entries.ts diff --git a/x-pack/legacy/plugins/infra/common/http_api/log_entries/highlights.ts b/x-pack/plugins/infra/common/http_api/log_entries/highlights.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/http_api/log_entries/highlights.ts rename to x-pack/plugins/infra/common/http_api/log_entries/highlights.ts diff --git a/x-pack/legacy/plugins/infra/common/http_api/log_entries/index.ts b/x-pack/plugins/infra/common/http_api/log_entries/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/http_api/log_entries/index.ts rename to x-pack/plugins/infra/common/http_api/log_entries/index.ts diff --git a/x-pack/legacy/plugins/infra/common/http_api/log_entries/item.ts b/x-pack/plugins/infra/common/http_api/log_entries/item.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/http_api/log_entries/item.ts rename to x-pack/plugins/infra/common/http_api/log_entries/item.ts diff --git a/x-pack/legacy/plugins/infra/common/http_api/log_entries/summary.ts b/x-pack/plugins/infra/common/http_api/log_entries/summary.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/http_api/log_entries/summary.ts rename to x-pack/plugins/infra/common/http_api/log_entries/summary.ts diff --git a/x-pack/legacy/plugins/infra/common/http_api/log_entries/summary_highlights.ts b/x-pack/plugins/infra/common/http_api/log_entries/summary_highlights.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/http_api/log_entries/summary_highlights.ts rename to x-pack/plugins/infra/common/http_api/log_entries/summary_highlights.ts diff --git a/x-pack/legacy/plugins/infra/common/http_api/metadata_api.ts b/x-pack/plugins/infra/common/http_api/metadata_api.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/http_api/metadata_api.ts rename to x-pack/plugins/infra/common/http_api/metadata_api.ts diff --git a/x-pack/legacy/plugins/infra/common/http_api/metrics_explorer/index.ts b/x-pack/plugins/infra/common/http_api/metrics_explorer/index.ts similarity index 78% rename from x-pack/legacy/plugins/infra/common/http_api/metrics_explorer/index.ts rename to x-pack/plugins/infra/common/http_api/metrics_explorer/index.ts index c10f86c40ad46..93655f931f45d 100644 --- a/x-pack/legacy/plugins/infra/common/http_api/metrics_explorer/index.ts +++ b/x-pack/plugins/infra/common/http_api/metrics_explorer/index.ts @@ -94,3 +94,21 @@ export const metricsExplorerResponseRT = rt.type({ series: rt.array(metricsExplorerSeriesRT), pageInfo: metricsExplorerPageInfoRT, }); + +export type MetricsExplorerAggregation = rt.TypeOf; + +export type MetricsExplorerColumnType = rt.TypeOf; + +export type MetricsExplorerMetric = rt.TypeOf; + +export type MetricsExplorerPageInfo = rt.TypeOf; + +export type MetricsExplorerColumn = rt.TypeOf; + +export type MetricsExplorerRow = rt.TypeOf; + +export type MetricsExplorerSeries = rt.TypeOf; + +export type MetricsExplorerRequestBody = rt.TypeOf; + +export type MetricsExplorerResponse = rt.TypeOf; diff --git a/x-pack/legacy/plugins/infra/common/http_api/node_details_api.ts b/x-pack/plugins/infra/common/http_api/node_details_api.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/http_api/node_details_api.ts rename to x-pack/plugins/infra/common/http_api/node_details_api.ts diff --git a/x-pack/legacy/plugins/infra/common/http_api/shared/errors.ts b/x-pack/plugins/infra/common/http_api/shared/errors.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/http_api/shared/errors.ts rename to x-pack/plugins/infra/common/http_api/shared/errors.ts diff --git a/x-pack/legacy/plugins/infra/common/http_api/shared/index.ts b/x-pack/plugins/infra/common/http_api/shared/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/http_api/shared/index.ts rename to x-pack/plugins/infra/common/http_api/shared/index.ts diff --git a/x-pack/legacy/plugins/infra/common/http_api/shared/metric_statistics.ts b/x-pack/plugins/infra/common/http_api/shared/metric_statistics.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/http_api/shared/metric_statistics.ts rename to x-pack/plugins/infra/common/http_api/shared/metric_statistics.ts diff --git a/x-pack/legacy/plugins/infra/common/http_api/shared/time_range.ts b/x-pack/plugins/infra/common/http_api/shared/time_range.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/http_api/shared/time_range.ts rename to x-pack/plugins/infra/common/http_api/shared/time_range.ts diff --git a/x-pack/legacy/plugins/infra/common/http_api/shared/timing.ts b/x-pack/plugins/infra/common/http_api/shared/timing.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/http_api/shared/timing.ts rename to x-pack/plugins/infra/common/http_api/shared/timing.ts diff --git a/x-pack/legacy/plugins/infra/common/http_api/snapshot_api.ts b/x-pack/plugins/infra/common/http_api/snapshot_api.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/http_api/snapshot_api.ts rename to x-pack/plugins/infra/common/http_api/snapshot_api.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_ec2/index.ts b/x-pack/plugins/infra/common/inventory_models/aws_ec2/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_ec2/index.ts rename to x-pack/plugins/infra/common/inventory_models/aws_ec2/index.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_ec2/layout.tsx b/x-pack/plugins/infra/common/inventory_models/aws_ec2/layout.tsx similarity index 89% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_ec2/layout.tsx rename to x-pack/plugins/infra/common/inventory_models/aws_ec2/layout.tsx index a3074b78f9f3b..c8e0680287526 100644 --- a/x-pack/legacy/plugins/infra/common/inventory_models/aws_ec2/layout.tsx +++ b/x-pack/plugins/infra/common/inventory_models/aws_ec2/layout.tsx @@ -5,12 +5,19 @@ */ import React from 'react'; import { i18n } from '@kbn/i18n'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { LayoutPropsWithTheme } from '../../../public/pages/metrics/types'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { Section } from '../../../public/pages/metrics/components/section'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { SubSection } from '../../../public/pages/metrics/components/sub_section'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { LayoutContent } from '../../../public/pages/metrics/components/layout_content'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { ChartSectionVis } from '../../../public/pages/metrics/components/chart_section_vis'; -import { withTheme } from '../../../../../common/eui_styled_components'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { withTheme } from '../../../../observability/public'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { MetadataDetails } from '../../../public/pages/metrics/components/metadata_details'; export const Layout = withTheme(({ metrics, theme }: LayoutPropsWithTheme) => ( diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_ec2/metrics/index.ts b/x-pack/plugins/infra/common/inventory_models/aws_ec2/metrics/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_ec2/metrics/index.ts rename to x-pack/plugins/infra/common/inventory_models/aws_ec2/metrics/index.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_ec2/metrics/snapshot/cpu.ts b/x-pack/plugins/infra/common/inventory_models/aws_ec2/metrics/snapshot/cpu.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_ec2/metrics/snapshot/cpu.ts rename to x-pack/plugins/infra/common/inventory_models/aws_ec2/metrics/snapshot/cpu.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_ec2/metrics/snapshot/disk_io_read_bytes.ts b/x-pack/plugins/infra/common/inventory_models/aws_ec2/metrics/snapshot/disk_io_read_bytes.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_ec2/metrics/snapshot/disk_io_read_bytes.ts rename to x-pack/plugins/infra/common/inventory_models/aws_ec2/metrics/snapshot/disk_io_read_bytes.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_ec2/metrics/snapshot/disk_io_write_bytes.ts b/x-pack/plugins/infra/common/inventory_models/aws_ec2/metrics/snapshot/disk_io_write_bytes.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_ec2/metrics/snapshot/disk_io_write_bytes.ts rename to x-pack/plugins/infra/common/inventory_models/aws_ec2/metrics/snapshot/disk_io_write_bytes.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_ec2/metrics/snapshot/rx.ts b/x-pack/plugins/infra/common/inventory_models/aws_ec2/metrics/snapshot/rx.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_ec2/metrics/snapshot/rx.ts rename to x-pack/plugins/infra/common/inventory_models/aws_ec2/metrics/snapshot/rx.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_ec2/metrics/snapshot/tx.ts b/x-pack/plugins/infra/common/inventory_models/aws_ec2/metrics/snapshot/tx.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_ec2/metrics/snapshot/tx.ts rename to x-pack/plugins/infra/common/inventory_models/aws_ec2/metrics/snapshot/tx.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_ec2/metrics/tsvb/aws_ec2_cpu_utilization.ts b/x-pack/plugins/infra/common/inventory_models/aws_ec2/metrics/tsvb/aws_ec2_cpu_utilization.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_ec2/metrics/tsvb/aws_ec2_cpu_utilization.ts rename to x-pack/plugins/infra/common/inventory_models/aws_ec2/metrics/tsvb/aws_ec2_cpu_utilization.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_ec2/metrics/tsvb/aws_ec2_diskio_bytes.ts b/x-pack/plugins/infra/common/inventory_models/aws_ec2/metrics/tsvb/aws_ec2_diskio_bytes.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_ec2/metrics/tsvb/aws_ec2_diskio_bytes.ts rename to x-pack/plugins/infra/common/inventory_models/aws_ec2/metrics/tsvb/aws_ec2_diskio_bytes.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_ec2/metrics/tsvb/aws_ec2_network_traffic.ts b/x-pack/plugins/infra/common/inventory_models/aws_ec2/metrics/tsvb/aws_ec2_network_traffic.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_ec2/metrics/tsvb/aws_ec2_network_traffic.ts rename to x-pack/plugins/infra/common/inventory_models/aws_ec2/metrics/tsvb/aws_ec2_network_traffic.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_ec2/toolbar_items.tsx b/x-pack/plugins/infra/common/inventory_models/aws_ec2/toolbar_items.tsx similarity index 95% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_ec2/toolbar_items.tsx rename to x-pack/plugins/infra/common/inventory_models/aws_ec2/toolbar_items.tsx index 4b16728a52bec..683851fec4d77 100644 --- a/x-pack/legacy/plugins/infra/common/inventory_models/aws_ec2/toolbar_items.tsx +++ b/x-pack/plugins/infra/common/inventory_models/aws_ec2/toolbar_items.tsx @@ -5,6 +5,7 @@ */ import React from 'react'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { ToolbarProps } from '../../../public/components/inventory/toolbars/toolbar'; import { MetricsAndGroupByToolbarItems } from '../shared/compontents/metrics_and_groupby_toolbar_items'; import { CloudToolbarItems } from '../shared/compontents/cloud_toolbar_items'; diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_rds/index.ts b/x-pack/plugins/infra/common/inventory_models/aws_rds/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_rds/index.ts rename to x-pack/plugins/infra/common/inventory_models/aws_rds/index.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_rds/layout.tsx b/x-pack/plugins/infra/common/inventory_models/aws_rds/layout.tsx similarity index 93% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_rds/layout.tsx rename to x-pack/plugins/infra/common/inventory_models/aws_rds/layout.tsx index debb569fcd5bb..4bc4562ab2760 100644 --- a/x-pack/legacy/plugins/infra/common/inventory_models/aws_rds/layout.tsx +++ b/x-pack/plugins/infra/common/inventory_models/aws_rds/layout.tsx @@ -5,11 +5,17 @@ */ import React from 'react'; import { i18n } from '@kbn/i18n'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { LayoutPropsWithTheme } from '../../../public/pages/metrics/types'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { Section } from '../../../public/pages/metrics/components/section'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { SubSection } from '../../../public/pages/metrics/components/sub_section'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { ChartSectionVis } from '../../../public/pages/metrics/components/chart_section_vis'; -import { withTheme } from '../../../../../common/eui_styled_components'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { withTheme } from '../../../../observability/public'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { LayoutContent } from '../../../public/pages/metrics/components/layout_content'; export const Layout = withTheme(({ metrics, theme }: LayoutPropsWithTheme) => ( diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_rds/metrics/index.ts b/x-pack/plugins/infra/common/inventory_models/aws_rds/metrics/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_rds/metrics/index.ts rename to x-pack/plugins/infra/common/inventory_models/aws_rds/metrics/index.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_rds/metrics/snapshot/cpu.ts b/x-pack/plugins/infra/common/inventory_models/aws_rds/metrics/snapshot/cpu.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_rds/metrics/snapshot/cpu.ts rename to x-pack/plugins/infra/common/inventory_models/aws_rds/metrics/snapshot/cpu.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_rds/metrics/snapshot/rds_active_transactions.ts b/x-pack/plugins/infra/common/inventory_models/aws_rds/metrics/snapshot/rds_active_transactions.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_rds/metrics/snapshot/rds_active_transactions.ts rename to x-pack/plugins/infra/common/inventory_models/aws_rds/metrics/snapshot/rds_active_transactions.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_rds/metrics/snapshot/rds_connections.ts b/x-pack/plugins/infra/common/inventory_models/aws_rds/metrics/snapshot/rds_connections.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_rds/metrics/snapshot/rds_connections.ts rename to x-pack/plugins/infra/common/inventory_models/aws_rds/metrics/snapshot/rds_connections.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_rds/metrics/snapshot/rds_latency.ts b/x-pack/plugins/infra/common/inventory_models/aws_rds/metrics/snapshot/rds_latency.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_rds/metrics/snapshot/rds_latency.ts rename to x-pack/plugins/infra/common/inventory_models/aws_rds/metrics/snapshot/rds_latency.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_rds/metrics/snapshot/rds_queries_executed.ts b/x-pack/plugins/infra/common/inventory_models/aws_rds/metrics/snapshot/rds_queries_executed.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_rds/metrics/snapshot/rds_queries_executed.ts rename to x-pack/plugins/infra/common/inventory_models/aws_rds/metrics/snapshot/rds_queries_executed.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_rds/metrics/tsvb/aws_rds_active_transactions.ts b/x-pack/plugins/infra/common/inventory_models/aws_rds/metrics/tsvb/aws_rds_active_transactions.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_rds/metrics/tsvb/aws_rds_active_transactions.ts rename to x-pack/plugins/infra/common/inventory_models/aws_rds/metrics/tsvb/aws_rds_active_transactions.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_rds/metrics/tsvb/aws_rds_connections.ts b/x-pack/plugins/infra/common/inventory_models/aws_rds/metrics/tsvb/aws_rds_connections.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_rds/metrics/tsvb/aws_rds_connections.ts rename to x-pack/plugins/infra/common/inventory_models/aws_rds/metrics/tsvb/aws_rds_connections.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_rds/metrics/tsvb/aws_rds_cpu_total.ts b/x-pack/plugins/infra/common/inventory_models/aws_rds/metrics/tsvb/aws_rds_cpu_total.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_rds/metrics/tsvb/aws_rds_cpu_total.ts rename to x-pack/plugins/infra/common/inventory_models/aws_rds/metrics/tsvb/aws_rds_cpu_total.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_rds/metrics/tsvb/aws_rds_latency.ts b/x-pack/plugins/infra/common/inventory_models/aws_rds/metrics/tsvb/aws_rds_latency.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_rds/metrics/tsvb/aws_rds_latency.ts rename to x-pack/plugins/infra/common/inventory_models/aws_rds/metrics/tsvb/aws_rds_latency.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_rds/metrics/tsvb/aws_rds_queries_executed.ts b/x-pack/plugins/infra/common/inventory_models/aws_rds/metrics/tsvb/aws_rds_queries_executed.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_rds/metrics/tsvb/aws_rds_queries_executed.ts rename to x-pack/plugins/infra/common/inventory_models/aws_rds/metrics/tsvb/aws_rds_queries_executed.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_rds/toolbar_items.tsx b/x-pack/plugins/infra/common/inventory_models/aws_rds/toolbar_items.tsx similarity index 95% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_rds/toolbar_items.tsx rename to x-pack/plugins/infra/common/inventory_models/aws_rds/toolbar_items.tsx index e4654825a8de1..24f05fd91589c 100644 --- a/x-pack/legacy/plugins/infra/common/inventory_models/aws_rds/toolbar_items.tsx +++ b/x-pack/plugins/infra/common/inventory_models/aws_rds/toolbar_items.tsx @@ -5,8 +5,8 @@ */ import React from 'react'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { ToolbarProps } from '../../../public/components/inventory/toolbars/toolbar'; - import { MetricsAndGroupByToolbarItems } from '../shared/compontents/metrics_and_groupby_toolbar_items'; import { CloudToolbarItems } from '../shared/compontents/cloud_toolbar_items'; import { SnapshotMetricType } from '../types'; diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_s3/index.ts b/x-pack/plugins/infra/common/inventory_models/aws_s3/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_s3/index.ts rename to x-pack/plugins/infra/common/inventory_models/aws_s3/index.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_s3/layout.tsx b/x-pack/plugins/infra/common/inventory_models/aws_s3/layout.tsx similarity index 91% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_s3/layout.tsx rename to x-pack/plugins/infra/common/inventory_models/aws_s3/layout.tsx index 955960f5baeda..c40c8e7b8c6d3 100644 --- a/x-pack/legacy/plugins/infra/common/inventory_models/aws_s3/layout.tsx +++ b/x-pack/plugins/infra/common/inventory_models/aws_s3/layout.tsx @@ -5,11 +5,17 @@ */ import React from 'react'; import { i18n } from '@kbn/i18n'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { LayoutPropsWithTheme } from '../../../public/pages/metrics/types'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { Section } from '../../../public/pages/metrics/components/section'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { SubSection } from '../../../public/pages/metrics/components/sub_section'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { ChartSectionVis } from '../../../public/pages/metrics/components/chart_section_vis'; -import { withTheme } from '../../../../../common/eui_styled_components'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { withTheme } from '../../../../observability/public'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { LayoutContent } from '../../../public/pages/metrics/components/layout_content'; export const Layout = withTheme(({ metrics, theme }: LayoutPropsWithTheme) => ( diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_s3/metrics/index.ts b/x-pack/plugins/infra/common/inventory_models/aws_s3/metrics/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_s3/metrics/index.ts rename to x-pack/plugins/infra/common/inventory_models/aws_s3/metrics/index.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_s3/metrics/snapshot/s3_bucket_size.ts b/x-pack/plugins/infra/common/inventory_models/aws_s3/metrics/snapshot/s3_bucket_size.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_s3/metrics/snapshot/s3_bucket_size.ts rename to x-pack/plugins/infra/common/inventory_models/aws_s3/metrics/snapshot/s3_bucket_size.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_s3/metrics/snapshot/s3_download_bytes.ts b/x-pack/plugins/infra/common/inventory_models/aws_s3/metrics/snapshot/s3_download_bytes.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_s3/metrics/snapshot/s3_download_bytes.ts rename to x-pack/plugins/infra/common/inventory_models/aws_s3/metrics/snapshot/s3_download_bytes.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_s3/metrics/snapshot/s3_number_of_objects.ts b/x-pack/plugins/infra/common/inventory_models/aws_s3/metrics/snapshot/s3_number_of_objects.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_s3/metrics/snapshot/s3_number_of_objects.ts rename to x-pack/plugins/infra/common/inventory_models/aws_s3/metrics/snapshot/s3_number_of_objects.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_s3/metrics/snapshot/s3_total_requests.ts b/x-pack/plugins/infra/common/inventory_models/aws_s3/metrics/snapshot/s3_total_requests.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_s3/metrics/snapshot/s3_total_requests.ts rename to x-pack/plugins/infra/common/inventory_models/aws_s3/metrics/snapshot/s3_total_requests.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_s3/metrics/snapshot/s3_upload_bytes.ts b/x-pack/plugins/infra/common/inventory_models/aws_s3/metrics/snapshot/s3_upload_bytes.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_s3/metrics/snapshot/s3_upload_bytes.ts rename to x-pack/plugins/infra/common/inventory_models/aws_s3/metrics/snapshot/s3_upload_bytes.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_s3/metrics/tsvb/aws_s3_bucket_size.ts b/x-pack/plugins/infra/common/inventory_models/aws_s3/metrics/tsvb/aws_s3_bucket_size.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_s3/metrics/tsvb/aws_s3_bucket_size.ts rename to x-pack/plugins/infra/common/inventory_models/aws_s3/metrics/tsvb/aws_s3_bucket_size.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_s3/metrics/tsvb/aws_s3_download_bytes.ts b/x-pack/plugins/infra/common/inventory_models/aws_s3/metrics/tsvb/aws_s3_download_bytes.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_s3/metrics/tsvb/aws_s3_download_bytes.ts rename to x-pack/plugins/infra/common/inventory_models/aws_s3/metrics/tsvb/aws_s3_download_bytes.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_s3/metrics/tsvb/aws_s3_number_of_objects.ts b/x-pack/plugins/infra/common/inventory_models/aws_s3/metrics/tsvb/aws_s3_number_of_objects.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_s3/metrics/tsvb/aws_s3_number_of_objects.ts rename to x-pack/plugins/infra/common/inventory_models/aws_s3/metrics/tsvb/aws_s3_number_of_objects.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_s3/metrics/tsvb/aws_s3_total_requests.ts b/x-pack/plugins/infra/common/inventory_models/aws_s3/metrics/tsvb/aws_s3_total_requests.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_s3/metrics/tsvb/aws_s3_total_requests.ts rename to x-pack/plugins/infra/common/inventory_models/aws_s3/metrics/tsvb/aws_s3_total_requests.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_s3/metrics/tsvb/aws_s3_upload_bytes.ts b/x-pack/plugins/infra/common/inventory_models/aws_s3/metrics/tsvb/aws_s3_upload_bytes.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_s3/metrics/tsvb/aws_s3_upload_bytes.ts rename to x-pack/plugins/infra/common/inventory_models/aws_s3/metrics/tsvb/aws_s3_upload_bytes.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_s3/toolbar_items.tsx b/x-pack/plugins/infra/common/inventory_models/aws_s3/toolbar_items.tsx similarity index 94% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_s3/toolbar_items.tsx rename to x-pack/plugins/infra/common/inventory_models/aws_s3/toolbar_items.tsx index d1aa48260db47..54c3196ae2833 100644 --- a/x-pack/legacy/plugins/infra/common/inventory_models/aws_s3/toolbar_items.tsx +++ b/x-pack/plugins/infra/common/inventory_models/aws_s3/toolbar_items.tsx @@ -5,6 +5,7 @@ */ import React from 'react'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { ToolbarProps } from '../../../public/components/inventory/toolbars/toolbar'; import { MetricsAndGroupByToolbarItems } from '../shared/compontents/metrics_and_groupby_toolbar_items'; import { CloudToolbarItems } from '../shared/compontents/cloud_toolbar_items'; diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_sqs/index.ts b/x-pack/plugins/infra/common/inventory_models/aws_sqs/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_sqs/index.ts rename to x-pack/plugins/infra/common/inventory_models/aws_sqs/index.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_sqs/layout.tsx b/x-pack/plugins/infra/common/inventory_models/aws_sqs/layout.tsx similarity index 92% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_sqs/layout.tsx rename to x-pack/plugins/infra/common/inventory_models/aws_sqs/layout.tsx index 5d460c971ec3b..7f2dc92f42205 100644 --- a/x-pack/legacy/plugins/infra/common/inventory_models/aws_sqs/layout.tsx +++ b/x-pack/plugins/infra/common/inventory_models/aws_sqs/layout.tsx @@ -5,11 +5,17 @@ */ import React from 'react'; import { i18n } from '@kbn/i18n'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { LayoutPropsWithTheme } from '../../../public/pages/metrics/types'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { Section } from '../../../public/pages/metrics/components/section'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { SubSection } from '../../../public/pages/metrics/components/sub_section'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { ChartSectionVis } from '../../../public/pages/metrics/components/chart_section_vis'; -import { withTheme } from '../../../../../common/eui_styled_components'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { withTheme } from '../../../../observability/public'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { LayoutContent } from '../../../public/pages/metrics/components/layout_content'; export const Layout = withTheme(({ metrics, theme }: LayoutPropsWithTheme) => ( diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_sqs/metrics/index.ts b/x-pack/plugins/infra/common/inventory_models/aws_sqs/metrics/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_sqs/metrics/index.ts rename to x-pack/plugins/infra/common/inventory_models/aws_sqs/metrics/index.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_sqs/metrics/snapshot/sqs_messages_delayed.ts b/x-pack/plugins/infra/common/inventory_models/aws_sqs/metrics/snapshot/sqs_messages_delayed.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_sqs/metrics/snapshot/sqs_messages_delayed.ts rename to x-pack/plugins/infra/common/inventory_models/aws_sqs/metrics/snapshot/sqs_messages_delayed.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_sqs/metrics/snapshot/sqs_messages_empty.ts b/x-pack/plugins/infra/common/inventory_models/aws_sqs/metrics/snapshot/sqs_messages_empty.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_sqs/metrics/snapshot/sqs_messages_empty.ts rename to x-pack/plugins/infra/common/inventory_models/aws_sqs/metrics/snapshot/sqs_messages_empty.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_sqs/metrics/snapshot/sqs_messages_sent.ts b/x-pack/plugins/infra/common/inventory_models/aws_sqs/metrics/snapshot/sqs_messages_sent.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_sqs/metrics/snapshot/sqs_messages_sent.ts rename to x-pack/plugins/infra/common/inventory_models/aws_sqs/metrics/snapshot/sqs_messages_sent.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_sqs/metrics/snapshot/sqs_messages_visible.ts b/x-pack/plugins/infra/common/inventory_models/aws_sqs/metrics/snapshot/sqs_messages_visible.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_sqs/metrics/snapshot/sqs_messages_visible.ts rename to x-pack/plugins/infra/common/inventory_models/aws_sqs/metrics/snapshot/sqs_messages_visible.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_sqs/metrics/snapshot/sqs_oldest_message.ts b/x-pack/plugins/infra/common/inventory_models/aws_sqs/metrics/snapshot/sqs_oldest_message.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_sqs/metrics/snapshot/sqs_oldest_message.ts rename to x-pack/plugins/infra/common/inventory_models/aws_sqs/metrics/snapshot/sqs_oldest_message.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_sqs/metrics/tsvb/aws_sqs_messages_delayed.ts b/x-pack/plugins/infra/common/inventory_models/aws_sqs/metrics/tsvb/aws_sqs_messages_delayed.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_sqs/metrics/tsvb/aws_sqs_messages_delayed.ts rename to x-pack/plugins/infra/common/inventory_models/aws_sqs/metrics/tsvb/aws_sqs_messages_delayed.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_sqs/metrics/tsvb/aws_sqs_messages_empty.ts b/x-pack/plugins/infra/common/inventory_models/aws_sqs/metrics/tsvb/aws_sqs_messages_empty.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_sqs/metrics/tsvb/aws_sqs_messages_empty.ts rename to x-pack/plugins/infra/common/inventory_models/aws_sqs/metrics/tsvb/aws_sqs_messages_empty.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_sqs/metrics/tsvb/aws_sqs_messages_sent.ts b/x-pack/plugins/infra/common/inventory_models/aws_sqs/metrics/tsvb/aws_sqs_messages_sent.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_sqs/metrics/tsvb/aws_sqs_messages_sent.ts rename to x-pack/plugins/infra/common/inventory_models/aws_sqs/metrics/tsvb/aws_sqs_messages_sent.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_sqs/metrics/tsvb/aws_sqs_messages_visible.ts b/x-pack/plugins/infra/common/inventory_models/aws_sqs/metrics/tsvb/aws_sqs_messages_visible.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_sqs/metrics/tsvb/aws_sqs_messages_visible.ts rename to x-pack/plugins/infra/common/inventory_models/aws_sqs/metrics/tsvb/aws_sqs_messages_visible.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_sqs/metrics/tsvb/aws_sqs_oldest_message.ts b/x-pack/plugins/infra/common/inventory_models/aws_sqs/metrics/tsvb/aws_sqs_oldest_message.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_sqs/metrics/tsvb/aws_sqs_oldest_message.ts rename to x-pack/plugins/infra/common/inventory_models/aws_sqs/metrics/tsvb/aws_sqs_oldest_message.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/aws_sqs/toolbar_items.tsx b/x-pack/plugins/infra/common/inventory_models/aws_sqs/toolbar_items.tsx similarity index 94% rename from x-pack/legacy/plugins/infra/common/inventory_models/aws_sqs/toolbar_items.tsx rename to x-pack/plugins/infra/common/inventory_models/aws_sqs/toolbar_items.tsx index 9c5ff51b2d9a2..22cb2740a4a7f 100644 --- a/x-pack/legacy/plugins/infra/common/inventory_models/aws_sqs/toolbar_items.tsx +++ b/x-pack/plugins/infra/common/inventory_models/aws_sqs/toolbar_items.tsx @@ -5,6 +5,7 @@ */ import React from 'react'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { ToolbarProps } from '../../../public/components/inventory/toolbars/toolbar'; import { MetricsAndGroupByToolbarItems } from '../shared/compontents/metrics_and_groupby_toolbar_items'; import { CloudToolbarItems } from '../shared/compontents/cloud_toolbar_items'; diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/container/index.ts b/x-pack/plugins/infra/common/inventory_models/container/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/container/index.ts rename to x-pack/plugins/infra/common/inventory_models/container/index.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/container/layout.tsx b/x-pack/plugins/infra/common/inventory_models/container/layout.tsx similarity index 93% rename from x-pack/legacy/plugins/infra/common/inventory_models/container/layout.tsx rename to x-pack/plugins/infra/common/inventory_models/container/layout.tsx index e207687cf8643..b61e8eed09cce 100644 --- a/x-pack/legacy/plugins/infra/common/inventory_models/container/layout.tsx +++ b/x-pack/plugins/infra/common/inventory_models/container/layout.tsx @@ -5,13 +5,21 @@ */ import React from 'react'; import { i18n } from '@kbn/i18n'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { LayoutPropsWithTheme } from '../../../public/pages/metrics/types'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { Section } from '../../../public/pages/metrics/components/section'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { SubSection } from '../../../public/pages/metrics/components/sub_section'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { GaugesSectionVis } from '../../../public/pages/metrics/components/gauges_section_vis'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { ChartSectionVis } from '../../../public/pages/metrics/components/chart_section_vis'; -import { withTheme } from '../../../../../common/eui_styled_components'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { withTheme } from '../../../../observability/public'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { LayoutContent } from '../../../public/pages/metrics/components/layout_content'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { MetadataDetails } from '../../../public/pages/metrics/components/metadata_details'; export const Layout = withTheme(({ metrics, theme }: LayoutPropsWithTheme) => ( diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/container/metrics/index.ts b/x-pack/plugins/infra/common/inventory_models/container/metrics/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/container/metrics/index.ts rename to x-pack/plugins/infra/common/inventory_models/container/metrics/index.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/container/metrics/snapshot/cpu.ts b/x-pack/plugins/infra/common/inventory_models/container/metrics/snapshot/cpu.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/container/metrics/snapshot/cpu.ts rename to x-pack/plugins/infra/common/inventory_models/container/metrics/snapshot/cpu.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/container/metrics/snapshot/memory.ts b/x-pack/plugins/infra/common/inventory_models/container/metrics/snapshot/memory.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/container/metrics/snapshot/memory.ts rename to x-pack/plugins/infra/common/inventory_models/container/metrics/snapshot/memory.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/container/metrics/snapshot/rx.ts b/x-pack/plugins/infra/common/inventory_models/container/metrics/snapshot/rx.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/container/metrics/snapshot/rx.ts rename to x-pack/plugins/infra/common/inventory_models/container/metrics/snapshot/rx.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/container/metrics/snapshot/tx.ts b/x-pack/plugins/infra/common/inventory_models/container/metrics/snapshot/tx.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/container/metrics/snapshot/tx.ts rename to x-pack/plugins/infra/common/inventory_models/container/metrics/snapshot/tx.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/container/metrics/tsvb/container_cpu_kernel.ts b/x-pack/plugins/infra/common/inventory_models/container/metrics/tsvb/container_cpu_kernel.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/container/metrics/tsvb/container_cpu_kernel.ts rename to x-pack/plugins/infra/common/inventory_models/container/metrics/tsvb/container_cpu_kernel.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/container/metrics/tsvb/container_cpu_usage.ts b/x-pack/plugins/infra/common/inventory_models/container/metrics/tsvb/container_cpu_usage.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/container/metrics/tsvb/container_cpu_usage.ts rename to x-pack/plugins/infra/common/inventory_models/container/metrics/tsvb/container_cpu_usage.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/container/metrics/tsvb/container_disk_io_bytes.ts b/x-pack/plugins/infra/common/inventory_models/container/metrics/tsvb/container_disk_io_bytes.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/container/metrics/tsvb/container_disk_io_bytes.ts rename to x-pack/plugins/infra/common/inventory_models/container/metrics/tsvb/container_disk_io_bytes.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/container/metrics/tsvb/container_diskio_ops.ts b/x-pack/plugins/infra/common/inventory_models/container/metrics/tsvb/container_diskio_ops.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/container/metrics/tsvb/container_diskio_ops.ts rename to x-pack/plugins/infra/common/inventory_models/container/metrics/tsvb/container_diskio_ops.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/container/metrics/tsvb/container_memory.ts b/x-pack/plugins/infra/common/inventory_models/container/metrics/tsvb/container_memory.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/container/metrics/tsvb/container_memory.ts rename to x-pack/plugins/infra/common/inventory_models/container/metrics/tsvb/container_memory.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/container/metrics/tsvb/container_network_traffic.ts b/x-pack/plugins/infra/common/inventory_models/container/metrics/tsvb/container_network_traffic.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/container/metrics/tsvb/container_network_traffic.ts rename to x-pack/plugins/infra/common/inventory_models/container/metrics/tsvb/container_network_traffic.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/container/metrics/tsvb/container_overview.ts b/x-pack/plugins/infra/common/inventory_models/container/metrics/tsvb/container_overview.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/container/metrics/tsvb/container_overview.ts rename to x-pack/plugins/infra/common/inventory_models/container/metrics/tsvb/container_overview.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/container/toolbar_items.tsx b/x-pack/plugins/infra/common/inventory_models/container/toolbar_items.tsx similarity index 94% rename from x-pack/legacy/plugins/infra/common/inventory_models/container/toolbar_items.tsx rename to x-pack/plugins/infra/common/inventory_models/container/toolbar_items.tsx index f1e7ea721cabd..dbb77cb3b677e 100644 --- a/x-pack/legacy/plugins/infra/common/inventory_models/container/toolbar_items.tsx +++ b/x-pack/plugins/infra/common/inventory_models/container/toolbar_items.tsx @@ -5,6 +5,7 @@ */ import React from 'react'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { ToolbarProps } from '../../../public/components/inventory/toolbars/toolbar'; import { MetricsAndGroupByToolbarItems } from '../shared/compontents/metrics_and_groupby_toolbar_items'; import { SnapshotMetricType } from '../types'; diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/create_tsvb_model.ts b/x-pack/plugins/infra/common/inventory_models/create_tsvb_model.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/create_tsvb_model.ts rename to x-pack/plugins/infra/common/inventory_models/create_tsvb_model.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/host/index.ts b/x-pack/plugins/infra/common/inventory_models/host/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/host/index.ts rename to x-pack/plugins/infra/common/inventory_models/host/index.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/host/layout.tsx b/x-pack/plugins/infra/common/inventory_models/host/layout.tsx similarity index 95% rename from x-pack/legacy/plugins/infra/common/inventory_models/host/layout.tsx rename to x-pack/plugins/infra/common/inventory_models/host/layout.tsx index ca53193e64ca2..15e5530e8db53 100644 --- a/x-pack/legacy/plugins/infra/common/inventory_models/host/layout.tsx +++ b/x-pack/plugins/infra/common/inventory_models/host/layout.tsx @@ -5,15 +5,23 @@ */ import React from 'react'; import { i18n } from '@kbn/i18n'; -import { withTheme } from '../../../../../common/eui_styled_components/eui_styled_components'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { withTheme } from '../../../../observability/public'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { LayoutPropsWithTheme } from '../../../public/pages/metrics/types'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { Section } from '../../../public/pages/metrics/components/section'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { SubSection } from '../../../public/pages/metrics/components/sub_section'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { GaugesSectionVis } from '../../../public/pages/metrics/components/gauges_section_vis'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { ChartSectionVis } from '../../../public/pages/metrics/components/chart_section_vis'; import * as Aws from '../shared/layouts/aws'; import * as Ngnix from '../shared/layouts/nginx'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { MetadataDetails } from '../../../public/pages/metrics/components/metadata_details'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { LayoutContent } from '../../../public/pages/metrics/components/layout_content'; export const Layout = withTheme(({ metrics, theme }: LayoutPropsWithTheme) => ( diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/host/metrics/index.ts b/x-pack/plugins/infra/common/inventory_models/host/metrics/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/host/metrics/index.ts rename to x-pack/plugins/infra/common/inventory_models/host/metrics/index.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/host/metrics/snapshot/cpu.ts b/x-pack/plugins/infra/common/inventory_models/host/metrics/snapshot/cpu.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/host/metrics/snapshot/cpu.ts rename to x-pack/plugins/infra/common/inventory_models/host/metrics/snapshot/cpu.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/host/metrics/snapshot/load.ts b/x-pack/plugins/infra/common/inventory_models/host/metrics/snapshot/load.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/host/metrics/snapshot/load.ts rename to x-pack/plugins/infra/common/inventory_models/host/metrics/snapshot/load.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/host/metrics/snapshot/log_rate.ts b/x-pack/plugins/infra/common/inventory_models/host/metrics/snapshot/log_rate.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/host/metrics/snapshot/log_rate.ts rename to x-pack/plugins/infra/common/inventory_models/host/metrics/snapshot/log_rate.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/host/metrics/snapshot/memory.ts b/x-pack/plugins/infra/common/inventory_models/host/metrics/snapshot/memory.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/host/metrics/snapshot/memory.ts rename to x-pack/plugins/infra/common/inventory_models/host/metrics/snapshot/memory.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/host/metrics/snapshot/rx.ts b/x-pack/plugins/infra/common/inventory_models/host/metrics/snapshot/rx.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/host/metrics/snapshot/rx.ts rename to x-pack/plugins/infra/common/inventory_models/host/metrics/snapshot/rx.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/host/metrics/snapshot/tx.ts b/x-pack/plugins/infra/common/inventory_models/host/metrics/snapshot/tx.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/host/metrics/snapshot/tx.ts rename to x-pack/plugins/infra/common/inventory_models/host/metrics/snapshot/tx.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/host/metrics/tsvb/host_cpu_usage.ts b/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_cpu_usage.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/host/metrics/tsvb/host_cpu_usage.ts rename to x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_cpu_usage.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/host/metrics/tsvb/host_docker_info.ts b/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_docker_info.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/host/metrics/tsvb/host_docker_info.ts rename to x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_docker_info.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/host/metrics/tsvb/host_docker_overview.ts b/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_docker_overview.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/host/metrics/tsvb/host_docker_overview.ts rename to x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_docker_overview.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/host/metrics/tsvb/host_docker_top_5_by_cpu.ts b/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_docker_top_5_by_cpu.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/host/metrics/tsvb/host_docker_top_5_by_cpu.ts rename to x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_docker_top_5_by_cpu.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/host/metrics/tsvb/host_docker_top_5_by_memory.ts b/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_docker_top_5_by_memory.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/host/metrics/tsvb/host_docker_top_5_by_memory.ts rename to x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_docker_top_5_by_memory.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/host/metrics/tsvb/host_filesystem.ts b/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_filesystem.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/host/metrics/tsvb/host_filesystem.ts rename to x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_filesystem.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/host/metrics/tsvb/host_k8s_cpu_cap.ts b/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_k8s_cpu_cap.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/host/metrics/tsvb/host_k8s_cpu_cap.ts rename to x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_k8s_cpu_cap.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/host/metrics/tsvb/host_k8s_disk_cap.ts b/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_k8s_disk_cap.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/host/metrics/tsvb/host_k8s_disk_cap.ts rename to x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_k8s_disk_cap.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/host/metrics/tsvb/host_k8s_memory_cap.ts b/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_k8s_memory_cap.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/host/metrics/tsvb/host_k8s_memory_cap.ts rename to x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_k8s_memory_cap.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/host/metrics/tsvb/host_k8s_overview.ts b/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_k8s_overview.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/host/metrics/tsvb/host_k8s_overview.ts rename to x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_k8s_overview.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/host/metrics/tsvb/host_k8s_pod_cap.ts b/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_k8s_pod_cap.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/host/metrics/tsvb/host_k8s_pod_cap.ts rename to x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_k8s_pod_cap.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/host/metrics/tsvb/host_load.ts b/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_load.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/host/metrics/tsvb/host_load.ts rename to x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_load.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/host/metrics/tsvb/host_memory_usage.ts b/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_memory_usage.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/host/metrics/tsvb/host_memory_usage.ts rename to x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_memory_usage.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/host/metrics/tsvb/host_network_traffic.ts b/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_network_traffic.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/host/metrics/tsvb/host_network_traffic.ts rename to x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_network_traffic.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/host/metrics/tsvb/host_system_overview.ts b/x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_system_overview.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/host/metrics/tsvb/host_system_overview.ts rename to x-pack/plugins/infra/common/inventory_models/host/metrics/tsvb/host_system_overview.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/host/toolbar_items.tsx b/x-pack/plugins/infra/common/inventory_models/host/toolbar_items.tsx similarity index 94% rename from x-pack/legacy/plugins/infra/common/inventory_models/host/toolbar_items.tsx rename to x-pack/plugins/infra/common/inventory_models/host/toolbar_items.tsx index 6e0563f2f555b..fc7696ee53c9d 100644 --- a/x-pack/legacy/plugins/infra/common/inventory_models/host/toolbar_items.tsx +++ b/x-pack/plugins/infra/common/inventory_models/host/toolbar_items.tsx @@ -5,6 +5,7 @@ */ import React from 'react'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { ToolbarProps } from '../../../public/components/inventory/toolbars/toolbar'; import { MetricsAndGroupByToolbarItems } from '../shared/compontents/metrics_and_groupby_toolbar_items'; import { SnapshotMetricType } from '../types'; diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/index.ts b/x-pack/plugins/infra/common/inventory_models/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/index.ts rename to x-pack/plugins/infra/common/inventory_models/index.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/intl_strings.ts b/x-pack/plugins/infra/common/inventory_models/intl_strings.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/intl_strings.ts rename to x-pack/plugins/infra/common/inventory_models/intl_strings.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/layouts.ts b/x-pack/plugins/infra/common/inventory_models/layouts.ts similarity index 96% rename from x-pack/legacy/plugins/infra/common/inventory_models/layouts.ts rename to x-pack/plugins/infra/common/inventory_models/layouts.ts index d9008753adf7b..b59ce010361ec 100644 --- a/x-pack/legacy/plugins/infra/common/inventory_models/layouts.ts +++ b/x-pack/plugins/infra/common/inventory_models/layouts.ts @@ -22,6 +22,7 @@ import { Layout as AwsS3Layout } from './aws_s3/layout'; import { Layout as AwsRDSLayout } from './aws_rds/layout'; import { Layout as AwsSQSLayout } from './aws_sqs/layout'; import { InventoryItemType } from './types'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { LayoutProps } from '../../public/pages/metrics/types'; interface Layouts { diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/metrics.ts b/x-pack/plugins/infra/common/inventory_models/metrics.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/metrics.ts rename to x-pack/plugins/infra/common/inventory_models/metrics.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/pod/index.ts b/x-pack/plugins/infra/common/inventory_models/pod/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/pod/index.ts rename to x-pack/plugins/infra/common/inventory_models/pod/index.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/pod/layout.tsx b/x-pack/plugins/infra/common/inventory_models/pod/layout.tsx similarity index 91% rename from x-pack/legacy/plugins/infra/common/inventory_models/pod/layout.tsx rename to x-pack/plugins/infra/common/inventory_models/pod/layout.tsx index f0c27ccff13b1..43b95d73f6d95 100644 --- a/x-pack/legacy/plugins/infra/common/inventory_models/pod/layout.tsx +++ b/x-pack/plugins/infra/common/inventory_models/pod/layout.tsx @@ -5,14 +5,22 @@ */ import React from 'react'; import { i18n } from '@kbn/i18n'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { LayoutPropsWithTheme } from '../../../public/pages/metrics/types'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { Section } from '../../../public/pages/metrics/components/section'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { SubSection } from '../../../public/pages/metrics/components/sub_section'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { GaugesSectionVis } from '../../../public/pages/metrics/components/gauges_section_vis'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { ChartSectionVis } from '../../../public/pages/metrics/components/chart_section_vis'; -import { withTheme } from '../../../../../common/eui_styled_components'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { withTheme } from '../../../../observability/public'; import * as Nginx from '../shared/layouts/nginx'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { MetadataDetails } from '../../../public/pages/metrics/components/metadata_details'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { LayoutContent } from '../../../public/pages/metrics/components/layout_content'; export const Layout = withTheme(({ metrics, theme }: LayoutPropsWithTheme) => ( diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/pod/metrics/index.ts b/x-pack/plugins/infra/common/inventory_models/pod/metrics/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/pod/metrics/index.ts rename to x-pack/plugins/infra/common/inventory_models/pod/metrics/index.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/pod/metrics/snapshot/cpu.ts b/x-pack/plugins/infra/common/inventory_models/pod/metrics/snapshot/cpu.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/pod/metrics/snapshot/cpu.ts rename to x-pack/plugins/infra/common/inventory_models/pod/metrics/snapshot/cpu.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/pod/metrics/snapshot/memory.ts b/x-pack/plugins/infra/common/inventory_models/pod/metrics/snapshot/memory.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/pod/metrics/snapshot/memory.ts rename to x-pack/plugins/infra/common/inventory_models/pod/metrics/snapshot/memory.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/pod/metrics/snapshot/rx.ts b/x-pack/plugins/infra/common/inventory_models/pod/metrics/snapshot/rx.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/pod/metrics/snapshot/rx.ts rename to x-pack/plugins/infra/common/inventory_models/pod/metrics/snapshot/rx.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/pod/metrics/snapshot/tx.ts b/x-pack/plugins/infra/common/inventory_models/pod/metrics/snapshot/tx.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/pod/metrics/snapshot/tx.ts rename to x-pack/plugins/infra/common/inventory_models/pod/metrics/snapshot/tx.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/pod/metrics/tsvb/pod_cpu_usage.ts b/x-pack/plugins/infra/common/inventory_models/pod/metrics/tsvb/pod_cpu_usage.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/pod/metrics/tsvb/pod_cpu_usage.ts rename to x-pack/plugins/infra/common/inventory_models/pod/metrics/tsvb/pod_cpu_usage.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/pod/metrics/tsvb/pod_log_usage.ts b/x-pack/plugins/infra/common/inventory_models/pod/metrics/tsvb/pod_log_usage.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/pod/metrics/tsvb/pod_log_usage.ts rename to x-pack/plugins/infra/common/inventory_models/pod/metrics/tsvb/pod_log_usage.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/pod/metrics/tsvb/pod_memory_usage.ts b/x-pack/plugins/infra/common/inventory_models/pod/metrics/tsvb/pod_memory_usage.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/pod/metrics/tsvb/pod_memory_usage.ts rename to x-pack/plugins/infra/common/inventory_models/pod/metrics/tsvb/pod_memory_usage.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/pod/metrics/tsvb/pod_network_traffic.ts b/x-pack/plugins/infra/common/inventory_models/pod/metrics/tsvb/pod_network_traffic.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/pod/metrics/tsvb/pod_network_traffic.ts rename to x-pack/plugins/infra/common/inventory_models/pod/metrics/tsvb/pod_network_traffic.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/pod/metrics/tsvb/pod_overview.ts b/x-pack/plugins/infra/common/inventory_models/pod/metrics/tsvb/pod_overview.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/pod/metrics/tsvb/pod_overview.ts rename to x-pack/plugins/infra/common/inventory_models/pod/metrics/tsvb/pod_overview.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/pod/toolbar_items.tsx b/x-pack/plugins/infra/common/inventory_models/pod/toolbar_items.tsx similarity index 93% rename from x-pack/legacy/plugins/infra/common/inventory_models/pod/toolbar_items.tsx rename to x-pack/plugins/infra/common/inventory_models/pod/toolbar_items.tsx index b075f10a15680..d48c27efd88fd 100644 --- a/x-pack/legacy/plugins/infra/common/inventory_models/pod/toolbar_items.tsx +++ b/x-pack/plugins/infra/common/inventory_models/pod/toolbar_items.tsx @@ -5,6 +5,7 @@ */ import React from 'react'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { ToolbarProps } from '../../../public/components/inventory/toolbars/toolbar'; import { MetricsAndGroupByToolbarItems } from '../shared/compontents/metrics_and_groupby_toolbar_items'; import { SnapshotMetricType } from '../types'; diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/shared/compontents/cloud_toolbar_items.tsx b/x-pack/plugins/infra/common/inventory_models/shared/compontents/cloud_toolbar_items.tsx similarity index 87% rename from x-pack/legacy/plugins/infra/common/inventory_models/shared/compontents/cloud_toolbar_items.tsx rename to x-pack/plugins/infra/common/inventory_models/shared/compontents/cloud_toolbar_items.tsx index 7150d58be4eb7..766a8ae8142f5 100644 --- a/x-pack/legacy/plugins/infra/common/inventory_models/shared/compontents/cloud_toolbar_items.tsx +++ b/x-pack/plugins/infra/common/inventory_models/shared/compontents/cloud_toolbar_items.tsx @@ -6,8 +6,11 @@ import React from 'react'; import { EuiFlexItem } from '@elastic/eui'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { ToolbarProps } from '../../../../public/components/inventory/toolbars/toolbar'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { WaffleAccountsControls } from '../../../../public/components/waffle/waffle_accounts_controls'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { WaffleRegionControls } from '../../../../public/components/waffle/waffle_region_controls'; type Props = ToolbarProps; diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/shared/compontents/metrics_and_groupby_toolbar_items.tsx b/x-pack/plugins/infra/common/inventory_models/shared/compontents/metrics_and_groupby_toolbar_items.tsx similarity index 88% rename from x-pack/legacy/plugins/infra/common/inventory_models/shared/compontents/metrics_and_groupby_toolbar_items.tsx rename to x-pack/plugins/infra/common/inventory_models/shared/compontents/metrics_and_groupby_toolbar_items.tsx index dd7be5619df46..fcaedcdd080b8 100644 --- a/x-pack/legacy/plugins/infra/common/inventory_models/shared/compontents/metrics_and_groupby_toolbar_items.tsx +++ b/x-pack/plugins/infra/common/inventory_models/shared/compontents/metrics_and_groupby_toolbar_items.tsx @@ -6,12 +6,16 @@ import React, { useMemo } from 'react'; import { EuiFlexItem } from '@elastic/eui'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { ToolbarProps } from '../../../../public/components/inventory/toolbars/toolbar'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { WaffleMetricControls } from '../../../../public/components/waffle/waffle_metric_controls'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { WaffleGroupByControls } from '../../../../public/components/waffle/waffle_group_by_controls'; import { toGroupByOpt, toMetricOpt, + // eslint-disable-next-line @kbn/eslint/no-restricted-paths } from '../../../../public/components/inventory/toolbars/toolbar_wrapper'; import { SnapshotMetricType } from '../../types'; diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/shared/layouts/aws.tsx b/x-pack/plugins/infra/common/inventory_models/shared/layouts/aws.tsx similarity index 94% rename from x-pack/legacy/plugins/infra/common/inventory_models/shared/layouts/aws.tsx rename to x-pack/plugins/infra/common/inventory_models/shared/layouts/aws.tsx index 2cabbe4c33ff3..fba48c4224e6b 100644 --- a/x-pack/legacy/plugins/infra/common/inventory_models/shared/layouts/aws.tsx +++ b/x-pack/plugins/infra/common/inventory_models/shared/layouts/aws.tsx @@ -5,12 +5,18 @@ */ import React from 'react'; import { i18n } from '@kbn/i18n'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { LayoutPropsWithTheme } from '../../../../public/pages/metrics/types'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { Section } from '../../../../public/pages/metrics/components/section'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { SubSection } from '../../../../public/pages/metrics/components/sub_section'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { GaugesSectionVis } from '../../../../public/pages/metrics/components/gauges_section_vis'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { ChartSectionVis } from '../../../../public/pages/metrics/components/chart_section_vis'; -import { withTheme } from '../../../../../../common/eui_styled_components'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { withTheme } from '../../../../../observability/public'; export const Layout = withTheme(({ metrics, theme }: LayoutPropsWithTheme) => ( diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/shared/layouts/nginx.tsx b/x-pack/plugins/infra/common/inventory_models/shared/layouts/nginx.tsx similarity index 90% rename from x-pack/legacy/plugins/infra/common/inventory_models/shared/layouts/nginx.tsx rename to x-pack/plugins/infra/common/inventory_models/shared/layouts/nginx.tsx index 9d31ffa775d21..eff0a9bbca85a 100644 --- a/x-pack/legacy/plugins/infra/common/inventory_models/shared/layouts/nginx.tsx +++ b/x-pack/plugins/infra/common/inventory_models/shared/layouts/nginx.tsx @@ -5,11 +5,16 @@ */ import React from 'react'; import { i18n } from '@kbn/i18n'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { LayoutPropsWithTheme } from '../../../../public/pages/metrics/types'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { Section } from '../../../../public/pages/metrics/components/section'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { SubSection } from '../../../../public/pages/metrics/components/sub_section'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { ChartSectionVis } from '../../../../public/pages/metrics/components/chart_section_vis'; -import { withTheme } from '../../../../../../common/eui_styled_components'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { withTheme } from '../../../../../observability/public'; export const Layout = withTheme(({ metrics, theme }: LayoutPropsWithTheme) => ( diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/shared/metrics/index.ts b/x-pack/plugins/infra/common/inventory_models/shared/metrics/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/shared/metrics/index.ts rename to x-pack/plugins/infra/common/inventory_models/shared/metrics/index.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/shared/metrics/required_metrics.ts b/x-pack/plugins/infra/common/inventory_models/shared/metrics/required_metrics.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/shared/metrics/required_metrics.ts rename to x-pack/plugins/infra/common/inventory_models/shared/metrics/required_metrics.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/shared/metrics/snapshot/count.ts b/x-pack/plugins/infra/common/inventory_models/shared/metrics/snapshot/count.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/shared/metrics/snapshot/count.ts rename to x-pack/plugins/infra/common/inventory_models/shared/metrics/snapshot/count.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/shared/metrics/snapshot/network_traffic.ts b/x-pack/plugins/infra/common/inventory_models/shared/metrics/snapshot/network_traffic.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/shared/metrics/snapshot/network_traffic.ts rename to x-pack/plugins/infra/common/inventory_models/shared/metrics/snapshot/network_traffic.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/shared/metrics/snapshot/network_traffic_with_interfaces.ts b/x-pack/plugins/infra/common/inventory_models/shared/metrics/snapshot/network_traffic_with_interfaces.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/shared/metrics/snapshot/network_traffic_with_interfaces.ts rename to x-pack/plugins/infra/common/inventory_models/shared/metrics/snapshot/network_traffic_with_interfaces.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/shared/metrics/snapshot/rate.ts b/x-pack/plugins/infra/common/inventory_models/shared/metrics/snapshot/rate.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/shared/metrics/snapshot/rate.ts rename to x-pack/plugins/infra/common/inventory_models/shared/metrics/snapshot/rate.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_cpu_utilization.ts b/x-pack/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_cpu_utilization.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_cpu_utilization.ts rename to x-pack/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_cpu_utilization.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_diskio_bytes.ts b/x-pack/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_diskio_bytes.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_diskio_bytes.ts rename to x-pack/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_diskio_bytes.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_diskio_ops.ts b/x-pack/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_diskio_ops.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_diskio_ops.ts rename to x-pack/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_diskio_ops.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_network_bytes.ts b/x-pack/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_network_bytes.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_network_bytes.ts rename to x-pack/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_network_bytes.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_network_packets.ts b/x-pack/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_network_packets.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_network_packets.ts rename to x-pack/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_network_packets.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_overview.ts b/x-pack/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_overview.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_overview.ts rename to x-pack/plugins/infra/common/inventory_models/shared/metrics/tsvb/aws_overview.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/shared/metrics/tsvb/nginx_active_connections.ts b/x-pack/plugins/infra/common/inventory_models/shared/metrics/tsvb/nginx_active_connections.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/shared/metrics/tsvb/nginx_active_connections.ts rename to x-pack/plugins/infra/common/inventory_models/shared/metrics/tsvb/nginx_active_connections.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/shared/metrics/tsvb/nginx_hits.ts b/x-pack/plugins/infra/common/inventory_models/shared/metrics/tsvb/nginx_hits.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/shared/metrics/tsvb/nginx_hits.ts rename to x-pack/plugins/infra/common/inventory_models/shared/metrics/tsvb/nginx_hits.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/shared/metrics/tsvb/nginx_request_rate.ts b/x-pack/plugins/infra/common/inventory_models/shared/metrics/tsvb/nginx_request_rate.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/shared/metrics/tsvb/nginx_request_rate.ts rename to x-pack/plugins/infra/common/inventory_models/shared/metrics/tsvb/nginx_request_rate.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/shared/metrics/tsvb/nginx_requests_per_connection.ts b/x-pack/plugins/infra/common/inventory_models/shared/metrics/tsvb/nginx_requests_per_connection.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/shared/metrics/tsvb/nginx_requests_per_connection.ts rename to x-pack/plugins/infra/common/inventory_models/shared/metrics/tsvb/nginx_requests_per_connection.ts diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/toolbars.ts b/x-pack/plugins/infra/common/inventory_models/toolbars.ts similarity index 96% rename from x-pack/legacy/plugins/infra/common/inventory_models/toolbars.ts rename to x-pack/plugins/infra/common/inventory_models/toolbars.ts index 05def078c7f2d..39e9f5a260f7a 100644 --- a/x-pack/legacy/plugins/infra/common/inventory_models/toolbars.ts +++ b/x-pack/plugins/infra/common/inventory_models/toolbars.ts @@ -10,6 +10,7 @@ import { InventoryItemType } from './types'; import { HostToolbarItems } from './host/toolbar_items'; import { ContainerToolbarItems } from './container/toolbar_items'; import { PodToolbarItems } from './pod/toolbar_items'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { ToolbarProps } from '../../public/components/inventory/toolbars/toolbar'; import { AwsEC2ToolbarItems } from './aws_ec2/toolbar_items'; import { AwsS3ToolbarItems } from './aws_s3/toolbar_items'; diff --git a/x-pack/legacy/plugins/infra/common/inventory_models/types.ts b/x-pack/plugins/infra/common/inventory_models/types.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/inventory_models/types.ts rename to x-pack/plugins/infra/common/inventory_models/types.ts diff --git a/x-pack/legacy/plugins/infra/common/log_analysis/index.ts b/x-pack/plugins/infra/common/log_analysis/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/log_analysis/index.ts rename to x-pack/plugins/infra/common/log_analysis/index.ts diff --git a/x-pack/legacy/plugins/infra/common/log_analysis/job_parameters.ts b/x-pack/plugins/infra/common/log_analysis/job_parameters.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/log_analysis/job_parameters.ts rename to x-pack/plugins/infra/common/log_analysis/job_parameters.ts diff --git a/x-pack/legacy/plugins/infra/common/log_analysis/log_analysis.ts b/x-pack/plugins/infra/common/log_analysis/log_analysis.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/log_analysis/log_analysis.ts rename to x-pack/plugins/infra/common/log_analysis/log_analysis.ts diff --git a/x-pack/legacy/plugins/infra/common/log_analysis/log_analysis_results.ts b/x-pack/plugins/infra/common/log_analysis/log_analysis_results.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/log_analysis/log_analysis_results.ts rename to x-pack/plugins/infra/common/log_analysis/log_analysis_results.ts diff --git a/x-pack/legacy/plugins/infra/common/log_analysis/log_entry_categories_analysis.ts b/x-pack/plugins/infra/common/log_analysis/log_entry_categories_analysis.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/log_analysis/log_entry_categories_analysis.ts rename to x-pack/plugins/infra/common/log_analysis/log_entry_categories_analysis.ts diff --git a/x-pack/legacy/plugins/infra/common/log_analysis/log_entry_rate_analysis.ts b/x-pack/plugins/infra/common/log_analysis/log_entry_rate_analysis.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/log_analysis/log_entry_rate_analysis.ts rename to x-pack/plugins/infra/common/log_analysis/log_entry_rate_analysis.ts diff --git a/x-pack/legacy/plugins/infra/common/log_entry/index.ts b/x-pack/plugins/infra/common/log_entry/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/log_entry/index.ts rename to x-pack/plugins/infra/common/log_entry/index.ts diff --git a/x-pack/legacy/plugins/infra/common/log_entry/log_entry.ts b/x-pack/plugins/infra/common/log_entry/log_entry.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/log_entry/log_entry.ts rename to x-pack/plugins/infra/common/log_entry/log_entry.ts diff --git a/x-pack/legacy/plugins/infra/common/log_search_result/index.ts b/x-pack/plugins/infra/common/log_search_result/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/log_search_result/index.ts rename to x-pack/plugins/infra/common/log_search_result/index.ts diff --git a/x-pack/legacy/plugins/infra/common/log_search_result/log_search_result.ts b/x-pack/plugins/infra/common/log_search_result/log_search_result.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/log_search_result/log_search_result.ts rename to x-pack/plugins/infra/common/log_search_result/log_search_result.ts diff --git a/x-pack/legacy/plugins/infra/common/log_search_summary/index.ts b/x-pack/plugins/infra/common/log_search_summary/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/log_search_summary/index.ts rename to x-pack/plugins/infra/common/log_search_summary/index.ts diff --git a/x-pack/legacy/plugins/infra/common/log_search_summary/log_search_summary.ts b/x-pack/plugins/infra/common/log_search_summary/log_search_summary.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/log_search_summary/log_search_summary.ts rename to x-pack/plugins/infra/common/log_search_summary/log_search_summary.ts diff --git a/x-pack/legacy/plugins/infra/common/log_text_scale/index.ts b/x-pack/plugins/infra/common/log_text_scale/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/log_text_scale/index.ts rename to x-pack/plugins/infra/common/log_text_scale/index.ts diff --git a/x-pack/legacy/plugins/infra/common/log_text_scale/log_text_scale.ts b/x-pack/plugins/infra/common/log_text_scale/log_text_scale.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/log_text_scale/log_text_scale.ts rename to x-pack/plugins/infra/common/log_text_scale/log_text_scale.ts diff --git a/x-pack/legacy/plugins/infra/common/performance_tracing.ts b/x-pack/plugins/infra/common/performance_tracing.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/performance_tracing.ts rename to x-pack/plugins/infra/common/performance_tracing.ts diff --git a/x-pack/legacy/plugins/infra/common/runtime_types.ts b/x-pack/plugins/infra/common/runtime_types.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/runtime_types.ts rename to x-pack/plugins/infra/common/runtime_types.ts diff --git a/x-pack/legacy/plugins/infra/common/saved_objects/inventory_view.ts b/x-pack/plugins/infra/common/saved_objects/inventory_view.ts similarity index 91% rename from x-pack/legacy/plugins/infra/common/saved_objects/inventory_view.ts rename to x-pack/plugins/infra/common/saved_objects/inventory_view.ts index c86be102f85a8..3ab9042947f97 100644 --- a/x-pack/legacy/plugins/infra/common/saved_objects/inventory_view.ts +++ b/x-pack/plugins/infra/common/saved_objects/inventory_view.ts @@ -4,10 +4,13 @@ * you may not use this file except in compliance with the Elastic License. */ +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { ElasticsearchMappingOf } from '../../server/utils/typed_elasticsearch_mappings'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { WaffleViewState } from '../../public/containers/waffle/with_waffle_view_state'; export const inventoryViewSavedObjectType = 'inventory-view'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { SavedViewSavedObject } from '../../public/hooks/use_saved_view'; export const inventoryViewSavedObjectMappings: { diff --git a/x-pack/legacy/plugins/infra/common/saved_objects/metrics_explorer_view.ts b/x-pack/plugins/infra/common/saved_objects/metrics_explorer_view.ts similarity index 92% rename from x-pack/legacy/plugins/infra/common/saved_objects/metrics_explorer_view.ts rename to x-pack/plugins/infra/common/saved_objects/metrics_explorer_view.ts index e4ec71907eaa8..a9f1194844640 100644 --- a/x-pack/legacy/plugins/infra/common/saved_objects/metrics_explorer_view.ts +++ b/x-pack/plugins/infra/common/saved_objects/metrics_explorer_view.ts @@ -4,12 +4,15 @@ * you may not use this file except in compliance with the Elastic License. */ +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { ElasticsearchMappingOf } from '../../server/utils/typed_elasticsearch_mappings'; import { MetricsExplorerOptions, MetricsExplorerChartOptions, MetricsExplorerTimeOptions, + // eslint-disable-next-line @kbn/eslint/no-restricted-paths } from '../../public/containers/metrics_explorer/use_metrics_explorer_options'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { SavedViewSavedObject } from '../../public/hooks/use_saved_view'; interface MetricsExplorerSavedView { diff --git a/x-pack/legacy/plugins/infra/common/time/index.ts b/x-pack/plugins/infra/common/time/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/time/index.ts rename to x-pack/plugins/infra/common/time/index.ts diff --git a/x-pack/legacy/plugins/infra/common/time/time_key.ts b/x-pack/plugins/infra/common/time/time_key.ts similarity index 97% rename from x-pack/legacy/plugins/infra/common/time/time_key.ts rename to x-pack/plugins/infra/common/time/time_key.ts index 117cd38314de0..e4f41615eb484 100644 --- a/x-pack/legacy/plugins/infra/common/time/time_key.ts +++ b/x-pack/plugins/infra/common/time/time_key.ts @@ -5,7 +5,7 @@ */ import { ascending, bisector } from 'd3-array'; -import pick from 'lodash/fp/pick'; +import { pick } from 'lodash'; export interface TimeKey { time: number; @@ -27,7 +27,7 @@ export const isTimeKey = (value: any): value is TimeKey => typeof value.tiebreaker === 'number'; export const pickTimeKey = (value: T): TimeKey => - pick(['time', 'tiebreaker'], value); + pick(value, ['time', 'tiebreaker']); export function compareTimeKeys( firstKey: TimeKey, diff --git a/x-pack/legacy/plugins/infra/common/time/time_scale.ts b/x-pack/plugins/infra/common/time/time_scale.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/time/time_scale.ts rename to x-pack/plugins/infra/common/time/time_scale.ts diff --git a/x-pack/legacy/plugins/infra/common/time/time_unit.ts b/x-pack/plugins/infra/common/time/time_unit.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/time/time_unit.ts rename to x-pack/plugins/infra/common/time/time_unit.ts diff --git a/x-pack/legacy/plugins/infra/common/typed_json.ts b/x-pack/plugins/infra/common/typed_json.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/typed_json.ts rename to x-pack/plugins/infra/common/typed_json.ts diff --git a/x-pack/legacy/plugins/infra/common/utility_types.ts b/x-pack/plugins/infra/common/utility_types.ts similarity index 100% rename from x-pack/legacy/plugins/infra/common/utility_types.ts rename to x-pack/plugins/infra/common/utility_types.ts diff --git a/x-pack/legacy/plugins/infra/docs/arch.md b/x-pack/plugins/infra/docs/arch.md similarity index 100% rename from x-pack/legacy/plugins/infra/docs/arch.md rename to x-pack/plugins/infra/docs/arch.md diff --git a/x-pack/legacy/plugins/infra/docs/arch_client.md b/x-pack/plugins/infra/docs/arch_client.md similarity index 100% rename from x-pack/legacy/plugins/infra/docs/arch_client.md rename to x-pack/plugins/infra/docs/arch_client.md diff --git a/x-pack/legacy/plugins/infra/docs/assets/arch.png b/x-pack/plugins/infra/docs/assets/arch.png similarity index 100% rename from x-pack/legacy/plugins/infra/docs/assets/arch.png rename to x-pack/plugins/infra/docs/assets/arch.png diff --git a/x-pack/legacy/plugins/infra/docs/assets/infra_metricbeat_aws.jpg b/x-pack/plugins/infra/docs/assets/infra_metricbeat_aws.jpg similarity index 100% rename from x-pack/legacy/plugins/infra/docs/assets/infra_metricbeat_aws.jpg rename to x-pack/plugins/infra/docs/assets/infra_metricbeat_aws.jpg diff --git a/x-pack/legacy/plugins/infra/docs/graphql.md b/x-pack/plugins/infra/docs/graphql.md similarity index 100% rename from x-pack/legacy/plugins/infra/docs/graphql.md rename to x-pack/plugins/infra/docs/graphql.md diff --git a/x-pack/legacy/plugins/infra/docs/test_setups/infra_metricbeat_aws.md b/x-pack/plugins/infra/docs/test_setups/infra_metricbeat_aws.md similarity index 100% rename from x-pack/legacy/plugins/infra/docs/test_setups/infra_metricbeat_aws.md rename to x-pack/plugins/infra/docs/test_setups/infra_metricbeat_aws.md diff --git a/x-pack/plugins/infra/docs/test_setups/infra_metricbeat_docker_nginx.md b/x-pack/plugins/infra/docs/test_setups/infra_metricbeat_docker_nginx.md new file mode 100644 index 0000000000000..4cd8d90778606 --- /dev/null +++ b/x-pack/plugins/infra/docs/test_setups/infra_metricbeat_docker_nginx.md @@ -0,0 +1,200 @@ +# metricbeat / docker / nginx + +This guide explains how to set up +* `docker` to run `nginx` serving a very simple web page +* `metricbeat` to report metrics from `docker` and `nginx` + +This is helpful to test the following features in the Kibana Metrics UI: +* waffle map and list overview +* metrics detail page + +This guide assumes: +* a linux environment, but mac os x should be very similar +* a running `elasticsearch` instance to send metrics data to + +The information in this guide was valid on March 05 2019. + +## Docker + +First, get docker running. To do so, visit https://docs.docker.com/install/ and follow the instructions for your operating system. When you can run the `hello-world` container as described in https://docs.docker.com/get-started/, you're done. + +## Create a docker image with nginx in it + +Create a directory for your docker image: +``` +$ mkdir nginx-docker-image +$ cd nginx-docker-image +``` + +Create a directory for content to be served by `nginx` and put a simple HTML document in it. +``` +$ mkdir content +$ cat >> content/index.html < + + Hello World! +

Hello World!

+ +HTML +``` +Create a Dockerfile: +``` +$ cat >>Dockerfile <80/tcp my-nginx-2 +29e1ca569a49 my-nginx-image "nginx -g 'daemon of…" 2 minutes ago Up 2 minutes 0.0.0.0:8081->80/tcp my-nginx-1 + +``` + +## Metricbeat + +One easy method to have several versions of `metricbeat` available on the same machine is to run them from archives, unpacked into separate directories. + +Make a directory to keep all downloaded archives in: +``` +$ mkdir tars +$ cd tars +``` +Find the URL of the correct archive for the version and platform you want to test with. + +For released versions you can find this link in the documentation, e.g. https://www.elastic.co/guide/en/beats/metricbeat/6.5/metricbeat-installation.html (which is used in this guide). + +If you need a snapshot build for testing purposes, https://artifacts-api.elastic.co/v1/search/master/metricbeat gives a list of the latest builds. (If you arrived at this page NOT looking for test instructions, please be aware that these artifacts are UNSUPPORTED and should NOT be used in a production environment.) + +If you need a specific build result, https://beats-ci.elastic.co/ has jobs which build packages. Their names end in `package`, and they have nested jobs with names ending in `multijob package PLATFORM`. Those then will contain a `Google Cloud Storage Upload Report`, and that contains links to the build artifact. A most likely outdated (!) example is https://beats-ci.elastic.co/job/elastic+beats+6.x+multijob-package-linux/gcsObjects/ , you will need to hunt down the one you need for your test yourself. (These build artifacts are even more UNSUPPORTED than the ones above and should NOT be used in a production environment either.) + +Download the archive, unpack it and change into the unpacked directory: +``` +$ curl -L -O https://artifacts.elastic.co/downloads/beats/metricbeat/metricbeat-6.5.4-linux-x86_64.tar.gz +$ tar xzvf metricbeat-6.5.4-linux-x86_64.tar.gz +$ cd metricbeat-6.5.4-linux-x86_64 +``` +Edit `metricbeat.yml` and configure the correct `elasticsearch.output`, if necessary. + +Change the ownership of some files to make `metricbeat` happy: +``` +$ sudo chown root metricbeat.yml +$ sudo chown root modules.d/system.yml +``` + +Enable the `docker` module of `metricbeat` with +``` +$ sudo ./metricbeat modules enable docker +``` +Enable docker metricsets in `modules.d/docker.yml` if necessary (i.e. make sure they're not commented out): +``` +- module: docker + metricsets: + - container + - cpu + - diskio + - healthcheck + - info + - memory + - network +``` +Fix one more file ownership: +``` +$ sudo chown root modules.d/docker.yml +``` +Out of the box, the docker module only reports basic system metrics from the running containers. To see metrics from `nginx` running in the containers, we need to enable autodiscover (https://www.elastic.co/guide/en/beats/metricbeat/6.5/configuration-autodiscover.html). + +To do so, add the following lines at the end of `metricbeat.yml`: +``` +metricbeat.autodiscover: + providers: + - type: docker + templates: + - condition: + contains: + docker.container.image: nginx + config: + - module: nginx + metricsets: ["stubstatus"] + hosts: "${data.host}:${data.port}" +``` +This assumes that the name of the docker image you use indeed contains the string `nginx` (which it will if you followed this guide). + +Now start `metricbeat` with: +``` +$ sudo ./metricbeat -e +``` +Watch the console output. At some point, a log line starting like this will appear, followed by the data sent to elasticsearch: +``` +2019-03-05T13:40:38.194+0100 INFO [monitoring] log/log.go:144 Non-zero metrics in the last 30s {...} +``` +If this data contains entries for `docker` and for `nginx`, the configuration is correct. + +## Metrics UI + +Now start Kibana and navigate to the Metrics UI. You should see your containers in the `Docker` tab, and `nginx` metrics on the node detail page for each container. + +## Clean up + +To stop `metricbeat`, hit `Ctrl-C` in the terminal in which it is running. + +To see a list of running `docker` containers, use: +``` +$ docker ps +``` +To stop a running docker container, pick the container id from the list and use +``` +$ docker stop CONTAINER_ID +``` +To see a list of all containers, running or stopped, use +``` +$ docker ps -a +``` +To remove a container from your system, use +``` +$ docker rm CONTAINER_ID +``` +To see a list of all images you created, use +``` +$ docker images +``` +To remove an image, pick the image id from that list and use +``` +$ docker rmi IMAGE_ID +``` +## References + +- https://docs.docker.com/install/ +- https://docs.docker.com/get-started/ +- https://docs.docker.com/samples/library/nginx/ +- https://docs.docker.com/engine/reference/builder/#from +- https://www.elastic.co/guide/en/beats/metricbeat/6.5/metricbeat-installation.html +- https://artifacts-api.elastic.co/v1/search/master/metricbeat +- https://beats-ci.elastic.co/ +- https://www.elastic.co/guide/en/beats/metricbeat/6.5/metricbeat-module-docker.html +- https://www.elastic.co/guide/en/beats/metricbeat/6.5/configuration-autodiscover.html diff --git a/x-pack/plugins/infra/kibana.json b/x-pack/plugins/infra/kibana.json index ec5420a4d28d5..7ba81127c1e67 100644 --- a/x-pack/plugins/infra/kibana.json +++ b/x-pack/plugins/infra/kibana.json @@ -2,5 +2,8 @@ "id": "infra", "version": "8.0.0", "kibanaVersion": "kibana", - "server": true + "requiredPlugins": ["features", "apm", "usageCollection", "spaces", "home", "data", "data_enhanced", "metrics"], + "server": true, + "ui": true, + "configPath": ["xpack", "infra"] } diff --git a/x-pack/legacy/plugins/infra/public/apps/start_app.tsx b/x-pack/plugins/infra/public/apps/start_app.tsx similarity index 65% rename from x-pack/legacy/plugins/infra/public/apps/start_app.tsx rename to x-pack/plugins/infra/public/apps/start_app.tsx index dbdc827478a45..300d97d3c45b1 100644 --- a/x-pack/legacy/plugins/infra/public/apps/start_app.tsx +++ b/x-pack/plugins/infra/public/apps/start_app.tsx @@ -4,20 +4,19 @@ * you may not use this file except in compliance with the Elastic License. */ -import { createHashHistory } from 'history'; +import { createBrowserHistory } from 'history'; import React from 'react'; import ReactDOM from 'react-dom'; import { ApolloProvider } from 'react-apollo'; import { Provider as ReduxStoreProvider } from 'react-redux'; import { BehaviorSubject } from 'rxjs'; import { pluck } from 'rxjs/operators'; -import { CoreStart } from 'kibana/public'; +import { CoreStart, AppMountParameters } from 'kibana/public'; // TODO use theme provided from parentApp when kibana supports it import { EuiErrorBoundary } from '@elastic/eui'; -import { EuiThemeProvider } from '../../../../common/eui_styled_components'; +import { EuiThemeProvider } from '../../../observability/public'; import { InfraFrontendLibs } from '../lib/lib'; -import { PageRouter } from '../routes'; import { createStore } from '../store'; import { ApolloClientContext } from '../utils/apollo_context'; import { ReduxStateContextProvider } from '../utils/redux_context'; @@ -25,12 +24,20 @@ import { HistoryContext } from '../utils/history_context'; import { useUiSetting$, KibanaContextProvider, -} from '../../../../../../src/plugins/kibana_react/public'; -import { ROOT_ELEMENT_ID } from '../app'; +} from '../../../../../src/plugins/kibana_react/public'; +import { AppRouter } from '../routers'; -// NP_TODO: Type plugins -export async function startApp(libs: InfraFrontendLibs, core: CoreStart, plugins: any) { - const history = createHashHistory(); +export const CONTAINER_CLASSNAME = 'infra-container-element'; + +export async function startApp( + libs: InfraFrontendLibs, + core: CoreStart, + plugins: object, + params: AppMountParameters, + Router: AppRouter +) { + const { element, appBasePath } = params; + const history = createBrowserHistory({ basename: appBasePath }); const libs$ = new BehaviorSubject(libs); const store = createStore({ apolloClient: libs$.pipe(pluck('apolloClient')), @@ -49,7 +56,7 @@ export async function startApp(libs: InfraFrontendLibs, core: CoreStart, plugins - + @@ -61,15 +68,22 @@ export async function startApp(libs: InfraFrontendLibs, core: CoreStart, plugins ); }; - const node = await document.getElementById(ROOT_ELEMENT_ID); - - const App = ( + const App: React.FunctionComponent = () => ( ); - if (node) { - ReactDOM.render(App, node); - } + // Ensure the element we're handed from application mounting takes up + // the full size it can, so that our inner application styles work as + // expected. + element.style.height = '100%'; + element.style.display = 'flex'; + element.className += ` ${CONTAINER_CLASSNAME}`; + + ReactDOM.render(, element); + + return () => { + ReactDOM.unmountComponentAtNode(element); + }; } diff --git a/x-pack/plugins/infra/public/apps/start_legacy_app.tsx b/x-pack/plugins/infra/public/apps/start_legacy_app.tsx new file mode 100644 index 0000000000000..6e5960ceb2081 --- /dev/null +++ b/x-pack/plugins/infra/public/apps/start_legacy_app.tsx @@ -0,0 +1,100 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { createBrowserHistory } from 'history'; +import React from 'react'; +import url from 'url'; +import ReactDOM from 'react-dom'; +import { AppMountParameters } from 'kibana/public'; +import { Route, Router, Switch, RouteProps } from 'react-router-dom'; +// TODO use theme provided from parentApp when kibana supports it +import { EuiErrorBoundary } from '@elastic/eui'; + +// This exists purely to facilitate legacy app/infra URL redirects. +// It will be removed in 8.0.0. +export async function startLegacyApp(params: AppMountParameters) { + const { element } = params; + const history = createBrowserHistory(); + + const App: React.FunctionComponent = () => { + return ( + + + + { + if (!location) { + return null; + } + + let nextPath = ''; + let nextBasePath = ''; + let nextSearch; + + if ( + location.hash.indexOf('#infrastructure') > -1 || + location.hash.indexOf('#/infrastructure') > -1 + ) { + nextPath = location.hash.replace( + new RegExp( + '#infrastructure/|#/infrastructure/|#/infrastructure|#infrastructure', + 'g' + ), + '' + ); + nextBasePath = location.pathname.replace('app/infra', 'app/metrics'); + } else if ( + location.hash.indexOf('#logs') > -1 || + location.hash.indexOf('#/logs') > -1 + ) { + nextPath = location.hash.replace( + new RegExp('#logs/|#/logs/|#/logs|#logs', 'g'), + '' + ); + nextBasePath = location.pathname.replace('app/infra', 'app/logs'); + } else { + // This covers /app/infra and /app/infra/home (both of which used to render + // the metrics inventory page) + nextPath = 'inventory'; + nextBasePath = location.pathname.replace('app/infra', 'app/metrics'); + nextSearch = undefined; + } + + // app/inra#infrastructure/metrics/:type/:node was changed to app/metrics/detail/:type/:node, this + // accounts for that edge case + nextPath = nextPath.replace('metrics/', 'detail/'); + + // Query parameters (location.search) will arrive as part of location.hash and not location.search + const nextPathParts = nextPath.split('?'); + nextPath = nextPathParts[0]; + nextSearch = nextPathParts[1] ? nextPathParts[1] : undefined; + + let nextUrl = url.format({ + pathname: `${nextBasePath}/${nextPath}`, + hash: undefined, + search: nextSearch, + }); + + nextUrl = nextUrl.replace('//', '/'); + + window.location.href = nextUrl; + + return null; + }} + /> + + + + ); + }; + + ReactDOM.render(, element); + + return () => { + ReactDOM.unmountComponentAtNode(element); + }; +} diff --git a/x-pack/legacy/plugins/infra/public/components/auto_sizer.tsx b/x-pack/plugins/infra/public/components/auto_sizer.tsx similarity index 99% rename from x-pack/legacy/plugins/infra/public/components/auto_sizer.tsx rename to x-pack/plugins/infra/public/components/auto_sizer.tsx index 1d6798aacebe5..284b5295111c6 100644 --- a/x-pack/legacy/plugins/infra/public/components/auto_sizer.tsx +++ b/x-pack/plugins/infra/public/components/auto_sizer.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import isEqual from 'lodash/fp/isEqual'; +import { isEqual } from 'lodash'; import React from 'react'; import ResizeObserver from 'resize-observer-polyfill'; diff --git a/x-pack/legacy/plugins/infra/public/components/autocomplete_field/autocomplete_field.tsx b/x-pack/plugins/infra/public/components/autocomplete_field/autocomplete_field.tsx similarity index 98% rename from x-pack/legacy/plugins/infra/public/components/autocomplete_field/autocomplete_field.tsx rename to x-pack/plugins/infra/public/components/autocomplete_field/autocomplete_field.tsx index f483f2b1b3f57..2abef7d71e65a 100644 --- a/x-pack/legacy/plugins/infra/public/components/autocomplete_field/autocomplete_field.tsx +++ b/x-pack/plugins/infra/public/components/autocomplete_field/autocomplete_field.tsx @@ -12,9 +12,8 @@ import { } from '@elastic/eui'; import React from 'react'; -import { QuerySuggestion } from '../../../../../../../src/plugins/data/public'; - -import euiStyled from '../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../observability/public'; +import { QuerySuggestion } from '../../../../../../src/plugins/data/public'; import { composeStateUpdaters } from '../../utils/typed_react'; import { SuggestionItem } from './suggestion_item'; diff --git a/x-pack/legacy/plugins/infra/public/components/autocomplete_field/index.ts b/x-pack/plugins/infra/public/components/autocomplete_field/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/autocomplete_field/index.ts rename to x-pack/plugins/infra/public/components/autocomplete_field/index.ts diff --git a/x-pack/legacy/plugins/infra/public/components/autocomplete_field/suggestion_item.tsx b/x-pack/plugins/infra/public/components/autocomplete_field/suggestion_item.tsx similarity index 79% rename from x-pack/legacy/plugins/infra/public/components/autocomplete_field/suggestion_item.tsx rename to x-pack/plugins/infra/public/components/autocomplete_field/suggestion_item.tsx index 689eb47f289c2..fb0c1127df3d1 100644 --- a/x-pack/legacy/plugins/infra/public/components/autocomplete_field/suggestion_item.tsx +++ b/x-pack/plugins/infra/public/components/autocomplete_field/suggestion_item.tsx @@ -7,9 +7,8 @@ import { EuiIcon } from '@elastic/eui'; import { transparentize } from 'polished'; import React from 'react'; - -import { QuerySuggestion } from '../../../../../../../src/plugins/data/public'; -import euiStyled from '../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../observability/public'; +import { QuerySuggestion, QuerySuggestionTypes } from '../../../../../../src/plugins/data/public'; interface Props { isSelected?: boolean; @@ -57,7 +56,9 @@ const SuggestionItemField = euiStyled.div` padding: ${props => props.theme.eui.euiSizeXS}; `; -const SuggestionItemIconField = euiStyled(SuggestionItemField)<{ suggestionType: string }>` +const SuggestionItemIconField = euiStyled(SuggestionItemField)<{ + suggestionType: QuerySuggestionTypes; +}>` background-color: ${props => transparentize(0.9, getEuiIconColor(props.theme, props.suggestionType))}; color: ${props => getEuiIconColor(props.theme, props.suggestionType)}; @@ -83,34 +84,34 @@ const SuggestionItemDescriptionField = euiStyled(SuggestionItemField)` } `; -const getEuiIconType = (suggestionType: string) => { +const getEuiIconType = (suggestionType: QuerySuggestionTypes) => { switch (suggestionType) { - case 'field': + case QuerySuggestionTypes.Field: return 'kqlField'; - case 'value': + case QuerySuggestionTypes.Value: return 'kqlValue'; - case 'recentSearch': + case QuerySuggestionTypes.RecentSearch: return 'search'; - case 'conjunction': + case QuerySuggestionTypes.Conjunction: return 'kqlSelector'; - case 'operator': + case QuerySuggestionTypes.Operator: return 'kqlOperand'; default: return 'empty'; } }; -const getEuiIconColor = (theme: any, suggestionType: string): string => { +const getEuiIconColor = (theme: any, suggestionType: QuerySuggestionTypes): string => { switch (suggestionType) { - case 'field': + case QuerySuggestionTypes.Field: return theme.eui.euiColorVis7; - case 'value': + case QuerySuggestionTypes.Value: return theme.eui.euiColorVis0; - case 'operator': + case QuerySuggestionTypes.Operator: return theme.eui.euiColorVis1; - case 'conjunction': + case QuerySuggestionTypes.Conjunction: return theme.eui.euiColorVis2; - case 'recentSearch': + case QuerySuggestionTypes.RecentSearch: default: return theme.eui.euiColorMediumShade; } diff --git a/x-pack/legacy/plugins/infra/public/components/beta_badge.tsx b/x-pack/plugins/infra/public/components/beta_badge.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/beta_badge.tsx rename to x-pack/plugins/infra/public/components/beta_badge.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/document_title.tsx b/x-pack/plugins/infra/public/components/document_title.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/document_title.tsx rename to x-pack/plugins/infra/public/components/document_title.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/empty_states/index.tsx b/x-pack/plugins/infra/public/components/empty_states/index.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/empty_states/index.tsx rename to x-pack/plugins/infra/public/components/empty_states/index.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/empty_states/no_data.tsx b/x-pack/plugins/infra/public/components/empty_states/no_data.tsx similarity index 93% rename from x-pack/legacy/plugins/infra/public/components/empty_states/no_data.tsx rename to x-pack/plugins/infra/public/components/empty_states/no_data.tsx index 7519e3fe10779..97dc7ac1f8520 100644 --- a/x-pack/legacy/plugins/infra/public/components/empty_states/no_data.tsx +++ b/x-pack/plugins/infra/public/components/empty_states/no_data.tsx @@ -7,7 +7,7 @@ import { EuiButton, EuiEmptyPrompt } from '@elastic/eui'; import React from 'react'; -import euiStyled from '../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../observability/public'; interface NoDataProps { titleText: string; diff --git a/x-pack/legacy/plugins/infra/public/components/empty_states/no_indices.tsx b/x-pack/plugins/infra/public/components/empty_states/no_indices.tsx similarity index 91% rename from x-pack/legacy/plugins/infra/public/components/empty_states/no_indices.tsx rename to x-pack/plugins/infra/public/components/empty_states/no_indices.tsx index bfe282d2cee04..b453a4f0bc342 100644 --- a/x-pack/legacy/plugins/infra/public/components/empty_states/no_indices.tsx +++ b/x-pack/plugins/infra/public/components/empty_states/no_indices.tsx @@ -7,7 +7,7 @@ import { EuiEmptyPrompt } from '@elastic/eui'; import React from 'react'; -import euiStyled from '../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../observability/public'; interface NoIndicesProps { message: string; diff --git a/x-pack/legacy/plugins/infra/public/components/error_page.tsx b/x-pack/plugins/infra/public/components/error_page.tsx similarity index 96% rename from x-pack/legacy/plugins/infra/public/components/error_page.tsx rename to x-pack/plugins/infra/public/components/error_page.tsx index fea76c83292c2..5c8b576c161d7 100644 --- a/x-pack/legacy/plugins/infra/public/components/error_page.tsx +++ b/x-pack/plugins/infra/public/components/error_page.tsx @@ -15,7 +15,7 @@ import { import { FormattedMessage } from '@kbn/i18n/react'; import React from 'react'; -import euiStyled from '../../../../common/eui_styled_components'; +import { euiStyled } from '../../../observability/public'; import { FlexPage } from './page'; interface Props { diff --git a/x-pack/legacy/plugins/infra/public/components/eui/index.ts b/x-pack/plugins/infra/public/components/eui/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/eui/index.ts rename to x-pack/plugins/infra/public/components/eui/index.ts diff --git a/x-pack/legacy/plugins/infra/public/components/eui/toolbar/index.ts b/x-pack/plugins/infra/public/components/eui/toolbar/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/eui/toolbar/index.ts rename to x-pack/plugins/infra/public/components/eui/toolbar/index.ts diff --git a/x-pack/legacy/plugins/infra/public/components/eui/toolbar/toolbar.tsx b/x-pack/plugins/infra/public/components/eui/toolbar/toolbar.tsx similarity index 88% rename from x-pack/legacy/plugins/infra/public/components/eui/toolbar/toolbar.tsx rename to x-pack/plugins/infra/public/components/eui/toolbar/toolbar.tsx index 2c3b5cb924e36..8446587e8671d 100644 --- a/x-pack/legacy/plugins/infra/public/components/eui/toolbar/toolbar.tsx +++ b/x-pack/plugins/infra/public/components/eui/toolbar/toolbar.tsx @@ -6,7 +6,7 @@ import { EuiPanel } from '@elastic/eui'; -import euiStyled from '../../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../../observability/public'; export const Toolbar = euiStyled(EuiPanel).attrs(() => ({ grow: false, diff --git a/x-pack/legacy/plugins/infra/public/components/fixed_datepicker.tsx b/x-pack/plugins/infra/public/components/fixed_datepicker.tsx similarity index 90% rename from x-pack/legacy/plugins/infra/public/components/fixed_datepicker.tsx rename to x-pack/plugins/infra/public/components/fixed_datepicker.tsx index aab1bcd1da873..fcebb89561826 100644 --- a/x-pack/legacy/plugins/infra/public/components/fixed_datepicker.tsx +++ b/x-pack/plugins/infra/public/components/fixed_datepicker.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { EuiDatePicker, EuiDatePickerProps } from '@elastic/eui'; -import euiStyled from '../../../../common/eui_styled_components'; +import { euiStyled } from '../../../observability/public'; export const FixedDatePicker = euiStyled( ({ diff --git a/x-pack/legacy/plugins/infra/public/components/formatted_time.tsx b/x-pack/plugins/infra/public/components/formatted_time.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/formatted_time.tsx rename to x-pack/plugins/infra/public/components/formatted_time.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/header/header.tsx b/x-pack/plugins/infra/public/components/header/header.tsx similarity index 94% rename from x-pack/legacy/plugins/infra/public/components/header/header.tsx rename to x-pack/plugins/infra/public/components/header/header.tsx index 731e62b927ae4..fa71426f83645 100644 --- a/x-pack/legacy/plugins/infra/public/components/header/header.tsx +++ b/x-pack/plugins/infra/public/components/header/header.tsx @@ -7,7 +7,7 @@ import { useCallback, useEffect } from 'react'; import { i18n } from '@kbn/i18n'; import { ChromeBreadcrumb } from 'src/core/public'; -import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; +import { useKibana } from '../../../../../../src/plugins/kibana_react/public'; interface HeaderProps { breadcrumbs?: ChromeBreadcrumb[]; diff --git a/x-pack/legacy/plugins/infra/public/components/header/index.ts b/x-pack/plugins/infra/public/components/header/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/header/index.ts rename to x-pack/plugins/infra/public/components/header/index.ts diff --git a/x-pack/legacy/plugins/infra/public/components/help_center_content.tsx b/x-pack/plugins/infra/public/components/help_center_content.tsx similarity index 90% rename from x-pack/legacy/plugins/infra/public/components/help_center_content.tsx rename to x-pack/plugins/infra/public/components/help_center_content.tsx index 4b27c6cfce53f..acaf4b069dc1c 100644 --- a/x-pack/legacy/plugins/infra/public/components/help_center_content.tsx +++ b/x-pack/plugins/infra/public/components/help_center_content.tsx @@ -5,7 +5,7 @@ */ import React, { useEffect } from 'react'; -import { useKibana } from '../../../../../../src/plugins/kibana_react/public'; +import { useKibana } from '../../../../../src/plugins/kibana_react/public'; interface HelpCenterContentProps { feedbackLink: string; diff --git a/x-pack/legacy/plugins/infra/public/components/inventory/layout.tsx b/x-pack/plugins/infra/public/components/inventory/layout.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/inventory/layout.tsx rename to x-pack/plugins/infra/public/components/inventory/layout.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/inventory/toolbars/toolbar.tsx b/x-pack/plugins/infra/public/components/inventory/toolbars/toolbar.tsx similarity index 97% rename from x-pack/legacy/plugins/infra/public/components/inventory/toolbars/toolbar.tsx rename to x-pack/plugins/infra/public/components/inventory/toolbars/toolbar.tsx index ee0eceee6d157..a2882a3cd3124 100644 --- a/x-pack/legacy/plugins/infra/public/components/inventory/toolbars/toolbar.tsx +++ b/x-pack/plugins/infra/public/components/inventory/toolbars/toolbar.tsx @@ -17,7 +17,7 @@ import { InfraGroupByOptions } from '../../../lib/lib'; import { WithWaffleViewState } from '../../../containers/waffle/with_waffle_view_state'; import { SavedViewsToolbarControls } from '../../saved_views/toolbar_control'; import { inventoryViewSavedObjectType } from '../../../../common/saved_objects/inventory_view'; -import { IIndexPattern } from '../../../../../../../../src/plugins/data/public'; +import { IIndexPattern } from '../../../../../../../src/plugins/data/public'; import { InventoryItemType } from '../../../../common/inventory_models/types'; export interface ToolbarProps { diff --git a/x-pack/legacy/plugins/infra/public/components/inventory/toolbars/toolbar_wrapper.tsx b/x-pack/plugins/infra/public/components/inventory/toolbars/toolbar_wrapper.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/inventory/toolbars/toolbar_wrapper.tsx rename to x-pack/plugins/infra/public/components/inventory/toolbars/toolbar_wrapper.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/loading/__examples__/index.stories.tsx b/x-pack/plugins/infra/public/components/loading/__examples__/index.stories.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/loading/__examples__/index.stories.tsx rename to x-pack/plugins/infra/public/components/loading/__examples__/index.stories.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/loading/index.tsx b/x-pack/plugins/infra/public/components/loading/index.tsx similarity index 94% rename from x-pack/legacy/plugins/infra/public/components/loading/index.tsx rename to x-pack/plugins/infra/public/components/loading/index.tsx index 30dfef9ed48bd..8c25dfc2380f9 100644 --- a/x-pack/legacy/plugins/infra/public/components/loading/index.tsx +++ b/x-pack/plugins/infra/public/components/loading/index.tsx @@ -7,7 +7,7 @@ import { EuiLoadingChart, EuiPanel, EuiText } from '@elastic/eui'; import * as React from 'react'; -import euiStyled from '../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../observability/public'; interface InfraLoadingProps { text: string | JSX.Element; diff --git a/x-pack/legacy/plugins/infra/public/components/loading_overlay_wrapper.tsx b/x-pack/plugins/infra/public/components/loading_overlay_wrapper.tsx similarity index 94% rename from x-pack/legacy/plugins/infra/public/components/loading_overlay_wrapper.tsx rename to x-pack/plugins/infra/public/components/loading_overlay_wrapper.tsx index 5df1fc07e83b9..599969d9b15a8 100644 --- a/x-pack/legacy/plugins/infra/public/components/loading_overlay_wrapper.tsx +++ b/x-pack/plugins/infra/public/components/loading_overlay_wrapper.tsx @@ -8,7 +8,7 @@ import { EuiLoadingSpinner } from '@elastic/eui'; import { transparentize } from 'polished'; import React from 'react'; -import { euiStyled } from '../../../../common/eui_styled_components'; +import { euiStyled } from '../../../observability/public'; export const LoadingOverlayWrapper: React.FC & { isLoading: boolean; diff --git a/x-pack/legacy/plugins/infra/public/components/loading_page.tsx b/x-pack/plugins/infra/public/components/loading_page.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/loading_page.tsx rename to x-pack/plugins/infra/public/components/loading_page.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_job_status/index.ts b/x-pack/plugins/infra/public/components/logging/log_analysis_job_status/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/logging/log_analysis_job_status/index.ts rename to x-pack/plugins/infra/public/components/logging/log_analysis_job_status/index.ts diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_job_status/job_configuration_outdated_callout.tsx b/x-pack/plugins/infra/public/components/logging/log_analysis_job_status/job_configuration_outdated_callout.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/logging/log_analysis_job_status/job_configuration_outdated_callout.tsx rename to x-pack/plugins/infra/public/components/logging/log_analysis_job_status/job_configuration_outdated_callout.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_job_status/job_definition_outdated_callout.tsx b/x-pack/plugins/infra/public/components/logging/log_analysis_job_status/job_definition_outdated_callout.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/logging/log_analysis_job_status/job_definition_outdated_callout.tsx rename to x-pack/plugins/infra/public/components/logging/log_analysis_job_status/job_definition_outdated_callout.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_job_status/job_stopped_callout.tsx b/x-pack/plugins/infra/public/components/logging/log_analysis_job_status/job_stopped_callout.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/logging/log_analysis_job_status/job_stopped_callout.tsx rename to x-pack/plugins/infra/public/components/logging/log_analysis_job_status/job_stopped_callout.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_job_status/log_analysis_job_problem_indicator.tsx b/x-pack/plugins/infra/public/components/logging/log_analysis_job_status/log_analysis_job_problem_indicator.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/logging/log_analysis_job_status/log_analysis_job_problem_indicator.tsx rename to x-pack/plugins/infra/public/components/logging/log_analysis_job_status/log_analysis_job_problem_indicator.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_job_status/recreate_job_button.tsx b/x-pack/plugins/infra/public/components/logging/log_analysis_job_status/recreate_job_button.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/logging/log_analysis_job_status/recreate_job_button.tsx rename to x-pack/plugins/infra/public/components/logging/log_analysis_job_status/recreate_job_button.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_job_status/recreate_job_callout.tsx b/x-pack/plugins/infra/public/components/logging/log_analysis_job_status/recreate_job_callout.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/logging/log_analysis_job_status/recreate_job_callout.tsx rename to x-pack/plugins/infra/public/components/logging/log_analysis_job_status/recreate_job_callout.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_results/analyze_in_ml_button.tsx b/x-pack/plugins/infra/public/components/logging/log_analysis_results/analyze_in_ml_button.tsx similarity index 93% rename from x-pack/legacy/plugins/infra/public/components/logging/log_analysis_results/analyze_in_ml_button.tsx rename to x-pack/plugins/infra/public/components/logging/log_analysis_results/analyze_in_ml_button.tsx index 9fbba94407dc0..6b946898f6330 100644 --- a/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_results/analyze_in_ml_button.tsx +++ b/x-pack/plugins/infra/public/components/logging/log_analysis_results/analyze_in_ml_button.tsx @@ -10,9 +10,9 @@ import React from 'react'; import { encode } from 'rison-node'; import url from 'url'; import { stringify } from 'query-string'; -import { useKibana } from '../../../../../../../../src/plugins/kibana_react/public'; +import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; import { TimeRange } from '../../../../common/http_api/shared/time_range'; -import { url as urlUtils } from '../../../../../../../../src/plugins/kibana_utils/public'; +import { url as urlUtils } from '../../../../../../../src/plugins/kibana_utils/public'; export const AnalyzeInMlButton: React.FunctionComponent<{ jobId: string; diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_results/first_use_callout.tsx b/x-pack/plugins/infra/public/components/logging/log_analysis_results/first_use_callout.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/logging/log_analysis_results/first_use_callout.tsx rename to x-pack/plugins/infra/public/components/logging/log_analysis_results/first_use_callout.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_results/index.ts b/x-pack/plugins/infra/public/components/logging/log_analysis_results/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/logging/log_analysis_results/index.ts rename to x-pack/plugins/infra/public/components/logging/log_analysis_results/index.ts diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/index.ts b/x-pack/plugins/infra/public/components/logging/log_analysis_setup/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/index.ts rename to x-pack/plugins/infra/public/components/logging/log_analysis_setup/index.ts diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/initial_configuration_step/analysis_setup_indices_form.tsx b/x-pack/plugins/infra/public/components/logging/log_analysis_setup/initial_configuration_step/analysis_setup_indices_form.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/initial_configuration_step/analysis_setup_indices_form.tsx rename to x-pack/plugins/infra/public/components/logging/log_analysis_setup/initial_configuration_step/analysis_setup_indices_form.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/initial_configuration_step/analysis_setup_timerange_form.tsx b/x-pack/plugins/infra/public/components/logging/log_analysis_setup/initial_configuration_step/analysis_setup_timerange_form.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/initial_configuration_step/analysis_setup_timerange_form.tsx rename to x-pack/plugins/infra/public/components/logging/log_analysis_setup/initial_configuration_step/analysis_setup_timerange_form.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/initial_configuration_step/index.ts b/x-pack/plugins/infra/public/components/logging/log_analysis_setup/initial_configuration_step/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/initial_configuration_step/index.ts rename to x-pack/plugins/infra/public/components/logging/log_analysis_setup/initial_configuration_step/index.ts diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/initial_configuration_step/initial_configuration_step.tsx b/x-pack/plugins/infra/public/components/logging/log_analysis_setup/initial_configuration_step/initial_configuration_step.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/initial_configuration_step/initial_configuration_step.tsx rename to x-pack/plugins/infra/public/components/logging/log_analysis_setup/initial_configuration_step/initial_configuration_step.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/initial_configuration_step/validation.tsx b/x-pack/plugins/infra/public/components/logging/log_analysis_setup/initial_configuration_step/validation.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/initial_configuration_step/validation.tsx rename to x-pack/plugins/infra/public/components/logging/log_analysis_setup/initial_configuration_step/validation.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/missing_results_privileges_prompt.tsx b/x-pack/plugins/infra/public/components/logging/log_analysis_setup/missing_results_privileges_prompt.tsx similarity index 94% rename from x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/missing_results_privileges_prompt.tsx rename to x-pack/plugins/infra/public/components/logging/log_analysis_setup/missing_results_privileges_prompt.tsx index 0c3393b0e15e3..2d378508e2b58 100644 --- a/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/missing_results_privileges_prompt.tsx +++ b/x-pack/plugins/infra/public/components/logging/log_analysis_setup/missing_results_privileges_prompt.tsx @@ -8,7 +8,7 @@ import { EuiEmptyPrompt, EuiCode } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import React from 'react'; -import euiStyled from '../../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../../observability/public'; import { UserManagementLink } from './user_management_link'; export const MissingResultsPrivilegesPrompt: React.FunctionComponent = () => ( diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/missing_setup_privileges_prompt.tsx b/x-pack/plugins/infra/public/components/logging/log_analysis_setup/missing_setup_privileges_prompt.tsx similarity index 94% rename from x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/missing_setup_privileges_prompt.tsx rename to x-pack/plugins/infra/public/components/logging/log_analysis_setup/missing_setup_privileges_prompt.tsx index 1549ab9120777..db89ff415a6f7 100644 --- a/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/missing_setup_privileges_prompt.tsx +++ b/x-pack/plugins/infra/public/components/logging/log_analysis_setup/missing_setup_privileges_prompt.tsx @@ -8,7 +8,7 @@ import { EuiEmptyPrompt, EuiCode } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import React from 'react'; -import euiStyled from '../../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../../observability/public'; import { UserManagementLink } from './user_management_link'; export const MissingSetupPrivilegesPrompt: React.FunctionComponent = () => ( diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/ml_unavailable_prompt.tsx b/x-pack/plugins/infra/public/components/logging/log_analysis_setup/ml_unavailable_prompt.tsx similarity index 95% rename from x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/ml_unavailable_prompt.tsx rename to x-pack/plugins/infra/public/components/logging/log_analysis_setup/ml_unavailable_prompt.tsx index 63e1bb23a2d82..4b15ce19ef096 100644 --- a/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/ml_unavailable_prompt.tsx +++ b/x-pack/plugins/infra/public/components/logging/log_analysis_setup/ml_unavailable_prompt.tsx @@ -9,7 +9,7 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import React from 'react'; -import euiStyled from '../../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../../observability/public'; export const MlUnavailablePrompt: React.FunctionComponent<{}> = () => ( = ({ children, diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/setup_status_unknown_prompt.tsx b/x-pack/plugins/infra/public/components/logging/log_analysis_setup/setup_status_unknown_prompt.tsx similarity index 93% rename from x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/setup_status_unknown_prompt.tsx rename to x-pack/plugins/infra/public/components/logging/log_analysis_setup/setup_status_unknown_prompt.tsx index f65ff6a1eec78..334aaa251f524 100644 --- a/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/setup_status_unknown_prompt.tsx +++ b/x-pack/plugins/infra/public/components/logging/log_analysis_setup/setup_status_unknown_prompt.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import { EuiEmptyPrompt, EuiButton } from '@elastic/eui'; -import euiStyled from '../../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../../observability/public'; interface Props { retry: () => void; diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/user_management_link.tsx b/x-pack/plugins/infra/public/components/logging/log_analysis_setup/user_management_link.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/logging/log_analysis_setup/user_management_link.tsx rename to x-pack/plugins/infra/public/components/logging/log_analysis_setup/user_management_link.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_customization_menu.tsx b/x-pack/plugins/infra/public/components/logging/log_customization_menu.tsx similarity index 95% rename from x-pack/legacy/plugins/infra/public/components/logging/log_customization_menu.tsx rename to x-pack/plugins/infra/public/components/logging/log_customization_menu.tsx index 9ca0d4329a90b..febfdddfcfb0e 100644 --- a/x-pack/legacy/plugins/infra/public/components/logging/log_customization_menu.tsx +++ b/x-pack/plugins/infra/public/components/logging/log_customization_menu.tsx @@ -8,7 +8,7 @@ import { EuiButtonEmpty, EuiPopover } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import * as React from 'react'; -import euiStyled from '../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../observability/public'; interface LogCustomizationMenuState { isShown: boolean; diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_entry_flyout/index.tsx b/x-pack/plugins/infra/public/components/logging/log_entry_flyout/index.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/logging/log_entry_flyout/index.tsx rename to x-pack/plugins/infra/public/components/logging/log_entry_flyout/index.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_entry_flyout/log_entry_actions_menu.test.tsx b/x-pack/plugins/infra/public/components/logging/log_entry_flyout/log_entry_actions_menu.test.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/logging/log_entry_flyout/log_entry_actions_menu.test.tsx rename to x-pack/plugins/infra/public/components/logging/log_entry_flyout/log_entry_actions_menu.test.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_entry_flyout/log_entry_actions_menu.tsx b/x-pack/plugins/infra/public/components/logging/log_entry_flyout/log_entry_actions_menu.tsx similarity index 95% rename from x-pack/legacy/plugins/infra/public/components/logging/log_entry_flyout/log_entry_actions_menu.tsx rename to x-pack/plugins/infra/public/components/logging/log_entry_flyout/log_entry_actions_menu.tsx index 4137027f35c12..60e50f486d22a 100644 --- a/x-pack/legacy/plugins/infra/public/components/logging/log_entry_flyout/log_entry_actions_menu.tsx +++ b/x-pack/plugins/infra/public/components/logging/log_entry_flyout/log_entry_actions_menu.tsx @@ -8,9 +8,9 @@ import { EuiButtonEmpty, EuiContextMenuItem, EuiContextMenuPanel, EuiPopover } f import { FormattedMessage } from '@kbn/i18n/react'; import React, { useMemo } from 'react'; import url from 'url'; -import { useKibana } from '../../../../../../../../src/plugins/kibana_react/public'; +import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; import { useVisibilityState } from '../../../utils/use_visibility_state'; -import { getTraceUrl } from '../../../../../apm/public/components/shared/Links/apm/ExternalLinks'; +import { getTraceUrl } from '../../../../../../legacy/plugins/apm/public/components/shared/Links/apm/ExternalLinks'; import { LogEntriesItem } from '../../../../common/http_api'; const UPTIME_FIELDS = ['container.id', 'host.ip', 'kubernetes.pod.uid']; diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_entry_flyout/log_entry_flyout.tsx b/x-pack/plugins/infra/public/components/logging/log_entry_flyout/log_entry_flyout.tsx similarity index 98% rename from x-pack/legacy/plugins/infra/public/components/logging/log_entry_flyout/log_entry_flyout.tsx rename to x-pack/plugins/infra/public/components/logging/log_entry_flyout/log_entry_flyout.tsx index d2cb9cf9370dd..57f27ee76184b 100644 --- a/x-pack/legacy/plugins/infra/public/components/logging/log_entry_flyout/log_entry_flyout.tsx +++ b/x-pack/plugins/infra/public/components/logging/log_entry_flyout/log_entry_flyout.tsx @@ -20,7 +20,7 @@ import { FormattedMessage } from '@kbn/i18n/react'; import moment from 'moment'; import React, { useCallback, useMemo } from 'react'; -import euiStyled from '../../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../../observability/public'; import { TimeKey } from '../../../../common/time'; import { InfraLoadingPanel } from '../../loading'; import { LogEntryActionsMenu } from './log_entry_actions_menu'; diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_highlights_menu.tsx b/x-pack/plugins/infra/public/components/logging/log_highlights_menu.tsx similarity index 98% rename from x-pack/legacy/plugins/infra/public/components/logging/log_highlights_menu.tsx rename to x-pack/plugins/infra/public/components/logging/log_highlights_menu.tsx index d13ccde7466cd..f51ed693e7d80 100644 --- a/x-pack/legacy/plugins/infra/public/components/logging/log_highlights_menu.tsx +++ b/x-pack/plugins/infra/public/components/logging/log_highlights_menu.tsx @@ -18,7 +18,7 @@ import { FormattedMessage } from '@kbn/i18n/react'; import { debounce } from 'lodash'; import React, { useCallback, useMemo, useState } from 'react'; -import euiStyled from '../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../observability/public'; import { useVisibilityState } from '../../utils/use_visibility_state'; interface LogHighlightsMenuProps { diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_minimap/density_chart.tsx b/x-pack/plugins/infra/public/components/logging/log_minimap/density_chart.tsx similarity index 95% rename from x-pack/legacy/plugins/infra/public/components/logging/log_minimap/density_chart.tsx rename to x-pack/plugins/infra/public/components/logging/log_minimap/density_chart.tsx index b31afe6abea28..729689e65739e 100644 --- a/x-pack/legacy/plugins/infra/public/components/logging/log_minimap/density_chart.tsx +++ b/x-pack/plugins/infra/public/components/logging/log_minimap/density_chart.tsx @@ -6,10 +6,10 @@ import { scaleLinear, scaleTime } from 'd3-scale'; import { area, curveMonotoneY } from 'd3-shape'; -import max from 'lodash/fp/max'; +import { max } from 'lodash'; import * as React from 'react'; -import euiStyled from '../../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../../observability/public'; import { SummaryBucket } from './types'; interface DensityChartProps { diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_minimap/highlighted_interval.tsx b/x-pack/plugins/infra/public/components/logging/log_minimap/highlighted_interval.tsx similarity index 95% rename from x-pack/legacy/plugins/infra/public/components/logging/log_minimap/highlighted_interval.tsx rename to x-pack/plugins/infra/public/components/logging/log_minimap/highlighted_interval.tsx index 4711a7ac6ffde..2e45bcea42109 100644 --- a/x-pack/legacy/plugins/infra/public/components/logging/log_minimap/highlighted_interval.tsx +++ b/x-pack/plugins/infra/public/components/logging/log_minimap/highlighted_interval.tsx @@ -6,7 +6,7 @@ import * as React from 'react'; -import euiStyled from '../../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../../observability/public'; interface HighlightedIntervalProps { className?: string; diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_minimap/index.ts b/x-pack/plugins/infra/public/components/logging/log_minimap/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/logging/log_minimap/index.ts rename to x-pack/plugins/infra/public/components/logging/log_minimap/index.ts diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_minimap/log_minimap.tsx b/x-pack/plugins/infra/public/components/logging/log_minimap/log_minimap.tsx similarity index 99% rename from x-pack/legacy/plugins/infra/public/components/logging/log_minimap/log_minimap.tsx rename to x-pack/plugins/infra/public/components/logging/log_minimap/log_minimap.tsx index 75d8c5a47d32d..e3a7e5aa30633 100644 --- a/x-pack/legacy/plugins/infra/public/components/logging/log_minimap/log_minimap.tsx +++ b/x-pack/plugins/infra/public/components/logging/log_minimap/log_minimap.tsx @@ -7,7 +7,7 @@ import { scaleLinear } from 'd3-scale'; import * as React from 'react'; -import euiStyled from '../../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../../observability/public'; import { LogEntryTime } from '../../../../common/log_entry'; import { DensityChart } from './density_chart'; import { HighlightedInterval } from './highlighted_interval'; diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_minimap/search_marker.tsx b/x-pack/plugins/infra/public/components/logging/log_minimap/search_marker.tsx similarity index 97% rename from x-pack/legacy/plugins/infra/public/components/logging/log_minimap/search_marker.tsx rename to x-pack/plugins/infra/public/components/logging/log_minimap/search_marker.tsx index 5b661562a451e..8b87aa15f16f0 100644 --- a/x-pack/legacy/plugins/infra/public/components/logging/log_minimap/search_marker.tsx +++ b/x-pack/plugins/infra/public/components/logging/log_minimap/search_marker.tsx @@ -7,7 +7,7 @@ import { FormattedMessage } from '@kbn/i18n/react'; import * as React from 'react'; -import euiStyled, { keyframes } from '../../../../../../common/eui_styled_components'; +import { euiStyled, keyframes } from '../../../../../observability/public'; import { LogEntryTime } from '../../../../common/log_entry'; import { SearchMarkerTooltip } from './search_marker_tooltip'; import { SummaryHighlightBucket } from './types'; diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_minimap/search_marker_tooltip.tsx b/x-pack/plugins/infra/public/components/logging/log_minimap/search_marker_tooltip.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/logging/log_minimap/search_marker_tooltip.tsx rename to x-pack/plugins/infra/public/components/logging/log_minimap/search_marker_tooltip.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_minimap/search_markers.tsx b/x-pack/plugins/infra/public/components/logging/log_minimap/search_markers.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/logging/log_minimap/search_markers.tsx rename to x-pack/plugins/infra/public/components/logging/log_minimap/search_markers.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_minimap/time_ruler.tsx b/x-pack/plugins/infra/public/components/logging/log_minimap/time_ruler.tsx similarity index 96% rename from x-pack/legacy/plugins/infra/public/components/logging/log_minimap/time_ruler.tsx rename to x-pack/plugins/infra/public/components/logging/log_minimap/time_ruler.tsx index c72403539563d..b610737663e8d 100644 --- a/x-pack/legacy/plugins/infra/public/components/logging/log_minimap/time_ruler.tsx +++ b/x-pack/plugins/infra/public/components/logging/log_minimap/time_ruler.tsx @@ -7,7 +7,7 @@ import { scaleTime } from 'd3-scale'; import * as React from 'react'; -import euiStyled from '../../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../../observability/public'; interface TimeRulerProps { end: number; diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_minimap/types.ts b/x-pack/plugins/infra/public/components/logging/log_minimap/types.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/logging/log_minimap/types.ts rename to x-pack/plugins/infra/public/components/logging/log_minimap/types.ts diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_minimap_scale_controls.tsx b/x-pack/plugins/infra/public/components/logging/log_minimap_scale_controls.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/logging/log_minimap_scale_controls.tsx rename to x-pack/plugins/infra/public/components/logging/log_minimap_scale_controls.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_search_controls/index.ts b/x-pack/plugins/infra/public/components/logging/log_search_controls/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/logging/log_search_controls/index.ts rename to x-pack/plugins/infra/public/components/logging/log_search_controls/index.ts diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_search_controls/log_search_buttons.tsx b/x-pack/plugins/infra/public/components/logging/log_search_controls/log_search_buttons.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/logging/log_search_controls/log_search_buttons.tsx rename to x-pack/plugins/infra/public/components/logging/log_search_controls/log_search_buttons.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_search_controls/log_search_controls.tsx b/x-pack/plugins/infra/public/components/logging/log_search_controls/log_search_controls.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/logging/log_search_controls/log_search_controls.tsx rename to x-pack/plugins/infra/public/components/logging/log_search_controls/log_search_controls.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_search_controls/log_search_input.tsx b/x-pack/plugins/infra/public/components/logging/log_search_controls/log_search_input.tsx similarity index 96% rename from x-pack/legacy/plugins/infra/public/components/logging/log_search_controls/log_search_input.tsx rename to x-pack/plugins/infra/public/components/logging/log_search_controls/log_search_input.tsx index c5eedef83e824..a5277260d56e0 100644 --- a/x-pack/legacy/plugins/infra/public/components/logging/log_search_controls/log_search_input.tsx +++ b/x-pack/plugins/infra/public/components/logging/log_search_controls/log_search_input.tsx @@ -10,7 +10,7 @@ import { i18n } from '@kbn/i18n'; import classNames from 'classnames'; import * as React from 'react'; -import euiStyled from '../../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../../observability/public'; interface LogSearchInputProps { className?: string; diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_statusbar.tsx b/x-pack/plugins/infra/public/components/logging/log_statusbar.tsx similarity index 91% rename from x-pack/legacy/plugins/infra/public/components/logging/log_statusbar.tsx rename to x-pack/plugins/infra/public/components/logging/log_statusbar.tsx index 4bda5a5a4b009..8a0f1290c2af3 100644 --- a/x-pack/legacy/plugins/infra/public/components/logging/log_statusbar.tsx +++ b/x-pack/plugins/infra/public/components/logging/log_statusbar.tsx @@ -6,7 +6,7 @@ import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; -import euiStyled from '../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../observability/public'; export const LogStatusbar = euiStyled(EuiFlexGroup).attrs(() => ({ alignItems: 'center', diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_text_scale_controls.tsx b/x-pack/plugins/infra/public/components/logging/log_text_scale_controls.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/logging/log_text_scale_controls.tsx rename to x-pack/plugins/infra/public/components/logging/log_text_scale_controls.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/column_headers.tsx b/x-pack/plugins/infra/public/components/logging/log_text_stream/column_headers.tsx similarity index 98% rename from x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/column_headers.tsx rename to x-pack/plugins/infra/public/components/logging/log_text_stream/column_headers.tsx index 6516993397e02..72d6aea5ecfc6 100644 --- a/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/column_headers.tsx +++ b/x-pack/plugins/infra/public/components/logging/log_text_stream/column_headers.tsx @@ -7,7 +7,7 @@ import React, { useContext } from 'react'; import { transparentize } from 'polished'; -import euiStyled from '../../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../../observability/public'; import { LogColumnConfiguration, isTimestampLogColumnConfiguration, diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/highlighting.tsx b/x-pack/plugins/infra/public/components/logging/log_text_stream/highlighting.tsx similarity index 96% rename from x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/highlighting.tsx rename to x-pack/plugins/infra/public/components/logging/log_text_stream/highlighting.tsx index a48f3c96958be..a6cb8def4f6c4 100644 --- a/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/highlighting.tsx +++ b/x-pack/plugins/infra/public/components/logging/log_text_stream/highlighting.tsx @@ -6,7 +6,7 @@ import React from 'react'; -import euiStyled from '../../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../../observability/public'; import { chooseLightOrDarkColor, tintOrShade } from '../../../utils/styles'; export const ActiveHighlightMarker = euiStyled.mark` diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/index.ts b/x-pack/plugins/infra/public/components/logging/log_text_stream/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/index.ts rename to x-pack/plugins/infra/public/components/logging/log_text_stream/index.ts diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/item.ts b/x-pack/plugins/infra/public/components/logging/log_text_stream/item.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/item.ts rename to x-pack/plugins/infra/public/components/logging/log_text_stream/item.ts diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/jump_to_tail.tsx b/x-pack/plugins/infra/public/components/logging/log_text_stream/jump_to_tail.tsx similarity index 95% rename from x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/jump_to_tail.tsx rename to x-pack/plugins/infra/public/components/logging/log_text_stream/jump_to_tail.tsx index 05f85ceed49c0..50595cfe971d8 100644 --- a/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/jump_to_tail.tsx +++ b/x-pack/plugins/infra/public/components/logging/log_text_stream/jump_to_tail.tsx @@ -10,7 +10,7 @@ import { EuiButtonEmpty, EuiText } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import * as React from 'react'; -import euiStyled from '../../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../../observability/public'; interface LogTextStreamJumpToTailProps { onClickJump?: () => void; diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/loading_item_view.tsx b/x-pack/plugins/infra/public/components/logging/log_text_stream/loading_item_view.tsx similarity index 98% rename from x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/loading_item_view.tsx rename to x-pack/plugins/infra/public/components/logging/log_text_stream/loading_item_view.tsx index 4cefbea7225ec..8c48d9e176d3b 100644 --- a/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/loading_item_view.tsx +++ b/x-pack/plugins/infra/public/components/logging/log_text_stream/loading_item_view.tsx @@ -10,7 +10,7 @@ import { EuiButtonEmpty, EuiIcon, EuiProgress, EuiText } from '@elastic/eui'; import { FormattedMessage, FormattedRelative } from '@kbn/i18n/react'; import * as React from 'react'; -import euiStyled from '../../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../../observability/public'; interface LogTextStreamLoadingItemViewProps { alignment: 'top' | 'bottom'; diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/log_date_row.tsx b/x-pack/plugins/infra/public/components/logging/log_text_stream/log_date_row.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/log_date_row.tsx rename to x-pack/plugins/infra/public/components/logging/log_text_stream/log_date_row.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/log_entry_column.tsx b/x-pack/plugins/infra/public/components/logging/log_text_stream/log_entry_column.tsx similarity index 97% rename from x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/log_entry_column.tsx rename to x-pack/plugins/infra/public/components/logging/log_text_stream/log_entry_column.tsx index 643f98018cb0a..bcb5400c72209 100644 --- a/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/log_entry_column.tsx +++ b/x-pack/plugins/infra/public/components/logging/log_text_stream/log_entry_column.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import euiStyled from '../../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../../observability/public'; import { LogColumnConfiguration, isMessageLogColumnConfiguration, diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/log_entry_field_column.test.tsx b/x-pack/plugins/infra/public/components/logging/log_text_stream/log_entry_field_column.test.tsx similarity index 97% rename from x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/log_entry_field_column.test.tsx rename to x-pack/plugins/infra/public/components/logging/log_text_stream/log_entry_field_column.test.tsx index f947a0fb1adcd..8589f82ba15dd 100644 --- a/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/log_entry_field_column.test.tsx +++ b/x-pack/plugins/infra/public/components/logging/log_text_stream/log_entry_field_column.test.tsx @@ -7,7 +7,7 @@ import { mount } from 'enzyme'; import React from 'react'; -import { EuiThemeProvider } from '../../../../../../common/eui_styled_components'; +import { EuiThemeProvider } from '../../../../../observability/public'; import { LogEntryColumn } from '../../../utils/log_entry'; import { LogEntryFieldColumn } from './log_entry_field_column'; diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/log_entry_field_column.tsx b/x-pack/plugins/infra/public/components/logging/log_text_stream/log_entry_field_column.tsx similarity index 97% rename from x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/log_entry_field_column.tsx rename to x-pack/plugins/infra/public/components/logging/log_text_stream/log_entry_field_column.tsx index 6252b3a396d1b..705a7f4c12de4 100644 --- a/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/log_entry_field_column.tsx +++ b/x-pack/plugins/infra/public/components/logging/log_text_stream/log_entry_field_column.tsx @@ -8,7 +8,7 @@ import stringify from 'json-stable-stringify'; import { darken, transparentize } from 'polished'; import React, { useMemo } from 'react'; -import euiStyled, { css } from '../../../../../../common/eui_styled_components'; +import { euiStyled, css } from '../../../../../observability/public'; import { isFieldColumn, isHighlightFieldColumn, diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/log_entry_icon_column.tsx b/x-pack/plugins/infra/public/components/logging/log_text_stream/log_entry_icon_column.tsx similarity index 96% rename from x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/log_entry_icon_column.tsx rename to x-pack/plugins/infra/public/components/logging/log_text_stream/log_entry_icon_column.tsx index f7d841bcce94f..a4099cdf5a1fb 100644 --- a/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/log_entry_icon_column.tsx +++ b/x-pack/plugins/infra/public/components/logging/log_text_stream/log_entry_icon_column.tsx @@ -10,7 +10,7 @@ import React from 'react'; import { LogEntryColumnContent } from './log_entry_column'; import { hoveredContentStyle } from './text_styles'; -import euiStyled from '../../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../../observability/public'; interface LogEntryIconColumnProps { isHighlighted: boolean; diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/log_entry_message_column.tsx b/x-pack/plugins/infra/public/components/logging/log_text_stream/log_entry_message_column.tsx similarity index 97% rename from x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/log_entry_message_column.tsx rename to x-pack/plugins/infra/public/components/logging/log_text_stream/log_entry_message_column.tsx index 11d73736463e2..10bc2a7b4597a 100644 --- a/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/log_entry_message_column.tsx +++ b/x-pack/plugins/infra/public/components/logging/log_text_stream/log_entry_message_column.tsx @@ -6,7 +6,7 @@ import React, { memo, useMemo } from 'react'; -import euiStyled, { css } from '../../../../../../common/eui_styled_components'; +import { euiStyled, css } from '../../../../../observability/public'; import { isConstantSegment, isFieldSegment, diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/log_entry_row.tsx b/x-pack/plugins/infra/public/components/logging/log_text_stream/log_entry_row.tsx similarity index 98% rename from x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/log_entry_row.tsx rename to x-pack/plugins/infra/public/components/logging/log_text_stream/log_entry_row.tsx index 0da601ae52088..9c1a1bb5962e4 100644 --- a/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/log_entry_row.tsx +++ b/x-pack/plugins/infra/public/components/logging/log_text_stream/log_entry_row.tsx @@ -7,7 +7,7 @@ // import { darken, transparentize } from 'polished'; import React, { useState, useCallback, useMemo } from 'react'; -import euiStyled from '../../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../../observability/public'; import { LogEntry, LogEntryHighlight, diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/log_entry_timestamp_column.tsx b/x-pack/plugins/infra/public/components/logging/log_text_stream/log_entry_timestamp_column.tsx similarity index 95% rename from x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/log_entry_timestamp_column.tsx rename to x-pack/plugins/infra/public/components/logging/log_text_stream/log_entry_timestamp_column.tsx index 8e161367b428d..e3c1e80a43a1a 100644 --- a/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/log_entry_timestamp_column.tsx +++ b/x-pack/plugins/infra/public/components/logging/log_text_stream/log_entry_timestamp_column.tsx @@ -7,7 +7,7 @@ import { darken, transparentize } from 'polished'; import React, { memo } from 'react'; -import euiStyled, { css } from '../../../../../../common/eui_styled_components'; +import { euiStyled, css } from '../../../../../observability/public'; import { useFormattedTime } from '../../formatted_time'; import { LogEntryColumnContent } from './log_entry_column'; diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/measurable_item_view.tsx b/x-pack/plugins/infra/public/components/logging/log_text_stream/measurable_item_view.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/measurable_item_view.tsx rename to x-pack/plugins/infra/public/components/logging/log_text_stream/measurable_item_view.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/scrollable_log_text_stream_view.tsx b/x-pack/plugins/infra/public/components/logging/log_text_stream/scrollable_log_text_stream_view.tsx similarity index 99% rename from x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/scrollable_log_text_stream_view.tsx rename to x-pack/plugins/infra/public/components/logging/log_text_stream/scrollable_log_text_stream_view.tsx index 15d3c83ffebe9..0bf121cf6c1eb 100644 --- a/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/scrollable_log_text_stream_view.tsx +++ b/x-pack/plugins/infra/public/components/logging/log_text_stream/scrollable_log_text_stream_view.tsx @@ -9,7 +9,7 @@ import { FormattedMessage } from '@kbn/i18n/react'; import React, { Fragment, useMemo } from 'react'; import moment from 'moment'; -import euiStyled from '../../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../../observability/public'; import { TextScale } from '../../../../common/log_text_scale'; import { TimeKey, UniqueTimeKey } from '../../../../common/time'; import { callWithoutRepeats } from '../../../utils/handlers'; diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/text_styles.tsx b/x-pack/plugins/infra/public/components/logging/log_text_stream/text_styles.tsx similarity index 96% rename from x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/text_styles.tsx rename to x-pack/plugins/infra/public/components/logging/log_text_stream/text_styles.tsx index e95ac6aa7923b..6857f94105dad 100644 --- a/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/text_styles.tsx +++ b/x-pack/plugins/infra/public/components/logging/log_text_stream/text_styles.tsx @@ -7,7 +7,7 @@ import { darken, transparentize } from 'polished'; import React, { useMemo, useState, useCallback } from 'react'; -import euiStyled, { css } from '../../../../../../common/eui_styled_components'; +import { euiStyled, css } from '../../../../../observability/public'; import { TextScale } from '../../../../common/log_text_scale'; export const monospaceTextStyle = (scale: TextScale) => css` diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/vertical_scroll_panel.tsx b/x-pack/plugins/infra/public/components/logging/log_text_stream/vertical_scroll_panel.tsx similarity index 91% rename from x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/vertical_scroll_panel.tsx rename to x-pack/plugins/infra/public/components/logging/log_text_stream/vertical_scroll_panel.tsx index a57c25bf77bc8..199f24f5d3f53 100644 --- a/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/vertical_scroll_panel.tsx +++ b/x-pack/plugins/infra/public/components/logging/log_text_stream/vertical_scroll_panel.tsx @@ -5,11 +5,10 @@ */ import { bisector } from 'd3-array'; -import sortBy from 'lodash/fp/sortBy'; -import throttle from 'lodash/fp/throttle'; +import { sortBy, throttle } from 'lodash'; import * as React from 'react'; -import euiStyled from '../../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../../observability/public'; import { Rect } from './measurable_item_view'; interface VerticalScrollPanelProps { @@ -57,17 +56,14 @@ export class VerticalScrollPanel extends React.PureComponent< public childDimensions = new Map(); private nextScrollEventFromCenterTarget = false; - public handleScroll: React.UIEventHandler = throttle( - SCROLL_THROTTLE_INTERVAL, - () => { - // If this event was fired by the centerTarget method modifying the scrollTop, - // then don't send `fromScroll: true` to reportVisibleChildren. The rest of the - // app needs to respond differently depending on whether the user is scrolling through - // the pane manually, versus whether the pane is updating itself in response to new data - this.reportVisibleChildren(!this.nextScrollEventFromCenterTarget); - this.nextScrollEventFromCenterTarget = false; - } - ); + public handleScroll: React.UIEventHandler = throttle(() => { + // If this event was fired by the centerTarget method modifying the scrollTop, + // then don't send `fromScroll: true` to reportVisibleChildren. The rest of the + // app needs to respond differently depending on whether the user is scrolling through + // the pane manually, versus whether the pane is updating itself in response to new data + this.reportVisibleChildren(!this.nextScrollEventFromCenterTarget); + this.nextScrollEventFromCenterTarget = false; + }, SCROLL_THROTTLE_INTERVAL); public registerChild = (key: any, element: MeasurableChild | null) => { if (element === null) { @@ -79,7 +75,7 @@ export class VerticalScrollPanel extends React.PureComponent< public updateChildDimensions = () => { this.childDimensions = new Map( - sortDimensionsByTop( + sortBy<[any, Rect]>( Array.from(this.childRefs.entries()).reduce((accumulatedDimensions, [key, child]) => { const currentOffsetRect = child.getOffsetRect(); @@ -88,7 +84,8 @@ export class VerticalScrollPanel extends React.PureComponent< } return accumulatedDimensions; - }, [] as Array<[any, Rect]>) + }, [] as Array<[any, Rect]>), + '1.top' ) ); }; @@ -302,7 +299,5 @@ const getVisibleChildren = ( }; }; -const sortDimensionsByTop = sortBy<[any, Rect]>('1.top'); - const getChildIndexBefore = bisector<[any, Rect], number>(([key, rect]) => rect.top + rect.height) .left; diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_text_wrap_controls.tsx b/x-pack/plugins/infra/public/components/logging/log_text_wrap_controls.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/logging/log_text_wrap_controls.tsx rename to x-pack/plugins/infra/public/components/logging/log_text_wrap_controls.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_time_controls.tsx b/x-pack/plugins/infra/public/components/logging/log_time_controls.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/logging/log_time_controls.tsx rename to x-pack/plugins/infra/public/components/logging/log_time_controls.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/aggregation.tsx b/x-pack/plugins/infra/public/components/metrics_explorer/aggregation.tsx similarity index 96% rename from x-pack/legacy/plugins/infra/public/components/metrics_explorer/aggregation.tsx rename to x-pack/plugins/infra/public/components/metrics_explorer/aggregation.tsx index 2abc03d6ea9b9..76fa519ab3756 100644 --- a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/aggregation.tsx +++ b/x-pack/plugins/infra/public/components/metrics_explorer/aggregation.tsx @@ -8,7 +8,7 @@ import { EuiSelect } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import React, { useCallback } from 'react'; -import { MetricsExplorerAggregation } from '../../../server/routes/metrics_explorer/types'; +import { MetricsExplorerAggregation } from '../../../common/http_api/metrics_explorer'; import { MetricsExplorerOptions } from '../../containers/metrics_explorer/use_metrics_explorer_options'; import { metricsExplorerAggregationRT, diff --git a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/chart.tsx b/x-pack/plugins/infra/public/components/metrics_explorer/chart.tsx similarity index 95% rename from x-pack/legacy/plugins/infra/public/components/metrics_explorer/chart.tsx rename to x-pack/plugins/infra/public/components/metrics_explorer/chart.tsx index 3fb755aa6957c..c01452c6e2baf 100644 --- a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/chart.tsx +++ b/x-pack/plugins/infra/public/components/metrics_explorer/chart.tsx @@ -9,14 +9,14 @@ import { EuiTitle, EuiToolTip, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import { Axis, Chart, niceTimeFormatter, Position, Settings, TooltipValue } from '@elastic/charts'; import { first, last } from 'lodash'; import moment from 'moment'; -import { MetricsExplorerSeries } from '../../../server/routes/metrics_explorer/types'; +import { MetricsExplorerSeries } from '../../../common/http_api/metrics_explorer'; import { MetricsExplorerOptions, MetricsExplorerTimeOptions, MetricsExplorerYAxisMode, MetricsExplorerChartOptions, } from '../../containers/metrics_explorer/use_metrics_explorer_options'; -import euiStyled from '../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../observability/public'; import { createFormatterForMetric } from './helpers/create_formatter_for_metric'; import { MetricExplorerSeriesChart } from './series_chart'; import { MetricsExplorerChartContextMenu } from './chart_context_menu'; @@ -26,7 +26,7 @@ import { MetricsExplorerNoMetrics } from './no_metrics'; import { getChartTheme } from './helpers/get_chart_theme'; import { useKibanaUiSetting } from '../../utils/use_kibana_ui_setting'; import { calculateDomain } from './helpers/calculate_domain'; -import { useKibana, useUiSetting } from '../../../../../../../src/plugins/kibana_react/public'; +import { useKibana, useUiSetting } from '../../../../../../src/plugins/kibana_react/public'; interface Props { title?: string | null; diff --git a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/chart_context_menu.test.tsx b/x-pack/plugins/infra/public/components/metrics_explorer/chart_context_menu.test.tsx similarity index 61% rename from x-pack/legacy/plugins/infra/public/components/metrics_explorer/chart_context_menu.test.tsx rename to x-pack/plugins/infra/public/components/metrics_explorer/chart_context_menu.test.tsx index 4dd46e9ef233a..9c3319d467ae2 100644 --- a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/chart_context_menu.test.tsx +++ b/x-pack/plugins/infra/public/components/metrics_explorer/chart_context_menu.test.tsx @@ -5,12 +5,12 @@ */ import React from 'react'; -import { MetricsExplorerChartContextMenu, createNodeDetailLink } from './chart_context_menu'; -import { mount } from 'enzyme'; +import { MetricsExplorerChartContextMenu, createNodeDetailLink, Props } from './chart_context_menu'; +import { ReactWrapper, mount } from 'enzyme'; import { options, source, timeRange, chartOptions } from '../../utils/fixtures/metrics_explorer'; import DateMath from '@elastic/datemath'; -import { ReactWrapper } from 'enzyme'; import { Capabilities } from 'src/core/public'; +import { KibanaContextProvider } from '../../../../../../src/plugins/kibana_react/public'; const series = { id: 'exmaple-01', rows: [], columns: [] }; const uiCapabilities: Capabilities = { @@ -24,22 +24,36 @@ const getTestSubject = (component: ReactWrapper, name: string) => { return component.find(`[data-test-subj="${name}"]`).hostNodes(); }; +const mountComponentWithProviders = (props: Props): ReactWrapper => { + const services = { + http: { + fetch: jest.fn(), + }, + application: { + getUrlForApp: jest.fn(), + }, + }; + + return mount( + + + + ); +}; + describe('MetricsExplorerChartContextMenu', () => { describe('component', () => { it('should just work', async () => { const onFilter = jest.fn().mockImplementation((query: string) => void 0); - const component = mount( - - ); - + const component = mountComponentWithProviders({ + timeRange, + source, + series, + options, + onFilter, + uiCapabilities, + chartOptions, + }); component.find('button').simulate('click'); expect(getTestSubject(component, 'metricsExplorerAction-AddFilter').length).toBe(1); expect(getTestSubject(component, 'metricsExplorerAction-OpenInTSVB').length).toBe(1); @@ -49,33 +63,28 @@ describe('MetricsExplorerChartContextMenu', () => { it('should not display View metrics for incompatible groupBy', async () => { const customOptions = { ...options, groupBy: 'system.network.name' }; const onFilter = jest.fn().mockImplementation((query: string) => void 0); - const component = mount( - - ); + const component = mountComponentWithProviders({ + timeRange, + source, + series, + options: customOptions, + onFilter, + uiCapabilities, + chartOptions, + }); component.find('button').simulate('click'); expect(getTestSubject(component, 'metricsExplorerAction-ViewNodeMetrics').length).toBe(0); }); it('should not display "Add Filter" without onFilter', async () => { - const component = mount( - - ); - + const component = mountComponentWithProviders({ + timeRange, + source, + series, + options, + uiCapabilities, + chartOptions, + }); component.find('button').simulate('click'); expect(getTestSubject(component, 'metricsExplorerAction-AddFilter').length).toBe(0); }); @@ -83,35 +92,29 @@ describe('MetricsExplorerChartContextMenu', () => { it('should not display "Add Filter" without options.groupBy', async () => { const customOptions = { ...options, groupBy: void 0 }; const onFilter = jest.fn().mockImplementation((query: string) => void 0); - const component = mount( - - ); - + const component = mountComponentWithProviders({ + timeRange, + source, + series, + options: customOptions, + onFilter, + uiCapabilities, + chartOptions, + }); component.find('button').simulate('click'); expect(getTestSubject(component, 'metricsExplorerAction-AddFilter').length).toBe(0); }); it('should disable "Open in Visualize" when options.metrics is empty', async () => { const customOptions = { ...options, metrics: [] }; - const component = mount( - - ); - + const component = mountComponentWithProviders({ + timeRange, + source, + series, + options: customOptions, + uiCapabilities, + chartOptions, + }); component.find('button').simulate('click'); expect( getTestSubject(component, 'metricsExplorerAction-OpenInTSVB').prop('disabled') @@ -121,17 +124,15 @@ describe('MetricsExplorerChartContextMenu', () => { it('should not display "Open in Visualize" when unavailble in uiCapabilities', async () => { const customUICapabilities = { ...uiCapabilities, visualize: { show: false } }; const onFilter = jest.fn().mockImplementation((query: string) => void 0); - const component = mount( - - ); + const component = mountComponentWithProviders({ + timeRange, + source, + series, + options, + onFilter, + uiCapabilities: customUICapabilities, + chartOptions, + }); component.find('button').simulate('click'); expect(getTestSubject(component, 'metricsExplorerAction-OpenInTSVB').length).toBe(0); @@ -141,17 +142,15 @@ describe('MetricsExplorerChartContextMenu', () => { const customUICapabilities = { ...uiCapabilities, visualize: { show: false } }; const onFilter = jest.fn().mockImplementation((query: string) => void 0); const customOptions = { ...options, groupBy: void 0 }; - const component = mount( - - ); + const component = mountComponentWithProviders({ + timeRange, + source, + series, + options: customOptions, + onFilter, + uiCapabilities: customUICapabilities, + chartOptions, + }); expect(component.find('button').length).toBe(0); }); }); @@ -163,9 +162,7 @@ describe('MetricsExplorerChartContextMenu', () => { const to = DateMath.parse(toDateStrig, { roundUp: true })!; const from = DateMath.parse(fromDateStrig)!; const link = createNodeDetailLink('host', 'example-01', fromDateStrig, toDateStrig); - expect(link).toBe( - `#/link-to/host-detail/example-01?to=${to.valueOf()}&from=${from.valueOf()}` - ); + expect(link).toBe(`link-to/host-detail/example-01?to=${to.valueOf()}&from=${from.valueOf()}`); }); }); }); diff --git a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/chart_context_menu.tsx b/x-pack/plugins/infra/public/components/metrics_explorer/chart_context_menu.tsx similarity index 92% rename from x-pack/legacy/plugins/infra/public/components/metrics_explorer/chart_context_menu.tsx rename to x-pack/plugins/infra/public/components/metrics_explorer/chart_context_menu.tsx index 298f7dd8f8d17..f7c97033f8d50 100644 --- a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/chart_context_menu.tsx +++ b/x-pack/plugins/infra/public/components/metrics_explorer/chart_context_menu.tsx @@ -14,7 +14,7 @@ import { } from '@elastic/eui'; import DateMath from '@elastic/datemath'; import { Capabilities } from 'src/core/public'; -import { MetricsExplorerSeries } from '../../../server/routes/metrics_explorer/types'; +import { MetricsExplorerSeries } from '../../../common/http_api/metrics_explorer'; import { MetricsExplorerOptions, MetricsExplorerTimeOptions, @@ -24,8 +24,9 @@ import { createTSVBLink } from './helpers/create_tsvb_link'; import { getNodeDetailUrl } from '../../pages/link_to/redirect_to_node_detail'; import { SourceConfiguration } from '../../utils/source_configuration'; import { InventoryItemType } from '../../../common/inventory_models/types'; +import { usePrefixPathWithBasepath } from '../../hooks/use_prefix_path_with_basepath'; -interface Props { +export interface Props { options: MetricsExplorerOptions; onFilter?: (query: string) => void; series: MetricsExplorerSeries; @@ -70,7 +71,7 @@ export const createNodeDetailLink = ( }); }; -export const MetricsExplorerChartContextMenu = ({ +export const MetricsExplorerChartContextMenu: React.FC = ({ onFilter, options, series, @@ -79,6 +80,7 @@ export const MetricsExplorerChartContextMenu = ({ uiCapabilities, chartOptions, }: Props) => { + const urlPrefixer = usePrefixPathWithBasepath(); const [isPopoverOpen, setPopoverState] = useState(false); const supportFiltering = options.groupBy != null && onFilter != null; const handleFilter = useCallback(() => { @@ -115,7 +117,10 @@ export const MetricsExplorerChartContextMenu = ({ values: { name: nodeType }, }), icon: 'metricsApp', - href: createNodeDetailLink(nodeType, series.id, timeRange.from, timeRange.to), + href: urlPrefixer( + 'metrics', + createNodeDetailLink(nodeType, series.id, timeRange.from, timeRange.to) + ), 'data-test-subj': 'metricsExplorerAction-ViewNodeMetrics', }, ] diff --git a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/chart_options.tsx b/x-pack/plugins/infra/public/components/metrics_explorer/chart_options.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/metrics_explorer/chart_options.tsx rename to x-pack/plugins/infra/public/components/metrics_explorer/chart_options.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/charts.tsx b/x-pack/plugins/infra/public/components/metrics_explorer/charts.tsx similarity index 97% rename from x-pack/legacy/plugins/infra/public/components/metrics_explorer/charts.tsx rename to x-pack/plugins/infra/public/components/metrics_explorer/charts.tsx index 3d32e2e09caea..3b639ee5e953a 100644 --- a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/charts.tsx +++ b/x-pack/plugins/infra/public/components/metrics_explorer/charts.tsx @@ -8,7 +8,7 @@ import { EuiButton, EuiFlexGrid, EuiFlexItem, EuiText, EuiHorizontalRule } from import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import React from 'react'; -import { MetricsExplorerResponse } from '../../../server/routes/metrics_explorer/types'; +import { MetricsExplorerResponse } from '../../../common/http_api/metrics_explorer'; import { MetricsExplorerOptions, MetricsExplorerTimeOptions, diff --git a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/empty_chart.tsx b/x-pack/plugins/infra/public/components/metrics_explorer/empty_chart.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/metrics_explorer/empty_chart.tsx rename to x-pack/plugins/infra/public/components/metrics_explorer/empty_chart.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/group_by.tsx b/x-pack/plugins/infra/public/components/metrics_explorer/group_by.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/metrics_explorer/group_by.tsx rename to x-pack/plugins/infra/public/components/metrics_explorer/group_by.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/helpers/calculate_domain.ts b/x-pack/plugins/infra/public/components/metrics_explorer/helpers/calculate_domain.ts similarity index 56% rename from x-pack/legacy/plugins/infra/public/components/metrics_explorer/helpers/calculate_domain.ts rename to x-pack/plugins/infra/public/components/metrics_explorer/helpers/calculate_domain.ts index fd18adea3aad0..90569854b833b 100644 --- a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/helpers/calculate_domain.ts +++ b/x-pack/plugins/infra/public/components/metrics_explorer/helpers/calculate_domain.ts @@ -3,10 +3,20 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ -import { min, max, sum } from 'lodash'; -import { MetricsExplorerSeries } from '../../../../server/routes/metrics_explorer/types'; +import { min, max, sum, isNumber } from 'lodash'; +import { MetricsExplorerSeries } from '../../../../common/http_api/metrics_explorer'; import { MetricsExplorerOptionsMetric } from '../../../containers/metrics_explorer/use_metrics_explorer_options'; +const getMin = (values: Array) => { + const minValue = min(values); + return isNumber(minValue) && Number.isFinite(minValue) ? minValue : undefined; +}; + +const getMax = (values: Array) => { + const maxValue = max(values); + return isNumber(maxValue) && Number.isFinite(maxValue) ? maxValue : undefined; +}; + export const calculateDomain = ( series: MetricsExplorerSeries, metrics: MetricsExplorerOptionsMetric[], @@ -18,13 +28,13 @@ export const calculateDomain = ( .map((m, index) => { return (row[`metric_${index}`] as number) || null; }) - .filter(v => v); - const minValue = min(rowValues); + .filter(v => isNumber(v)); + const minValue = getMin(rowValues); // For stacked domains we want to add 10% head room so the charts have // enough room to draw the 2 pixel line as well. - const maxValue = stacked ? sum(rowValues) * 1.1 : max(rowValues); + const maxValue = stacked ? sum(rowValues) * 1.1 : getMax(rowValues); return acc.concat([minValue || null, maxValue || null]); }, [] as Array) - .filter(v => v); - return { min: min(values) || 0, max: max(values) || 0 }; + .filter(v => isNumber(v)); + return { min: getMin(values) || 0, max: getMax(values) || 0 }; }; diff --git a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/helpers/calculate_domian.test.ts b/x-pack/plugins/infra/public/components/metrics_explorer/helpers/calculate_domian.test.ts similarity index 95% rename from x-pack/legacy/plugins/infra/public/components/metrics_explorer/helpers/calculate_domian.test.ts rename to x-pack/plugins/infra/public/components/metrics_explorer/helpers/calculate_domian.test.ts index e85cd67060d2c..4b45534d41db8 100644 --- a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/helpers/calculate_domian.test.ts +++ b/x-pack/plugins/infra/public/components/metrics_explorer/helpers/calculate_domian.test.ts @@ -5,7 +5,7 @@ */ import { calculateDomain } from './calculate_domain'; -import { MetricsExplorerSeries } from '../../../../server/routes/metrics_explorer/types'; +import { MetricsExplorerSeries } from '../../../../common/http_api/metrics_explorer'; import { MetricsExplorerOptionsMetric } from '../../../containers/metrics_explorer/use_metrics_explorer_options'; import { MetricsExplorerColor } from '../../../../common/color_palette'; describe('calculateDomain()', () => { diff --git a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/helpers/create_formatter_for_metric.ts b/x-pack/plugins/infra/public/components/metrics_explorer/helpers/create_formatter_for_metric.ts similarity index 90% rename from x-pack/legacy/plugins/infra/public/components/metrics_explorer/helpers/create_formatter_for_metric.ts rename to x-pack/plugins/infra/public/components/metrics_explorer/helpers/create_formatter_for_metric.ts index 1e9902337e032..33ec2ce2715a3 100644 --- a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/helpers/create_formatter_for_metric.ts +++ b/x-pack/plugins/infra/public/components/metrics_explorer/helpers/create_formatter_for_metric.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { MetricsExplorerMetric } from '../../../../server/routes/metrics_explorer/types'; +import { MetricsExplorerMetric } from '../../../../common/http_api/metrics_explorer'; import { createFormatter } from '../../../utils/formatters'; import { InfraFormatterType } from '../../../lib/lib'; import { metricToFormat } from './metric_to_format'; diff --git a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/helpers/create_formatter_for_metrics.test.ts b/x-pack/plugins/infra/public/components/metrics_explorer/helpers/create_formatter_for_metrics.test.ts similarity index 94% rename from x-pack/legacy/plugins/infra/public/components/metrics_explorer/helpers/create_formatter_for_metrics.test.ts rename to x-pack/plugins/infra/public/components/metrics_explorer/helpers/create_formatter_for_metrics.test.ts index 592dd70345bfa..ec41e90e441a4 100644 --- a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/helpers/create_formatter_for_metrics.test.ts +++ b/x-pack/plugins/infra/public/components/metrics_explorer/helpers/create_formatter_for_metrics.test.ts @@ -5,7 +5,7 @@ */ import { createFormatterForMetric } from './create_formatter_for_metric'; -import { MetricsExplorerMetric } from '../../../../server/routes/metrics_explorer/types'; +import { MetricsExplorerMetric } from '../../../../common/http_api/metrics_explorer'; describe('createFormatterForMetric()', () => { it('should just work for count', () => { diff --git a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/helpers/create_metric_label.test.ts b/x-pack/plugins/infra/public/components/metrics_explorer/helpers/create_metric_label.test.ts similarity index 89% rename from x-pack/legacy/plugins/infra/public/components/metrics_explorer/helpers/create_metric_label.test.ts rename to x-pack/plugins/infra/public/components/metrics_explorer/helpers/create_metric_label.test.ts index 0c52d8d56a6e9..cbf6904d246c7 100644 --- a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/helpers/create_metric_label.test.ts +++ b/x-pack/plugins/infra/public/components/metrics_explorer/helpers/create_metric_label.test.ts @@ -5,7 +5,7 @@ */ import { createMetricLabel } from './create_metric_label'; -import { MetricsExplorerMetric } from '../../../../server/routes/metrics_explorer/types'; +import { MetricsExplorerMetric } from '../../../../common/http_api/metrics_explorer'; describe('createMetricLabel()', () => { it('should work with metrics with fields', () => { diff --git a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/helpers/create_metric_label.ts b/x-pack/plugins/infra/public/components/metrics_explorer/helpers/create_metric_label.ts similarity index 80% rename from x-pack/legacy/plugins/infra/public/components/metrics_explorer/helpers/create_metric_label.ts rename to x-pack/plugins/infra/public/components/metrics_explorer/helpers/create_metric_label.ts index 489520177f07d..b6453a81317b1 100644 --- a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/helpers/create_metric_label.ts +++ b/x-pack/plugins/infra/public/components/metrics_explorer/helpers/create_metric_label.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { MetricsExplorerMetric } from '../../../../server/routes/metrics_explorer/types'; +import { MetricsExplorerMetric } from '../../../../common/http_api/metrics_explorer'; export const createMetricLabel = (metric: MetricsExplorerMetric) => { return `${metric.aggregation}(${metric.field || ''})`; diff --git a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/helpers/create_tsvb_link.test.ts b/x-pack/plugins/infra/public/components/metrics_explorer/helpers/create_tsvb_link.test.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/metrics_explorer/helpers/create_tsvb_link.test.ts rename to x-pack/plugins/infra/public/components/metrics_explorer/helpers/create_tsvb_link.test.ts diff --git a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/helpers/create_tsvb_link.ts b/x-pack/plugins/infra/public/components/metrics_explorer/helpers/create_tsvb_link.ts similarity index 97% rename from x-pack/legacy/plugins/infra/public/components/metrics_explorer/helpers/create_tsvb_link.ts rename to x-pack/plugins/infra/public/components/metrics_explorer/helpers/create_tsvb_link.ts index 2fe81123594e9..cb23a96b9c163 100644 --- a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/helpers/create_tsvb_link.ts +++ b/x-pack/plugins/infra/public/components/metrics_explorer/helpers/create_tsvb_link.ts @@ -8,7 +8,7 @@ import { encode } from 'rison-node'; import uuid from 'uuid'; import { set } from 'lodash'; import { colorTransformer, MetricsExplorerColor } from '../../../../common/color_palette'; -import { MetricsExplorerSeries } from '../../../../server/routes/metrics_explorer/types'; +import { MetricsExplorerSeries } from '../../../../common/http_api/metrics_explorer'; import { MetricsExplorerOptions, MetricsExplorerOptionsMetric, diff --git a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/helpers/get_chart_theme.ts b/x-pack/plugins/infra/public/components/metrics_explorer/helpers/get_chart_theme.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/metrics_explorer/helpers/get_chart_theme.ts rename to x-pack/plugins/infra/public/components/metrics_explorer/helpers/get_chart_theme.ts diff --git a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/helpers/metric_to_format.test.ts b/x-pack/plugins/infra/public/components/metrics_explorer/helpers/metric_to_format.test.ts similarity index 94% rename from x-pack/legacy/plugins/infra/public/components/metrics_explorer/helpers/metric_to_format.test.ts rename to x-pack/plugins/infra/public/components/metrics_explorer/helpers/metric_to_format.test.ts index a38a9ac54d828..4cb27b4fb65c3 100644 --- a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/helpers/metric_to_format.test.ts +++ b/x-pack/plugins/infra/public/components/metrics_explorer/helpers/metric_to_format.test.ts @@ -5,7 +5,7 @@ */ import { metricToFormat } from './metric_to_format'; -import { MetricsExplorerMetric } from '../../../../server/routes/metrics_explorer/types'; +import { MetricsExplorerMetric } from '../../../../common/http_api/metrics_explorer'; import { InfraFormatterType } from '../../../lib/lib'; describe('metricToFormat()', () => { it('should just work for numeric metrics', () => { diff --git a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/helpers/metric_to_format.ts b/x-pack/plugins/infra/public/components/metrics_explorer/helpers/metric_to_format.ts similarity index 89% rename from x-pack/legacy/plugins/infra/public/components/metrics_explorer/helpers/metric_to_format.ts rename to x-pack/plugins/infra/public/components/metrics_explorer/helpers/metric_to_format.ts index 69f2bd50ef42f..63272c86a5dc7 100644 --- a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/helpers/metric_to_format.ts +++ b/x-pack/plugins/infra/public/components/metrics_explorer/helpers/metric_to_format.ts @@ -5,7 +5,7 @@ */ import { last } from 'lodash'; -import { MetricsExplorerMetric } from '../../../../server/routes/metrics_explorer/types'; +import { MetricsExplorerMetric } from '../../../../common/http_api/metrics_explorer'; import { InfraFormatterType } from '../../../lib/lib'; export const metricToFormat = (metric?: MetricsExplorerMetric) => { if (metric && metric.field) { diff --git a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/kuery_bar.tsx b/x-pack/plugins/infra/public/components/metrics_explorer/kuery_bar.tsx similarity index 96% rename from x-pack/legacy/plugins/infra/public/components/metrics_explorer/kuery_bar.tsx rename to x-pack/plugins/infra/public/components/metrics_explorer/kuery_bar.tsx index 7114217920998..0e18deedd404c 100644 --- a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/kuery_bar.tsx +++ b/x-pack/plugins/infra/public/components/metrics_explorer/kuery_bar.tsx @@ -10,7 +10,7 @@ import React, { useEffect, useState } from 'react'; import { WithKueryAutocompletion } from '../../containers/with_kuery_autocompletion'; import { AutocompleteField } from '../autocomplete_field'; import { isDisplayable } from '../../utils/is_displayable'; -import { esKuery, IIndexPattern } from '../../../../../../../src/plugins/data/public'; +import { esKuery, IIndexPattern } from '../../../../../../src/plugins/data/public'; interface Props { derivedIndexPattern: IIndexPattern; diff --git a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/metrics.tsx b/x-pack/plugins/infra/public/components/metrics_explorer/metrics.tsx similarity index 96% rename from x-pack/legacy/plugins/infra/public/components/metrics_explorer/metrics.tsx rename to x-pack/plugins/infra/public/components/metrics_explorer/metrics.tsx index 0010fce7efa49..79d4122733c55 100644 --- a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/metrics.tsx +++ b/x-pack/plugins/infra/public/components/metrics_explorer/metrics.tsx @@ -10,7 +10,7 @@ import { i18n } from '@kbn/i18n'; import React, { useCallback, useState } from 'react'; import { IFieldType } from 'src/plugins/data/public'; import { colorTransformer, MetricsExplorerColor } from '../../../common/color_palette'; -import { MetricsExplorerMetric } from '../../../server/routes/metrics_explorer/types'; +import { MetricsExplorerMetric } from '../../../common/http_api/metrics_explorer'; import { MetricsExplorerOptions } from '../../containers/metrics_explorer/use_metrics_explorer_options'; import { isDisplayable } from '../../utils/is_displayable'; diff --git a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/no_metrics.tsx b/x-pack/plugins/infra/public/components/metrics_explorer/no_metrics.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/metrics_explorer/no_metrics.tsx rename to x-pack/plugins/infra/public/components/metrics_explorer/no_metrics.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/series_chart.tsx b/x-pack/plugins/infra/public/components/metrics_explorer/series_chart.tsx similarity index 97% rename from x-pack/legacy/plugins/infra/public/components/metrics_explorer/series_chart.tsx rename to x-pack/plugins/infra/public/components/metrics_explorer/series_chart.tsx index f365faa134d93..65911a02c938a 100644 --- a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/series_chart.tsx +++ b/x-pack/plugins/infra/public/components/metrics_explorer/series_chart.tsx @@ -13,7 +13,7 @@ import { AreaSeriesStyle, BarSeriesStyle, } from '@elastic/charts'; -import { MetricsExplorerSeries } from '../../../server/routes/metrics_explorer/types'; +import { MetricsExplorerSeries } from '../../../common/http_api/metrics_explorer'; import { colorTransformer, MetricsExplorerColor } from '../../../common/color_palette'; import { createMetricLabel } from './helpers/create_metric_label'; import { diff --git a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/toolbar.tsx b/x-pack/plugins/infra/public/components/metrics_explorer/toolbar.tsx similarity index 98% rename from x-pack/legacy/plugins/infra/public/components/metrics_explorer/toolbar.tsx rename to x-pack/plugins/infra/public/components/metrics_explorer/toolbar.tsx index 839e40e057c9a..9e96819a36cac 100644 --- a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/toolbar.tsx +++ b/x-pack/plugins/infra/public/components/metrics_explorer/toolbar.tsx @@ -11,7 +11,7 @@ import { IIndexPattern } from 'src/plugins/data/public'; import { MetricsExplorerMetric, MetricsExplorerAggregation, -} from '../../../server/routes/metrics_explorer/types'; +} from '../../../common/http_api/metrics_explorer'; import { MetricsExplorerOptions, MetricsExplorerTimeOptions, diff --git a/x-pack/legacy/plugins/infra/public/components/navigation/app_navigation.tsx b/x-pack/plugins/infra/public/components/navigation/app_navigation.tsx similarity index 93% rename from x-pack/legacy/plugins/infra/public/components/navigation/app_navigation.tsx rename to x-pack/plugins/infra/public/components/navigation/app_navigation.tsx index 79785c11a3ebe..b229fb4a6b494 100644 --- a/x-pack/legacy/plugins/infra/public/components/navigation/app_navigation.tsx +++ b/x-pack/plugins/infra/public/components/navigation/app_navigation.tsx @@ -6,7 +6,7 @@ import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import React from 'react'; -import euiStyled from '../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../observability/public'; interface AppNavigationProps { 'aria-label': string; diff --git a/x-pack/legacy/plugins/infra/public/components/navigation/routed_tabs.tsx b/x-pack/plugins/infra/public/components/navigation/routed_tabs.tsx similarity index 53% rename from x-pack/legacy/plugins/infra/public/components/navigation/routed_tabs.tsx rename to x-pack/plugins/infra/public/components/navigation/routed_tabs.tsx index c43ade12ded6d..2838ac6cda6dd 100644 --- a/x-pack/legacy/plugins/infra/public/components/navigation/routed_tabs.tsx +++ b/x-pack/plugins/infra/public/components/navigation/routed_tabs.tsx @@ -8,7 +8,7 @@ import { EuiLink, EuiTab, EuiTabs } from '@elastic/eui'; import React from 'react'; import { Route } from 'react-router-dom'; -import euiStyled from '../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../observability/public'; interface TabConfiguration { title: string | React.ReactNode; @@ -32,23 +32,27 @@ export class RoutedTabs extends React.Component { ( - - {/* eslint-disable-next-line @elastic/eui/href-or-on-click */} - ) => { - e.preventDefault(); - history.push(tab.path); - }} - > - - {tab.title} - - - - )} + children={({ match, history }) => { + return ( + + {/* eslint-disable-next-line @elastic/eui/href-or-on-click */} + ) => { + e.preventDefault(); + history.push(tab.path); + }} + > + + {tab.title} + + + + ); + }} /> ); }); diff --git a/x-pack/legacy/plugins/infra/public/components/nodes_overview/index.tsx b/x-pack/plugins/infra/public/components/nodes_overview/index.tsx similarity index 99% rename from x-pack/legacy/plugins/infra/public/components/nodes_overview/index.tsx rename to x-pack/plugins/infra/public/components/nodes_overview/index.tsx index 8e8015ce6a82e..8cd3faabd1e12 100644 --- a/x-pack/legacy/plugins/infra/public/components/nodes_overview/index.tsx +++ b/x-pack/plugins/infra/public/components/nodes_overview/index.tsx @@ -10,7 +10,7 @@ import { FormattedMessage } from '@kbn/i18n/react'; import { get, max, min } from 'lodash'; import React from 'react'; -import euiStyled from '../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../observability/public'; import { InfraFormatterType, InfraWaffleMapBounds, InfraWaffleMapOptions } from '../../lib/lib'; import { KueryFilterQuery } from '../../store/local/waffle_filter'; import { createFormatter } from '../../utils/formatters'; diff --git a/x-pack/legacy/plugins/infra/public/components/nodes_overview/table.tsx b/x-pack/plugins/infra/public/components/nodes_overview/table.tsx similarity index 94% rename from x-pack/legacy/plugins/infra/public/components/nodes_overview/table.tsx rename to x-pack/plugins/infra/public/components/nodes_overview/table.tsx index 5c793f670119c..82991076255ee 100644 --- a/x-pack/legacy/plugins/infra/public/components/nodes_overview/table.tsx +++ b/x-pack/plugins/infra/public/components/nodes_overview/table.tsx @@ -15,7 +15,7 @@ import { fieldToName } from '../waffle/lib/field_to_display_name'; import { NodeContextMenu } from '../waffle/node_context_menu'; import { InventoryItemType } from '../../../common/inventory_models/types'; import { SnapshotNode, SnapshotNodePath } from '../../../common/http_api/snapshot_api'; -import { ROOT_ELEMENT_ID } from '../../app'; +import { CONTAINER_CLASSNAME } from '../../apps/start_app'; interface Props { nodes: SnapshotNode[]; @@ -57,10 +57,13 @@ export const TableView = (props: Props) => { ); useEffect(() => { - if (openPopovers.length > 0) { - document.getElementById(ROOT_ELEMENT_ID)!.style.overflowY = 'hidden'; - } else { - document.getElementById(ROOT_ELEMENT_ID)!.style.overflowY = 'auto'; + const el = document.getElementsByClassName(CONTAINER_CLASSNAME)[0]; + if (el instanceof HTMLElement) { + if (openPopovers.length > 0) { + el.style.overflowY = 'hidden'; + } else { + el.style.overflowY = 'auto'; + } } }, [openPopovers]); diff --git a/x-pack/legacy/plugins/infra/public/components/page.tsx b/x-pack/plugins/infra/public/components/page.tsx similarity index 90% rename from x-pack/legacy/plugins/infra/public/components/page.tsx rename to x-pack/plugins/infra/public/components/page.tsx index ca029e43ac37b..b51afdd8ca803 100644 --- a/x-pack/legacy/plugins/infra/public/components/page.tsx +++ b/x-pack/plugins/infra/public/components/page.tsx @@ -6,7 +6,7 @@ import { EuiPage } from '@elastic/eui'; -import euiStyled from '../../../../common/eui_styled_components'; +import { euiStyled } from '../../../observability/public'; export const ColumnarPage = euiStyled.div` display: flex; diff --git a/x-pack/legacy/plugins/infra/public/components/saved_views/create_modal.tsx b/x-pack/plugins/infra/public/components/saved_views/create_modal.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/saved_views/create_modal.tsx rename to x-pack/plugins/infra/public/components/saved_views/create_modal.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/saved_views/toolbar_control.tsx b/x-pack/plugins/infra/public/components/saved_views/toolbar_control.tsx similarity index 98% rename from x-pack/legacy/plugins/infra/public/components/saved_views/toolbar_control.tsx rename to x-pack/plugins/infra/public/components/saved_views/toolbar_control.tsx index e03b7fcc8ffa4..c66aea669682e 100644 --- a/x-pack/legacy/plugins/infra/public/components/saved_views/toolbar_control.tsx +++ b/x-pack/plugins/infra/public/components/saved_views/toolbar_control.tsx @@ -11,7 +11,7 @@ import { i18n } from '@kbn/i18n'; import { useSavedView } from '../../hooks/use_saved_view'; import { SavedViewCreateModal } from './create_modal'; import { SavedViewListFlyout } from './view_list_flyout'; -import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; +import { useKibana } from '../../../../../../src/plugins/kibana_react/public'; interface Props { viewType: string; diff --git a/x-pack/legacy/plugins/infra/public/components/saved_views/view_list_flyout.tsx b/x-pack/plugins/infra/public/components/saved_views/view_list_flyout.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/saved_views/view_list_flyout.tsx rename to x-pack/plugins/infra/public/components/saved_views/view_list_flyout.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/source_configuration/add_log_column_popover.tsx b/x-pack/plugins/infra/public/components/source_configuration/add_log_column_popover.tsx similarity index 98% rename from x-pack/legacy/plugins/infra/public/components/source_configuration/add_log_column_popover.tsx rename to x-pack/plugins/infra/public/components/source_configuration/add_log_column_popover.tsx index fc8407c5298e6..0835a904585ed 100644 --- a/x-pack/legacy/plugins/infra/public/components/source_configuration/add_log_column_popover.tsx +++ b/x-pack/plugins/infra/public/components/source_configuration/add_log_column_popover.tsx @@ -12,7 +12,7 @@ import { v4 as uuidv4 } from 'uuid'; import { LogColumnConfiguration } from '../../utils/source_configuration'; import { useVisibilityState } from '../../utils/use_visibility_state'; -import { euiStyled } from '../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../observability/public'; interface SelectableColumnOption { optionProps: Option; diff --git a/x-pack/legacy/plugins/infra/public/components/source_configuration/fields_configuration_panel.tsx b/x-pack/plugins/infra/public/components/source_configuration/fields_configuration_panel.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/source_configuration/fields_configuration_panel.tsx rename to x-pack/plugins/infra/public/components/source_configuration/fields_configuration_panel.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/source_configuration/index.ts b/x-pack/plugins/infra/public/components/source_configuration/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/source_configuration/index.ts rename to x-pack/plugins/infra/public/components/source_configuration/index.ts diff --git a/x-pack/legacy/plugins/infra/public/components/source_configuration/indices_configuration_form_state.ts b/x-pack/plugins/infra/public/components/source_configuration/indices_configuration_form_state.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/source_configuration/indices_configuration_form_state.ts rename to x-pack/plugins/infra/public/components/source_configuration/indices_configuration_form_state.ts diff --git a/x-pack/legacy/plugins/infra/public/components/source_configuration/indices_configuration_panel.tsx b/x-pack/plugins/infra/public/components/source_configuration/indices_configuration_panel.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/source_configuration/indices_configuration_panel.tsx rename to x-pack/plugins/infra/public/components/source_configuration/indices_configuration_panel.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/source_configuration/input_fields.tsx b/x-pack/plugins/infra/public/components/source_configuration/input_fields.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/source_configuration/input_fields.tsx rename to x-pack/plugins/infra/public/components/source_configuration/input_fields.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/source_configuration/log_columns_configuration_form_state.tsx b/x-pack/plugins/infra/public/components/source_configuration/log_columns_configuration_form_state.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/source_configuration/log_columns_configuration_form_state.tsx rename to x-pack/plugins/infra/public/components/source_configuration/log_columns_configuration_form_state.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/source_configuration/log_columns_configuration_panel.tsx b/x-pack/plugins/infra/public/components/source_configuration/log_columns_configuration_panel.tsx similarity index 99% rename from x-pack/legacy/plugins/infra/public/components/source_configuration/log_columns_configuration_panel.tsx rename to x-pack/plugins/infra/public/components/source_configuration/log_columns_configuration_panel.tsx index 90361a5c2b541..9ccd28f149ec7 100644 --- a/x-pack/legacy/plugins/infra/public/components/source_configuration/log_columns_configuration_panel.tsx +++ b/x-pack/plugins/infra/public/components/source_configuration/log_columns_configuration_panel.tsx @@ -22,7 +22,7 @@ import { import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import React, { useCallback } from 'react'; -import { DragHandleProps, DropResult } from '../../../../../common/eui_draggable'; +import { DragHandleProps, DropResult } from '../../../../observability/public'; import { AddLogColumnButtonAndPopover } from './add_log_column_popover'; import { diff --git a/x-pack/legacy/plugins/infra/public/components/source_configuration/name_configuration_panel.tsx b/x-pack/plugins/infra/public/components/source_configuration/name_configuration_panel.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/source_configuration/name_configuration_panel.tsx rename to x-pack/plugins/infra/public/components/source_configuration/name_configuration_panel.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/source_configuration/source_configuration_form_state.tsx b/x-pack/plugins/infra/public/components/source_configuration/source_configuration_form_state.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/source_configuration/source_configuration_form_state.tsx rename to x-pack/plugins/infra/public/components/source_configuration/source_configuration_form_state.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/source_configuration/source_configuration_settings.tsx b/x-pack/plugins/infra/public/components/source_configuration/source_configuration_settings.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/source_configuration/source_configuration_settings.tsx rename to x-pack/plugins/infra/public/components/source_configuration/source_configuration_settings.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/source_configuration/view_source_configuration_button.tsx b/x-pack/plugins/infra/public/components/source_configuration/view_source_configuration_button.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/source_configuration/view_source_configuration_button.tsx rename to x-pack/plugins/infra/public/components/source_configuration/view_source_configuration_button.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/source_error_page.tsx b/x-pack/plugins/infra/public/components/source_error_page.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/source_error_page.tsx rename to x-pack/plugins/infra/public/components/source_error_page.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/source_loading_page.tsx b/x-pack/plugins/infra/public/components/source_loading_page.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/source_loading_page.tsx rename to x-pack/plugins/infra/public/components/source_loading_page.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/waffle/conditional_tooltip.tsx b/x-pack/plugins/infra/public/components/waffle/conditional_tooltip.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/waffle/conditional_tooltip.tsx rename to x-pack/plugins/infra/public/components/waffle/conditional_tooltip.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/waffle/custom_field_panel.tsx b/x-pack/plugins/infra/public/components/waffle/custom_field_panel.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/waffle/custom_field_panel.tsx rename to x-pack/plugins/infra/public/components/waffle/custom_field_panel.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/waffle/gradient_legend.tsx b/x-pack/plugins/infra/public/components/waffle/gradient_legend.tsx similarity index 97% rename from x-pack/legacy/plugins/infra/public/components/waffle/gradient_legend.tsx rename to x-pack/plugins/infra/public/components/waffle/gradient_legend.tsx index 3dcc40818b4d5..6b0c4bb41dc98 100644 --- a/x-pack/legacy/plugins/infra/public/components/waffle/gradient_legend.tsx +++ b/x-pack/plugins/infra/public/components/waffle/gradient_legend.tsx @@ -6,7 +6,7 @@ import React from 'react'; -import euiStyled from '../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../observability/public'; import { InfraFormatter, InfraWaffleMapBounds, diff --git a/x-pack/legacy/plugins/infra/public/components/waffle/group_name.tsx b/x-pack/plugins/infra/public/components/waffle/group_name.tsx similarity index 97% rename from x-pack/legacy/plugins/infra/public/components/waffle/group_name.tsx rename to x-pack/plugins/infra/public/components/waffle/group_name.tsx index 731bcdd52a98e..01bd3600a1624 100644 --- a/x-pack/legacy/plugins/infra/public/components/waffle/group_name.tsx +++ b/x-pack/plugins/infra/public/components/waffle/group_name.tsx @@ -6,7 +6,7 @@ import { EuiLink, EuiToolTip } from '@elastic/eui'; import React from 'react'; -import euiStyled from '../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../observability/public'; import { InfraWaffleMapGroup, InfraWaffleMapOptions } from '../../lib/lib'; interface Props { diff --git a/x-pack/legacy/plugins/infra/public/components/waffle/group_of_groups.tsx b/x-pack/plugins/infra/public/components/waffle/group_of_groups.tsx similarity index 96% rename from x-pack/legacy/plugins/infra/public/components/waffle/group_of_groups.tsx rename to x-pack/plugins/infra/public/components/waffle/group_of_groups.tsx index 60a117e3ed617..9634293587d49 100644 --- a/x-pack/legacy/plugins/infra/public/components/waffle/group_of_groups.tsx +++ b/x-pack/plugins/infra/public/components/waffle/group_of_groups.tsx @@ -6,7 +6,7 @@ import React from 'react'; -import euiStyled from '../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../observability/public'; import { InfraWaffleMapBounds, InfraWaffleMapGroupOfGroups, diff --git a/x-pack/legacy/plugins/infra/public/components/waffle/group_of_nodes.tsx b/x-pack/plugins/infra/public/components/waffle/group_of_nodes.tsx similarity index 96% rename from x-pack/legacy/plugins/infra/public/components/waffle/group_of_nodes.tsx rename to x-pack/plugins/infra/public/components/waffle/group_of_nodes.tsx index b47b8f6a1bf39..6b82671617df7 100644 --- a/x-pack/legacy/plugins/infra/public/components/waffle/group_of_nodes.tsx +++ b/x-pack/plugins/infra/public/components/waffle/group_of_nodes.tsx @@ -6,7 +6,7 @@ import React from 'react'; -import euiStyled from '../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../observability/public'; import { InfraWaffleMapBounds, InfraWaffleMapGroupOfNodes, diff --git a/x-pack/legacy/plugins/infra/public/components/waffle/legend.tsx b/x-pack/plugins/infra/public/components/waffle/legend.tsx similarity index 96% rename from x-pack/legacy/plugins/infra/public/components/waffle/legend.tsx rename to x-pack/plugins/infra/public/components/waffle/legend.tsx index c7f647449606e..de070efb35a1f 100644 --- a/x-pack/legacy/plugins/infra/public/components/waffle/legend.tsx +++ b/x-pack/plugins/infra/public/components/waffle/legend.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import euiStyled from '../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../observability/public'; import { WithWaffleOptions } from '../../containers/waffle/with_waffle_options'; import { InfraFormatter, InfraWaffleMapBounds, InfraWaffleMapLegend } from '../../lib/lib'; import { GradientLegend } from './gradient_legend'; diff --git a/x-pack/legacy/plugins/infra/public/components/waffle/legend_controls.tsx b/x-pack/plugins/infra/public/components/waffle/legend_controls.tsx similarity index 98% rename from x-pack/legacy/plugins/infra/public/components/waffle/legend_controls.tsx rename to x-pack/plugins/infra/public/components/waffle/legend_controls.tsx index f6e4a65eead24..26b5b1c0af727 100644 --- a/x-pack/legacy/plugins/infra/public/components/waffle/legend_controls.tsx +++ b/x-pack/plugins/infra/public/components/waffle/legend_controls.tsx @@ -23,7 +23,7 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import React, { SyntheticEvent, useState } from 'react'; -import euiStyled from '../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../observability/public'; import { InfraWaffleMapBounds } from '../../lib/lib'; interface Props { diff --git a/x-pack/legacy/plugins/infra/public/components/waffle/lib/apply_wafflemap_layout.ts b/x-pack/plugins/infra/public/components/waffle/lib/apply_wafflemap_layout.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/waffle/lib/apply_wafflemap_layout.ts rename to x-pack/plugins/infra/public/components/waffle/lib/apply_wafflemap_layout.ts diff --git a/x-pack/legacy/plugins/infra/public/components/waffle/lib/color_from_value.ts b/x-pack/plugins/infra/public/components/waffle/lib/color_from_value.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/waffle/lib/color_from_value.ts rename to x-pack/plugins/infra/public/components/waffle/lib/color_from_value.ts diff --git a/x-pack/legacy/plugins/infra/public/components/waffle/lib/create_uptime_link.test.ts b/x-pack/plugins/infra/public/components/waffle/lib/create_uptime_link.test.ts similarity index 86% rename from x-pack/legacy/plugins/infra/public/components/waffle/lib/create_uptime_link.test.ts rename to x-pack/plugins/infra/public/components/waffle/lib/create_uptime_link.test.ts index 1a285ceefec0e..fb9791fae9b5e 100644 --- a/x-pack/legacy/plugins/infra/public/components/waffle/lib/create_uptime_link.test.ts +++ b/x-pack/plugins/infra/public/components/waffle/lib/create_uptime_link.test.ts @@ -46,9 +46,7 @@ describe('createUptimeLink()', () => { avg: 0.6, }, }; - expect(createUptimeLink(options, 'host', node)).toBe( - '../app/uptime#/?search=host.ip:"10.0.1.2"' - ); + expect(createUptimeLink(options, 'host', node)).toBe('#/?search=host.ip:"10.0.1.2"'); }); it('should work for hosts without ip', () => { @@ -64,9 +62,7 @@ describe('createUptimeLink()', () => { avg: 0.6, }, }; - expect(createUptimeLink(options, 'host', node)).toBe( - '../app/uptime#/?search=host.name:"host-01"' - ); + expect(createUptimeLink(options, 'host', node)).toBe('#/?search=host.name:"host-01"'); }); it('should work for pods', () => { @@ -83,7 +79,7 @@ describe('createUptimeLink()', () => { }, }; expect(createUptimeLink(options, 'pod', node)).toBe( - '../app/uptime#/?search=kubernetes.pod.uid:"29193-pod-02939"' + '#/?search=kubernetes.pod.uid:"29193-pod-02939"' ); }); @@ -101,7 +97,7 @@ describe('createUptimeLink()', () => { }, }; expect(createUptimeLink(options, 'container', node)).toBe( - '../app/uptime#/?search=container.id:"docker-1234"' + '#/?search=container.id:"docker-1234"' ); }); }); diff --git a/x-pack/legacy/plugins/infra/public/components/waffle/lib/create_uptime_link.ts b/x-pack/plugins/infra/public/components/waffle/lib/create_uptime_link.ts similarity index 81% rename from x-pack/legacy/plugins/infra/public/components/waffle/lib/create_uptime_link.ts rename to x-pack/plugins/infra/public/components/waffle/lib/create_uptime_link.ts index 05b4b6d514cd0..023a1a4b6ecef 100644 --- a/x-pack/legacy/plugins/infra/public/components/waffle/lib/create_uptime_link.ts +++ b/x-pack/plugins/infra/public/components/waffle/lib/create_uptime_link.ts @@ -8,16 +8,14 @@ import { get } from 'lodash'; import { InfraWaffleMapNode, InfraWaffleMapOptions } from '../../../lib/lib'; import { InventoryItemType } from '../../../../common/inventory_models/types'; -const BASE_URL = '../app/uptime#/?search='; - export const createUptimeLink = ( options: InfraWaffleMapOptions, nodeType: InventoryItemType, node: InfraWaffleMapNode ) => { if (nodeType === 'host' && node.ip) { - return `${BASE_URL}host.ip:"${node.ip}"`; + return `#/?search=host.ip:"${node.ip}"`; } const field = get(options, ['fields', nodeType], ''); - return `${BASE_URL}${field ? field + ':' : ''}"${node.id}"`; + return `#/?search=${field ? field + ':' : ''}"${node.id}"`; }; diff --git a/x-pack/legacy/plugins/infra/public/components/waffle/lib/field_to_display_name.ts b/x-pack/plugins/infra/public/components/waffle/lib/field_to_display_name.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/waffle/lib/field_to_display_name.ts rename to x-pack/plugins/infra/public/components/waffle/lib/field_to_display_name.ts diff --git a/x-pack/legacy/plugins/infra/public/components/waffle/lib/size_of_squares.ts b/x-pack/plugins/infra/public/components/waffle/lib/size_of_squares.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/waffle/lib/size_of_squares.ts rename to x-pack/plugins/infra/public/components/waffle/lib/size_of_squares.ts diff --git a/x-pack/legacy/plugins/infra/public/components/waffle/lib/type_guards.ts b/x-pack/plugins/infra/public/components/waffle/lib/type_guards.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/waffle/lib/type_guards.ts rename to x-pack/plugins/infra/public/components/waffle/lib/type_guards.ts diff --git a/x-pack/legacy/plugins/infra/public/components/waffle/map.tsx b/x-pack/plugins/infra/public/components/waffle/map.tsx similarity index 98% rename from x-pack/legacy/plugins/infra/public/components/waffle/map.tsx rename to x-pack/plugins/infra/public/components/waffle/map.tsx index 91fb84840f37f..7cab2307dacfa 100644 --- a/x-pack/legacy/plugins/infra/public/components/waffle/map.tsx +++ b/x-pack/plugins/infra/public/components/waffle/map.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import euiStyled from '../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../observability/public'; import { nodesToWaffleMap } from '../../containers/waffle/nodes_to_wafflemap'; import { isWaffleMapGroupWithGroups, diff --git a/x-pack/legacy/plugins/infra/public/components/waffle/node.tsx b/x-pack/plugins/infra/public/components/waffle/node.tsx similarity index 98% rename from x-pack/legacy/plugins/infra/public/components/waffle/node.tsx rename to x-pack/plugins/infra/public/components/waffle/node.tsx index 72e2a4c8f35d7..4eb5ccb8c1b4d 100644 --- a/x-pack/legacy/plugins/infra/public/components/waffle/node.tsx +++ b/x-pack/plugins/infra/public/components/waffle/node.tsx @@ -10,7 +10,7 @@ import React from 'react'; import { i18n } from '@kbn/i18n'; import { ConditionalToolTip } from './conditional_tooltip'; -import euiStyled from '../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../observability/public'; import { InfraWaffleMapBounds, InfraWaffleMapNode, InfraWaffleMapOptions } from '../../lib/lib'; import { colorFromValue } from './lib/color_from_value'; import { NodeContextMenu } from './node_context_menu'; diff --git a/x-pack/legacy/plugins/infra/public/components/waffle/node_context_menu.tsx b/x-pack/plugins/infra/public/components/waffle/node_context_menu.tsx similarity index 89% rename from x-pack/legacy/plugins/infra/public/components/waffle/node_context_menu.tsx rename to x-pack/plugins/infra/public/components/waffle/node_context_menu.tsx index 97b85a7e6e17d..43d27bb8259b3 100644 --- a/x-pack/legacy/plugins/infra/public/components/waffle/node_context_menu.tsx +++ b/x-pack/plugins/infra/public/components/waffle/node_context_menu.tsx @@ -13,7 +13,7 @@ import { InfraWaffleMapNode, InfraWaffleMapOptions } from '../../lib/lib'; import { getNodeDetailUrl, getNodeLogsUrl } from '../../pages/link_to'; import { createUptimeLink } from './lib/create_uptime_link'; import { findInventoryModel, findInventoryFields } from '../../../common/inventory_models'; -import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; +import { useKibana } from '../../../../../../src/plugins/kibana_react/public'; import { InventoryItemType } from '../../../common/inventory_models/types'; import { Section, @@ -23,7 +23,8 @@ import { SectionSubtitle, SectionLinks, SectionLink, -} from '../../../../../../plugins/observability/public'; +} from '../../../../observability/public'; +import { usePrefixPathWithBasepath } from '../../hooks/use_prefix_path_with_basepath'; interface Props { options: InfraWaffleMapOptions; @@ -45,6 +46,7 @@ export const NodeContextMenu: React.FC = ({ nodeType, popoverPosition, }) => { + const urlPrefixer = usePrefixPathWithBasepath(); const uiCapabilities = useKibana().services.application?.capabilities; const inventoryModel = findInventoryModel(nodeType); const nodeDetailFrom = currentTime - inventoryModel.metrics.defaultTimeRangeInSeconds * 1000; @@ -84,11 +86,14 @@ export const NodeContextMenu: React.FC = ({ defaultMessage: '{inventoryName} logs', values: { inventoryName: inventoryModel.singularDisplayName }, }), - href: getNodeLogsUrl({ - nodeType, - nodeId: node.id, - time: currentTime, - }), + href: urlPrefixer( + 'logs', + getNodeLogsUrl({ + nodeType, + nodeId: node.id, + time: currentTime, + }) + ), 'data-test-subj': 'viewLogsContextMenuItem', isDisabled: !showLogsLink, }; @@ -98,12 +103,15 @@ export const NodeContextMenu: React.FC = ({ defaultMessage: '{inventoryName} metrics', values: { inventoryName: inventoryModel.singularDisplayName }, }), - href: getNodeDetailUrl({ - nodeType, - nodeId: node.id, - from: nodeDetailFrom, - to: currentTime, - }), + href: urlPrefixer( + 'metrics', + getNodeDetailUrl({ + nodeType, + nodeId: node.id, + from: nodeDetailFrom, + to: currentTime, + }) + ), isDisabled: !showDetail, }; @@ -112,7 +120,7 @@ export const NodeContextMenu: React.FC = ({ defaultMessage: '{inventoryName} APM traces', values: { inventoryName: inventoryModel.singularDisplayName }, }), - href: `../app/apm#/traces?_g=()&kuery=${apmField}:"${node.id}"`, + href: urlPrefixer('apm', `#traces?_g=()&kuery=${apmField}:"${node.id}"`), 'data-test-subj': 'viewApmTracesContextMenuItem', isDisabled: !showAPMTraceLink, }; @@ -122,7 +130,7 @@ export const NodeContextMenu: React.FC = ({ defaultMessage: '{inventoryName} in Uptime', values: { inventoryName: inventoryModel.singularDisplayName }, }), - href: createUptimeLink(options, nodeType, node), + href: urlPrefixer('uptime', createUptimeLink(options, nodeType, node)), isDisabled: !showUptimeLink, }; diff --git a/x-pack/legacy/plugins/infra/public/components/waffle/steps_legend.tsx b/x-pack/plugins/infra/public/components/waffle/steps_legend.tsx similarity index 96% rename from x-pack/legacy/plugins/infra/public/components/waffle/steps_legend.tsx rename to x-pack/plugins/infra/public/components/waffle/steps_legend.tsx index e251720795074..d2079d53dad71 100644 --- a/x-pack/legacy/plugins/infra/public/components/waffle/steps_legend.tsx +++ b/x-pack/plugins/infra/public/components/waffle/steps_legend.tsx @@ -7,7 +7,7 @@ import { darken } from 'polished'; import React from 'react'; -import euiStyled from '../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../observability/public'; import { InfraFormatter, InfraWaffleMapRuleOperator, diff --git a/x-pack/legacy/plugins/infra/public/components/waffle/view_switcher.tsx b/x-pack/plugins/infra/public/components/waffle/view_switcher.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/waffle/view_switcher.tsx rename to x-pack/plugins/infra/public/components/waffle/view_switcher.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/waffle/waffle_accounts_controls.tsx b/x-pack/plugins/infra/public/components/waffle/waffle_accounts_controls.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/waffle/waffle_accounts_controls.tsx rename to x-pack/plugins/infra/public/components/waffle/waffle_accounts_controls.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/waffle/waffle_group_by_controls.tsx b/x-pack/plugins/infra/public/components/waffle/waffle_group_by_controls.tsx similarity index 98% rename from x-pack/legacy/plugins/infra/public/components/waffle/waffle_group_by_controls.tsx rename to x-pack/plugins/infra/public/components/waffle/waffle_group_by_controls.tsx index 3e697dccabac5..81f82ec27b4a3 100644 --- a/x-pack/legacy/plugins/infra/public/components/waffle/waffle_group_by_controls.tsx +++ b/x-pack/plugins/infra/public/components/waffle/waffle_group_by_controls.tsx @@ -19,7 +19,7 @@ import React from 'react'; import { IFieldType } from 'src/plugins/data/public'; import { InfraGroupByOptions } from '../../lib/lib'; import { CustomFieldPanel } from './custom_field_panel'; -import euiStyled from '../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../observability/public'; import { InventoryItemType } from '../../../common/inventory_models/types'; import { SnapshotGroupBy } from '../../../common/http_api/snapshot_api'; diff --git a/x-pack/legacy/plugins/infra/public/components/waffle/waffle_inventory_switcher.tsx b/x-pack/plugins/infra/public/components/waffle/waffle_inventory_switcher.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/waffle/waffle_inventory_switcher.tsx rename to x-pack/plugins/infra/public/components/waffle/waffle_inventory_switcher.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/waffle/waffle_metric_controls.tsx b/x-pack/plugins/infra/public/components/waffle/waffle_metric_controls.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/waffle/waffle_metric_controls.tsx rename to x-pack/plugins/infra/public/components/waffle/waffle_metric_controls.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/waffle/waffle_region_controls.tsx b/x-pack/plugins/infra/public/components/waffle/waffle_region_controls.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/waffle/waffle_region_controls.tsx rename to x-pack/plugins/infra/public/components/waffle/waffle_region_controls.tsx diff --git a/x-pack/legacy/plugins/infra/public/components/waffle/waffle_time_controls.tsx b/x-pack/plugins/infra/public/components/waffle/waffle_time_controls.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/components/waffle/waffle_time_controls.tsx rename to x-pack/plugins/infra/public/components/waffle/waffle_time_controls.tsx diff --git a/x-pack/legacy/plugins/infra/public/containers/inventory_metadata/use_inventory_meta.ts b/x-pack/plugins/infra/public/containers/inventory_metadata/use_inventory_meta.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/inventory_metadata/use_inventory_meta.ts rename to x-pack/plugins/infra/public/containers/inventory_metadata/use_inventory_meta.ts diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/api/ml_api_types.ts b/x-pack/plugins/infra/public/containers/logs/log_analysis/api/ml_api_types.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/api/ml_api_types.ts rename to x-pack/plugins/infra/public/containers/logs/log_analysis/api/ml_api_types.ts diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/api/ml_cleanup.ts b/x-pack/plugins/infra/public/containers/logs/log_analysis/api/ml_cleanup.ts similarity index 88% rename from x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/api/ml_cleanup.ts rename to x-pack/plugins/infra/public/containers/logs/log_analysis/api/ml_cleanup.ts index 76e5f210ca238..21ae7804292dd 100644 --- a/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/api/ml_cleanup.ts +++ b/x-pack/plugins/infra/public/containers/logs/log_analysis/api/ml_cleanup.ts @@ -8,7 +8,7 @@ import * as rt from 'io-ts'; import { pipe } from 'fp-ts/lib/pipeable'; import { fold } from 'fp-ts/lib/Either'; import { identity } from 'fp-ts/lib/function'; -import { npStart } from 'ui/new_platform'; +import { npStart } from '../../../../legacy_singletons'; import { getDatafeedId, getJobId } from '../../../../../common/log_analysis'; import { throwErrors, createPlainError } from '../../../../../common/runtime_types'; @@ -19,7 +19,7 @@ export const callDeleteJobs = async ( jobTypes: JobType[] ) => { // NOTE: Deleting the jobs via this API will delete the datafeeds at the same time - const deleteJobsResponse = await npStart.core.http.fetch('/api/ml/jobs/delete_jobs', { + const deleteJobsResponse = await npStart.http.fetch('/api/ml/jobs/delete_jobs', { method: 'POST', body: JSON.stringify( deleteJobsRequestPayloadRT.encode({ @@ -35,9 +35,7 @@ export const callDeleteJobs = async ( }; export const callGetJobDeletionTasks = async () => { - const jobDeletionTasksResponse = await npStart.core.http.fetch( - '/api/ml/jobs/deleting_jobs_tasks' - ); + const jobDeletionTasksResponse = await npStart.http.fetch('/api/ml/jobs/deleting_jobs_tasks'); return pipe( getJobDeletionTasksResponsePayloadRT.decode(jobDeletionTasksResponse), @@ -51,7 +49,7 @@ export const callStopDatafeeds = async ( jobTypes: JobType[] ) => { // Stop datafeed due to https://github.com/elastic/kibana/issues/44652 - const stopDatafeedResponse = await npStart.core.http.fetch('/api/ml/jobs/stop_datafeeds', { + const stopDatafeedResponse = await npStart.http.fetch('/api/ml/jobs/stop_datafeeds', { method: 'POST', body: JSON.stringify( stopDatafeedsRequestPayloadRT.encode({ diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/api/ml_get_jobs_summary_api.ts b/x-pack/plugins/infra/public/containers/logs/log_analysis/api/ml_get_jobs_summary_api.ts similarity index 93% rename from x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/api/ml_get_jobs_summary_api.ts rename to x-pack/plugins/infra/public/containers/logs/log_analysis/api/ml_get_jobs_summary_api.ts index a067285026e33..ef463561a863f 100644 --- a/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/api/ml_get_jobs_summary_api.ts +++ b/x-pack/plugins/infra/public/containers/logs/log_analysis/api/ml_get_jobs_summary_api.ts @@ -8,7 +8,7 @@ import { pipe } from 'fp-ts/lib/pipeable'; import { fold } from 'fp-ts/lib/Either'; import { identity } from 'fp-ts/lib/function'; import * as rt from 'io-ts'; -import { npStart } from 'ui/new_platform'; +import { npStart } from '../../../../legacy_singletons'; import { jobCustomSettingsRT } from './ml_api_types'; import { throwErrors, createPlainError } from '../../../../../common/runtime_types'; import { getJobId } from '../../../../../common/log_analysis'; @@ -18,7 +18,7 @@ export const callJobsSummaryAPI = async ( sourceId: string, jobTypes: JobType[] ) => { - const response = await npStart.core.http.fetch('/api/ml/jobs/jobs_summary', { + const response = await npStart.http.fetch('/api/ml/jobs/jobs_summary', { method: 'POST', body: JSON.stringify( fetchJobStatusRequestPayloadRT.encode({ diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/api/ml_get_module.ts b/x-pack/plugins/infra/public/containers/logs/log_analysis/api/ml_get_module.ts similarity index 88% rename from x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/api/ml_get_module.ts rename to x-pack/plugins/infra/public/containers/logs/log_analysis/api/ml_get_module.ts index ae90c7bb84130..7c34eeca76a98 100644 --- a/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/api/ml_get_module.ts +++ b/x-pack/plugins/infra/public/containers/logs/log_analysis/api/ml_get_module.ts @@ -8,12 +8,12 @@ import { fold } from 'fp-ts/lib/Either'; import { pipe } from 'fp-ts/lib/pipeable'; import { identity } from 'fp-ts/lib/function'; import * as rt from 'io-ts'; -import { npStart } from 'ui/new_platform'; +import { npStart } from '../../../../legacy_singletons'; import { throwErrors, createPlainError } from '../../../../../common/runtime_types'; import { jobCustomSettingsRT } from './ml_api_types'; export const callGetMlModuleAPI = async (moduleId: string) => { - const response = await npStart.core.http.fetch(`/api/ml/modules/get_module/${moduleId}`, { + const response = await npStart.http.fetch(`/api/ml/modules/get_module/${moduleId}`, { method: 'GET', }); diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/api/ml_setup_module_api.ts b/x-pack/plugins/infra/public/containers/logs/log_analysis/api/ml_setup_module_api.ts similarity index 95% rename from x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/api/ml_setup_module_api.ts rename to x-pack/plugins/infra/public/containers/logs/log_analysis/api/ml_setup_module_api.ts index 774a521ff1d34..d90bbab267871 100644 --- a/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/api/ml_setup_module_api.ts +++ b/x-pack/plugins/infra/public/containers/logs/log_analysis/api/ml_setup_module_api.ts @@ -8,7 +8,7 @@ import { fold } from 'fp-ts/lib/Either'; import { pipe } from 'fp-ts/lib/pipeable'; import { identity } from 'fp-ts/lib/function'; import * as rt from 'io-ts'; -import { npStart } from 'ui/new_platform'; +import { npStart } from '../../../../legacy_singletons'; import { throwErrors, createPlainError } from '../../../../../common/runtime_types'; import { getJobIdPrefix } from '../../../../../common/log_analysis'; @@ -22,7 +22,7 @@ export const callSetupMlModuleAPI = async ( jobOverrides: SetupMlModuleJobOverrides[] = [], datafeedOverrides: SetupMlModuleDatafeedOverrides[] = [] ) => { - const response = await npStart.core.http.fetch(`/api/ml/modules/setup/${moduleId}`, { + const response = await npStart.http.fetch(`/api/ml/modules/setup/${moduleId}`, { method: 'POST', body: JSON.stringify( setupMlModuleRequestPayloadRT.encode({ diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/api/validate_indices.ts b/x-pack/plugins/infra/public/containers/logs/log_analysis/api/validate_indices.ts similarity index 88% rename from x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/api/validate_indices.ts rename to x-pack/plugins/infra/public/containers/logs/log_analysis/api/validate_indices.ts index 480e84ff53e43..bbef7d201045f 100644 --- a/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/api/validate_indices.ts +++ b/x-pack/plugins/infra/public/containers/logs/log_analysis/api/validate_indices.ts @@ -7,7 +7,7 @@ import { fold } from 'fp-ts/lib/Either'; import { pipe } from 'fp-ts/lib/pipeable'; import { identity } from 'fp-ts/lib/function'; -import { npStart } from 'ui/new_platform'; +import { npStart } from '../../../../legacy_singletons'; import { LOG_ANALYSIS_VALIDATE_INDICES_PATH, ValidationIndicesFieldSpecification, @@ -21,7 +21,7 @@ export const callValidateIndicesAPI = async ( indices: string[], fields: ValidationIndicesFieldSpecification[] ) => { - const response = await npStart.core.http.fetch(LOG_ANALYSIS_VALIDATE_INDICES_PATH, { + const response = await npStart.http.fetch(LOG_ANALYSIS_VALIDATE_INDICES_PATH, { method: 'POST', body: JSON.stringify(validationIndicesRequestPayloadRT.encode({ data: { indices, fields } })), }); diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/index.ts b/x-pack/plugins/infra/public/containers/logs/log_analysis/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/index.ts rename to x-pack/plugins/infra/public/containers/logs/log_analysis/index.ts diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/log_analysis_capabilities.tsx b/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_capabilities.tsx similarity index 95% rename from x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/log_analysis_capabilities.tsx rename to x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_capabilities.tsx index 3c10ba805fad5..7bee10c3bfaa7 100644 --- a/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/log_analysis_capabilities.tsx +++ b/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_capabilities.tsx @@ -6,11 +6,11 @@ import createContainer from 'constate'; import { useMemo, useState, useEffect } from 'react'; -import { npStart } from 'ui/new_platform'; import { fold } from 'fp-ts/lib/Either'; import { pipe } from 'fp-ts/lib/pipeable'; import { identity } from 'fp-ts/lib/function'; import { useTrackedPromise } from '../../../utils/use_tracked_promise'; +import { npStart } from '../../../legacy_singletons'; import { getMlCapabilitiesResponsePayloadRT, GetMlCapabilitiesResponsePayload, @@ -26,7 +26,7 @@ export const useLogAnalysisCapabilities = () => { { cancelPreviousOn: 'resolution', createPromise: async () => { - const rawResponse = await npStart.core.http.fetch('/api/ml/ml_capabilities'); + const rawResponse = await npStart.http.fetch('/api/ml/ml_capabilities'); return pipe( getMlCapabilitiesResponsePayloadRT.decode(rawResponse), diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/log_analysis_cleanup.tsx b/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_cleanup.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/log_analysis_cleanup.tsx rename to x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_cleanup.tsx diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/log_analysis_module.tsx b/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_module.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/log_analysis_module.tsx rename to x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_module.tsx diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/log_analysis_module_status.tsx b/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_module_status.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/log_analysis_module_status.tsx rename to x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_module_status.tsx diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/log_analysis_module_types.ts b/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_module_types.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/log_analysis_module_types.ts rename to x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_module_types.ts diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/log_analysis_setup_state.tsx b/x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_setup_state.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/logs/log_analysis/log_analysis_setup_state.tsx rename to x-pack/plugins/infra/public/containers/logs/log_analysis/log_analysis_setup_state.tsx diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_entries/api/fetch_log_entries_item.ts b/x-pack/plugins/infra/public/containers/logs/log_entries/api/fetch_log_entries_item.ts similarity index 87% rename from x-pack/legacy/plugins/infra/public/containers/logs/log_entries/api/fetch_log_entries_item.ts rename to x-pack/plugins/infra/public/containers/logs/log_entries/api/fetch_log_entries_item.ts index fd093f20dd490..5fde01e458e36 100644 --- a/x-pack/legacy/plugins/infra/public/containers/logs/log_entries/api/fetch_log_entries_item.ts +++ b/x-pack/plugins/infra/public/containers/logs/log_entries/api/fetch_log_entries_item.ts @@ -7,7 +7,7 @@ import { fold } from 'fp-ts/lib/Either'; import { pipe } from 'fp-ts/lib/pipeable'; import { identity } from 'fp-ts/lib/function'; -import { kfetch } from 'ui/kfetch'; +import { npStart } from '../../../../legacy_singletons'; import { throwErrors, createPlainError } from '../../../../../common/runtime_types'; @@ -19,9 +19,8 @@ import { } from '../../../../../common/http_api'; export const fetchLogEntriesItem = async (requestArgs: LogEntriesItemRequest) => { - const response = await kfetch({ + const response = await npStart.http.fetch(LOG_ENTRIES_ITEM_PATH, { method: 'POST', - pathname: LOG_ENTRIES_ITEM_PATH, body: JSON.stringify(logEntriesItemRequestRT.encode(requestArgs)), }); diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_entries/gql_queries.ts b/x-pack/plugins/infra/public/containers/logs/log_entries/gql_queries.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/logs/log_entries/gql_queries.ts rename to x-pack/plugins/infra/public/containers/logs/log_entries/gql_queries.ts diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_entries/index.ts b/x-pack/plugins/infra/public/containers/logs/log_entries/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/logs/log_entries/index.ts rename to x-pack/plugins/infra/public/containers/logs/log_entries/index.ts diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_entries/types.ts b/x-pack/plugins/infra/public/containers/logs/log_entries/types.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/logs/log_entries/types.ts rename to x-pack/plugins/infra/public/containers/logs/log_entries/types.ts diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_filter/index.ts b/x-pack/plugins/infra/public/containers/logs/log_filter/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/logs/log_filter/index.ts rename to x-pack/plugins/infra/public/containers/logs/log_filter/index.ts diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_filter/log_filter_state.ts b/x-pack/plugins/infra/public/containers/logs/log_filter/log_filter_state.ts similarity index 97% rename from x-pack/legacy/plugins/infra/public/containers/logs/log_filter/log_filter_state.ts rename to x-pack/plugins/infra/public/containers/logs/log_filter/log_filter_state.ts index 2911ee729638a..dd1ba585061fe 100644 --- a/x-pack/legacy/plugins/infra/public/containers/logs/log_filter/log_filter_state.ts +++ b/x-pack/plugins/infra/public/containers/logs/log_filter/log_filter_state.ts @@ -7,7 +7,7 @@ import { useState, useMemo } from 'react'; import createContainer from 'constate'; import { IIndexPattern } from 'src/plugins/data/public'; -import { esKuery } from '../../../../../../../../src/plugins/data/public'; +import { esKuery } from '../../../../../../../src/plugins/data/public'; import { convertKueryToElasticSearchQuery } from '../../../utils/kuery'; export interface KueryFilterQuery { diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_filter/with_log_filter_url_state.tsx b/x-pack/plugins/infra/public/containers/logs/log_filter/with_log_filter_url_state.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/logs/log_filter/with_log_filter_url_state.tsx rename to x-pack/plugins/infra/public/containers/logs/log_filter/with_log_filter_url_state.tsx diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_flyout.tsx b/x-pack/plugins/infra/public/containers/logs/log_flyout.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/logs/log_flyout.tsx rename to x-pack/plugins/infra/public/containers/logs/log_flyout.tsx diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_highlights/api/fetch_log_summary_highlights.ts b/x-pack/plugins/infra/public/containers/logs/log_highlights/api/fetch_log_summary_highlights.ts similarity index 87% rename from x-pack/legacy/plugins/infra/public/containers/logs/log_highlights/api/fetch_log_summary_highlights.ts rename to x-pack/plugins/infra/public/containers/logs/log_highlights/api/fetch_log_summary_highlights.ts index 781e8401cf881..bda8f535549c7 100644 --- a/x-pack/legacy/plugins/infra/public/containers/logs/log_highlights/api/fetch_log_summary_highlights.ts +++ b/x-pack/plugins/infra/public/containers/logs/log_highlights/api/fetch_log_summary_highlights.ts @@ -6,8 +6,7 @@ import { fold } from 'fp-ts/lib/Either'; import { pipe } from 'fp-ts/lib/pipeable'; import { identity } from 'fp-ts/lib/function'; -import { kfetch } from 'ui/kfetch'; - +import { npStart } from '../../../../legacy_singletons'; import { throwErrors, createPlainError } from '../../../../../common/runtime_types'; import { @@ -20,9 +19,8 @@ import { export const fetchLogSummaryHighlights = async ( requestArgs: LogEntriesSummaryHighlightsRequest ) => { - const response = await kfetch({ + const response = await npStart.http.fetch(LOG_ENTRIES_SUMMARY_HIGHLIGHTS_PATH, { method: 'POST', - pathname: LOG_ENTRIES_SUMMARY_HIGHLIGHTS_PATH, body: JSON.stringify(logEntriesSummaryHighlightsRequestRT.encode(requestArgs)), }); diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_highlights/index.ts b/x-pack/plugins/infra/public/containers/logs/log_highlights/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/logs/log_highlights/index.ts rename to x-pack/plugins/infra/public/containers/logs/log_highlights/index.ts diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_highlights/log_entry_highlights.gql_query.ts b/x-pack/plugins/infra/public/containers/logs/log_highlights/log_entry_highlights.gql_query.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/logs/log_highlights/log_entry_highlights.gql_query.ts rename to x-pack/plugins/infra/public/containers/logs/log_highlights/log_entry_highlights.gql_query.ts diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_highlights/log_entry_highlights.tsx b/x-pack/plugins/infra/public/containers/logs/log_highlights/log_entry_highlights.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/logs/log_highlights/log_entry_highlights.tsx rename to x-pack/plugins/infra/public/containers/logs/log_highlights/log_entry_highlights.tsx diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_highlights/log_highlights.tsx b/x-pack/plugins/infra/public/containers/logs/log_highlights/log_highlights.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/logs/log_highlights/log_highlights.tsx rename to x-pack/plugins/infra/public/containers/logs/log_highlights/log_highlights.tsx diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_highlights/log_summary_highlights.ts b/x-pack/plugins/infra/public/containers/logs/log_highlights/log_summary_highlights.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/logs/log_highlights/log_summary_highlights.ts rename to x-pack/plugins/infra/public/containers/logs/log_highlights/log_summary_highlights.ts diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_highlights/next_and_previous.tsx b/x-pack/plugins/infra/public/containers/logs/log_highlights/next_and_previous.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/logs/log_highlights/next_and_previous.tsx rename to x-pack/plugins/infra/public/containers/logs/log_highlights/next_and_previous.tsx diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_position/index.ts b/x-pack/plugins/infra/public/containers/logs/log_position/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/logs/log_position/index.ts rename to x-pack/plugins/infra/public/containers/logs/log_position/index.ts diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_position/log_position_state.ts b/x-pack/plugins/infra/public/containers/logs/log_position/log_position_state.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/logs/log_position/log_position_state.ts rename to x-pack/plugins/infra/public/containers/logs/log_position/log_position_state.ts diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_position/with_log_position_url_state.tsx b/x-pack/plugins/infra/public/containers/logs/log_position/with_log_position_url_state.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/logs/log_position/with_log_position_url_state.tsx rename to x-pack/plugins/infra/public/containers/logs/log_position/with_log_position_url_state.tsx diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_summary/api/fetch_log_summary.ts b/x-pack/plugins/infra/public/containers/logs/log_summary/api/fetch_log_summary.ts similarity index 87% rename from x-pack/legacy/plugins/infra/public/containers/logs/log_summary/api/fetch_log_summary.ts rename to x-pack/plugins/infra/public/containers/logs/log_summary/api/fetch_log_summary.ts index 5dabb8ebf0179..f74f0dc0e3117 100644 --- a/x-pack/legacy/plugins/infra/public/containers/logs/log_summary/api/fetch_log_summary.ts +++ b/x-pack/plugins/infra/public/containers/logs/log_summary/api/fetch_log_summary.ts @@ -7,8 +7,7 @@ import { fold } from 'fp-ts/lib/Either'; import { pipe } from 'fp-ts/lib/pipeable'; import { identity } from 'fp-ts/lib/function'; -import { kfetch } from 'ui/kfetch'; - +import { npStart } from '../../../../legacy_singletons'; import { throwErrors, createPlainError } from '../../../../../common/runtime_types'; import { @@ -19,9 +18,8 @@ import { } from '../../../../../common/http_api'; export const fetchLogSummary = async (requestArgs: LogEntriesSummaryRequest) => { - const response = await kfetch({ + const response = await npStart.http.fetch(LOG_ENTRIES_SUMMARY_PATH, { method: 'POST', - pathname: LOG_ENTRIES_SUMMARY_PATH, body: JSON.stringify(logEntriesSummaryRequestRT.encode(requestArgs)), }); diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_summary/index.ts b/x-pack/plugins/infra/public/containers/logs/log_summary/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/logs/log_summary/index.ts rename to x-pack/plugins/infra/public/containers/logs/log_summary/index.ts diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_summary/log_summary.test.tsx b/x-pack/plugins/infra/public/containers/logs/log_summary/log_summary.test.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/logs/log_summary/log_summary.test.tsx rename to x-pack/plugins/infra/public/containers/logs/log_summary/log_summary.test.tsx diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_summary/log_summary.tsx b/x-pack/plugins/infra/public/containers/logs/log_summary/log_summary.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/logs/log_summary/log_summary.tsx rename to x-pack/plugins/infra/public/containers/logs/log_summary/log_summary.tsx diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_summary/use_log_summary_buffer_interval.ts b/x-pack/plugins/infra/public/containers/logs/log_summary/use_log_summary_buffer_interval.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/logs/log_summary/use_log_summary_buffer_interval.ts rename to x-pack/plugins/infra/public/containers/logs/log_summary/use_log_summary_buffer_interval.ts diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_summary/with_summary.ts b/x-pack/plugins/infra/public/containers/logs/log_summary/with_summary.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/logs/log_summary/with_summary.ts rename to x-pack/plugins/infra/public/containers/logs/log_summary/with_summary.ts diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_view_configuration.test.tsx b/x-pack/plugins/infra/public/containers/logs/log_view_configuration.test.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/logs/log_view_configuration.test.tsx rename to x-pack/plugins/infra/public/containers/logs/log_view_configuration.test.tsx diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_view_configuration.tsx b/x-pack/plugins/infra/public/containers/logs/log_view_configuration.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/logs/log_view_configuration.tsx rename to x-pack/plugins/infra/public/containers/logs/log_view_configuration.tsx diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/with_log_minimap.tsx b/x-pack/plugins/infra/public/containers/logs/with_log_minimap.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/logs/with_log_minimap.tsx rename to x-pack/plugins/infra/public/containers/logs/with_log_minimap.tsx diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/with_log_textview.tsx b/x-pack/plugins/infra/public/containers/logs/with_log_textview.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/logs/with_log_textview.tsx rename to x-pack/plugins/infra/public/containers/logs/with_log_textview.tsx diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/with_stream_items.ts b/x-pack/plugins/infra/public/containers/logs/with_stream_items.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/logs/with_stream_items.ts rename to x-pack/plugins/infra/public/containers/logs/with_stream_items.ts diff --git a/x-pack/legacy/plugins/infra/public/containers/metadata/lib/get_filtered_metrics.ts b/x-pack/plugins/infra/public/containers/metadata/lib/get_filtered_metrics.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/metadata/lib/get_filtered_metrics.ts rename to x-pack/plugins/infra/public/containers/metadata/lib/get_filtered_metrics.ts diff --git a/x-pack/legacy/plugins/infra/public/containers/metadata/use_metadata.ts b/x-pack/plugins/infra/public/containers/metadata/use_metadata.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/metadata/use_metadata.ts rename to x-pack/plugins/infra/public/containers/metadata/use_metadata.ts diff --git a/x-pack/legacy/plugins/infra/public/containers/metrics_explorer/use_metrics_explorer_data.test.tsx b/x-pack/plugins/infra/public/containers/metrics_explorer/use_metrics_explorer_data.test.tsx similarity index 81% rename from x-pack/legacy/plugins/infra/public/containers/metrics_explorer/use_metrics_explorer_data.test.tsx rename to x-pack/plugins/infra/public/containers/metrics_explorer/use_metrics_explorer_data.test.tsx index 4baa93f93753c..bbc8778545b4a 100644 --- a/x-pack/legacy/plugins/infra/public/containers/metrics_explorer/use_metrics_explorer_data.test.tsx +++ b/x-pack/plugins/infra/public/containers/metrics_explorer/use_metrics_explorer_data.test.tsx @@ -4,10 +4,11 @@ * you may not use this file except in compliance with the Elastic License. */ -import { fetch } from '../../utils/fetch'; +import React from 'react'; import { useMetricsExplorerData } from './use_metrics_explorer_data'; import { renderHook } from '@testing-library/react-hooks'; +import { KibanaContextProvider } from '../../../../../../src/plugins/kibana_react/public'; import { options, @@ -18,8 +19,18 @@ import { createSeries, } from '../../utils/fixtures/metrics_explorer'; -const renderUseMetricsExplorerDataHook = () => - renderHook( +const mockedFetch = jest.fn(); + +const renderUseMetricsExplorerDataHook = () => { + const wrapper: React.FC = ({ children }) => { + const services = { + http: { + fetch: mockedFetch, + }, + }; + return {children}; + }; + return renderHook( props => useMetricsExplorerData( props.options, @@ -38,14 +49,20 @@ const renderUseMetricsExplorerDataHook = () => afterKey: null as string | null, signal: 1, }, + wrapper, } ); +}; + +jest.mock('../../utils/kuery', () => { + return { + convertKueryToElasticSearchQuery: (query: string) => query, + }; +}); -jest.mock('../../utils/fetch'); -const mockedFetch = fetch as jest.Mocked; describe('useMetricsExplorerData Hook', () => { it('should just work', async () => { - mockedFetch.post.mockResolvedValue({ data: resp } as any); + mockedFetch.mockResolvedValue(resp as any); const { result, waitForNextUpdate } = renderUseMetricsExplorerDataHook(); expect(result.current.data).toBe(null); expect(result.current.loading).toBe(true); @@ -58,7 +75,7 @@ describe('useMetricsExplorerData Hook', () => { }); it('should paginate', async () => { - mockedFetch.post.mockResolvedValue({ data: resp } as any); + mockedFetch.mockResolvedValue(resp as any); const { result, waitForNextUpdate, rerender } = renderUseMetricsExplorerDataHook(); expect(result.current.data).toBe(null); expect(result.current.loading).toBe(true); @@ -68,11 +85,9 @@ describe('useMetricsExplorerData Hook', () => { const { series, pageInfo } = result.current.data!; expect(series).toBeDefined(); expect(series.length).toBe(3); - mockedFetch.post.mockResolvedValue({ - data: { - pageInfo: { total: 10, afterKey: 'host-06' }, - series: [createSeries('host-04'), createSeries('host-05'), createSeries('host-06')], - }, + mockedFetch.mockResolvedValue({ + pageInfo: { total: 10, afterKey: 'host-06' }, + series: [createSeries('host-04'), createSeries('host-05'), createSeries('host-06')], } as any); rerender({ options, @@ -92,7 +107,7 @@ describe('useMetricsExplorerData Hook', () => { it('should reset error upon recovery', async () => { const error = new Error('Network Error'); - mockedFetch.post.mockRejectedValue(error); + mockedFetch.mockRejectedValue(error); const { result, waitForNextUpdate, rerender } = renderUseMetricsExplorerDataHook(); expect(result.current.data).toBe(null); expect(result.current.error).toEqual(null); @@ -101,7 +116,7 @@ describe('useMetricsExplorerData Hook', () => { expect(result.current.data).toEqual(null); expect(result.current.error).toEqual(error); expect(result.current.loading).toBe(false); - mockedFetch.post.mockResolvedValue({ data: resp } as any); + mockedFetch.mockResolvedValue(resp as any); rerender({ options, source, @@ -117,7 +132,7 @@ describe('useMetricsExplorerData Hook', () => { }); it('should not paginate on option change', async () => { - mockedFetch.post.mockResolvedValue({ data: resp } as any); + mockedFetch.mockResolvedValue(resp as any); const { result, waitForNextUpdate, rerender } = renderUseMetricsExplorerDataHook(); expect(result.current.data).toBe(null); expect(result.current.loading).toBe(true); @@ -127,7 +142,7 @@ describe('useMetricsExplorerData Hook', () => { const { series, pageInfo } = result.current.data!; expect(series).toBeDefined(); expect(series.length).toBe(3); - mockedFetch.post.mockResolvedValue({ data: resp } as any); + mockedFetch.mockResolvedValue(resp as any); rerender({ options: { ...options, @@ -147,7 +162,7 @@ describe('useMetricsExplorerData Hook', () => { }); it('should not paginate on time change', async () => { - mockedFetch.post.mockResolvedValue({ data: resp } as any); + mockedFetch.mockResolvedValue(resp as any); const { result, waitForNextUpdate, rerender } = renderUseMetricsExplorerDataHook(); expect(result.current.data).toBe(null); expect(result.current.loading).toBe(true); @@ -157,7 +172,7 @@ describe('useMetricsExplorerData Hook', () => { const { series, pageInfo } = result.current.data!; expect(series).toBeDefined(); expect(series.length).toBe(3); - mockedFetch.post.mockResolvedValue({ data: resp } as any); + mockedFetch.mockResolvedValue(resp as any); rerender({ options, source, diff --git a/x-pack/legacy/plugins/infra/public/containers/metrics_explorer/use_metrics_explorer_data.ts b/x-pack/plugins/infra/public/containers/metrics_explorer/use_metrics_explorer_data.ts similarity index 59% rename from x-pack/legacy/plugins/infra/public/containers/metrics_explorer/use_metrics_explorer_data.ts rename to x-pack/plugins/infra/public/containers/metrics_explorer/use_metrics_explorer_data.ts index 1bca733a6e02a..b32496fbf30a1 100644 --- a/x-pack/legacy/plugins/infra/public/containers/metrics_explorer/use_metrics_explorer_data.ts +++ b/x-pack/plugins/infra/public/containers/metrics_explorer/use_metrics_explorer_data.ts @@ -9,10 +9,14 @@ import { isEqual } from 'lodash'; import { useEffect, useState } from 'react'; import { IIndexPattern } from 'src/plugins/data/public'; import { SourceQuery } from '../../../common/graphql/types'; -import { MetricsExplorerResponse } from '../../../server/routes/metrics_explorer/types'; -import { fetch } from '../../utils/fetch'; +import { + MetricsExplorerResponse, + metricsExplorerResponseRT, +} from '../../../common/http_api/metrics_explorer'; import { convertKueryToElasticSearchQuery } from '../../utils/kuery'; import { MetricsExplorerOptions, MetricsExplorerTimeOptions } from './use_metrics_explorer_options'; +import { useKibana } from '../../../../../../src/plugins/kibana_react/public'; +import { decodeOrThrow } from '../../../common/runtime_types'; function isSameOptions(current: MetricsExplorerOptions, next: MetricsExplorerOptions) { return isEqual(current, next); @@ -26,6 +30,7 @@ export function useMetricsExplorerData( afterKey: string | null, signal: any ) { + const fetch = useKibana().services.http?.fetch; const [error, setError] = useState(null); const [loading, setLoading] = useState(true); const [data, setData] = useState(null); @@ -41,48 +46,54 @@ export function useMetricsExplorerData( if (!from || !to) { throw new Error('Unalble to parse timerange'); } - const response = await fetch.post( - '../api/infra/metrics_explorer', - { - metrics: - options.aggregation === 'count' - ? [{ aggregation: 'count' }] - : options.metrics.map(metric => ({ - aggregation: metric.aggregation, - field: metric.field, - })), - groupBy: options.groupBy, - afterKey, - limit: options.limit, - indexPattern: source.metricAlias, - filterQuery: - (options.filterQuery && - convertKueryToElasticSearchQuery(options.filterQuery, derivedIndexPattern)) || - void 0, - timerange: { - ...timerange, - field: source.fields.timestamp, - from: from.valueOf(), - to: to.valueOf(), - }, - } + if (!fetch) { + throw new Error('HTTP service is unavailable'); + } + const response = decodeOrThrow(metricsExplorerResponseRT)( + await fetch('/api/infra/metrics_explorer', { + method: 'POST', + body: JSON.stringify({ + metrics: + options.aggregation === 'count' + ? [{ aggregation: 'count' }] + : options.metrics.map(metric => ({ + aggregation: metric.aggregation, + field: metric.field, + })), + groupBy: options.groupBy, + afterKey, + limit: options.limit, + indexPattern: source.metricAlias, + filterQuery: + (options.filterQuery && + convertKueryToElasticSearchQuery(options.filterQuery, derivedIndexPattern)) || + void 0, + timerange: { + ...timerange, + field: source.fields.timestamp, + from: from.valueOf(), + to: to.valueOf(), + }, + }), + }) ); - if (response.data) { + + if (response) { if ( data && lastOptions && - data.pageInfo.afterKey !== response.data.pageInfo.afterKey && + data.pageInfo.afterKey !== response.pageInfo.afterKey && isSameOptions(lastOptions, options) && isEqual(timerange, lastTimerange) && afterKey ) { const { series } = data; setData({ - ...response.data, - series: [...series, ...response.data.series], + ...response, + series: [...series, ...response.series], }); } else { - setData(response.data); + setData(response); } setLastOptions(options); setLastTimerange(timerange); diff --git a/x-pack/legacy/plugins/infra/public/containers/metrics_explorer/use_metrics_explorer_options.test.tsx b/x-pack/plugins/infra/public/containers/metrics_explorer/use_metrics_explorer_options.test.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/metrics_explorer/use_metrics_explorer_options.test.tsx rename to x-pack/plugins/infra/public/containers/metrics_explorer/use_metrics_explorer_options.test.tsx diff --git a/x-pack/legacy/plugins/infra/public/containers/metrics_explorer/use_metrics_explorer_options.ts b/x-pack/plugins/infra/public/containers/metrics_explorer/use_metrics_explorer_options.ts similarity index 98% rename from x-pack/legacy/plugins/infra/public/containers/metrics_explorer/use_metrics_explorer_options.ts rename to x-pack/plugins/infra/public/containers/metrics_explorer/use_metrics_explorer_options.ts index 076a9159940e2..2b802af8e8c15 100644 --- a/x-pack/legacy/plugins/infra/public/containers/metrics_explorer/use_metrics_explorer_options.ts +++ b/x-pack/plugins/infra/public/containers/metrics_explorer/use_metrics_explorer_options.ts @@ -10,7 +10,7 @@ import { MetricsExplorerColor } from '../../../common/color_palette'; import { MetricsExplorerAggregation, MetricsExplorerMetric, -} from '../../../server/routes/metrics_explorer/types'; +} from '../../../common/http_api/metrics_explorer'; export type MetricsExplorerOptionsMetric = MetricsExplorerMetric & { color?: MetricsExplorerColor; diff --git a/x-pack/legacy/plugins/infra/public/containers/metrics_explorer/with_metrics_explorer_options_url_state.tsx b/x-pack/plugins/infra/public/containers/metrics_explorer/with_metrics_explorer_options_url_state.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/metrics_explorer/with_metrics_explorer_options_url_state.tsx rename to x-pack/plugins/infra/public/containers/metrics_explorer/with_metrics_explorer_options_url_state.tsx diff --git a/x-pack/legacy/plugins/infra/public/containers/node_details/use_node_details.ts b/x-pack/plugins/infra/public/containers/node_details/use_node_details.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/node_details/use_node_details.ts rename to x-pack/plugins/infra/public/containers/node_details/use_node_details.ts diff --git a/x-pack/legacy/plugins/infra/public/containers/source/create_source.gql_query.ts b/x-pack/plugins/infra/public/containers/source/create_source.gql_query.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/source/create_source.gql_query.ts rename to x-pack/plugins/infra/public/containers/source/create_source.gql_query.ts diff --git a/x-pack/legacy/plugins/infra/public/containers/source/index.ts b/x-pack/plugins/infra/public/containers/source/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/source/index.ts rename to x-pack/plugins/infra/public/containers/source/index.ts diff --git a/x-pack/legacy/plugins/infra/public/containers/source/query_source.gql_query.ts b/x-pack/plugins/infra/public/containers/source/query_source.gql_query.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/source/query_source.gql_query.ts rename to x-pack/plugins/infra/public/containers/source/query_source.gql_query.ts diff --git a/x-pack/legacy/plugins/infra/public/containers/source/source.tsx b/x-pack/plugins/infra/public/containers/source/source.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/source/source.tsx rename to x-pack/plugins/infra/public/containers/source/source.tsx diff --git a/x-pack/legacy/plugins/infra/public/containers/source/source_fields_fragment.gql_query.ts b/x-pack/plugins/infra/public/containers/source/source_fields_fragment.gql_query.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/source/source_fields_fragment.gql_query.ts rename to x-pack/plugins/infra/public/containers/source/source_fields_fragment.gql_query.ts diff --git a/x-pack/legacy/plugins/infra/public/containers/source/update_source.gql_query.ts b/x-pack/plugins/infra/public/containers/source/update_source.gql_query.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/source/update_source.gql_query.ts rename to x-pack/plugins/infra/public/containers/source/update_source.gql_query.ts diff --git a/x-pack/legacy/plugins/infra/public/containers/source_id/index.ts b/x-pack/plugins/infra/public/containers/source_id/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/source_id/index.ts rename to x-pack/plugins/infra/public/containers/source_id/index.ts diff --git a/x-pack/legacy/plugins/infra/public/containers/source_id/source_id.ts b/x-pack/plugins/infra/public/containers/source_id/source_id.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/source_id/source_id.ts rename to x-pack/plugins/infra/public/containers/source_id/source_id.ts diff --git a/x-pack/legacy/plugins/infra/public/containers/waffle/index.ts b/x-pack/plugins/infra/public/containers/waffle/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/waffle/index.ts rename to x-pack/plugins/infra/public/containers/waffle/index.ts diff --git a/x-pack/legacy/plugins/infra/public/containers/waffle/nodes_to_wafflemap.ts b/x-pack/plugins/infra/public/containers/waffle/nodes_to_wafflemap.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/waffle/nodes_to_wafflemap.ts rename to x-pack/plugins/infra/public/containers/waffle/nodes_to_wafflemap.ts diff --git a/x-pack/legacy/plugins/infra/public/containers/waffle/type_guards.ts b/x-pack/plugins/infra/public/containers/waffle/type_guards.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/waffle/type_guards.ts rename to x-pack/plugins/infra/public/containers/waffle/type_guards.ts diff --git a/x-pack/legacy/plugins/infra/public/containers/waffle/use_snaphot.ts b/x-pack/plugins/infra/public/containers/waffle/use_snaphot.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/waffle/use_snaphot.ts rename to x-pack/plugins/infra/public/containers/waffle/use_snaphot.ts diff --git a/x-pack/legacy/plugins/infra/public/containers/waffle/waffle_nodes.gql_query.ts b/x-pack/plugins/infra/public/containers/waffle/waffle_nodes.gql_query.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/waffle/waffle_nodes.gql_query.ts rename to x-pack/plugins/infra/public/containers/waffle/waffle_nodes.gql_query.ts diff --git a/x-pack/legacy/plugins/infra/public/containers/waffle/with_waffle_filters.tsx b/x-pack/plugins/infra/public/containers/waffle/with_waffle_filters.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/waffle/with_waffle_filters.tsx rename to x-pack/plugins/infra/public/containers/waffle/with_waffle_filters.tsx diff --git a/x-pack/legacy/plugins/infra/public/containers/waffle/with_waffle_options.tsx b/x-pack/plugins/infra/public/containers/waffle/with_waffle_options.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/waffle/with_waffle_options.tsx rename to x-pack/plugins/infra/public/containers/waffle/with_waffle_options.tsx diff --git a/x-pack/legacy/plugins/infra/public/containers/waffle/with_waffle_time.tsx b/x-pack/plugins/infra/public/containers/waffle/with_waffle_time.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/waffle/with_waffle_time.tsx rename to x-pack/plugins/infra/public/containers/waffle/with_waffle_time.tsx diff --git a/x-pack/legacy/plugins/infra/public/containers/waffle/with_waffle_view_state.tsx b/x-pack/plugins/infra/public/containers/waffle/with_waffle_view_state.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/waffle/with_waffle_view_state.tsx rename to x-pack/plugins/infra/public/containers/waffle/with_waffle_view_state.tsx diff --git a/x-pack/legacy/plugins/infra/public/containers/with_kuery_autocompletion.tsx b/x-pack/plugins/infra/public/containers/with_kuery_autocompletion.tsx similarity index 77% rename from x-pack/legacy/plugins/infra/public/containers/with_kuery_autocompletion.tsx rename to x-pack/plugins/infra/public/containers/with_kuery_autocompletion.tsx index 8188517ba7617..98e59227bc6f0 100644 --- a/x-pack/legacy/plugins/infra/public/containers/with_kuery_autocompletion.tsx +++ b/x-pack/plugins/infra/public/containers/with_kuery_autocompletion.tsx @@ -5,11 +5,16 @@ */ import React from 'react'; -import { npStart } from 'ui/new_platform'; -import { QuerySuggestion, IIndexPattern } from 'src/plugins/data/public'; +import { QuerySuggestion, IIndexPattern, DataPublicPluginStart } from 'src/plugins/data/public'; +import { + withKibana, + KibanaReactContextValue, + KibanaServices, +} from '../../../../../src/plugins/kibana_react/public'; import { RendererFunction } from '../utils/typed_react'; interface WithKueryAutocompletionLifecycleProps { + kibana: KibanaReactContextValue<{ data: DataPublicPluginStart } & KibanaServices>; children: RendererFunction<{ isLoadingSuggestions: boolean; loadSuggestions: (expression: string, cursorPosition: number, maxSuggestions?: number) => void; @@ -28,7 +33,7 @@ interface WithKueryAutocompletionLifecycleState { suggestions: QuerySuggestion[]; } -export class WithKueryAutocompletion extends React.Component< +class WithKueryAutocompletionComponent extends React.Component< WithKueryAutocompletionLifecycleProps, WithKueryAutocompletionLifecycleState > { @@ -54,7 +59,9 @@ export class WithKueryAutocompletion extends React.Component< ) => { const { indexPattern } = this.props; const language = 'kuery'; - const hasQuerySuggestions = npStart.plugins.data.autocomplete.hasQuerySuggestions(language); + const hasQuerySuggestions = this.props.kibana.services.data.autocomplete.hasQuerySuggestions( + language + ); if (!hasQuerySuggestions) { return; @@ -69,7 +76,7 @@ export class WithKueryAutocompletion extends React.Component< }); const suggestions = - (await npStart.plugins.data.autocomplete.getQuerySuggestions({ + (await this.props.kibana.services.data.autocomplete.getQuerySuggestions({ language, query: expression, selectionStart: cursorPosition, @@ -91,3 +98,7 @@ export class WithKueryAutocompletion extends React.Component< ); }; } + +export const WithKueryAutocompletion = withKibana( + WithKueryAutocompletionComponent +); diff --git a/x-pack/legacy/plugins/infra/public/containers/with_options.tsx b/x-pack/plugins/infra/public/containers/with_options.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/with_options.tsx rename to x-pack/plugins/infra/public/containers/with_options.tsx diff --git a/x-pack/legacy/plugins/infra/public/containers/with_source/index.ts b/x-pack/plugins/infra/public/containers/with_source/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/with_source/index.ts rename to x-pack/plugins/infra/public/containers/with_source/index.ts diff --git a/x-pack/legacy/plugins/infra/public/containers/with_source/with_source.tsx b/x-pack/plugins/infra/public/containers/with_source/with_source.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/containers/with_source/with_source.tsx rename to x-pack/plugins/infra/public/containers/with_source/with_source.tsx diff --git a/x-pack/legacy/plugins/infra/public/containers/with_state_from_location.tsx b/x-pack/plugins/infra/public/containers/with_state_from_location.tsx similarity index 96% rename from x-pack/legacy/plugins/infra/public/containers/with_state_from_location.tsx rename to x-pack/plugins/infra/public/containers/with_state_from_location.tsx index 6f7baf6b98b62..2a9676046d451 100644 --- a/x-pack/legacy/plugins/infra/public/containers/with_state_from_location.tsx +++ b/x-pack/plugins/infra/public/containers/with_state_from_location.tsx @@ -6,7 +6,7 @@ import { parse, stringify } from 'query-string'; import { Location } from 'history'; -import omit from 'lodash/fp/omit'; +import { omit } from 'lodash'; import React from 'react'; import { RouteComponentProps, withRouter } from 'react-router-dom'; // eslint-disable-next-line @typescript-eslint/camelcase @@ -46,7 +46,7 @@ export const withStateFromLocation = ({ public render() { const { location } = this.props; - const otherProps = omit(['location', 'history', 'match', 'staticContext'], this.props); + const otherProps = omit(this.props, ['location', 'history', 'match', 'staticContext']); const stateFromLocation = mapLocationToState(location); diff --git a/x-pack/legacy/plugins/infra/public/graphql/introspection.json b/x-pack/plugins/infra/public/graphql/introspection.json similarity index 100% rename from x-pack/legacy/plugins/infra/public/graphql/introspection.json rename to x-pack/plugins/infra/public/graphql/introspection.json diff --git a/x-pack/legacy/plugins/infra/public/graphql/log_entries.gql_query.ts b/x-pack/plugins/infra/public/graphql/log_entries.gql_query.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/graphql/log_entries.gql_query.ts rename to x-pack/plugins/infra/public/graphql/log_entries.gql_query.ts diff --git a/x-pack/legacy/plugins/infra/public/graphql/types.ts b/x-pack/plugins/infra/public/graphql/types.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/graphql/types.ts rename to x-pack/plugins/infra/public/graphql/types.ts diff --git a/x-pack/legacy/plugins/infra/public/hooks/use_bulk_get_saved_object.tsx b/x-pack/plugins/infra/public/hooks/use_bulk_get_saved_object.tsx similarity index 71% rename from x-pack/legacy/plugins/infra/public/hooks/use_bulk_get_saved_object.tsx rename to x-pack/plugins/infra/public/hooks/use_bulk_get_saved_object.tsx index 934022d6e6bd0..80d1b67e59798 100644 --- a/x-pack/legacy/plugins/infra/public/hooks/use_bulk_get_saved_object.tsx +++ b/x-pack/plugins/infra/public/hooks/use_bulk_get_saved_object.tsx @@ -5,11 +5,11 @@ */ import { useState, useCallback } from 'react'; - -import { npStart } from 'ui/new_platform'; import { SavedObjectAttributes, SavedObjectsBatchResponse } from 'src/core/public'; +import { useKibana } from '../../../../../src/plugins/kibana_react/public'; export const useBulkGetSavedObject = (type: string) => { + const kibana = useKibana(); const [data, setData] = useState | null>(null); const [error, setError] = useState(null); const [loading, setLoading] = useState(false); @@ -19,7 +19,11 @@ export const useBulkGetSavedObject = (type: string) => { setLoading(true); const fetchData = async () => { try { - const d = await npStart.core.savedObjects.client.bulkGet(ids.map(i => ({ type, id: i }))); + const savedObjectsClient = kibana.services.savedObjects?.client; + if (!savedObjectsClient) { + throw new Error('Saved objects client is unavailable'); + } + const d = await savedObjectsClient.bulkGet(ids.map(i => ({ type, id: i }))); setError(null); setLoading(false); setData(d); @@ -30,7 +34,7 @@ export const useBulkGetSavedObject = (type: string) => { }; fetchData(); }, - [type] + [type, kibana.services.savedObjects] ); return { diff --git a/x-pack/legacy/plugins/infra/public/hooks/use_create_saved_object.tsx b/x-pack/plugins/infra/public/hooks/use_create_saved_object.tsx similarity index 74% rename from x-pack/legacy/plugins/infra/public/hooks/use_create_saved_object.tsx rename to x-pack/plugins/infra/public/hooks/use_create_saved_object.tsx index f03a198355bb8..8313d496a0651 100644 --- a/x-pack/legacy/plugins/infra/public/hooks/use_create_saved_object.tsx +++ b/x-pack/plugins/infra/public/hooks/use_create_saved_object.tsx @@ -5,15 +5,15 @@ */ import { useState, useCallback } from 'react'; - -import { npStart } from 'ui/new_platform'; import { SavedObjectAttributes, SavedObjectsCreateOptions, SimpleSavedObject, } from 'src/core/public'; +import { useKibana } from '../../../../../src/plugins/kibana_react/public'; export const useCreateSavedObject = (type: string) => { + const kibana = useKibana(); const [data, setData] = useState | null>(null); const [createdId, setCreatedId] = useState(null); const [error, setError] = useState(null); @@ -24,7 +24,11 @@ export const useCreateSavedObject = (type: string) => { setLoading(true); const save = async () => { try { - const d = await npStart.core.savedObjects.client.create(type, attributes, options); + const savedObjectsClient = kibana.services.savedObjects?.client; + if (!savedObjectsClient) { + throw new Error('Saved objects client is unavailable'); + } + const d = await savedObjectsClient.create(type, attributes, options); setCreatedId(d.id); setError(null); setData(d); @@ -36,7 +40,7 @@ export const useCreateSavedObject = (type: string) => { }; save(); }, - [type] + [type, kibana.services.savedObjects] ); return { diff --git a/x-pack/legacy/plugins/infra/public/hooks/use_delete_saved_object.tsx b/x-pack/plugins/infra/public/hooks/use_delete_saved_object.tsx similarity index 81% rename from x-pack/legacy/plugins/infra/public/hooks/use_delete_saved_object.tsx rename to x-pack/plugins/infra/public/hooks/use_delete_saved_object.tsx index cd04d82cc215b..3f2d15b3b86aa 100644 --- a/x-pack/legacy/plugins/infra/public/hooks/use_delete_saved_object.tsx +++ b/x-pack/plugins/infra/public/hooks/use_delete_saved_object.tsx @@ -5,9 +5,10 @@ */ import { useState, useCallback } from 'react'; -import { npStart } from 'ui/new_platform'; +import { useKibana } from '../../../../../src/plugins/kibana_react/public'; export const useDeleteSavedObject = (type: string) => { + const kibana = useKibana(); const [error, setError] = useState(null); const [loading, setLoading] = useState(false); const [deletedId, setDeletedId] = useState(null); @@ -17,7 +18,7 @@ export const useDeleteSavedObject = (type: string) => { setLoading(true); const dobj = async () => { try { - await npStart.core.savedObjects.client.delete(type, id); + await kibana.services.savedObjects?.client.delete(type, id); setError(null); setDeletedId(id); setLoading(false); @@ -28,7 +29,7 @@ export const useDeleteSavedObject = (type: string) => { }; dobj(); }, - [type] + [type, kibana.services.savedObjects] ); return { diff --git a/x-pack/legacy/plugins/infra/public/hooks/use_find_saved_object.tsx b/x-pack/plugins/infra/public/hooks/use_find_saved_object.tsx similarity index 67% rename from x-pack/legacy/plugins/infra/public/hooks/use_find_saved_object.tsx rename to x-pack/plugins/infra/public/hooks/use_find_saved_object.tsx index 2487d830266b1..2b704e7984415 100644 --- a/x-pack/legacy/plugins/infra/public/hooks/use_find_saved_object.tsx +++ b/x-pack/plugins/infra/public/hooks/use_find_saved_object.tsx @@ -5,11 +5,11 @@ */ import { useState, useCallback } from 'react'; - -import { npStart } from 'ui/new_platform'; import { SavedObjectAttributes, SavedObjectsBatchResponse } from 'src/core/public'; +import { useKibana } from '../../../../../src/plugins/kibana_react/public'; export const useFindSavedObject = (type: string) => { + const kibana = useKibana(); const [data, setData] = useState | null>(null); const [error, setError] = useState(null); const [loading, setLoading] = useState(false); @@ -18,7 +18,11 @@ export const useFindSavedObject = { try { - const d = await npStart.core.savedObjects.client.find({ + const savedObjectsClient = kibana.services.savedObjects?.client; + if (!savedObjectsClient) { + throw new Error('Saved objects client is unavailable'); + } + const d = await savedObjectsClient.find({ type, search: query, searchFields, @@ -33,14 +37,17 @@ export const useFindSavedObject = { - const objects = await npStart.core.savedObjects.client.find({ + const savedObjectsClient = kibana.services.savedObjects?.client; + if (!savedObjectsClient) { + throw new Error('Saved objects client is unavailable'); + } + const objects = await savedObjectsClient.find({ type, }); - return objects.savedObjects.filter(o => o.attributes.name === name).length > 0; }; diff --git a/x-pack/legacy/plugins/infra/public/hooks/use_http_request.tsx b/x-pack/plugins/infra/public/hooks/use_http_request.tsx similarity index 97% rename from x-pack/legacy/plugins/infra/public/hooks/use_http_request.tsx rename to x-pack/plugins/infra/public/hooks/use_http_request.tsx index 2078c4bdc151d..50f4a636b48a3 100644 --- a/x-pack/legacy/plugins/infra/public/hooks/use_http_request.tsx +++ b/x-pack/plugins/infra/public/hooks/use_http_request.tsx @@ -8,7 +8,7 @@ import React, { useMemo, useState } from 'react'; import { IHttpFetchError } from 'src/core/public'; import { i18n } from '@kbn/i18n'; import { useTrackedPromise } from '../utils/use_tracked_promise'; -import { useKibana } from '../../../../../../src/plugins/kibana_react/public'; +import { useKibana } from '../../../../../src/plugins/kibana_react/public'; export function useHTTPRequest( pathname: string, diff --git a/x-pack/legacy/plugins/infra/public/hooks/use_interval.ts b/x-pack/plugins/infra/public/hooks/use_interval.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/hooks/use_interval.ts rename to x-pack/plugins/infra/public/hooks/use_interval.ts diff --git a/x-pack/plugins/infra/public/hooks/use_prefix_path_with_basepath.tsx b/x-pack/plugins/infra/public/hooks/use_prefix_path_with_basepath.tsx new file mode 100644 index 0000000000000..652a3fb478605 --- /dev/null +++ b/x-pack/plugins/infra/public/hooks/use_prefix_path_with_basepath.tsx @@ -0,0 +1,22 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { useMemo } from 'react'; +import { useKibana } from '../../../../../src/plugins/kibana_react/public'; + +export const usePrefixPathWithBasepath = () => { + const getUrlForApp = useKibana().services.application?.getUrlForApp; + const prefixer = useMemo(() => { + if (!getUrlForApp) { + throw new Error('Application core service is unavailable'); + } + + return (app: string, path: string) => { + return getUrlForApp(app, { path }); + }; + }, [getUrlForApp]); + return prefixer; +}; diff --git a/x-pack/legacy/plugins/infra/public/hooks/use_saved_view.ts b/x-pack/plugins/infra/public/hooks/use_saved_view.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/hooks/use_saved_view.ts rename to x-pack/plugins/infra/public/hooks/use_saved_view.ts diff --git a/x-pack/legacy/plugins/infra/public/images/docker.svg b/x-pack/plugins/infra/public/images/docker.svg similarity index 100% rename from x-pack/legacy/plugins/infra/public/images/docker.svg rename to x-pack/plugins/infra/public/images/docker.svg diff --git a/x-pack/legacy/plugins/infra/public/images/hosts.svg b/x-pack/plugins/infra/public/images/hosts.svg similarity index 100% rename from x-pack/legacy/plugins/infra/public/images/hosts.svg rename to x-pack/plugins/infra/public/images/hosts.svg diff --git a/x-pack/legacy/plugins/infra/public/images/infra_mono_white.svg b/x-pack/plugins/infra/public/images/infra_mono_white.svg similarity index 100% rename from x-pack/legacy/plugins/infra/public/images/infra_mono_white.svg rename to x-pack/plugins/infra/public/images/infra_mono_white.svg diff --git a/x-pack/legacy/plugins/infra/public/images/k8.svg b/x-pack/plugins/infra/public/images/k8.svg similarity index 100% rename from x-pack/legacy/plugins/infra/public/images/k8.svg rename to x-pack/plugins/infra/public/images/k8.svg diff --git a/x-pack/legacy/plugins/infra/public/images/logging_mono_white.svg b/x-pack/plugins/infra/public/images/logging_mono_white.svg similarity index 100% rename from x-pack/legacy/plugins/infra/public/images/logging_mono_white.svg rename to x-pack/plugins/infra/public/images/logging_mono_white.svg diff --git a/x-pack/legacy/plugins/infra/public/images/services.svg b/x-pack/plugins/infra/public/images/services.svg similarity index 100% rename from x-pack/legacy/plugins/infra/public/images/services.svg rename to x-pack/plugins/infra/public/images/services.svg diff --git a/x-pack/legacy/plugins/infra/public/index.scss b/x-pack/plugins/infra/public/index.scss similarity index 100% rename from x-pack/legacy/plugins/infra/public/index.scss rename to x-pack/plugins/infra/public/index.scss diff --git a/x-pack/plugins/infra/public/index.ts b/x-pack/plugins/infra/public/index.ts new file mode 100644 index 0000000000000..4465bde377c12 --- /dev/null +++ b/x-pack/plugins/infra/public/index.ts @@ -0,0 +1,22 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { PluginInitializerContext, PluginInitializer } from 'kibana/public'; +import { Plugin, ClientSetup, ClientStart, ClientPluginsSetup, ClientPluginsStart } from './plugin'; + +export const plugin: PluginInitializer< + ClientSetup, + ClientStart, + ClientPluginsSetup, + ClientPluginsStart +> = (context: PluginInitializerContext) => { + return new Plugin(context); +}; + +export { FORMATTERS } from './utils/formatters'; +export { InfraFormatterType } from './lib/lib'; + +export type InfraAppId = 'logs' | 'metrics'; diff --git a/x-pack/legacy/plugins/infra/public/new_platform_index.ts b/x-pack/plugins/infra/public/legacy_singletons.ts similarity index 55% rename from x-pack/legacy/plugins/infra/public/new_platform_index.ts rename to x-pack/plugins/infra/public/legacy_singletons.ts index 33b40da236145..f57047f21c281 100644 --- a/x-pack/legacy/plugins/infra/public/new_platform_index.ts +++ b/x-pack/plugins/infra/public/legacy_singletons.ts @@ -3,10 +3,12 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ +import { CoreStart } from 'kibana/public'; -import { PluginInitializerContext } from 'kibana/public'; -import { Plugin } from './new_platform_plugin'; +let npStart: CoreStart; -export function plugin(context: PluginInitializerContext) { - return new Plugin(context); +export function registerStartSingleton(start: CoreStart) { + npStart = start; } + +export { npStart }; diff --git a/x-pack/legacy/plugins/infra/public/lib/adapters/observable_api/kibana_observable_api.ts b/x-pack/plugins/infra/public/lib/adapters/observable_api/kibana_observable_api.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/lib/adapters/observable_api/kibana_observable_api.ts rename to x-pack/plugins/infra/public/lib/adapters/observable_api/kibana_observable_api.ts diff --git a/x-pack/legacy/plugins/infra/public/lib/lib.ts b/x-pack/plugins/infra/public/lib/lib.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/lib/lib.ts rename to x-pack/plugins/infra/public/lib/lib.ts diff --git a/x-pack/legacy/plugins/infra/public/pages/404.tsx b/x-pack/plugins/infra/public/pages/404.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/404.tsx rename to x-pack/plugins/infra/public/pages/404.tsx diff --git a/x-pack/legacy/plugins/infra/public/pages/error.tsx b/x-pack/plugins/infra/public/pages/error.tsx similarity index 96% rename from x-pack/legacy/plugins/infra/public/pages/error.tsx rename to x-pack/plugins/infra/public/pages/error.tsx index b525dd9b165ba..b8b598ba1a98b 100644 --- a/x-pack/legacy/plugins/infra/public/pages/error.tsx +++ b/x-pack/plugins/infra/public/pages/error.tsx @@ -15,7 +15,7 @@ import { import { FormattedMessage } from '@kbn/i18n/react'; import React from 'react'; -import euiStyled from '../../../../common/eui_styled_components'; +import { euiStyled } from '../../../observability/public'; import { Header } from '../components/header'; import { ColumnarPage, PageContent } from '../components/page'; diff --git a/x-pack/legacy/plugins/infra/public/pages/infrastructure/index.tsx b/x-pack/plugins/infra/public/pages/infrastructure/index.tsx similarity index 89% rename from x-pack/legacy/plugins/infra/public/pages/infrastructure/index.tsx rename to x-pack/plugins/infra/public/pages/infrastructure/index.tsx index 5eaa2850aebdb..2271147c9d088 100644 --- a/x-pack/legacy/plugins/infra/public/pages/infrastructure/index.tsx +++ b/x-pack/plugins/infra/public/pages/infrastructure/index.tsx @@ -23,7 +23,7 @@ import { SnapshotPage } from './snapshot'; import { MetricsSettingsPage } from './settings'; import { AppNavigation } from '../../components/navigation/app_navigation'; import { SourceLoadingPage } from '../../components/source_loading_page'; -import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; +import { useKibana } from '../../../../../../src/plugins/kibana_react/public'; export const InfrastructurePage = ({ match }: RouteComponentProps) => { const uiCapabilities = useKibana().services.application?.capabilities; @@ -65,28 +65,28 @@ export const InfrastructurePage = ({ match }: RouteComponentProps) => { title: i18n.translate('xpack.infra.homePage.inventoryTabTitle', { defaultMessage: 'Inventory', }), - path: `${match.path}/inventory`, + path: '/inventory', }, { title: i18n.translate('xpack.infra.homePage.metricsExplorerTabTitle', { defaultMessage: 'Metrics Explorer', }), - path: `${match.path}/metrics-explorer`, + path: '/explorer', }, { title: i18n.translate('xpack.infra.homePage.settingsTabTitle', { defaultMessage: 'Settings', }), - path: `${match.path}/settings`, + path: '/settings', }, ]} /> - + ( {({ configuration, createDerivedIndexPattern }) => ( @@ -106,7 +106,7 @@ export const InfrastructurePage = ({ match }: RouteComponentProps) => { )} /> - + diff --git a/x-pack/legacy/plugins/infra/public/pages/infrastructure/metrics_explorer/index.tsx b/x-pack/plugins/infra/public/pages/infrastructure/metrics_explorer/index.tsx similarity index 97% rename from x-pack/legacy/plugins/infra/public/pages/infrastructure/metrics_explorer/index.tsx rename to x-pack/plugins/infra/public/pages/infrastructure/metrics_explorer/index.tsx index 4db4319b91d3c..0999cea59731c 100644 --- a/x-pack/legacy/plugins/infra/public/pages/infrastructure/metrics_explorer/index.tsx +++ b/x-pack/plugins/infra/public/pages/infrastructure/metrics_explorer/index.tsx @@ -14,7 +14,7 @@ import { MetricsExplorerToolbar } from '../../../components/metrics_explorer/too import { SourceQuery } from '../../../../common/graphql/types'; import { NoData } from '../../../components/empty_states'; import { useMetricsExplorerState } from './use_metric_explorer_state'; -import { useTrackPageview } from '../../../hooks/use_track_metric'; +import { useTrackPageview } from '../../../../../observability/public'; interface MetricsExplorerPageProps { source: SourceQuery.Query['source']['configuration']; diff --git a/x-pack/legacy/plugins/infra/public/pages/infrastructure/metrics_explorer/use_metric_explorer_state.test.tsx b/x-pack/plugins/infra/public/pages/infrastructure/metrics_explorer/use_metric_explorer_state.test.tsx similarity index 68% rename from x-pack/legacy/plugins/infra/public/pages/infrastructure/metrics_explorer/use_metric_explorer_state.test.tsx rename to x-pack/plugins/infra/public/pages/infrastructure/metrics_explorer/use_metric_explorer_state.test.tsx index 14533d46aaef8..874ac0987023b 100644 --- a/x-pack/legacy/plugins/infra/public/pages/infrastructure/metrics_explorer/use_metric_explorer_state.test.tsx +++ b/x-pack/plugins/infra/public/pages/infrastructure/metrics_explorer/use_metric_explorer_state.test.tsx @@ -4,8 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { fetch } from '../../../utils/fetch'; -import { renderHook } from '@testing-library/react-hooks'; +import { renderHook, act } from '@testing-library/react-hooks'; import { useMetricsExplorerState } from './use_metric_explorer_state'; import { MetricsExplorerOptionsContainer } from '../../../containers/metrics_explorer/use_metrics_explorer_options'; import React from 'react'; @@ -26,8 +25,15 @@ const renderUseMetricsExplorerStateHook = () => ), }); -jest.mock('../../../utils/fetch'); -const mockedFetch = fetch as jest.Mocked; +const mockedUseMetricsExplorerData = jest.fn(); + +jest.mock('../../../containers/metrics_explorer/use_metrics_explorer_data', () => { + return { + useMetricsExplorerData: () => { + return mockedUseMetricsExplorerData(); + }, + }; +}); interface LocalStore { [key: string]: string; @@ -54,33 +60,36 @@ Object.defineProperty(window, 'localStorage', { describe('useMetricsExplorerState', () => { beforeEach(() => { - mockedFetch.post.mockResolvedValue({ data: resp } as any); + mockedUseMetricsExplorerData.mockReturnValue({ + loading: false, + error: null, + data: null, + }); delete STORE.MetricsExplorerOptions; delete STORE.MetricsExplorerTimeRange; }); it('should just work', async () => { - const { result, waitForNextUpdate } = renderUseMetricsExplorerStateHook(); - expect(result.current.data).toBe(null); + mockedUseMetricsExplorerData.mockReturnValue({ + loading: true, + error: null, + data: resp, + }); + const { result } = renderUseMetricsExplorerStateHook(); + expect(result.current.data).toEqual(resp); expect(result.current.error).toBe(null); expect(result.current.loading).toBe(true); - await waitForNextUpdate(); - expect(result.current.data).toEqual(resp); - expect(result.current.loading).toBe(false); - const { series } = result.current.data!; - expect(series).toBeDefined(); - expect(series.length).toBe(3); }); describe('handleRefresh', () => { it('should trigger an addition request when handleRefresh is called', async () => { - const { result, waitForNextUpdate } = renderUseMetricsExplorerStateHook(); - await waitForNextUpdate(); - expect(mockedFetch.post.mock.calls.length).toBe(2); - const { handleRefresh } = result.current; - handleRefresh(); - await waitForNextUpdate(); - expect(mockedFetch.post.mock.calls.length).toBe(3); + const { result } = renderUseMetricsExplorerStateHook(); + expect(result.current.refreshSignal).toBe(0); + act(() => { + result.current.handleRefresh(); + }); + expect(result.current.afterKey).toBe(null); + expect(result.current.refreshSignal).toBe(1); }); }); @@ -88,7 +97,9 @@ describe('useMetricsExplorerState', () => { it('should change the metric', async () => { const { result } = renderUseMetricsExplorerStateHook(); const { handleMetricsChange } = result.current; - handleMetricsChange([{ aggregation: 'max', field: 'system.load.1' }]); + act(() => { + handleMetricsChange([{ aggregation: 'max', field: 'system.load.1' }]); + }); expect(result.current.options.metrics).toEqual([ { aggregation: 'max', field: 'system.load.1' }, ]); @@ -99,7 +110,9 @@ describe('useMetricsExplorerState', () => { it('should change the metric', async () => { const { result } = renderUseMetricsExplorerStateHook(); const { handleGroupByChange } = result.current; - handleGroupByChange('host.name'); + act(() => { + handleGroupByChange('host.name'); + }); expect(result.current.options.groupBy).toBeDefined(); expect(result.current.options.groupBy).toBe('host.name'); }); @@ -109,7 +122,9 @@ describe('useMetricsExplorerState', () => { it('should change the time range', async () => { const { result } = renderUseMetricsExplorerStateHook(); const { handleTimeChange } = result.current; - handleTimeChange('now-10m', 'now'); + act(() => { + handleTimeChange('now-10m', 'now'); + }); expect(result.current.currentTimerange).toEqual({ from: 'now-10m', to: 'now', @@ -122,38 +137,44 @@ describe('useMetricsExplorerState', () => { it('should set the filter query', async () => { const { result } = renderUseMetricsExplorerStateHook(); const { handleFilterQuerySubmit } = result.current; - handleFilterQuerySubmit('host.name: "example-host-01"'); + act(() => { + handleFilterQuerySubmit('host.name: "example-host-01"'); + }); expect(result.current.options.filterQuery).toBe('host.name: "example-host-01"'); }); }); describe('handleAggregationChange', () => { it('should set the metrics to only count when selecting count', async () => { - const { result, waitForNextUpdate } = renderUseMetricsExplorerStateHook(); + const { result } = renderUseMetricsExplorerStateHook(); const { handleMetricsChange } = result.current; - handleMetricsChange([{ aggregation: 'avg', field: 'system.load.1' }]); + act(() => { + handleMetricsChange([{ aggregation: 'avg', field: 'system.load.1' }]); + }); expect(result.current.options.metrics).toEqual([ { aggregation: 'avg', field: 'system.load.1' }, ]); - await waitForNextUpdate(); const { handleAggregationChange } = result.current; - handleAggregationChange('count'); - await waitForNextUpdate(); + act(() => { + handleAggregationChange('count'); + }); expect(result.current.options.aggregation).toBe('count'); expect(result.current.options.metrics).toEqual([{ aggregation: 'count' }]); }); it('should change aggregation for metrics', async () => { - const { result, waitForNextUpdate } = renderUseMetricsExplorerStateHook(); + const { result } = renderUseMetricsExplorerStateHook(); const { handleMetricsChange } = result.current; - handleMetricsChange([{ aggregation: 'avg', field: 'system.load.1' }]); + act(() => { + handleMetricsChange([{ aggregation: 'avg', field: 'system.load.1' }]); + }); expect(result.current.options.metrics).toEqual([ { aggregation: 'avg', field: 'system.load.1' }, ]); - await waitForNextUpdate(); const { handleAggregationChange } = result.current; - handleAggregationChange('max'); - await waitForNextUpdate(); + act(() => { + handleAggregationChange('max'); + }); expect(result.current.options.aggregation).toBe('max'); expect(result.current.options.metrics).toEqual([ { aggregation: 'max', field: 'system.load.1' }, @@ -163,30 +184,32 @@ describe('useMetricsExplorerState', () => { describe('handleLoadMore', () => { it('should load more based on the afterKey', async () => { - const { result, waitForNextUpdate, rerender } = renderUseMetricsExplorerStateHook(); + const { result, rerender } = renderUseMetricsExplorerStateHook(); expect(result.current.data).toBe(null); - expect(result.current.loading).toBe(true); - await waitForNextUpdate(); - expect(result.current.data).toEqual(resp); expect(result.current.loading).toBe(false); + mockedUseMetricsExplorerData.mockReturnValue({ + loading: false, + error: null, + data: resp, + }); + await rerender(); const { series, pageInfo } = result.current.data!; expect(series).toBeDefined(); expect(series.length).toBe(3); - mockedFetch.post.mockResolvedValue({ + mockedUseMetricsExplorerData.mockReturnValue({ + loading: false, + error: null, data: { pageInfo: { total: 10, afterKey: 'host-06' }, series: [createSeries('host-04'), createSeries('host-05'), createSeries('host-06')], - }, - } as any); - const { handleLoadMore } = result.current; - handleLoadMore(pageInfo.afterKey!); + } as any, + }); await rerender(); - expect(result.current.loading).toBe(true); - await waitForNextUpdate(); - expect(result.current.loading).toBe(false); - const { series: nextSeries } = result.current.data!; - expect(nextSeries).toBeDefined(); - expect(nextSeries.length).toBe(6); + const { handleLoadMore } = result.current; + act(() => { + handleLoadMore(pageInfo.afterKey!); + }); + expect(result.current.afterKey).toBe(pageInfo.afterKey); }); }); }); diff --git a/x-pack/legacy/plugins/infra/public/pages/infrastructure/metrics_explorer/use_metric_explorer_state.ts b/x-pack/plugins/infra/public/pages/infrastructure/metrics_explorer/use_metric_explorer_state.ts similarity index 97% rename from x-pack/legacy/plugins/infra/public/pages/infrastructure/metrics_explorer/use_metric_explorer_state.ts rename to x-pack/plugins/infra/public/pages/infrastructure/metrics_explorer/use_metric_explorer_state.ts index 22d18234197b6..88e6d9d800661 100644 --- a/x-pack/legacy/plugins/infra/public/pages/infrastructure/metrics_explorer/use_metric_explorer_state.ts +++ b/x-pack/plugins/infra/public/pages/infrastructure/metrics_explorer/use_metric_explorer_state.ts @@ -9,7 +9,7 @@ import { IIndexPattern } from 'src/plugins/data/public'; import { MetricsExplorerMetric, MetricsExplorerAggregation, -} from '../../../../server/routes/metrics_explorer/types'; +} from '../../../../common/http_api/metrics_explorer'; import { useMetricsExplorerData } from '../../../containers/metrics_explorer/use_metrics_explorer_data'; import { MetricsExplorerOptionsContainer, @@ -144,5 +144,8 @@ export const useMetricsExplorerState = ( handleLoadMore: setAfterKey, defaultViewState, onViewStateChange, + + refreshSignal, + afterKey, }; }; diff --git a/x-pack/legacy/plugins/infra/public/pages/infrastructure/settings.tsx b/x-pack/plugins/infra/public/pages/infrastructure/settings.tsx similarity index 89% rename from x-pack/legacy/plugins/infra/public/pages/infrastructure/settings.tsx rename to x-pack/plugins/infra/public/pages/infrastructure/settings.tsx index d75af7879d17a..9414eb7d3e564 100644 --- a/x-pack/legacy/plugins/infra/public/pages/infrastructure/settings.tsx +++ b/x-pack/plugins/infra/public/pages/infrastructure/settings.tsx @@ -6,7 +6,7 @@ import React from 'react'; import { SourceConfigurationSettings } from '../../components/source_configuration/source_configuration_settings'; -import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; +import { useKibana } from '../../../../../../src/plugins/kibana_react/public'; export const MetricsSettingsPage = () => { const uiCapabilities = useKibana().services.application?.capabilities; diff --git a/x-pack/legacy/plugins/infra/public/pages/infrastructure/snapshot/index.tsx b/x-pack/plugins/infra/public/pages/infrastructure/snapshot/index.tsx similarity index 96% rename from x-pack/legacy/plugins/infra/public/pages/infrastructure/snapshot/index.tsx rename to x-pack/plugins/infra/public/pages/infrastructure/snapshot/index.tsx index 27d276a50c30d..7f3be965af8db 100644 --- a/x-pack/legacy/plugins/infra/public/pages/infrastructure/snapshot/index.tsx +++ b/x-pack/plugins/infra/public/pages/infrastructure/snapshot/index.tsx @@ -26,8 +26,8 @@ import { Source } from '../../../containers/source'; import { WithWaffleFilterUrlState } from '../../../containers/waffle/with_waffle_filters'; import { WithWaffleOptionsUrlState } from '../../../containers/waffle/with_waffle_options'; import { WithWaffleTimeUrlState } from '../../../containers/waffle/with_waffle_time'; -import { useTrackPageview } from '../../../hooks/use_track_metric'; -import { useKibana } from '../../../../../../../../src/plugins/kibana_react/public'; +import { useTrackPageview } from '../../../../../observability/public'; +import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; export const SnapshotPage = () => { const uiCapabilities = useKibana().services.application?.capabilities; diff --git a/x-pack/legacy/plugins/infra/public/pages/infrastructure/snapshot/page_content.tsx b/x-pack/plugins/infra/public/pages/infrastructure/snapshot/page_content.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/infrastructure/snapshot/page_content.tsx rename to x-pack/plugins/infra/public/pages/infrastructure/snapshot/page_content.tsx diff --git a/x-pack/legacy/plugins/infra/public/pages/infrastructure/snapshot/toolbar.tsx b/x-pack/plugins/infra/public/pages/infrastructure/snapshot/toolbar.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/infrastructure/snapshot/toolbar.tsx rename to x-pack/plugins/infra/public/pages/infrastructure/snapshot/toolbar.tsx diff --git a/x-pack/legacy/plugins/infra/public/pages/link_to/index.ts b/x-pack/plugins/infra/public/pages/link_to/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/link_to/index.ts rename to x-pack/plugins/infra/public/pages/link_to/index.ts diff --git a/x-pack/legacy/plugins/infra/public/pages/link_to/link_to.tsx b/x-pack/plugins/infra/public/pages/link_to/link_to.tsx similarity index 54% rename from x-pack/legacy/plugins/infra/public/pages/link_to/link_to.tsx rename to x-pack/plugins/infra/public/pages/link_to/link_to.tsx index 7a7c9eb8408a3..ce62a0a3f4e33 100644 --- a/x-pack/legacy/plugins/infra/public/pages/link_to/link_to.tsx +++ b/x-pack/plugins/infra/public/pages/link_to/link_to.tsx @@ -19,21 +19,23 @@ interface LinkToPageProps { const ITEM_TYPES = inventoryModels.map(m => m.id).join('|'); -export const LinkToPage: React.FC = props => ( - - - - - - - -); +export const LinkToPage: React.FC = props => { + return ( + + + + + + + + ); +}; diff --git a/x-pack/legacy/plugins/infra/public/pages/link_to/query_params.ts b/x-pack/plugins/infra/public/pages/link_to/query_params.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/link_to/query_params.ts rename to x-pack/plugins/infra/public/pages/link_to/query_params.ts diff --git a/x-pack/legacy/plugins/infra/public/pages/link_to/redirect_to_host_detail_via_ip.tsx b/x-pack/plugins/infra/public/pages/link_to/redirect_to_host_detail_via_ip.tsx similarity index 96% rename from x-pack/legacy/plugins/infra/public/pages/link_to/redirect_to_host_detail_via_ip.tsx rename to x-pack/plugins/infra/public/pages/link_to/redirect_to_host_detail_via_ip.tsx index c1b0814f550a3..01b02f1acbbf2 100644 --- a/x-pack/legacy/plugins/infra/public/pages/link_to/redirect_to_host_detail_via_ip.tsx +++ b/x-pack/plugins/infra/public/pages/link_to/redirect_to_host_detail_via_ip.tsx @@ -49,7 +49,7 @@ export const RedirectToHostDetailViaIP = ({ )(''); if (name) { - return ; + return ; } return ( diff --git a/x-pack/legacy/plugins/infra/public/pages/link_to/redirect_to_logs.test.tsx b/x-pack/plugins/infra/public/pages/link_to/redirect_to_logs.test.tsx similarity index 79% rename from x-pack/legacy/plugins/infra/public/pages/link_to/redirect_to_logs.test.tsx rename to x-pack/plugins/infra/public/pages/link_to/redirect_to_logs.test.tsx index e9ec053f8c609..3efefe93990bd 100644 --- a/x-pack/legacy/plugins/infra/public/pages/link_to/redirect_to_logs.test.tsx +++ b/x-pack/plugins/infra/public/pages/link_to/redirect_to_logs.test.tsx @@ -19,7 +19,7 @@ describe('RedirectToLogs component', () => { expect(component).toMatchInlineSnapshot(` `); }); @@ -33,7 +33,7 @@ describe('RedirectToLogs component', () => { expect(component).toMatchInlineSnapshot(` `); }); @@ -45,7 +45,7 @@ describe('RedirectToLogs component', () => { expect(component).toMatchInlineSnapshot(` `); }); diff --git a/x-pack/legacy/plugins/infra/public/pages/link_to/redirect_to_logs.tsx b/x-pack/plugins/infra/public/pages/link_to/redirect_to_logs.tsx similarity index 92% rename from x-pack/legacy/plugins/infra/public/pages/link_to/redirect_to_logs.tsx rename to x-pack/plugins/infra/public/pages/link_to/redirect_to_logs.tsx index b3fcaff75aafd..cc4b6967d34fb 100644 --- a/x-pack/legacy/plugins/infra/public/pages/link_to/redirect_to_logs.tsx +++ b/x-pack/plugins/infra/public/pages/link_to/redirect_to_logs.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import compose from 'lodash/fp/compose'; +import { compose } from 'lodash'; import React from 'react'; import { match as RouteMatch, Redirect, RouteComponentProps } from 'react-router-dom'; @@ -30,5 +30,5 @@ export const RedirectToLogs = ({ location, match }: RedirectToLogsProps) => { replaceSourceIdInQueryString(sourceId) )(''); - return ; + return ; }; diff --git a/x-pack/legacy/plugins/infra/public/pages/link_to/redirect_to_node_detail.tsx b/x-pack/plugins/infra/public/pages/link_to/redirect_to_node_detail.tsx similarity index 88% rename from x-pack/legacy/plugins/infra/public/pages/link_to/redirect_to_node_detail.tsx rename to x-pack/plugins/infra/public/pages/link_to/redirect_to_node_detail.tsx index ec1cc8ba45332..55dd15158b96f 100644 --- a/x-pack/legacy/plugins/infra/public/pages/link_to/redirect_to_node_detail.tsx +++ b/x-pack/plugins/infra/public/pages/link_to/redirect_to_node_detail.tsx @@ -27,7 +27,7 @@ export const RedirectToNodeDetail = ({ getToFromLocation(location) )(''); - return ; + return ; }; export const getNodeDetailUrl = ({ @@ -42,5 +42,5 @@ export const getNodeDetailUrl = ({ from?: number; }) => { const args = to && from ? `?to=${to}&from=${from}` : ''; - return `#/link-to/${nodeType}-detail/${nodeId}${args}`; + return `link-to/${nodeType}-detail/${nodeId}${args}`; }; diff --git a/x-pack/legacy/plugins/infra/public/pages/link_to/redirect_to_node_logs.test.tsx b/x-pack/plugins/infra/public/pages/link_to/redirect_to_node_logs.test.tsx similarity index 79% rename from x-pack/legacy/plugins/infra/public/pages/link_to/redirect_to_node_logs.test.tsx rename to x-pack/plugins/infra/public/pages/link_to/redirect_to_node_logs.test.tsx index 1e97072cac109..7c1cb9d7329ef 100644 --- a/x-pack/legacy/plugins/infra/public/pages/link_to/redirect_to_node_logs.test.tsx +++ b/x-pack/plugins/infra/public/pages/link_to/redirect_to_node_logs.test.tsx @@ -35,7 +35,7 @@ describe('RedirectToNodeLogs component', () => { expect(component).toMatchInlineSnapshot(` `); }); @@ -47,7 +47,7 @@ describe('RedirectToNodeLogs component', () => { expect(component).toMatchInlineSnapshot(` `); }); @@ -59,7 +59,7 @@ describe('RedirectToNodeLogs component', () => { expect(component).toMatchInlineSnapshot(` `); }); @@ -73,7 +73,7 @@ describe('RedirectToNodeLogs component', () => { expect(component).toMatchInlineSnapshot(` `); }); @@ -89,7 +89,7 @@ describe('RedirectToNodeLogs component', () => { expect(component).toMatchInlineSnapshot(` `); }); @@ -103,7 +103,7 @@ describe('RedirectToNodeLogs component', () => { expect(component).toMatchInlineSnapshot(` `); }); diff --git a/x-pack/legacy/plugins/infra/public/pages/link_to/redirect_to_node_logs.tsx b/x-pack/plugins/infra/public/pages/link_to/redirect_to_node_logs.tsx similarity index 93% rename from x-pack/legacy/plugins/infra/public/pages/link_to/redirect_to_node_logs.tsx rename to x-pack/plugins/infra/public/pages/link_to/redirect_to_node_logs.tsx index 6f1fdd606dd73..9c998085400ca 100644 --- a/x-pack/legacy/plugins/infra/public/pages/link_to/redirect_to_node_logs.tsx +++ b/x-pack/plugins/infra/public/pages/link_to/redirect_to_node_logs.tsx @@ -6,7 +6,7 @@ import { i18n } from '@kbn/i18n'; -import compose from 'lodash/fp/compose'; +import { compose } from 'lodash'; import React from 'react'; import { Redirect, RouteComponentProps } from 'react-router-dom'; @@ -70,7 +70,7 @@ export const RedirectToNodeLogs = ({ replaceSourceIdInQueryString(sourceId) )(''); - return ; + return ; }; export const getNodeLogsUrl = ({ @@ -81,4 +81,6 @@ export const getNodeLogsUrl = ({ nodeId: string; nodeType: InventoryItemType; time?: number; -}) => [`#/link-to/${nodeType}-logs/`, nodeId, ...(time ? [`?time=${time}`] : [])].join(''); +}) => { + return [`link-to/${nodeType}-logs/`, nodeId, ...(time ? [`?time=${time}`] : [])].join(''); +}; diff --git a/x-pack/legacy/plugins/infra/public/pages/link_to/use_host_ip_to_name.test.ts b/x-pack/plugins/infra/public/pages/link_to/use_host_ip_to_name.test.ts similarity index 81% rename from x-pack/legacy/plugins/infra/public/pages/link_to/use_host_ip_to_name.test.ts rename to x-pack/plugins/infra/public/pages/link_to/use_host_ip_to_name.test.ts index 3b61181dfc6e0..739ea872021cf 100644 --- a/x-pack/legacy/plugins/infra/public/pages/link_to/use_host_ip_to_name.test.ts +++ b/x-pack/plugins/infra/public/pages/link_to/use_host_ip_to_name.test.ts @@ -5,7 +5,6 @@ */ import { useHostIpToName } from './use_host_ip_to_name'; -import { fetch } from '../../utils/fetch'; import { renderHook } from '@testing-library/react-hooks'; const renderUseHostIpToNameHook = () => @@ -13,12 +12,25 @@ const renderUseHostIpToNameHook = () => initialProps: { ipAddress: '127.0.0.1', indexPattern: 'metricbest-*' }, }); -jest.mock('../../utils/fetch'); -const mockedFetch = fetch as jest.Mocked; +const mockedFetch = jest.fn(); + +jest.mock('../../../../../../src/plugins/kibana_react/public', () => { + return { + useKibana: () => { + return { + services: { + http: { + fetch: mockedFetch, + }, + }, + }; + }, + }; +}); describe('useHostIpToName Hook', () => { it('should basically work', async () => { - mockedFetch.post.mockResolvedValue({ data: { host: 'example-01' } } as any); + mockedFetch.mockResolvedValue({ host: 'example-01' } as any); const { result, waitForNextUpdate } = renderUseHostIpToNameHook(); expect(result.current.name).toBe(null); expect(result.current.loading).toBe(true); @@ -30,7 +42,7 @@ describe('useHostIpToName Hook', () => { it('should handle errors', async () => { const error = new Error('Host not found'); - mockedFetch.post.mockRejectedValue(error); + mockedFetch.mockRejectedValue(error); const { result, waitForNextUpdate } = renderUseHostIpToNameHook(); expect(result.current.name).toBe(null); expect(result.current.loading).toBe(true); @@ -42,7 +54,7 @@ describe('useHostIpToName Hook', () => { it('should reset errors', async () => { const error = new Error('Host not found'); - mockedFetch.post.mockRejectedValue(error); + mockedFetch.mockRejectedValue(error); const { result, waitForNextUpdate, rerender } = renderUseHostIpToNameHook(); expect(result.current.name).toBe(null); expect(result.current.loading).toBe(true); @@ -50,7 +62,7 @@ describe('useHostIpToName Hook', () => { expect(result.current.name).toBe(null); expect(result.current.loading).toBe(false); expect(result.current.error).toBe(error); - mockedFetch.post.mockResolvedValue({ data: { host: 'example-01' } } as any); + mockedFetch.mockResolvedValue({ host: 'example-01' } as any); rerender({ ipAddress: '192.168.1.2', indexPattern: 'metricbeat-*' }); await waitForNextUpdate(); expect(result.current.name).toBe('example-01'); diff --git a/x-pack/legacy/plugins/infra/public/pages/link_to/use_host_ip_to_name.ts b/x-pack/plugins/infra/public/pages/link_to/use_host_ip_to_name.ts similarity index 61% rename from x-pack/legacy/plugins/infra/public/pages/link_to/use_host_ip_to_name.ts rename to x-pack/plugins/infra/public/pages/link_to/use_host_ip_to_name.ts index 7b4b56f34a678..82236e152d6d0 100644 --- a/x-pack/legacy/plugins/infra/public/pages/link_to/use_host_ip_to_name.ts +++ b/x-pack/plugins/infra/public/pages/link_to/use_host_ip_to_name.ts @@ -5,10 +5,11 @@ */ import { useState, useEffect } from 'react'; -import { IpToHostResponse } from '../../../server/routes/ip_to_hostname'; -import { fetch } from '../../utils/fetch'; +import { IpToHostResponse } from '../../../common/http_api/ip_to_hostname'; +import { useKibana } from '../../../../../../src/plugins/kibana_react/public'; export const useHostIpToName = (ipAddress: string | null, indexPattern: string | null) => { + const fetch = useKibana().services.http?.fetch; const [error, setError] = useState(null); const [loading, setLoadingState] = useState(true); const [data, setData] = useState(null); @@ -18,19 +19,25 @@ export const useHostIpToName = (ipAddress: string | null, indexPattern: string | setLoadingState(true); setError(null); try { + if (!fetch) { + throw new Error('HTTP service is unavailable'); + } if (ipAddress && indexPattern) { - const response = await fetch.post('../api/infra/ip_to_host', { - ip: ipAddress, - index_pattern: indexPattern, + const response = await fetch('/api/infra/ip_to_host', { + method: 'POST', + body: JSON.stringify({ + ip: ipAddress, + index_pattern: indexPattern, + }), }); setLoadingState(false); - setData(response.data); + setData(response); } } catch (err) { setLoadingState(false); setError(err); } })(); - }, [ipAddress, indexPattern]); + }, [ipAddress, indexPattern, fetch]); return { name: (data && data.host) || null, loading, error }; }; diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/index.tsx b/x-pack/plugins/infra/public/pages/logs/index.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/logs/index.tsx rename to x-pack/plugins/infra/public/pages/logs/index.tsx diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/index.ts b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/index.ts rename to x-pack/plugins/infra/public/pages/logs/log_entry_categories/index.ts diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/module_descriptor.ts b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/module_descriptor.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/module_descriptor.ts rename to x-pack/plugins/infra/public/pages/logs/log_entry_categories/module_descriptor.ts diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/page.tsx b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/page.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/page.tsx rename to x-pack/plugins/infra/public/pages/logs/log_entry_categories/page.tsx diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/page_content.tsx b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/page_content.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/page_content.tsx rename to x-pack/plugins/infra/public/pages/logs/log_entry_categories/page_content.tsx diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/page_providers.tsx b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/page_providers.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/page_providers.tsx rename to x-pack/plugins/infra/public/pages/logs/log_entry_categories/page_providers.tsx diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/page_results_content.tsx b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/page_results_content.tsx similarity index 97% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/page_results_content.tsx rename to x-pack/plugins/infra/public/pages/logs/log_entry_categories/page_results_content.tsx index a810ce447d369..5826435878378 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/page_results_content.tsx +++ b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/page_results_content.tsx @@ -10,8 +10,8 @@ import { i18n } from '@kbn/i18n'; import moment from 'moment'; import React, { useCallback, useEffect, useMemo, useState } from 'react'; -import { useKibana } from '../../../../../../../../src/plugins/kibana_react/public'; -import euiStyled from '../../../../../../common/eui_styled_components'; +import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; +import { euiStyled } from '../../../../../observability/public'; import { TimeRange } from '../../../../common/http_api/shared/time_range'; import { LogAnalysisJobProblemIndicator, @@ -19,7 +19,7 @@ import { } from '../../../components/logging/log_analysis_job_status'; import { FirstUseCallout } from '../../../components/logging/log_analysis_results'; import { useInterval } from '../../../hooks/use_interval'; -import { useTrackPageview } from '../../../hooks/use_track_metric'; +import { useTrackPageview } from '../../../../../observability/public'; import { TopCategoriesSection } from './sections/top_categories'; import { useLogEntryCategoriesModuleContext } from './use_log_entry_categories_module'; import { useLogEntryCategoriesResults } from './use_log_entry_categories_results'; diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/page_setup_content.tsx b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/page_setup_content.tsx similarity index 97% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/page_setup_content.tsx rename to x-pack/plugins/infra/public/pages/logs/log_entry_categories/page_setup_content.tsx index ac902029f938e..a7ff98923a427 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/page_setup_content.tsx +++ b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/page_setup_content.tsx @@ -16,7 +16,7 @@ import { LogAnalysisSetupPageContent, LogAnalysisSetupPageHeader, } from '../../../components/logging/log_analysis_setup'; -import { useTrackPageview } from '../../../hooks/use_track_metric'; +import { useTrackPageview } from '../../../../../observability/public'; import { useLogEntryCategoriesSetup } from './use_log_entry_categories_setup'; export const LogEntryCategoriesSetupContent: React.FunctionComponent = () => { diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/anomaly_severity_indicator.tsx b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/anomaly_severity_indicator.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/anomaly_severity_indicator.tsx rename to x-pack/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/anomaly_severity_indicator.tsx diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/category_expression.tsx b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/category_expression.tsx similarity index 96% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/category_expression.tsx rename to x-pack/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/category_expression.tsx index 5c8b18528cae6..f6cf62421e2d5 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/category_expression.tsx +++ b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/category_expression.tsx @@ -7,7 +7,7 @@ import { i18n } from '@kbn/i18n'; import React, { memo } from 'react'; -import euiStyled from '../../../../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../../../../observability/public'; export const RegularExpressionRepresentation: React.FunctionComponent<{ maximumSegmentCount?: number; diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/datasets_list.tsx b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/datasets_list.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/datasets_list.tsx rename to x-pack/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/datasets_list.tsx diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/datasets_selector.tsx b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/datasets_selector.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/datasets_selector.tsx rename to x-pack/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/datasets_selector.tsx diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/index.ts b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/index.ts rename to x-pack/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/index.ts diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/log_entry_count_sparkline.tsx b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/log_entry_count_sparkline.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/log_entry_count_sparkline.tsx rename to x-pack/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/log_entry_count_sparkline.tsx diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/single_metric_comparison.tsx b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/single_metric_comparison.tsx similarity index 95% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/single_metric_comparison.tsx rename to x-pack/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/single_metric_comparison.tsx index 1352afb60a505..d73f9f33fe5db 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/single_metric_comparison.tsx +++ b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/single_metric_comparison.tsx @@ -9,7 +9,7 @@ import numeral from '@elastic/numeral'; import { i18n } from '@kbn/i18n'; import React from 'react'; -import euiStyled from '../../../../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../../../../observability/public'; export const SingleMetricComparison: React.FunctionComponent<{ currentValue: number; diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/single_metric_sparkline.tsx b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/single_metric_sparkline.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/single_metric_sparkline.tsx rename to x-pack/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/single_metric_sparkline.tsx diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/top_categories_section.tsx b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/top_categories_section.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/top_categories_section.tsx rename to x-pack/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/top_categories_section.tsx diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/top_categories_table.tsx b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/top_categories_table.tsx similarity index 97% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/top_categories_table.tsx rename to x-pack/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/top_categories_table.tsx index 3d20aef03ff15..a2bd2983092a0 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/top_categories_table.tsx +++ b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/top_categories_table.tsx @@ -9,7 +9,7 @@ import numeral from '@elastic/numeral'; import { i18n } from '@kbn/i18n'; import React, { useMemo } from 'react'; -import euiStyled from '../../../../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../../../../observability/public'; import { LogEntryCategory, LogEntryCategoryHistogram, diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/service_calls/get_log_entry_category_datasets.ts b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/service_calls/get_log_entry_category_datasets.ts similarity index 69% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/service_calls/get_log_entry_category_datasets.ts rename to x-pack/plugins/infra/public/pages/logs/log_entry_categories/service_calls/get_log_entry_category_datasets.ts index 942ded4230e97..a8cd7854efb6b 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/service_calls/get_log_entry_category_datasets.ts +++ b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/service_calls/get_log_entry_category_datasets.ts @@ -7,7 +7,7 @@ import { fold } from 'fp-ts/lib/Either'; import { pipe } from 'fp-ts/lib/pipeable'; import { identity } from 'fp-ts/lib/function'; -import { npStart } from 'ui/new_platform'; +import { npStart } from '../../../../legacy_singletons'; import { getLogEntryCategoryDatasetsRequestPayloadRT, @@ -21,23 +21,20 @@ export const callGetLogEntryCategoryDatasetsAPI = async ( startTime: number, endTime: number ) => { - const response = await npStart.core.http.fetch( - LOG_ANALYSIS_GET_LOG_ENTRY_CATEGORY_DATASETS_PATH, - { - method: 'POST', - body: JSON.stringify( - getLogEntryCategoryDatasetsRequestPayloadRT.encode({ - data: { - sourceId, - timeRange: { - startTime, - endTime, - }, + const response = await npStart.http.fetch(LOG_ANALYSIS_GET_LOG_ENTRY_CATEGORY_DATASETS_PATH, { + method: 'POST', + body: JSON.stringify( + getLogEntryCategoryDatasetsRequestPayloadRT.encode({ + data: { + sourceId, + timeRange: { + startTime, + endTime, }, - }) - ), - } - ); + }, + }) + ), + }); return pipe( getLogEntryCategoryDatasetsSuccessReponsePayloadRT.decode(response), diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/service_calls/get_top_log_entry_categories.ts b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/service_calls/get_top_log_entry_categories.ts similarity index 92% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/service_calls/get_top_log_entry_categories.ts rename to x-pack/plugins/infra/public/pages/logs/log_entry_categories/service_calls/get_top_log_entry_categories.ts index 35d6f1ec4f893..2ebcff4fd3ca5 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/service_calls/get_top_log_entry_categories.ts +++ b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/service_calls/get_top_log_entry_categories.ts @@ -7,7 +7,7 @@ import { fold } from 'fp-ts/lib/Either'; import { pipe } from 'fp-ts/lib/pipeable'; import { identity } from 'fp-ts/lib/function'; -import { npStart } from 'ui/new_platform'; +import { npStart } from '../../../../legacy_singletons'; import { getLogEntryCategoriesRequestPayloadRT, @@ -25,7 +25,7 @@ export const callGetTopLogEntryCategoriesAPI = async ( ) => { const intervalDuration = endTime - startTime; - const response = await npStart.core.http.fetch(LOG_ANALYSIS_GET_LOG_ENTRY_CATEGORIES_PATH, { + const response = await npStart.http.fetch(LOG_ANALYSIS_GET_LOG_ENTRY_CATEGORIES_PATH, { method: 'POST', body: JSON.stringify( getLogEntryCategoriesRequestPayloadRT.encode({ diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/use_log_entry_categories_module.tsx b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/use_log_entry_categories_module.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/use_log_entry_categories_module.tsx rename to x-pack/plugins/infra/public/pages/logs/log_entry_categories/use_log_entry_categories_module.tsx diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/use_log_entry_categories_results.ts b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/use_log_entry_categories_results.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/use_log_entry_categories_results.ts rename to x-pack/plugins/infra/public/pages/logs/log_entry_categories/use_log_entry_categories_results.ts diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/use_log_entry_categories_results_url_state.tsx b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/use_log_entry_categories_results_url_state.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/use_log_entry_categories_results_url_state.tsx rename to x-pack/plugins/infra/public/pages/logs/log_entry_categories/use_log_entry_categories_results_url_state.tsx diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/use_log_entry_categories_setup.tsx b/x-pack/plugins/infra/public/pages/logs/log_entry_categories/use_log_entry_categories_setup.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_categories/use_log_entry_categories_setup.tsx rename to x-pack/plugins/infra/public/pages/logs/log_entry_categories/use_log_entry_categories_setup.tsx diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/index.ts b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/index.ts rename to x-pack/plugins/infra/public/pages/logs/log_entry_rate/index.ts diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/module_descriptor.ts b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/module_descriptor.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/module_descriptor.ts rename to x-pack/plugins/infra/public/pages/logs/log_entry_rate/module_descriptor.ts diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/page.tsx b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/page.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/page.tsx rename to x-pack/plugins/infra/public/pages/logs/log_entry_rate/page.tsx diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/page_content.tsx b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/page_content.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/page_content.tsx rename to x-pack/plugins/infra/public/pages/logs/log_entry_rate/page_content.tsx diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/page_providers.tsx b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/page_providers.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/page_providers.tsx rename to x-pack/plugins/infra/public/pages/logs/log_entry_rate/page_providers.tsx diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/page_results_content.tsx b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/page_results_content.tsx similarity index 98% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/page_results_content.tsx rename to x-pack/plugins/infra/public/pages/logs/log_entry_rate/page_results_content.tsx index fd77cc8dd7173..50d58865e9746 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/page_results_content.tsx +++ b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/page_results_content.tsx @@ -20,12 +20,12 @@ import { FormattedMessage } from '@kbn/i18n/react'; import moment from 'moment'; import React, { useCallback, useMemo, useState, useEffect } from 'react'; -import euiStyled from '../../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../../observability/public'; import { TimeRange } from '../../../../common/http_api/shared/time_range'; import { bucketSpan } from '../../../../common/log_analysis'; import { LoadingOverlayWrapper } from '../../../components/loading_overlay_wrapper'; import { useInterval } from '../../../hooks/use_interval'; -import { useTrackPageview } from '../../../hooks/use_track_metric'; +import { useTrackPageview } from '../../../../../observability/public'; import { useKibanaUiSetting } from '../../../utils/use_kibana_ui_setting'; import { AnomaliesResults } from './sections/anomalies'; import { LogRateResults } from './sections/log_rate'; diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/page_setup_content.tsx b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/page_setup_content.tsx similarity index 97% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/page_setup_content.tsx rename to x-pack/plugins/infra/public/pages/logs/log_entry_rate/page_setup_content.tsx index 13574f589a111..a02dbfa941588 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/page_setup_content.tsx +++ b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/page_setup_content.tsx @@ -16,7 +16,7 @@ import { LogAnalysisSetupPageContent, LogAnalysisSetupPageHeader, } from '../../../components/logging/log_analysis_setup'; -import { useTrackPageview } from '../../../hooks/use_track_metric'; +import { useTrackPageview } from '../../../../../observability/public'; import { useLogEntryRateSetup } from './use_log_entry_rate_setup'; export const LogEntryRateSetupContent: React.FunctionComponent = () => { diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/sections/anomalies/chart.tsx b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/sections/anomalies/chart.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/sections/anomalies/chart.tsx rename to x-pack/plugins/infra/public/pages/logs/log_entry_rate/sections/anomalies/chart.tsx diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/sections/anomalies/expanded_row.tsx b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/sections/anomalies/expanded_row.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/sections/anomalies/expanded_row.tsx rename to x-pack/plugins/infra/public/pages/logs/log_entry_rate/sections/anomalies/expanded_row.tsx diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/sections/anomalies/index.tsx b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/sections/anomalies/index.tsx similarity index 99% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/sections/anomalies/index.tsx rename to x-pack/plugins/infra/public/pages/logs/log_entry_rate/sections/anomalies/index.tsx index 0dc52d2762765..2551170c44f4e 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/sections/anomalies/index.tsx +++ b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/sections/anomalies/index.tsx @@ -17,7 +17,7 @@ import numeral from '@elastic/numeral'; import { i18n } from '@kbn/i18n'; import React, { useMemo } from 'react'; -import euiStyled from '../../../../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../../../../observability/public'; import { LogEntryRateResults } from '../../use_log_entry_rate_results'; import { TimeRange } from '../../../../../../common/http_api/shared/time_range'; import { formatAnomalyScore, JobStatus, SetupStatus } from '../../../../../../common/log_analysis'; diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/sections/anomalies/table.tsx b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/sections/anomalies/table.tsx similarity index 98% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/sections/anomalies/table.tsx rename to x-pack/plugins/infra/public/pages/logs/log_entry_rate/sections/anomalies/table.tsx index 3e86b45fadfdd..39d76c4afcffe 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/sections/anomalies/table.tsx +++ b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/sections/anomalies/table.tsx @@ -9,7 +9,6 @@ import { RIGHT_ALIGNMENT } from '@elastic/eui/lib/services'; import { i18n } from '@kbn/i18n'; import React, { useCallback, useMemo, useState } from 'react'; -import euiStyled from '../../../../../../../../common/eui_styled_components'; import { TimeRange } from '../../../../../../common/http_api/shared/time_range'; import { formatAnomalyScore, @@ -17,6 +16,7 @@ import { } from '../../../../../../common/log_analysis'; import { LogEntryRateResults } from '../../use_log_entry_rate_results'; import { AnomaliesTableExpandedRow } from './expanded_row'; +import { euiStyled } from '../../../../../../../observability/public'; interface TableItem { id: string; diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/sections/helpers/data_formatters.tsx b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/sections/helpers/data_formatters.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/sections/helpers/data_formatters.tsx rename to x-pack/plugins/infra/public/pages/logs/log_entry_rate/sections/helpers/data_formatters.tsx diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/sections/log_rate/bar_chart.tsx b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/sections/log_rate/bar_chart.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/sections/log_rate/bar_chart.tsx rename to x-pack/plugins/infra/public/pages/logs/log_entry_rate/sections/log_rate/bar_chart.tsx diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/sections/log_rate/index.tsx b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/sections/log_rate/index.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/sections/log_rate/index.tsx rename to x-pack/plugins/infra/public/pages/logs/log_entry_rate/sections/log_rate/index.tsx diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/service_calls/get_log_entry_rate.ts b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/service_calls/get_log_entry_rate.ts similarity index 89% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/service_calls/get_log_entry_rate.ts rename to x-pack/plugins/infra/public/pages/logs/log_entry_rate/service_calls/get_log_entry_rate.ts index 1df7ef06b9d46..794139385f467 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/service_calls/get_log_entry_rate.ts +++ b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/service_calls/get_log_entry_rate.ts @@ -7,7 +7,7 @@ import { fold } from 'fp-ts/lib/Either'; import { pipe } from 'fp-ts/lib/pipeable'; import { identity } from 'fp-ts/lib/function'; -import { npStart } from 'ui/new_platform'; +import { npStart } from '../../../../legacy_singletons'; import { getLogEntryRateRequestPayloadRT, getLogEntryRateSuccessReponsePayloadRT, @@ -21,7 +21,7 @@ export const callGetLogEntryRateAPI = async ( endTime: number, bucketDuration: number ) => { - const response = await npStart.core.http.fetch(LOG_ANALYSIS_GET_LOG_ENTRY_RATE_PATH, { + const response = await npStart.http.fetch(LOG_ANALYSIS_GET_LOG_ENTRY_RATE_PATH, { method: 'POST', body: JSON.stringify( getLogEntryRateRequestPayloadRT.encode({ diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/use_log_entry_rate_module.tsx b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/use_log_entry_rate_module.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/use_log_entry_rate_module.tsx rename to x-pack/plugins/infra/public/pages/logs/log_entry_rate/use_log_entry_rate_module.tsx diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/use_log_entry_rate_results.ts b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/use_log_entry_rate_results.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/use_log_entry_rate_results.ts rename to x-pack/plugins/infra/public/pages/logs/log_entry_rate/use_log_entry_rate_results.ts diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/use_log_entry_rate_results_url_state.tsx b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/use_log_entry_rate_results_url_state.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/use_log_entry_rate_results_url_state.tsx rename to x-pack/plugins/infra/public/pages/logs/log_entry_rate/use_log_entry_rate_results_url_state.tsx diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/use_log_entry_rate_setup.tsx b/x-pack/plugins/infra/public/pages/logs/log_entry_rate/use_log_entry_rate_setup.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/logs/log_entry_rate/use_log_entry_rate_setup.tsx rename to x-pack/plugins/infra/public/pages/logs/log_entry_rate/use_log_entry_rate_setup.tsx diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/page.tsx b/x-pack/plugins/infra/public/pages/logs/page.tsx similarity index 91% rename from x-pack/legacy/plugins/infra/public/pages/logs/page.tsx rename to x-pack/plugins/infra/public/pages/logs/page.tsx index 72826b156d7b4..08049183d0a18 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/page.tsx +++ b/x-pack/plugins/infra/public/pages/logs/page.tsx @@ -13,7 +13,7 @@ import { LogsPageProviders } from './page_providers'; export const LogsPage: React.FunctionComponent = ({ match }) => { return ( - + ); }; diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/page_content.tsx b/x-pack/plugins/infra/public/pages/logs/page_content.tsx similarity index 89% rename from x-pack/legacy/plugins/infra/public/pages/logs/page_content.tsx rename to x-pack/plugins/infra/public/pages/logs/page_content.tsx index 41ef9987d1ad0..48ead15b2a232 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/page_content.tsx +++ b/x-pack/plugins/infra/public/pages/logs/page_content.tsx @@ -8,7 +8,7 @@ import { i18n } from '@kbn/i18n'; import React from 'react'; import { Route, Switch } from 'react-router-dom'; -import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; +import { useKibana } from '../../../../../../src/plugins/kibana_react/public'; import { DocumentTitle } from '../../components/document_title'; import { Header } from '../../components/header'; import { HelpCenterContent } from '../../components/help_center_content'; @@ -25,31 +25,29 @@ import { LogEntryRatePage } from './log_entry_rate'; import { LogsSettingsPage } from './settings'; import { StreamPage } from './stream'; -export const LogsPageContent: React.FunctionComponent<{ - logsPagePath: string; -}> = ({ logsPagePath }) => { +export const LogsPageContent: React.FunctionComponent = () => { const uiCapabilities = useKibana().services.application?.capabilities; const source = useSourceContext(); const logAnalysisCapabilities = useLogAnalysisCapabilitiesContext(); const streamTab = { title: streamTabTitle, - path: `${logsPagePath}/stream`, + path: '/stream', }; const logRateTab = { title: logRateTabTitle, - path: `${logsPagePath}/log-rate`, + path: '/log-rate', }; const logCategoriesTab = { title: logCategoriesTabTitle, - path: `${logsPagePath}/log-categories`, + path: '/log-categories', }; const settingsTab = { title: settingsTabTitle, - path: `${logsPagePath}/settings`, + path: '/settings', }; return ( @@ -91,7 +89,7 @@ export const LogsPageContent: React.FunctionComponent<{ - + )} diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/page_providers.tsx b/x-pack/plugins/infra/public/pages/logs/page_providers.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/logs/page_providers.tsx rename to x-pack/plugins/infra/public/pages/logs/page_providers.tsx diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/settings.tsx b/x-pack/plugins/infra/public/pages/logs/settings.tsx similarity index 88% rename from x-pack/legacy/plugins/infra/public/pages/logs/settings.tsx rename to x-pack/plugins/infra/public/pages/logs/settings.tsx index 52ccf5d59e611..faee7a643085a 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/settings.tsx +++ b/x-pack/plugins/infra/public/pages/logs/settings.tsx @@ -6,7 +6,7 @@ import React from 'react'; import { SourceConfigurationSettings } from '../../components/source_configuration/source_configuration_settings'; -import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; +import { useKibana } from '../../../../../../src/plugins/kibana_react/public'; export const LogsSettingsPage = () => { const uiCapabilities = useKibana().services.application?.capabilities; diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/stream/index.ts b/x-pack/plugins/infra/public/pages/logs/stream/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/logs/stream/index.ts rename to x-pack/plugins/infra/public/pages/logs/stream/index.ts diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/stream/page.tsx b/x-pack/plugins/infra/public/pages/logs/stream/page.tsx similarity index 92% rename from x-pack/legacy/plugins/infra/public/pages/logs/stream/page.tsx rename to x-pack/plugins/infra/public/pages/logs/stream/page.tsx index 9031a8cb4785d..3e07dcebf112d 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/stream/page.tsx +++ b/x-pack/plugins/infra/public/pages/logs/stream/page.tsx @@ -10,7 +10,7 @@ import { ColumnarPage } from '../../../components/page'; import { StreamPageContent } from './page_content'; import { StreamPageHeader } from './page_header'; import { LogsPageProviders } from './page_providers'; -import { useTrackPageview } from '../../../hooks/use_track_metric'; +import { useTrackPageview } from '../../../../../observability/public'; export const StreamPage = () => { useTrackPageview({ app: 'infra_logs', path: 'stream' }); diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/stream/page_content.tsx b/x-pack/plugins/infra/public/pages/logs/stream/page_content.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/logs/stream/page_content.tsx rename to x-pack/plugins/infra/public/pages/logs/stream/page_content.tsx diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/stream/page_header.tsx b/x-pack/plugins/infra/public/pages/logs/stream/page_header.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/logs/stream/page_header.tsx rename to x-pack/plugins/infra/public/pages/logs/stream/page_header.tsx diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/stream/page_logs_content.tsx b/x-pack/plugins/infra/public/pages/logs/stream/page_logs_content.tsx similarity index 98% rename from x-pack/legacy/plugins/infra/public/pages/logs/stream/page_logs_content.tsx rename to x-pack/plugins/infra/public/pages/logs/stream/page_logs_content.tsx index 4d2b99da9b412..c3c31b5d5bd0f 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/stream/page_logs_content.tsx +++ b/x-pack/plugins/infra/public/pages/logs/stream/page_logs_content.tsx @@ -6,7 +6,7 @@ import React, { useContext } from 'react'; -import euiStyled from '../../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../../observability/public'; import { AutoSizer } from '../../../components/auto_sizer'; import { LogEntryFlyout } from '../../../components/logging/log_entry_flyout'; import { LogMinimap } from '../../../components/logging/log_minimap'; diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/stream/page_no_indices_content.tsx b/x-pack/plugins/infra/public/pages/logs/stream/page_no_indices_content.tsx similarity index 96% rename from x-pack/legacy/plugins/infra/public/pages/logs/stream/page_no_indices_content.tsx rename to x-pack/plugins/infra/public/pages/logs/stream/page_no_indices_content.tsx index 7c697e8d22f14..1294007240027 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/stream/page_no_indices_content.tsx +++ b/x-pack/plugins/infra/public/pages/logs/stream/page_no_indices_content.tsx @@ -9,12 +9,12 @@ import { i18n } from '@kbn/i18n'; import { identity } from 'fp-ts/lib/function'; import React from 'react'; -import { useKibana } from '../../../../../../../../src/plugins/kibana_react/public'; import { NoIndices } from '../../../components/empty_states/no_indices'; import { ViewSourceConfigurationButton, ViewSourceConfigurationButtonHrefBase, } from '../../../components/source_configuration'; +import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; export const LogsPageNoIndicesContent = () => { const { diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/stream/page_providers.tsx b/x-pack/plugins/infra/public/pages/logs/stream/page_providers.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/logs/stream/page_providers.tsx rename to x-pack/plugins/infra/public/pages/logs/stream/page_providers.tsx diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/stream/page_toolbar.tsx b/x-pack/plugins/infra/public/pages/logs/stream/page_toolbar.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/logs/stream/page_toolbar.tsx rename to x-pack/plugins/infra/public/pages/logs/stream/page_toolbar.tsx diff --git a/x-pack/legacy/plugins/infra/public/pages/metrics/components/chart_section_vis.tsx b/x-pack/plugins/infra/public/pages/metrics/components/chart_section_vis.tsx similarity index 97% rename from x-pack/legacy/plugins/infra/public/pages/metrics/components/chart_section_vis.tsx rename to x-pack/plugins/infra/public/pages/metrics/components/chart_section_vis.tsx index 1731e9aa62cda..49e95394deb97 100644 --- a/x-pack/legacy/plugins/infra/public/pages/metrics/components/chart_section_vis.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/components/chart_section_vis.tsx @@ -20,7 +20,7 @@ import { } from './helpers'; import { ErrorMessage } from './error_message'; import { useKibanaUiSetting } from '../../../utils/use_kibana_ui_setting'; -import { useUiSetting } from '../../../../../../../../src/plugins/kibana_react/public'; +import { useUiSetting } from '../../../../../../../src/plugins/kibana_react/public'; import { VisSectionProps } from '../types'; export const ChartSectionVis = ({ diff --git a/x-pack/legacy/plugins/infra/public/pages/metrics/components/error_message.tsx b/x-pack/plugins/infra/public/pages/metrics/components/error_message.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/metrics/components/error_message.tsx rename to x-pack/plugins/infra/public/pages/metrics/components/error_message.tsx diff --git a/x-pack/legacy/plugins/infra/public/pages/metrics/components/gauges_section_vis.tsx b/x-pack/plugins/infra/public/pages/metrics/components/gauges_section_vis.tsx similarity index 97% rename from x-pack/legacy/plugins/infra/public/pages/metrics/components/gauges_section_vis.tsx rename to x-pack/plugins/infra/public/pages/metrics/components/gauges_section_vis.tsx index 4c0c7faa464dd..e069b52be8be7 100644 --- a/x-pack/legacy/plugins/infra/public/pages/metrics/components/gauges_section_vis.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/components/gauges_section_vis.tsx @@ -16,7 +16,7 @@ import { import { get, last, max } from 'lodash'; import React, { ReactText } from 'react'; -import euiStyled from '../../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../../observability/public'; import { createFormatter } from '../../../utils/formatters'; import { InventoryFormatterType } from '../../../../common/inventory_models/types'; import { SeriesOverrides, VisSectionProps } from '../types'; diff --git a/x-pack/legacy/plugins/infra/public/pages/metrics/components/helpers.ts b/x-pack/plugins/infra/public/pages/metrics/components/helpers.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/metrics/components/helpers.ts rename to x-pack/plugins/infra/public/pages/metrics/components/helpers.ts diff --git a/x-pack/legacy/plugins/infra/public/pages/metrics/components/invalid_node.tsx b/x-pack/plugins/infra/public/pages/metrics/components/invalid_node.tsx similarity index 93% rename from x-pack/legacy/plugins/infra/public/pages/metrics/components/invalid_node.tsx rename to x-pack/plugins/infra/public/pages/metrics/components/invalid_node.tsx index 0e810d9815cf9..fde3b61de50b5 100644 --- a/x-pack/legacy/plugins/infra/public/pages/metrics/components/invalid_node.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/components/invalid_node.tsx @@ -9,12 +9,12 @@ import { FormattedMessage } from '@kbn/i18n/react'; import { identity } from 'fp-ts/lib/function'; import React from 'react'; -import euiStyled from '../../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../../observability/public'; import { ViewSourceConfigurationButton, ViewSourceConfigurationButtonHrefBase, } from '../../../components/source_configuration'; -import { useKibana } from '../../../../../../../../src/plugins/kibana_react/public'; +import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; interface InvalidNodeErrorProps { nodeName: string; diff --git a/x-pack/legacy/plugins/infra/public/pages/metrics/components/layout_content.tsx b/x-pack/plugins/infra/public/pages/metrics/components/layout_content.tsx similarity index 83% rename from x-pack/legacy/plugins/infra/public/pages/metrics/components/layout_content.tsx rename to x-pack/plugins/infra/public/pages/metrics/components/layout_content.tsx index a2bd9cdc13179..4e10f245acdcc 100644 --- a/x-pack/legacy/plugins/infra/public/pages/metrics/components/layout_content.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/components/layout_content.tsx @@ -5,7 +5,7 @@ */ import { EuiPageContent } from '@elastic/eui'; -import { euiStyled } from '../../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../../observability/public'; export const LayoutContent = euiStyled(EuiPageContent)` position: relative; diff --git a/x-pack/legacy/plugins/infra/public/pages/metrics/components/metadata_details.tsx b/x-pack/plugins/infra/public/pages/metrics/components/metadata_details.tsx similarity index 98% rename from x-pack/legacy/plugins/infra/public/pages/metrics/components/metadata_details.tsx rename to x-pack/plugins/infra/public/pages/metrics/components/metadata_details.tsx index c43f2d10d7163..3bf492d398f2c 100644 --- a/x-pack/legacy/plugins/infra/public/pages/metrics/components/metadata_details.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/components/metadata_details.tsx @@ -9,7 +9,7 @@ import { EuiButtonIcon, EuiFlexGrid, EuiFlexItem, EuiTitle, EuiText } from '@ela import { i18n } from '@kbn/i18n'; import { get } from 'lodash'; import { InfraMetadata } from '../../../../common/http_api'; -import euiStyled from '../../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../../observability/public'; import { MetadataContext } from '../containers/metadata_context'; interface FieldDef { diff --git a/x-pack/legacy/plugins/infra/public/pages/metrics/components/node_details_page.tsx b/x-pack/plugins/infra/public/pages/metrics/components/node_details_page.tsx similarity index 98% rename from x-pack/legacy/plugins/infra/public/pages/metrics/components/node_details_page.tsx rename to x-pack/plugins/infra/public/pages/metrics/components/node_details_page.tsx index cc662f8fd5b57..ea91c53faf675 100644 --- a/x-pack/legacy/plugins/infra/public/pages/metrics/components/node_details_page.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/components/node_details_page.tsx @@ -21,7 +21,7 @@ import { AutoSizer } from '../../../components/auto_sizer'; import { MetricsTimeControls } from './time_controls'; import { SideNavContext, NavItem } from '../lib/side_nav_context'; import { PageBody } from './page_body'; -import euiStyled from '../../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../../observability/public'; import { MetricsTimeInput } from '../containers/with_metrics_time'; import { InfraMetadata } from '../../../../common/http_api/metadata_api'; import { PageError } from './page_error'; diff --git a/x-pack/legacy/plugins/infra/public/pages/metrics/components/page_body.tsx b/x-pack/plugins/infra/public/pages/metrics/components/page_body.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/metrics/components/page_body.tsx rename to x-pack/plugins/infra/public/pages/metrics/components/page_body.tsx diff --git a/x-pack/legacy/plugins/infra/public/pages/metrics/components/page_error.tsx b/x-pack/plugins/infra/public/pages/metrics/components/page_error.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/metrics/components/page_error.tsx rename to x-pack/plugins/infra/public/pages/metrics/components/page_error.tsx diff --git a/x-pack/legacy/plugins/infra/public/pages/metrics/components/section.tsx b/x-pack/plugins/infra/public/pages/metrics/components/section.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/metrics/components/section.tsx rename to x-pack/plugins/infra/public/pages/metrics/components/section.tsx diff --git a/x-pack/legacy/plugins/infra/public/pages/metrics/components/series_chart.tsx b/x-pack/plugins/infra/public/pages/metrics/components/series_chart.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/metrics/components/series_chart.tsx rename to x-pack/plugins/infra/public/pages/metrics/components/series_chart.tsx diff --git a/x-pack/legacy/plugins/infra/public/pages/metrics/components/side_nav.tsx b/x-pack/plugins/infra/public/pages/metrics/components/side_nav.tsx similarity index 95% rename from x-pack/legacy/plugins/infra/public/pages/metrics/components/side_nav.tsx rename to x-pack/plugins/infra/public/pages/metrics/components/side_nav.tsx index 8e922818222b4..94f97c7f45e61 100644 --- a/x-pack/legacy/plugins/infra/public/pages/metrics/components/side_nav.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/components/side_nav.tsx @@ -6,7 +6,7 @@ import { EuiHideFor, EuiPageSideBar, EuiShowFor, EuiSideNav } from '@elastic/eui'; import React, { useState, useCallback } from 'react'; -import euiStyled from '../../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../../observability/public'; import { NavItem } from '../lib/side_nav_context'; interface Props { diff --git a/x-pack/legacy/plugins/infra/public/pages/metrics/components/sub_section.tsx b/x-pack/plugins/infra/public/pages/metrics/components/sub_section.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/metrics/components/sub_section.tsx rename to x-pack/plugins/infra/public/pages/metrics/components/sub_section.tsx diff --git a/x-pack/legacy/plugins/infra/public/pages/metrics/components/time_controls.test.tsx b/x-pack/plugins/infra/public/pages/metrics/components/time_controls.test.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/metrics/components/time_controls.test.tsx rename to x-pack/plugins/infra/public/pages/metrics/components/time_controls.test.tsx diff --git a/x-pack/legacy/plugins/infra/public/pages/metrics/components/time_controls.tsx b/x-pack/plugins/infra/public/pages/metrics/components/time_controls.tsx similarity index 97% rename from x-pack/legacy/plugins/infra/public/pages/metrics/components/time_controls.tsx rename to x-pack/plugins/infra/public/pages/metrics/components/time_controls.tsx index 1546966c10a1e..b1daaa0320fab 100644 --- a/x-pack/legacy/plugins/infra/public/pages/metrics/components/time_controls.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/components/time_controls.tsx @@ -6,7 +6,7 @@ import { EuiSuperDatePicker, OnRefreshChangeProps, OnTimeChangeProps } from '@elastic/eui'; import React, { useCallback } from 'react'; -import euiStyled from '../../../../../../common/eui_styled_components'; +import { euiStyled } from '../../../../../observability/public'; import { MetricsTimeInput } from '../containers/with_metrics_time'; import { useKibanaUiSetting } from '../../../utils/use_kibana_ui_setting'; import { mapKibanaQuickRangesToDatePickerRanges } from '../../../utils/map_timepicker_quickranges_to_datepicker_ranges'; diff --git a/x-pack/legacy/plugins/infra/public/pages/metrics/containers/metadata_context.ts b/x-pack/plugins/infra/public/pages/metrics/containers/metadata_context.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/metrics/containers/metadata_context.ts rename to x-pack/plugins/infra/public/pages/metrics/containers/metadata_context.ts diff --git a/x-pack/legacy/plugins/infra/public/pages/metrics/containers/metrics.gql_query.ts b/x-pack/plugins/infra/public/pages/metrics/containers/metrics.gql_query.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/metrics/containers/metrics.gql_query.ts rename to x-pack/plugins/infra/public/pages/metrics/containers/metrics.gql_query.ts diff --git a/x-pack/legacy/plugins/infra/public/pages/metrics/containers/metrics_time.test.tsx b/x-pack/plugins/infra/public/pages/metrics/containers/metrics_time.test.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/metrics/containers/metrics_time.test.tsx rename to x-pack/plugins/infra/public/pages/metrics/containers/metrics_time.test.tsx diff --git a/x-pack/legacy/plugins/infra/public/pages/metrics/containers/with_metrics_time.tsx b/x-pack/plugins/infra/public/pages/metrics/containers/with_metrics_time.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/metrics/containers/with_metrics_time.tsx rename to x-pack/plugins/infra/public/pages/metrics/containers/with_metrics_time.tsx diff --git a/x-pack/legacy/plugins/infra/public/pages/metrics/index.tsx b/x-pack/plugins/infra/public/pages/metrics/index.tsx similarity index 96% rename from x-pack/legacy/plugins/infra/public/pages/metrics/index.tsx rename to x-pack/plugins/infra/public/pages/metrics/index.tsx index 4c0d2d7c93d7a..533e6a7b9a8f3 100644 --- a/x-pack/legacy/plugins/infra/public/pages/metrics/index.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/index.tsx @@ -5,7 +5,7 @@ */ import { i18n } from '@kbn/i18n'; import React, { useContext, useState } from 'react'; -import euiStyled, { EuiTheme, withTheme } from '../../../../../common/eui_styled_components'; +import { euiStyled, EuiTheme, withTheme } from '../../../../observability/public'; import { DocumentTitle } from '../../components/document_title'; import { Header } from '../../components/header'; import { ColumnarPage, PageContent } from '../../components/page'; @@ -17,7 +17,7 @@ import { InfraLoadingPanel } from '../../components/loading'; import { findInventoryModel } from '../../../common/inventory_models'; import { NavItem } from './lib/side_nav_context'; import { NodeDetailsPage } from './components/node_details_page'; -import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; +import { useKibana } from '../../../../../../src/plugins/kibana_react/public'; import { InventoryItemType } from '../../../common/inventory_models/types'; const DetailPageContent = euiStyled(PageContent)` diff --git a/x-pack/legacy/plugins/infra/public/pages/metrics/lib/side_nav_context.ts b/x-pack/plugins/infra/public/pages/metrics/lib/side_nav_context.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/metrics/lib/side_nav_context.ts rename to x-pack/plugins/infra/public/pages/metrics/lib/side_nav_context.ts diff --git a/x-pack/legacy/plugins/infra/public/pages/metrics/page_providers.tsx b/x-pack/plugins/infra/public/pages/metrics/page_providers.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/pages/metrics/page_providers.tsx rename to x-pack/plugins/infra/public/pages/metrics/page_providers.tsx diff --git a/x-pack/legacy/plugins/infra/public/pages/metrics/types.ts b/x-pack/plugins/infra/public/pages/metrics/types.ts similarity index 96% rename from x-pack/legacy/plugins/infra/public/pages/metrics/types.ts rename to x-pack/plugins/infra/public/pages/metrics/types.ts index 4b9e32fddcc76..fd6243292ec07 100644 --- a/x-pack/legacy/plugins/infra/public/pages/metrics/types.ts +++ b/x-pack/plugins/infra/public/pages/metrics/types.ts @@ -5,7 +5,7 @@ */ import rt from 'io-ts'; -import { EuiTheme } from '../../../../../common/eui_styled_components'; +import { EuiTheme } from '../../../../observability/public'; import { InventoryFormatterTypeRT } from '../../../common/inventory_models/types'; import { MetricsTimeInput } from './containers/with_metrics_time'; import { NodeDetailsMetricData } from '../../../common/http_api/node_details_api'; diff --git a/x-pack/plugins/infra/public/plugin.ts b/x-pack/plugins/infra/public/plugin.ts new file mode 100644 index 0000000000000..5d529e1fda0dc --- /dev/null +++ b/x-pack/plugins/infra/public/plugin.ts @@ -0,0 +1,209 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +import { i18n } from '@kbn/i18n'; +import { merge } from 'lodash'; +import { + Plugin as PluginClass, + CoreSetup, + CoreStart, + PluginInitializerContext, + AppMountParameters, +} from 'kibana/public'; +import { InMemoryCache, IntrospectionFragmentMatcher } from 'apollo-cache-inmemory'; +import ApolloClient from 'apollo-client'; +import { ApolloLink } from 'apollo-link'; +import { createHttpLink } from 'apollo-link-http'; +import { withClientState } from 'apollo-link-state'; +import { HttpFetchOptions } from 'src/core/public'; +import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/utils'; +import { InfraFrontendLibs } from './lib/lib'; +import introspectionQueryResultData from './graphql/introspection.json'; +import { InfraKibanaObservableApiAdapter } from './lib/adapters/observable_api/kibana_observable_api'; +import { registerStartSingleton } from './legacy_singletons'; +import { registerFeatures } from './register_feature'; +import { HomePublicPluginSetup, HomePublicPluginStart } from '../../../../src/plugins/home/public'; +import { DataPublicPluginSetup, DataPublicPluginStart } from '../../../../src/plugins/data/public'; +import { UsageCollectionSetup } from '../../../../src/plugins/usage_collection/public'; +import { DataEnhancedSetup, DataEnhancedStart } from '../../data_enhanced/public'; +import { LogsRouter, MetricsRouter } from './routers'; + +export type ClientSetup = void; +export type ClientStart = void; + +export interface ClientPluginsSetup { + home: HomePublicPluginSetup; + data: DataPublicPluginSetup; + usageCollection: UsageCollectionSetup; + dataEnhanced: DataEnhancedSetup; +} + +export interface ClientPluginsStart { + home: HomePublicPluginStart; + data: DataPublicPluginStart; + dataEnhanced: DataEnhancedStart; +} + +export type InfraPlugins = ClientPluginsSetup & ClientPluginsStart; + +const getMergedPlugins = (setup: ClientPluginsSetup, start: ClientPluginsStart): InfraPlugins => { + return merge({}, setup, start); +}; + +export class Plugin + implements PluginClass { + constructor(context: PluginInitializerContext) {} + + setup(core: CoreSetup, pluginsSetup: ClientPluginsSetup) { + registerFeatures(pluginsSetup.home); + + core.application.register({ + id: 'logs', + title: i18n.translate('xpack.infra.logs.pluginTitle', { + defaultMessage: 'Logs', + }), + euiIconType: 'logsApp', + order: 8001, + appRoute: '/app/logs', + category: DEFAULT_APP_CATEGORIES.observability, + mount: async (params: AppMountParameters) => { + const [coreStart, pluginsStart] = await core.getStartServices(); + const plugins = getMergedPlugins(pluginsSetup, pluginsStart as ClientPluginsStart); + const { startApp } = await import('./apps/start_app'); + return startApp( + this.composeLibs(coreStart, plugins), + coreStart, + plugins, + params, + LogsRouter + ); + }, + }); + + core.application.register({ + id: 'metrics', + title: i18n.translate('xpack.infra.metrics.pluginTitle', { + defaultMessage: 'Metrics', + }), + euiIconType: 'metricsApp', + order: 8000, + appRoute: '/app/metrics', + category: DEFAULT_APP_CATEGORIES.observability, + mount: async (params: AppMountParameters) => { + const [coreStart, pluginsStart] = await core.getStartServices(); + const plugins = getMergedPlugins(pluginsSetup, pluginsStart as ClientPluginsStart); + const { startApp } = await import('./apps/start_app'); + return startApp( + this.composeLibs(coreStart, plugins), + coreStart, + plugins, + params, + MetricsRouter + ); + }, + }); + + /* This exists purely to facilitate URL redirects from the old App ID ("infra"), + to our new App IDs ("metrics" and "logs"). With version 8.0.0 we can remove this. */ + core.application.register({ + id: 'infra', + appRoute: '/app/infra', + title: 'infra', + navLinkStatus: 3, + mount: async (params: AppMountParameters) => { + const { startLegacyApp } = await import('./apps/start_legacy_app'); + return startLegacyApp(params); + }, + }); + } + + start(core: CoreStart, plugins: ClientPluginsStart) { + registerStartSingleton(core); + } + + composeLibs(core: CoreStart, plugins: ClientPluginsStart) { + const cache = new InMemoryCache({ + addTypename: false, + fragmentMatcher: new IntrospectionFragmentMatcher({ + introspectionQueryResultData, + }), + }); + + const observableApi = new InfraKibanaObservableApiAdapter({ + basePath: core.http.basePath.get(), + }); + + const wrappedFetch = (path: string, options: HttpFetchOptions) => { + return new Promise(async (resolve, reject) => { + // core.http.fetch isn't 100% compatible with the Fetch API and will + // throw Errors on 401s. This top level try / catch handles those scenarios. + try { + core.http + .fetch(path, { + ...options, + // Set headers to undefined due to this bug: https://github.com/apollographql/apollo-link/issues/249, + // Apollo will try to set a "content-type" header which will conflict with the "Content-Type" header that + // core.http.fetch correctly sets. + headers: undefined, + asResponse: true, + }) + .then(res => { + if (!res.response) { + return reject(); + } + // core.http.fetch will parse the Response and set a body before handing it back. As such .text() / .json() + // will have already been called on the Response instance. However, Apollo will also want to call + // .text() / .json() on the instance, as it expects the raw Response instance, rather than core's wrapper. + // .text() / .json() can only be called once, and an Error will be thrown if those methods are accessed again. + // This hacks around that by setting up a new .text() method that will restringify the JSON response we already have. + // This does result in an extra stringify / parse cycle, which isn't ideal, but as we only have a few endpoints left using + // GraphQL this shouldn't create excessive overhead. + // Ref: https://github.com/apollographql/apollo-link/blob/master/packages/apollo-link-http/src/httpLink.ts#L134 + // and + // https://github.com/apollographql/apollo-link/blob/master/packages/apollo-link-http-common/src/index.ts#L125 + return resolve({ + ...res.response, + text: () => { + return new Promise(async (resolveText, rejectText) => { + if (res.body) { + return resolveText(JSON.stringify(res.body)); + } else { + return rejectText(); + } + }); + }, + }); + }); + } catch (error) { + reject(error); + } + }); + }; + + const HttpLink = createHttpLink({ + fetch: wrappedFetch, + uri: `/api/infra/graphql`, + }); + + const graphQLOptions = { + cache, + link: ApolloLink.from([ + withClientState({ + cache, + resolvers: {}, + }), + HttpLink, + ]), + }; + + const apolloClient = new ApolloClient(graphQLOptions); + + const libs: InfraFrontendLibs = { + apolloClient, + observableApi, + }; + return libs; + } +} diff --git a/x-pack/legacy/plugins/infra/public/feature_catalogue_entry.ts b/x-pack/plugins/infra/public/register_feature.ts similarity index 75% rename from x-pack/legacy/plugins/infra/public/feature_catalogue_entry.ts rename to x-pack/plugins/infra/public/register_feature.ts index 6442083234f2c..37217eaeaab2a 100644 --- a/x-pack/legacy/plugins/infra/public/feature_catalogue_entry.ts +++ b/x-pack/plugins/infra/public/register_feature.ts @@ -5,13 +5,14 @@ */ import { i18n } from '@kbn/i18n'; -import { FeatureCatalogueCategory } from '../../../../../src/plugins/home/public'; +import { + HomePublicPluginSetup, + FeatureCatalogueCategory, +} from '../../../../src/plugins/home/public'; -const APP_ID = 'infra'; - -export const featureCatalogueEntries = { - metrics: { - id: 'infraops', +export const registerFeatures = (homePlugin: HomePublicPluginSetup) => { + homePlugin.featureCatalogue.register({ + id: 'metrics', title: i18n.translate('xpack.infra.registerFeatures.infraOpsTitle', { defaultMessage: 'Metrics', }), @@ -20,12 +21,13 @@ export const featureCatalogueEntries = { 'Explore infrastructure metrics and logs for common servers, containers, and services.', }), icon: 'metricsApp', - path: `/app/${APP_ID}#infrastructure`, + path: `/app/metrics`, showOnHomePage: true, category: FeatureCatalogueCategory.DATA, - }, - logs: { - id: 'infralogging', + }); + + homePlugin.featureCatalogue.register({ + id: 'logs', title: i18n.translate('xpack.infra.registerFeatures.logsTitle', { defaultMessage: 'Logs', }), @@ -34,8 +36,8 @@ export const featureCatalogueEntries = { 'Stream logs in real time or scroll through historical views in a console-like experience.', }), icon: 'logsApp', - path: `/app/${APP_ID}#logs`, + path: `/app/logs`, showOnHomePage: true, category: FeatureCatalogueCategory.DATA, - }, + }); }; diff --git a/x-pack/plugins/infra/public/routers/index.ts b/x-pack/plugins/infra/public/routers/index.ts new file mode 100644 index 0000000000000..71ab2613d8dc1 --- /dev/null +++ b/x-pack/plugins/infra/public/routers/index.ts @@ -0,0 +1,15 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +import { History } from 'history'; + +export * from './logs_router'; +export * from './metrics_router'; + +interface RouterProps { + history: History; +} + +export type AppRouter = React.FC; diff --git a/x-pack/plugins/infra/public/routers/logs_router.tsx b/x-pack/plugins/infra/public/routers/logs_router.tsx new file mode 100644 index 0000000000000..6700ed1fc8479 --- /dev/null +++ b/x-pack/plugins/infra/public/routers/logs_router.tsx @@ -0,0 +1,31 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import React from 'react'; +import { Route, Router, Switch } from 'react-router-dom'; + +import { NotFoundPage } from '../pages/404'; +import { LinkToPage } from '../pages/link_to'; +import { LogsPage } from '../pages/logs'; +import { RedirectWithQueryParams } from '../utils/redirect_with_query_params'; +import { useKibana } from '../../../../../src/plugins/kibana_react/public'; +import { AppRouter } from './index'; + +export const LogsRouter: AppRouter = ({ history }) => { + const uiCapabilities = useKibana().services.application?.capabilities; + return ( + + + + {uiCapabilities?.logs?.show && ( + + )} + {uiCapabilities?.logs?.show && } + + + + ); +}; diff --git a/x-pack/plugins/infra/public/routers/metrics_router.tsx b/x-pack/plugins/infra/public/routers/metrics_router.tsx new file mode 100644 index 0000000000000..7c2ebed8463f1 --- /dev/null +++ b/x-pack/plugins/infra/public/routers/metrics_router.tsx @@ -0,0 +1,41 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import React from 'react'; +import { Route, Router, Switch } from 'react-router-dom'; + +import { NotFoundPage } from '../pages/404'; +import { InfrastructurePage } from '../pages/infrastructure'; +import { LinkToPage } from '../pages/link_to'; +import { MetricDetail } from '../pages/metrics'; +import { RedirectWithQueryParams } from '../utils/redirect_with_query_params'; +import { useKibana } from '../../../../../src/plugins/kibana_react/public'; +import { AppRouter } from './index'; + +export const MetricsRouter: AppRouter = ({ history }) => { + const uiCapabilities = useKibana().services.application?.capabilities; + return ( + + + + {uiCapabilities?.infrastructure?.show && ( + + )} + {uiCapabilities?.infrastructure?.show && ( + + )} + {uiCapabilities?.infrastructure?.show && ( + + )} + {uiCapabilities?.infrastructure?.show && ( + + )} + {uiCapabilities?.infrastructure?.show && } + + + + ); +}; diff --git a/x-pack/legacy/plugins/infra/public/store/actions.ts b/x-pack/plugins/infra/public/store/actions.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/store/actions.ts rename to x-pack/plugins/infra/public/store/actions.ts diff --git a/x-pack/legacy/plugins/infra/public/store/epics.ts b/x-pack/plugins/infra/public/store/epics.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/store/epics.ts rename to x-pack/plugins/infra/public/store/epics.ts diff --git a/x-pack/legacy/plugins/infra/public/store/index.ts b/x-pack/plugins/infra/public/store/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/store/index.ts rename to x-pack/plugins/infra/public/store/index.ts diff --git a/x-pack/legacy/plugins/infra/public/store/local/actions.ts b/x-pack/plugins/infra/public/store/local/actions.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/store/local/actions.ts rename to x-pack/plugins/infra/public/store/local/actions.ts diff --git a/x-pack/legacy/plugins/infra/public/store/local/epic.ts b/x-pack/plugins/infra/public/store/local/epic.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/store/local/epic.ts rename to x-pack/plugins/infra/public/store/local/epic.ts diff --git a/x-pack/legacy/plugins/infra/public/store/local/index.ts b/x-pack/plugins/infra/public/store/local/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/store/local/index.ts rename to x-pack/plugins/infra/public/store/local/index.ts diff --git a/x-pack/legacy/plugins/infra/public/store/local/reducer.ts b/x-pack/plugins/infra/public/store/local/reducer.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/store/local/reducer.ts rename to x-pack/plugins/infra/public/store/local/reducer.ts diff --git a/x-pack/legacy/plugins/infra/public/store/local/selectors.ts b/x-pack/plugins/infra/public/store/local/selectors.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/store/local/selectors.ts rename to x-pack/plugins/infra/public/store/local/selectors.ts diff --git a/x-pack/legacy/plugins/infra/public/store/local/waffle_filter/actions.ts b/x-pack/plugins/infra/public/store/local/waffle_filter/actions.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/store/local/waffle_filter/actions.ts rename to x-pack/plugins/infra/public/store/local/waffle_filter/actions.ts diff --git a/x-pack/legacy/plugins/infra/public/store/local/waffle_filter/index.ts b/x-pack/plugins/infra/public/store/local/waffle_filter/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/store/local/waffle_filter/index.ts rename to x-pack/plugins/infra/public/store/local/waffle_filter/index.ts diff --git a/x-pack/legacy/plugins/infra/public/store/local/waffle_filter/reducer.ts b/x-pack/plugins/infra/public/store/local/waffle_filter/reducer.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/store/local/waffle_filter/reducer.ts rename to x-pack/plugins/infra/public/store/local/waffle_filter/reducer.ts diff --git a/x-pack/legacy/plugins/infra/public/store/local/waffle_filter/selectors.ts b/x-pack/plugins/infra/public/store/local/waffle_filter/selectors.ts similarity index 93% rename from x-pack/legacy/plugins/infra/public/store/local/waffle_filter/selectors.ts rename to x-pack/plugins/infra/public/store/local/waffle_filter/selectors.ts index 0acce82950f77..047dabd3f0dd3 100644 --- a/x-pack/legacy/plugins/infra/public/store/local/waffle_filter/selectors.ts +++ b/x-pack/plugins/infra/public/store/local/waffle_filter/selectors.ts @@ -6,7 +6,7 @@ import { createSelector } from 'reselect'; -import { esKuery } from '../../../../../../../../src/plugins/data/public'; +import { esKuery } from '../../../../../../../src/plugins/data/public'; import { WaffleFilterState } from './reducer'; export const selectWaffleFilterQuery = (state: WaffleFilterState) => diff --git a/x-pack/legacy/plugins/infra/public/store/local/waffle_options/actions.ts b/x-pack/plugins/infra/public/store/local/waffle_options/actions.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/store/local/waffle_options/actions.ts rename to x-pack/plugins/infra/public/store/local/waffle_options/actions.ts diff --git a/x-pack/legacy/plugins/infra/public/store/local/waffle_options/index.ts b/x-pack/plugins/infra/public/store/local/waffle_options/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/store/local/waffle_options/index.ts rename to x-pack/plugins/infra/public/store/local/waffle_options/index.ts diff --git a/x-pack/legacy/plugins/infra/public/store/local/waffle_options/reducer.ts b/x-pack/plugins/infra/public/store/local/waffle_options/reducer.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/store/local/waffle_options/reducer.ts rename to x-pack/plugins/infra/public/store/local/waffle_options/reducer.ts diff --git a/x-pack/legacy/plugins/infra/public/store/local/waffle_options/selector.ts b/x-pack/plugins/infra/public/store/local/waffle_options/selector.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/store/local/waffle_options/selector.ts rename to x-pack/plugins/infra/public/store/local/waffle_options/selector.ts diff --git a/x-pack/legacy/plugins/infra/public/store/local/waffle_time/actions.ts b/x-pack/plugins/infra/public/store/local/waffle_time/actions.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/store/local/waffle_time/actions.ts rename to x-pack/plugins/infra/public/store/local/waffle_time/actions.ts diff --git a/x-pack/legacy/plugins/infra/public/store/local/waffle_time/epic.ts b/x-pack/plugins/infra/public/store/local/waffle_time/epic.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/store/local/waffle_time/epic.ts rename to x-pack/plugins/infra/public/store/local/waffle_time/epic.ts diff --git a/x-pack/legacy/plugins/infra/public/store/local/waffle_time/index.ts b/x-pack/plugins/infra/public/store/local/waffle_time/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/store/local/waffle_time/index.ts rename to x-pack/plugins/infra/public/store/local/waffle_time/index.ts diff --git a/x-pack/legacy/plugins/infra/public/store/local/waffle_time/reducer.ts b/x-pack/plugins/infra/public/store/local/waffle_time/reducer.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/store/local/waffle_time/reducer.ts rename to x-pack/plugins/infra/public/store/local/waffle_time/reducer.ts diff --git a/x-pack/legacy/plugins/infra/public/store/local/waffle_time/selectors.ts b/x-pack/plugins/infra/public/store/local/waffle_time/selectors.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/store/local/waffle_time/selectors.ts rename to x-pack/plugins/infra/public/store/local/waffle_time/selectors.ts diff --git a/x-pack/legacy/plugins/infra/public/store/reducer.ts b/x-pack/plugins/infra/public/store/reducer.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/store/reducer.ts rename to x-pack/plugins/infra/public/store/reducer.ts diff --git a/x-pack/legacy/plugins/infra/public/store/selectors.ts b/x-pack/plugins/infra/public/store/selectors.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/store/selectors.ts rename to x-pack/plugins/infra/public/store/selectors.ts diff --git a/x-pack/legacy/plugins/infra/public/store/store.ts b/x-pack/plugins/infra/public/store/store.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/store/store.ts rename to x-pack/plugins/infra/public/store/store.ts diff --git a/x-pack/legacy/plugins/infra/public/utils/apollo_context.ts b/x-pack/plugins/infra/public/utils/apollo_context.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/utils/apollo_context.ts rename to x-pack/plugins/infra/public/utils/apollo_context.ts diff --git a/x-pack/legacy/plugins/infra/public/utils/cancellable_effect.ts b/x-pack/plugins/infra/public/utils/cancellable_effect.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/utils/cancellable_effect.ts rename to x-pack/plugins/infra/public/utils/cancellable_effect.ts diff --git a/x-pack/legacy/plugins/infra/public/utils/convert_interval_to_string.ts b/x-pack/plugins/infra/public/utils/convert_interval_to_string.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/utils/convert_interval_to_string.ts rename to x-pack/plugins/infra/public/utils/convert_interval_to_string.ts diff --git a/x-pack/legacy/plugins/infra/public/utils/enzyme_helpers.tsx b/x-pack/plugins/infra/public/utils/enzyme_helpers.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/utils/enzyme_helpers.tsx rename to x-pack/plugins/infra/public/utils/enzyme_helpers.tsx diff --git a/x-pack/legacy/plugins/infra/public/utils/fixtures/metrics_explorer.ts b/x-pack/plugins/infra/public/utils/fixtures/metrics_explorer.ts similarity index 97% rename from x-pack/legacy/plugins/infra/public/utils/fixtures/metrics_explorer.ts rename to x-pack/plugins/infra/public/utils/fixtures/metrics_explorer.ts index 3d5198f2d379b..e39d6f785d53e 100644 --- a/x-pack/legacy/plugins/infra/public/utils/fixtures/metrics_explorer.ts +++ b/x-pack/plugins/infra/public/utils/fixtures/metrics_explorer.ts @@ -7,7 +7,7 @@ import { MetricsExplorerResponse, MetricsExplorerSeries, -} from '../../../server/routes/metrics_explorer/types'; +} from '../../../common/http_api/metrics_explorer'; import { MetricsExplorerOptions, MetricsExplorerTimeOptions, diff --git a/x-pack/legacy/plugins/infra/public/utils/formatters/bytes.test.ts b/x-pack/plugins/infra/public/utils/formatters/bytes.test.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/utils/formatters/bytes.test.ts rename to x-pack/plugins/infra/public/utils/formatters/bytes.test.ts diff --git a/x-pack/legacy/plugins/infra/public/utils/formatters/bytes.ts b/x-pack/plugins/infra/public/utils/formatters/bytes.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/utils/formatters/bytes.ts rename to x-pack/plugins/infra/public/utils/formatters/bytes.ts diff --git a/x-pack/legacy/plugins/infra/public/utils/formatters/datetime.ts b/x-pack/plugins/infra/public/utils/formatters/datetime.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/utils/formatters/datetime.ts rename to x-pack/plugins/infra/public/utils/formatters/datetime.ts diff --git a/x-pack/legacy/plugins/infra/public/utils/formatters/high_precision.ts b/x-pack/plugins/infra/public/utils/formatters/high_precision.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/utils/formatters/high_precision.ts rename to x-pack/plugins/infra/public/utils/formatters/high_precision.ts diff --git a/x-pack/legacy/plugins/infra/public/utils/formatters/index.ts b/x-pack/plugins/infra/public/utils/formatters/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/utils/formatters/index.ts rename to x-pack/plugins/infra/public/utils/formatters/index.ts diff --git a/x-pack/legacy/plugins/infra/public/utils/formatters/number.ts b/x-pack/plugins/infra/public/utils/formatters/number.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/utils/formatters/number.ts rename to x-pack/plugins/infra/public/utils/formatters/number.ts diff --git a/x-pack/legacy/plugins/infra/public/utils/formatters/percent.ts b/x-pack/plugins/infra/public/utils/formatters/percent.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/utils/formatters/percent.ts rename to x-pack/plugins/infra/public/utils/formatters/percent.ts diff --git a/x-pack/legacy/plugins/infra/public/utils/handlers.ts b/x-pack/plugins/infra/public/utils/handlers.ts similarity index 93% rename from x-pack/legacy/plugins/infra/public/utils/handlers.ts rename to x-pack/plugins/infra/public/utils/handlers.ts index 4678718169b94..077355a9c5960 100644 --- a/x-pack/legacy/plugins/infra/public/utils/handlers.ts +++ b/x-pack/plugins/infra/public/utils/handlers.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import isEqual from 'lodash/fp/isEqual'; +import { isEqual } from 'lodash'; export function callWithoutRepeats( func: (...args: any[]) => T, diff --git a/x-pack/legacy/plugins/infra/public/utils/history_context.ts b/x-pack/plugins/infra/public/utils/history_context.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/utils/history_context.ts rename to x-pack/plugins/infra/public/utils/history_context.ts diff --git a/x-pack/legacy/plugins/infra/public/utils/is_displayable.test.ts b/x-pack/plugins/infra/public/utils/is_displayable.test.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/utils/is_displayable.test.ts rename to x-pack/plugins/infra/public/utils/is_displayable.test.ts diff --git a/x-pack/legacy/plugins/infra/public/utils/is_displayable.ts b/x-pack/plugins/infra/public/utils/is_displayable.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/utils/is_displayable.ts rename to x-pack/plugins/infra/public/utils/is_displayable.ts diff --git a/x-pack/legacy/plugins/infra/public/utils/kuery.ts b/x-pack/plugins/infra/public/utils/kuery.ts similarity index 87% rename from x-pack/legacy/plugins/infra/public/utils/kuery.ts rename to x-pack/plugins/infra/public/utils/kuery.ts index 2292bf272b388..60d3f6454c546 100644 --- a/x-pack/legacy/plugins/infra/public/utils/kuery.ts +++ b/x-pack/plugins/infra/public/utils/kuery.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { esKuery, IIndexPattern } from '../../../../../../src/plugins/data/public'; +import { esKuery, IIndexPattern } from '../../../../../src/plugins/data/public'; export const convertKueryToElasticSearchQuery = ( kueryExpression: string, diff --git a/x-pack/legacy/plugins/infra/public/utils/loading_state/index.ts b/x-pack/plugins/infra/public/utils/loading_state/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/utils/loading_state/index.ts rename to x-pack/plugins/infra/public/utils/loading_state/index.ts diff --git a/x-pack/legacy/plugins/infra/public/utils/loading_state/loading_policy.ts b/x-pack/plugins/infra/public/utils/loading_state/loading_policy.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/utils/loading_state/loading_policy.ts rename to x-pack/plugins/infra/public/utils/loading_state/loading_policy.ts diff --git a/x-pack/legacy/plugins/infra/public/utils/loading_state/loading_progress.ts b/x-pack/plugins/infra/public/utils/loading_state/loading_progress.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/utils/loading_state/loading_progress.ts rename to x-pack/plugins/infra/public/utils/loading_state/loading_progress.ts diff --git a/x-pack/legacy/plugins/infra/public/utils/loading_state/loading_result.ts b/x-pack/plugins/infra/public/utils/loading_state/loading_result.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/utils/loading_state/loading_result.ts rename to x-pack/plugins/infra/public/utils/loading_state/loading_result.ts diff --git a/x-pack/legacy/plugins/infra/public/utils/loading_state/loading_state.ts b/x-pack/plugins/infra/public/utils/loading_state/loading_state.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/utils/loading_state/loading_state.ts rename to x-pack/plugins/infra/public/utils/loading_state/loading_state.ts diff --git a/x-pack/legacy/plugins/infra/public/utils/log_entry/index.ts b/x-pack/plugins/infra/public/utils/log_entry/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/utils/log_entry/index.ts rename to x-pack/plugins/infra/public/utils/log_entry/index.ts diff --git a/x-pack/legacy/plugins/infra/public/utils/log_entry/log_entry.ts b/x-pack/plugins/infra/public/utils/log_entry/log_entry.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/utils/log_entry/log_entry.ts rename to x-pack/plugins/infra/public/utils/log_entry/log_entry.ts diff --git a/x-pack/legacy/plugins/infra/public/utils/log_entry/log_entry_highlight.ts b/x-pack/plugins/infra/public/utils/log_entry/log_entry_highlight.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/utils/log_entry/log_entry_highlight.ts rename to x-pack/plugins/infra/public/utils/log_entry/log_entry_highlight.ts diff --git a/x-pack/legacy/plugins/infra/public/utils/map_timepicker_quickranges_to_datepicker_ranges.ts b/x-pack/plugins/infra/public/utils/map_timepicker_quickranges_to_datepicker_ranges.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/utils/map_timepicker_quickranges_to_datepicker_ranges.ts rename to x-pack/plugins/infra/public/utils/map_timepicker_quickranges_to_datepicker_ranges.ts diff --git a/x-pack/legacy/plugins/infra/public/utils/redirect_with_query_params.tsx b/x-pack/plugins/infra/public/utils/redirect_with_query_params.tsx similarity index 59% rename from x-pack/legacy/plugins/infra/public/utils/redirect_with_query_params.tsx rename to x-pack/plugins/infra/public/utils/redirect_with_query_params.tsx index 915b82860dd1b..7065ba7bf9b2e 100644 --- a/x-pack/legacy/plugins/infra/public/utils/redirect_with_query_params.tsx +++ b/x-pack/plugins/infra/public/utils/redirect_with_query_params.tsx @@ -18,27 +18,29 @@ export const RedirectWithQueryParams: React.FunctionComponent ( - - location ? ( - - ) : null - } - /> -); +}) => { + return ( + { + return location ? ( + + ) : null; + }} + /> + ); +}; diff --git a/x-pack/legacy/plugins/infra/public/utils/redux_context.tsx b/x-pack/plugins/infra/public/utils/redux_context.tsx similarity index 100% rename from x-pack/legacy/plugins/infra/public/utils/redux_context.tsx rename to x-pack/plugins/infra/public/utils/redux_context.tsx diff --git a/x-pack/legacy/plugins/infra/public/utils/source_configuration.ts b/x-pack/plugins/infra/public/utils/source_configuration.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/utils/source_configuration.ts rename to x-pack/plugins/infra/public/utils/source_configuration.ts diff --git a/x-pack/legacy/plugins/infra/public/utils/styles.ts b/x-pack/plugins/infra/public/utils/styles.ts similarity index 94% rename from x-pack/legacy/plugins/infra/public/utils/styles.ts rename to x-pack/plugins/infra/public/utils/styles.ts index 523f123666f6f..831996ddeca65 100644 --- a/x-pack/legacy/plugins/infra/public/utils/styles.ts +++ b/x-pack/plugins/infra/public/utils/styles.ts @@ -4,8 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import get from 'lodash/fp/get'; -import getOr from 'lodash/fp/getOr'; +import { get } from 'lodash'; import { getLuminance, parseToHsl, parseToRgb, rgba, shade, tint } from 'polished'; type PropReader = (props: object, defaultValue?: Default) => Prop; @@ -16,7 +15,7 @@ const asPropReader = (reader: string | string[] | PropReader) => : ( props: Props, defaultValue?: Default - ) => getOr(defaultValue, reader as Prop, props); + ) => get(props, reader as Prop, defaultValue); export const switchProp = Object.assign( (propName: string | string[] | PropReader, options: Map | object) => ( @@ -26,7 +25,7 @@ export const switchProp = Object.assign( if (typeof propValue === 'undefined') { return; } - return options instanceof Map ? options.get(propValue) : get(propValue, options); + return options instanceof Map ? options.get(propValue) : get(options, propValue); }, { default: Symbol('default'), diff --git a/x-pack/legacy/plugins/infra/public/utils/typed_react.tsx b/x-pack/plugins/infra/public/utils/typed_react.tsx similarity index 95% rename from x-pack/legacy/plugins/infra/public/utils/typed_react.tsx rename to x-pack/plugins/infra/public/utils/typed_react.tsx index d057899ba18be..c997fb4ac983a 100644 --- a/x-pack/legacy/plugins/infra/public/utils/typed_react.tsx +++ b/x-pack/plugins/infra/public/utils/typed_react.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import omit from 'lodash/fp/omit'; +import { omit } from 'lodash'; import React from 'react'; import { InferableComponentEnhancerWithProps, ConnectedComponent } from 'react-redux'; @@ -56,7 +56,7 @@ export const asChildFunctionRenderer = ( } private getRendererArgs = () => - omit(['children', 'initializeOnMount', 'resetOnUnmount'], this.props) as Pick< + omit(this.props, ['children', 'initializeOnMount', 'resetOnUnmount']) as Pick< ChildFunctionRendererProps, keyof InjectedProps >; diff --git a/x-pack/legacy/plugins/infra/public/utils/typed_redux.ts b/x-pack/plugins/infra/public/utils/typed_redux.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/utils/typed_redux.ts rename to x-pack/plugins/infra/public/utils/typed_redux.ts diff --git a/x-pack/legacy/plugins/infra/public/utils/url_state.tsx b/x-pack/plugins/infra/public/utils/url_state.tsx similarity index 96% rename from x-pack/legacy/plugins/infra/public/utils/url_state.tsx rename to x-pack/plugins/infra/public/utils/url_state.tsx index 58835715fe55c..bf4cfbaf05965 100644 --- a/x-pack/legacy/plugins/infra/public/utils/url_state.tsx +++ b/x-pack/plugins/infra/public/utils/url_state.tsx @@ -6,11 +6,11 @@ import { parse, stringify } from 'query-string'; import { History, Location } from 'history'; -import throttle from 'lodash/fp/throttle'; +import { throttle } from 'lodash'; import React from 'react'; import { Route, RouteProps } from 'react-router-dom'; import { decode, encode, RisonValue } from 'rison-node'; -import { url } from '../../../../../../src/plugins/kibana_utils/public'; +import { url } from '../../../../../src/plugins/kibana_utils/public'; interface UrlStateContainerProps { urlState: UrlState | undefined; @@ -54,7 +54,7 @@ class UrlStateContainerLifecycle extends React.Component< this.handleInitialize(location); } - private replaceStateInLocation = throttle(1000, (urlState: UrlState | undefined) => { + private replaceStateInLocation = throttle((urlState: UrlState | undefined) => { const { history, location, urlStateKey } = this.props; const newLocation = replaceQueryStringInLocation( @@ -65,7 +65,7 @@ class UrlStateContainerLifecycle extends React.Component< if (newLocation !== location) { history.replace(newLocation); } - }); + }, 1000); private handleInitialize = (location: Location) => { const { onInitialize, mapToUrlState, urlStateKey, urlState } = this.props; diff --git a/x-pack/legacy/plugins/infra/public/utils/use_kibana_space_id.ts b/x-pack/plugins/infra/public/utils/use_kibana_space_id.ts similarity index 64% rename from x-pack/legacy/plugins/infra/public/utils/use_kibana_space_id.ts rename to x-pack/plugins/infra/public/utils/use_kibana_space_id.ts index 52c896feef1a2..d229542ec940f 100644 --- a/x-pack/legacy/plugins/infra/public/utils/use_kibana_space_id.ts +++ b/x-pack/plugins/infra/public/utils/use_kibana_space_id.ts @@ -7,12 +7,13 @@ import { fold } from 'fp-ts/lib/Either'; import { pipe } from 'fp-ts/lib/pipeable'; import * as rt from 'io-ts'; - -import { useKibanaInjectedVar } from './use_kibana_injected_var'; +import { useKibana } from '../../../../../src/plugins/kibana_react/public'; export const useKibanaSpaceId = (): string => { - // NOTICE: use of `activeSpace` is deprecated and will not be made available in the New Platform. - const activeSpace = useKibanaInjectedVar('activeSpace'); + const kibana = useKibana(); + // NOTE: The injectedMetadata service will be deprecated at some point. We should migrate + // this to the client side Spaces plugin when it becomes available. + const activeSpace = kibana.services.injectedMetadata?.getInjectedVar('activeSpace'); return pipe( activeSpaceRT.decode(activeSpace), diff --git a/x-pack/legacy/plugins/infra/public/utils/use_kibana_ui_setting.ts b/x-pack/plugins/infra/public/utils/use_kibana_ui_setting.ts similarity index 72% rename from x-pack/legacy/plugins/infra/public/utils/use_kibana_ui_setting.ts rename to x-pack/plugins/infra/public/utils/use_kibana_ui_setting.ts index b3697db81fb6e..aef75570e7db1 100644 --- a/x-pack/legacy/plugins/infra/public/utils/use_kibana_ui_setting.ts +++ b/x-pack/plugins/infra/public/utils/use_kibana_ui_setting.ts @@ -3,11 +3,8 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ - -import { useCallback, useMemo } from 'react'; - -import { npSetup } from 'ui/new_platform'; -import useObservable from 'react-use/lib/useObservable'; +import { useMemo } from 'react'; +import { useUiSetting$ } from '../../../../../src/plugins/kibana_react/public'; /** * This hook behaves like a `useState` hook in that it provides a requested @@ -46,19 +43,9 @@ export function useKibanaUiSetting( ): [any, (key: string, value: any) => Promise]; export function useKibanaUiSetting(key: string, defaultValue?: any) { - const uiSettingsClient = npSetup.core.uiSettings; - - const uiSetting$ = useMemo(() => uiSettingsClient.get$(key, defaultValue), [ - defaultValue, - key, - uiSettingsClient, - ]); - const uiSetting = useObservable(uiSetting$); - - const setUiSetting = useCallback((value: any) => uiSettingsClient.set(key, value), [ - key, - uiSettingsClient, - ]); - - return [uiSetting, setUiSetting]; + const [uiSetting, setUiSetting] = useUiSetting$(key); + const uiSettingValue = useMemo(() => { + return uiSetting ? uiSetting : defaultValue; + }, [uiSetting, defaultValue]); + return [uiSettingValue, setUiSetting]; } diff --git a/x-pack/legacy/plugins/infra/public/utils/use_tracked_promise.ts b/x-pack/plugins/infra/public/utils/use_tracked_promise.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/utils/use_tracked_promise.ts rename to x-pack/plugins/infra/public/utils/use_tracked_promise.ts diff --git a/x-pack/legacy/plugins/infra/public/utils/use_url_state.ts b/x-pack/plugins/infra/public/utils/use_url_state.ts similarity index 98% rename from x-pack/legacy/plugins/infra/public/utils/use_url_state.ts rename to x-pack/plugins/infra/public/utils/use_url_state.ts index 284af62e52fbb..7a63b48fa9a1a 100644 --- a/x-pack/legacy/plugins/infra/public/utils/use_url_state.ts +++ b/x-pack/plugins/infra/public/utils/use_url_state.ts @@ -8,7 +8,7 @@ import { parse, stringify } from 'query-string'; import { Location } from 'history'; import { useCallback, useEffect, useMemo, useState } from 'react'; import { decode, encode, RisonValue } from 'rison-node'; -import { url } from '../../../../../../src/plugins/kibana_utils/public'; +import { url } from '../../../../../src/plugins/kibana_utils/public'; import { useHistory } from './history_context'; diff --git a/x-pack/legacy/plugins/infra/public/utils/use_visibility_state.ts b/x-pack/plugins/infra/public/utils/use_visibility_state.ts similarity index 100% rename from x-pack/legacy/plugins/infra/public/utils/use_visibility_state.ts rename to x-pack/plugins/infra/public/utils/use_visibility_state.ts diff --git a/x-pack/legacy/plugins/infra/scripts/combined_schema.ts b/x-pack/plugins/infra/scripts/combined_schema.ts similarity index 91% rename from x-pack/legacy/plugins/infra/scripts/combined_schema.ts rename to x-pack/plugins/infra/scripts/combined_schema.ts index 625eb3a4a4755..4813a3b674b31 100644 --- a/x-pack/legacy/plugins/infra/scripts/combined_schema.ts +++ b/x-pack/plugins/infra/scripts/combined_schema.ts @@ -5,7 +5,7 @@ */ import { buildSchemaFromTypeDefinitions } from 'graphql-tools'; - +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { schemas as serverSchemas } from '../server/graphql'; export const schemas = [...serverSchemas]; diff --git a/x-pack/legacy/plugins/infra/scripts/generate_types_from_graphql.js b/x-pack/plugins/infra/scripts/generate_types_from_graphql.js similarity index 97% rename from x-pack/legacy/plugins/infra/scripts/generate_types_from_graphql.js rename to x-pack/plugins/infra/scripts/generate_types_from_graphql.js index 9e2d3f4e05453..aec5ff6da99ce 100644 --- a/x-pack/legacy/plugins/infra/scripts/generate_types_from_graphql.js +++ b/x-pack/plugins/infra/scripts/generate_types_from_graphql.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -require('../../../../../src/setup_node_env'); +require('../../../../src/setup_node_env'); const { join, resolve } = require('path'); // eslint-disable-next-line import/no-extraneous-dependencies, import/no-unresolved diff --git a/x-pack/legacy/plugins/infra/scripts/gql_gen_client.json b/x-pack/plugins/infra/scripts/gql_gen_client.json similarity index 100% rename from x-pack/legacy/plugins/infra/scripts/gql_gen_client.json rename to x-pack/plugins/infra/scripts/gql_gen_client.json diff --git a/x-pack/legacy/plugins/infra/scripts/gql_gen_server.json b/x-pack/plugins/infra/scripts/gql_gen_server.json similarity index 100% rename from x-pack/legacy/plugins/infra/scripts/gql_gen_server.json rename to x-pack/plugins/infra/scripts/gql_gen_server.json diff --git a/x-pack/legacy/plugins/infra/scripts/storybook.js b/x-pack/plugins/infra/scripts/storybook.js similarity index 100% rename from x-pack/legacy/plugins/infra/scripts/storybook.js rename to x-pack/plugins/infra/scripts/storybook.js diff --git a/x-pack/legacy/plugins/infra/server/features.ts b/x-pack/plugins/infra/server/features.ts similarity index 96% rename from x-pack/legacy/plugins/infra/server/features.ts rename to x-pack/plugins/infra/server/features.ts index 02658002694d2..edf94beab43a7 100644 --- a/x-pack/legacy/plugins/infra/server/features.ts +++ b/x-pack/plugins/infra/server/features.ts @@ -12,7 +12,7 @@ export const METRICS_FEATURE = { defaultMessage: 'Metrics', }), icon: 'metricsApp', - navLinkId: 'infra:home', + navLinkId: 'metrics', app: ['infra', 'kibana'], catalogue: ['infraops'], privileges: { @@ -41,7 +41,7 @@ export const LOGS_FEATURE = { defaultMessage: 'Logs', }), icon: 'logsApp', - navLinkId: 'infra:logs', + navLinkId: 'logs', app: ['infra', 'kibana'], catalogue: ['infralogging'], privileges: { diff --git a/x-pack/legacy/plugins/infra/server/graphql/index.ts b/x-pack/plugins/infra/server/graphql/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/graphql/index.ts rename to x-pack/plugins/infra/server/graphql/index.ts diff --git a/x-pack/legacy/plugins/infra/server/graphql/log_entries/index.ts b/x-pack/plugins/infra/server/graphql/log_entries/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/graphql/log_entries/index.ts rename to x-pack/plugins/infra/server/graphql/log_entries/index.ts diff --git a/x-pack/legacy/plugins/infra/server/graphql/log_entries/resolvers.ts b/x-pack/plugins/infra/server/graphql/log_entries/resolvers.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/graphql/log_entries/resolvers.ts rename to x-pack/plugins/infra/server/graphql/log_entries/resolvers.ts diff --git a/x-pack/legacy/plugins/infra/server/graphql/log_entries/schema.gql.ts b/x-pack/plugins/infra/server/graphql/log_entries/schema.gql.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/graphql/log_entries/schema.gql.ts rename to x-pack/plugins/infra/server/graphql/log_entries/schema.gql.ts diff --git a/x-pack/legacy/plugins/infra/server/graphql/source_status/index.ts b/x-pack/plugins/infra/server/graphql/source_status/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/graphql/source_status/index.ts rename to x-pack/plugins/infra/server/graphql/source_status/index.ts diff --git a/x-pack/legacy/plugins/infra/server/graphql/source_status/resolvers.ts b/x-pack/plugins/infra/server/graphql/source_status/resolvers.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/graphql/source_status/resolvers.ts rename to x-pack/plugins/infra/server/graphql/source_status/resolvers.ts diff --git a/x-pack/legacy/plugins/infra/server/graphql/source_status/schema.gql.ts b/x-pack/plugins/infra/server/graphql/source_status/schema.gql.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/graphql/source_status/schema.gql.ts rename to x-pack/plugins/infra/server/graphql/source_status/schema.gql.ts diff --git a/x-pack/legacy/plugins/infra/server/graphql/sources/index.ts b/x-pack/plugins/infra/server/graphql/sources/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/graphql/sources/index.ts rename to x-pack/plugins/infra/server/graphql/sources/index.ts diff --git a/x-pack/legacy/plugins/infra/server/graphql/sources/resolvers.ts b/x-pack/plugins/infra/server/graphql/sources/resolvers.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/graphql/sources/resolvers.ts rename to x-pack/plugins/infra/server/graphql/sources/resolvers.ts diff --git a/x-pack/legacy/plugins/infra/server/graphql/sources/schema.gql.ts b/x-pack/plugins/infra/server/graphql/sources/schema.gql.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/graphql/sources/schema.gql.ts rename to x-pack/plugins/infra/server/graphql/sources/schema.gql.ts diff --git a/x-pack/legacy/plugins/infra/server/graphql/types.ts b/x-pack/plugins/infra/server/graphql/types.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/graphql/types.ts rename to x-pack/plugins/infra/server/graphql/types.ts diff --git a/x-pack/plugins/infra/server/index.ts b/x-pack/plugins/infra/server/index.ts index b12f92c8c5a9d..54f858554a5a3 100644 --- a/x-pack/plugins/infra/server/index.ts +++ b/x-pack/plugins/infra/server/index.ts @@ -4,21 +4,12 @@ * you may not use this file except in compliance with the Elastic License. */ -import { schema, TypeOf } from '@kbn/config-schema'; import { PluginInitializerContext } from 'src/core/server'; -import { InfraPlugin } from './plugin'; +import { config, InfraConfig, InfraServerPlugin } from './plugin'; +import { savedObjectMappings } from './saved_objects'; -export const config = { - schema: schema.object({ - enabled: schema.maybe(schema.boolean()), - query: schema.object({ - partitionSize: schema.maybe(schema.number()), - partitionFactor: schema.maybe(schema.number()), - }), - }), -}; +export { config, InfraConfig, savedObjectMappings }; -export const plugin = (initContext: PluginInitializerContext) => new InfraPlugin(initContext); - -export type InfraConfig = TypeOf; -export { InfraSetup } from './plugin'; +export function plugin(context: PluginInitializerContext) { + return new InfraServerPlugin(context); +} diff --git a/x-pack/legacy/plugins/infra/server/infra_server.ts b/x-pack/plugins/infra/server/infra_server.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/infra_server.ts rename to x-pack/plugins/infra/server/infra_server.ts diff --git a/x-pack/legacy/plugins/infra/server/kibana.index.ts b/x-pack/plugins/infra/server/kibana.index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/kibana.index.ts rename to x-pack/plugins/infra/server/kibana.index.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/adapters/fields/adapter_types.ts b/x-pack/plugins/infra/server/lib/adapters/fields/adapter_types.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/adapters/fields/adapter_types.ts rename to x-pack/plugins/infra/server/lib/adapters/fields/adapter_types.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/adapters/fields/framework_fields_adapter.ts b/x-pack/plugins/infra/server/lib/adapters/fields/framework_fields_adapter.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/adapters/fields/framework_fields_adapter.ts rename to x-pack/plugins/infra/server/lib/adapters/fields/framework_fields_adapter.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/adapters/fields/index.ts b/x-pack/plugins/infra/server/lib/adapters/fields/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/adapters/fields/index.ts rename to x-pack/plugins/infra/server/lib/adapters/fields/index.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/adapters/framework/adapter_types.ts b/x-pack/plugins/infra/server/lib/adapters/framework/adapter_types.ts similarity index 89% rename from x-pack/legacy/plugins/infra/server/lib/adapters/framework/adapter_types.ts rename to x-pack/plugins/infra/server/lib/adapters/framework/adapter_types.ts index 75cb860bd9869..0dbbf3566a61d 100644 --- a/x-pack/legacy/plugins/infra/server/lib/adapters/framework/adapter_types.ts +++ b/x-pack/plugins/infra/server/lib/adapters/framework/adapter_types.ts @@ -7,12 +7,12 @@ import { SearchResponse, GenericParams } from 'elasticsearch'; import { Lifecycle } from 'hapi'; import { UsageCollectionSetup } from 'src/plugins/usage_collection/server'; -import { RouteMethod, RouteConfig } from '../../../../../../../../src/core/server'; -import { PluginSetupContract as FeaturesPluginSetup } from '../../../../../../../plugins/features/server'; -import { SpacesPluginSetup } from '../../../../../../../plugins/spaces/server'; -import { VisTypeTimeseriesSetup } from '../../../../../../../../src/plugins/vis_type_timeseries/server'; -import { APMPluginContract } from '../../../../../../../plugins/apm/server'; -import { HomeServerPluginSetup } from '../../../../../../../../src/plugins/home/server'; +import { RouteMethod, RouteConfig } from '../../../../../../../src/core/server'; +import { PluginSetupContract as FeaturesPluginSetup } from '../../../../../../plugins/features/server'; +import { SpacesPluginSetup } from '../../../../../../plugins/spaces/server'; +import { VisTypeTimeseriesSetup } from '../../../../../../../src/plugins/vis_type_timeseries/server'; +import { APMPluginContract } from '../../../../../../plugins/apm/server'; +import { HomeServerPluginSetup } from '../../../../../../../src/plugins/home/server'; // NP_TODO: Compose real types from plugins we depend on, no "any" export interface InfraServerPluginDeps { diff --git a/x-pack/legacy/plugins/infra/server/lib/adapters/framework/index.ts b/x-pack/plugins/infra/server/lib/adapters/framework/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/adapters/framework/index.ts rename to x-pack/plugins/infra/server/lib/adapters/framework/index.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/adapters/framework/kibana_framework_adapter.ts b/x-pack/plugins/infra/server/lib/adapters/framework/kibana_framework_adapter.ts similarity index 92% rename from x-pack/legacy/plugins/infra/server/lib/adapters/framework/kibana_framework_adapter.ts rename to x-pack/plugins/infra/server/lib/adapters/framework/kibana_framework_adapter.ts index 4b1aa774a523f..7c12e23d7e903 100644 --- a/x-pack/legacy/plugins/infra/server/lib/adapters/framework/kibana_framework_adapter.ts +++ b/x-pack/plugins/infra/server/lib/adapters/framework/kibana_framework_adapter.ts @@ -6,7 +6,6 @@ /* eslint-disable @typescript-eslint/array-type */ -import { GenericParams } from 'elasticsearch'; import { GraphQLSchema } from 'graphql'; import { Legacy } from 'kibana'; import { runHttpQuery } from 'apollo-server-core'; @@ -30,9 +29,11 @@ import { RequestHandlerContext, KibanaResponseFactory, RouteMethod, -} from '../../../../../../../../src/core/server'; -import { RequestHandler } from '../../../../../../../../src/core/server'; -import { InfraConfig } from '../../../../../../../plugins/infra/server'; + APICaller, +} from '../../../../../../../src/core/server'; +import { RequestHandler } from '../../../../../../../src/core/server'; +import { InfraConfig } from '../../../plugin'; +import { IndexPatternsFetcher } from '../../../../../../../src/plugins/data/server'; export class KibanaFramework { public router: IRouter; @@ -214,14 +215,10 @@ export class KibanaFramework { public getIndexPatternsService( requestContext: RequestHandlerContext ): Legacy.IndexPatternsService { - return this.plugins.indexPatterns.indexPatternsServiceFactory({ - callCluster: async (method: string, args: [GenericParams], ...rest: any[]) => { - const fieldCaps = await this.callWithRequest(requestContext, method, { - ...args, - allowNoIndices: true, - } as GenericParams); - return fieldCaps; - }, + return new IndexPatternsFetcher((...rest: Parameters) => { + rest[1] = rest[1] || {}; + rest[1].allowNoIndices = true; + return requestContext.core.elasticsearch.adminClient.callAsCurrentUser(...rest); }); } diff --git a/x-pack/legacy/plugins/infra/server/lib/adapters/log_entries/adapter_types.ts b/x-pack/plugins/infra/server/lib/adapters/log_entries/adapter_types.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/adapters/log_entries/adapter_types.ts rename to x-pack/plugins/infra/server/lib/adapters/log_entries/adapter_types.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/adapters/log_entries/index.ts b/x-pack/plugins/infra/server/lib/adapters/log_entries/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/adapters/log_entries/index.ts rename to x-pack/plugins/infra/server/lib/adapters/log_entries/index.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/adapters/log_entries/kibana_log_entries_adapter.ts b/x-pack/plugins/infra/server/lib/adapters/log_entries/kibana_log_entries_adapter.ts similarity index 97% rename from x-pack/legacy/plugins/infra/server/lib/adapters/log_entries/kibana_log_entries_adapter.ts rename to x-pack/plugins/infra/server/lib/adapters/log_entries/kibana_log_entries_adapter.ts index b936d79a8edcd..f48c949329b04 100644 --- a/x-pack/legacy/plugins/infra/server/lib/adapters/log_entries/kibana_log_entries_adapter.ts +++ b/x-pack/plugins/infra/server/lib/adapters/log_entries/kibana_log_entries_adapter.ts @@ -8,11 +8,7 @@ import { timeMilliseconds } from 'd3-time'; import * as runtimeTypes from 'io-ts'; -import { compact } from 'lodash'; -import first from 'lodash/fp/first'; -import get from 'lodash/fp/get'; -import has from 'lodash/fp/has'; -import zip from 'lodash/fp/zip'; +import { compact, first, get, has, zip } from 'lodash'; import { pipe } from 'fp-ts/lib/pipeable'; import { map, fold } from 'fp-ts/lib/Either'; import { identity, constant } from 'fp-ts/lib/function'; @@ -408,8 +404,8 @@ function mapHitsToLogEntryDocuments( return hits.map(hit => { const logFields = fields.reduce<{ [fieldName: string]: JsonValue }>( (flattenedFields, field) => { - if (has(field, hit._source)) { - flattenedFields[field] = get(field, hit._source); + if (has(hit._source, field)) { + flattenedFields[field] = get(hit._source, field); } return flattenedFields; }, @@ -434,13 +430,13 @@ const convertHitToLogEntryDocument = (fields: string[]) => ( gid: hit._id, fields: fields.reduce( (flattenedFields, fieldName) => - has(fieldName, hit._source) + has(hit._source, fieldName) ? { ...flattenedFields, - [fieldName]: get(fieldName, hit._source), + [fieldName]: get(hit._source, fieldName), } : flattenedFields, - {} as { [fieldName: string]: string | number | boolean | null } + {} as { [fieldName: string]: string | number | object | boolean | null } ), highlights: hit.highlight || {}, key: { diff --git a/x-pack/legacy/plugins/infra/server/lib/adapters/metrics/adapter_types.ts b/x-pack/plugins/infra/server/lib/adapters/metrics/adapter_types.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/adapters/metrics/adapter_types.ts rename to x-pack/plugins/infra/server/lib/adapters/metrics/adapter_types.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/adapters/metrics/index.ts b/x-pack/plugins/infra/server/lib/adapters/metrics/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/adapters/metrics/index.ts rename to x-pack/plugins/infra/server/lib/adapters/metrics/index.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/adapters/metrics/kibana_metrics_adapter.ts b/x-pack/plugins/infra/server/lib/adapters/metrics/kibana_metrics_adapter.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/adapters/metrics/kibana_metrics_adapter.ts rename to x-pack/plugins/infra/server/lib/adapters/metrics/kibana_metrics_adapter.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/adapters/metrics/lib/check_valid_node.ts b/x-pack/plugins/infra/server/lib/adapters/metrics/lib/check_valid_node.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/adapters/metrics/lib/check_valid_node.ts rename to x-pack/plugins/infra/server/lib/adapters/metrics/lib/check_valid_node.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/adapters/metrics/lib/errors.ts b/x-pack/plugins/infra/server/lib/adapters/metrics/lib/errors.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/adapters/metrics/lib/errors.ts rename to x-pack/plugins/infra/server/lib/adapters/metrics/lib/errors.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/adapters/source_status/elasticsearch_source_status_adapter.ts b/x-pack/plugins/infra/server/lib/adapters/source_status/elasticsearch_source_status_adapter.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/adapters/source_status/elasticsearch_source_status_adapter.ts rename to x-pack/plugins/infra/server/lib/adapters/source_status/elasticsearch_source_status_adapter.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/adapters/source_status/index.ts b/x-pack/plugins/infra/server/lib/adapters/source_status/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/adapters/source_status/index.ts rename to x-pack/plugins/infra/server/lib/adapters/source_status/index.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/compose/kibana.ts b/x-pack/plugins/infra/server/lib/compose/kibana.ts similarity index 94% rename from x-pack/legacy/plugins/infra/server/lib/compose/kibana.ts rename to x-pack/plugins/infra/server/lib/compose/kibana.ts index d8a39a6b9c16f..f100726b5b92e 100644 --- a/x-pack/legacy/plugins/infra/server/lib/compose/kibana.ts +++ b/x-pack/plugins/infra/server/lib/compose/kibana.ts @@ -16,8 +16,8 @@ import { LogEntryCategoriesAnalysis, LogEntryRateAnalysis } from '../log_analysi import { InfraSnapshot } from '../snapshot'; import { InfraSourceStatus } from '../source_status'; import { InfraSources } from '../sources'; -import { InfraConfig } from '../../../../../../plugins/infra/server'; -import { CoreSetup } from '../../../../../../../src/core/server'; +import { InfraConfig } from '../../../server'; +import { CoreSetup } from '../../../../../../src/core/server'; import { InfraServerPluginDeps } from '../adapters/framework/adapter_types'; export function compose(core: CoreSetup, config: InfraConfig, plugins: InfraServerPluginDeps) { diff --git a/x-pack/legacy/plugins/infra/server/lib/constants.ts b/x-pack/plugins/infra/server/lib/constants.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/constants.ts rename to x-pack/plugins/infra/server/lib/constants.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/domains/fields_domain.ts b/x-pack/plugins/infra/server/lib/domains/fields_domain.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/domains/fields_domain.ts rename to x-pack/plugins/infra/server/lib/domains/fields_domain.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_apache2.test.ts b/x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_apache2.test.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_apache2.test.ts rename to x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_apache2.test.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_apache2.ts b/x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_apache2.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_apache2.ts rename to x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_apache2.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_auditd.test.ts b/x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_auditd.test.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_auditd.test.ts rename to x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_auditd.test.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_auditd.ts b/x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_auditd.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_auditd.ts rename to x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_auditd.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_haproxy.test.ts b/x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_haproxy.test.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_haproxy.test.ts rename to x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_haproxy.test.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_haproxy.ts b/x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_haproxy.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_haproxy.ts rename to x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_haproxy.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_icinga.test.ts b/x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_icinga.test.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_icinga.test.ts rename to x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_icinga.test.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_icinga.ts b/x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_icinga.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_icinga.ts rename to x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_icinga.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_iis.test.ts b/x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_iis.test.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_iis.test.ts rename to x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_iis.test.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_iis.ts b/x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_iis.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_iis.ts rename to x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_iis.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_kafka.test.ts b/x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_kafka.test.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_kafka.test.ts rename to x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_kafka.test.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_logstash.test.ts b/x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_logstash.test.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_logstash.test.ts rename to x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_logstash.test.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_logstash.ts b/x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_logstash.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_logstash.ts rename to x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_logstash.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_mongodb.test.ts b/x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_mongodb.test.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_mongodb.test.ts rename to x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_mongodb.test.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_mongodb.ts b/x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_mongodb.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_mongodb.ts rename to x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_mongodb.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_mysql.test.ts b/x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_mysql.test.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_mysql.test.ts rename to x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_mysql.test.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_mysql.ts b/x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_mysql.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_mysql.ts rename to x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_mysql.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_nginx.test.ts b/x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_nginx.test.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_nginx.test.ts rename to x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_nginx.test.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_nginx.ts b/x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_nginx.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_nginx.ts rename to x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_nginx.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_osquery.test.ts b/x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_osquery.test.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_osquery.test.ts rename to x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_osquery.test.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_osquery.ts b/x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_osquery.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_osquery.ts rename to x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_osquery.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_redis.ts b/x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_redis.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_redis.ts rename to x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_redis.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_system.ts b/x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_system.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_system.ts rename to x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_system.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_traefik.test.ts b/x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_traefik.test.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_traefik.test.ts rename to x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_traefik.test.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_traefik.ts b/x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_traefik.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_traefik.ts rename to x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/filebeat_traefik.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/generic.test.ts b/x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/generic.test.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/generic.test.ts rename to x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/generic.test.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/generic.ts b/x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/generic.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/generic.ts rename to x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/generic.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/generic_webserver.ts b/x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/generic_webserver.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/generic_webserver.ts rename to x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/generic_webserver.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/helpers.ts b/x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/helpers.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/helpers.ts rename to x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/helpers.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/index.ts b/x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/index.ts rename to x-pack/plugins/infra/server/lib/domains/log_entries_domain/builtin_rules/index.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/convert_document_source_to_log_item_fields.test.ts b/x-pack/plugins/infra/server/lib/domains/log_entries_domain/convert_document_source_to_log_item_fields.test.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/convert_document_source_to_log_item_fields.test.ts rename to x-pack/plugins/infra/server/lib/domains/log_entries_domain/convert_document_source_to_log_item_fields.test.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/convert_document_source_to_log_item_fields.ts b/x-pack/plugins/infra/server/lib/domains/log_entries_domain/convert_document_source_to_log_item_fields.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/convert_document_source_to_log_item_fields.ts rename to x-pack/plugins/infra/server/lib/domains/log_entries_domain/convert_document_source_to_log_item_fields.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/index.ts b/x-pack/plugins/infra/server/lib/domains/log_entries_domain/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/index.ts rename to x-pack/plugins/infra/server/lib/domains/log_entries_domain/index.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/log_entries_domain.ts b/x-pack/plugins/infra/server/lib/domains/log_entries_domain/log_entries_domain.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/log_entries_domain.ts rename to x-pack/plugins/infra/server/lib/domains/log_entries_domain/log_entries_domain.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/message.ts b/x-pack/plugins/infra/server/lib/domains/log_entries_domain/message.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/message.ts rename to x-pack/plugins/infra/server/lib/domains/log_entries_domain/message.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/rule_types.ts b/x-pack/plugins/infra/server/lib/domains/log_entries_domain/rule_types.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/domains/log_entries_domain/rule_types.ts rename to x-pack/plugins/infra/server/lib/domains/log_entries_domain/rule_types.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/domains/metrics_domain.ts b/x-pack/plugins/infra/server/lib/domains/metrics_domain.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/domains/metrics_domain.ts rename to x-pack/plugins/infra/server/lib/domains/metrics_domain.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/infra_types.ts b/x-pack/plugins/infra/server/lib/infra_types.ts similarity index 92% rename from x-pack/legacy/plugins/infra/server/lib/infra_types.ts rename to x-pack/plugins/infra/server/lib/infra_types.ts index d52416b39596b..51c433557f4fc 100644 --- a/x-pack/legacy/plugins/infra/server/lib/infra_types.ts +++ b/x-pack/plugins/infra/server/lib/infra_types.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { InfraSourceConfiguration } from '../../public/graphql/types'; +import { InfraSourceConfiguration } from '../../common/graphql/types'; import { InfraFieldsDomain } from './domains/fields_domain'; import { InfraLogEntriesDomain } from './domains/log_entries_domain'; import { InfraMetricsDomain } from './domains/metrics_domain'; @@ -12,7 +12,7 @@ import { LogEntryCategoriesAnalysis, LogEntryRateAnalysis } from './log_analysis import { InfraSnapshot } from './snapshot'; import { InfraSources } from './sources'; import { InfraSourceStatus } from './source_status'; -import { InfraConfig } from '../../../../../plugins/infra/server'; +import { InfraConfig } from '../plugin'; import { KibanaFramework } from './adapters/framework/kibana_framework_adapter'; // NP_TODO: We shouldn't need this context anymore but I am diff --git a/x-pack/legacy/plugins/infra/server/lib/log_analysis/errors.ts b/x-pack/plugins/infra/server/lib/log_analysis/errors.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/log_analysis/errors.ts rename to x-pack/plugins/infra/server/lib/log_analysis/errors.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/log_analysis/index.ts b/x-pack/plugins/infra/server/lib/log_analysis/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/log_analysis/index.ts rename to x-pack/plugins/infra/server/lib/log_analysis/index.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/log_analysis/log_entry_categories_analysis.ts b/x-pack/plugins/infra/server/lib/log_analysis/log_entry_categories_analysis.ts similarity index 99% rename from x-pack/legacy/plugins/infra/server/lib/log_analysis/log_entry_categories_analysis.ts rename to x-pack/plugins/infra/server/lib/log_analysis/log_entry_categories_analysis.ts index f2b6c468df69f..2e270f16ca867 100644 --- a/x-pack/legacy/plugins/infra/server/lib/log_analysis/log_entry_categories_analysis.ts +++ b/x-pack/plugins/infra/server/lib/log_analysis/log_entry_categories_analysis.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { KibanaRequest, RequestHandlerContext } from '../../../../../../../src/core/server'; +import { KibanaRequest, RequestHandlerContext } from 'src/core/server'; import { getJobId, logEntryCategoriesJobTypes } from '../../../common/log_analysis'; import { startTracingSpan, TracingSpan } from '../../../common/performance_tracing'; import { decodeOrThrow } from '../../../common/runtime_types'; diff --git a/x-pack/legacy/plugins/infra/server/lib/log_analysis/log_entry_rate_analysis.ts b/x-pack/plugins/infra/server/lib/log_analysis/log_entry_rate_analysis.ts similarity index 98% rename from x-pack/legacy/plugins/infra/server/lib/log_analysis/log_entry_rate_analysis.ts rename to x-pack/plugins/infra/server/lib/log_analysis/log_entry_rate_analysis.ts index 515856fa6be8a..f60f758053c47 100644 --- a/x-pack/legacy/plugins/infra/server/lib/log_analysis/log_entry_rate_analysis.ts +++ b/x-pack/plugins/infra/server/lib/log_analysis/log_entry_rate_analysis.ts @@ -7,6 +7,7 @@ import { pipe } from 'fp-ts/lib/pipeable'; import { map, fold } from 'fp-ts/lib/Either'; import { identity } from 'fp-ts/lib/function'; +import { RequestHandlerContext, KibanaRequest } from 'src/core/server'; import { getJobId } from '../../../common/log_analysis'; import { throwErrors, createPlainError } from '../../../common/runtime_types'; import { KibanaFramework } from '../adapters/framework/kibana_framework_adapter'; @@ -17,7 +18,6 @@ import { LogRateModelPlotBucket, CompositeTimestampPartitionKey, } from './queries'; -import { RequestHandlerContext, KibanaRequest } from '../../../../../../../src/core/server'; const COMPOSITE_AGGREGATION_BATCH_SIZE = 1000; diff --git a/x-pack/legacy/plugins/infra/server/lib/log_analysis/queries/common.ts b/x-pack/plugins/infra/server/lib/log_analysis/queries/common.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/log_analysis/queries/common.ts rename to x-pack/plugins/infra/server/lib/log_analysis/queries/common.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/log_analysis/queries/index.ts b/x-pack/plugins/infra/server/lib/log_analysis/queries/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/log_analysis/queries/index.ts rename to x-pack/plugins/infra/server/lib/log_analysis/queries/index.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/log_analysis/queries/log_entry_categories.ts b/x-pack/plugins/infra/server/lib/log_analysis/queries/log_entry_categories.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/log_analysis/queries/log_entry_categories.ts rename to x-pack/plugins/infra/server/lib/log_analysis/queries/log_entry_categories.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/log_analysis/queries/log_entry_category_histograms.ts b/x-pack/plugins/infra/server/lib/log_analysis/queries/log_entry_category_histograms.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/log_analysis/queries/log_entry_category_histograms.ts rename to x-pack/plugins/infra/server/lib/log_analysis/queries/log_entry_category_histograms.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/log_analysis/queries/log_entry_data_sets.ts b/x-pack/plugins/infra/server/lib/log_analysis/queries/log_entry_data_sets.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/log_analysis/queries/log_entry_data_sets.ts rename to x-pack/plugins/infra/server/lib/log_analysis/queries/log_entry_data_sets.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/log_analysis/queries/log_entry_rate.ts b/x-pack/plugins/infra/server/lib/log_analysis/queries/log_entry_rate.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/log_analysis/queries/log_entry_rate.ts rename to x-pack/plugins/infra/server/lib/log_analysis/queries/log_entry_rate.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/log_analysis/queries/top_log_entry_categories.ts b/x-pack/plugins/infra/server/lib/log_analysis/queries/top_log_entry_categories.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/log_analysis/queries/top_log_entry_categories.ts rename to x-pack/plugins/infra/server/lib/log_analysis/queries/top_log_entry_categories.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/snapshot/constants.ts b/x-pack/plugins/infra/server/lib/snapshot/constants.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/snapshot/constants.ts rename to x-pack/plugins/infra/server/lib/snapshot/constants.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/snapshot/create_timerange_with_interval.ts b/x-pack/plugins/infra/server/lib/snapshot/create_timerange_with_interval.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/snapshot/create_timerange_with_interval.ts rename to x-pack/plugins/infra/server/lib/snapshot/create_timerange_with_interval.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/snapshot/index.ts b/x-pack/plugins/infra/server/lib/snapshot/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/snapshot/index.ts rename to x-pack/plugins/infra/server/lib/snapshot/index.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/snapshot/query_helpers.ts b/x-pack/plugins/infra/server/lib/snapshot/query_helpers.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/snapshot/query_helpers.ts rename to x-pack/plugins/infra/server/lib/snapshot/query_helpers.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/snapshot/response_helpers.test.ts b/x-pack/plugins/infra/server/lib/snapshot/response_helpers.test.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/snapshot/response_helpers.test.ts rename to x-pack/plugins/infra/server/lib/snapshot/response_helpers.test.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/snapshot/response_helpers.ts b/x-pack/plugins/infra/server/lib/snapshot/response_helpers.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/snapshot/response_helpers.ts rename to x-pack/plugins/infra/server/lib/snapshot/response_helpers.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/snapshot/snapshot.ts b/x-pack/plugins/infra/server/lib/snapshot/snapshot.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/snapshot/snapshot.ts rename to x-pack/plugins/infra/server/lib/snapshot/snapshot.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/snapshot/types.ts b/x-pack/plugins/infra/server/lib/snapshot/types.ts similarity index 90% rename from x-pack/legacy/plugins/infra/server/lib/snapshot/types.ts rename to x-pack/plugins/infra/server/lib/snapshot/types.ts index 3627747e327e0..7e17cb91c6a59 100644 --- a/x-pack/legacy/plugins/infra/server/lib/snapshot/types.ts +++ b/x-pack/plugins/infra/server/lib/snapshot/types.ts @@ -5,7 +5,7 @@ */ import { JsonObject } from '../../../common/typed_json'; -import { InfraSourceConfiguration } from '../../../public/graphql/types'; +import { InfraSourceConfiguration } from '../../../common/graphql/types'; import { SnapshotRequest } from '../../../common/http_api/snapshot_api'; export interface InfraSnapshotRequestOptions diff --git a/x-pack/legacy/plugins/infra/server/lib/source_status.ts b/x-pack/plugins/infra/server/lib/source_status.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/source_status.ts rename to x-pack/plugins/infra/server/lib/source_status.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/sources/defaults.ts b/x-pack/plugins/infra/server/lib/sources/defaults.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/sources/defaults.ts rename to x-pack/plugins/infra/server/lib/sources/defaults.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/sources/errors.ts b/x-pack/plugins/infra/server/lib/sources/errors.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/sources/errors.ts rename to x-pack/plugins/infra/server/lib/sources/errors.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/sources/index.ts b/x-pack/plugins/infra/server/lib/sources/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/sources/index.ts rename to x-pack/plugins/infra/server/lib/sources/index.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/sources/saved_object_mappings.ts b/x-pack/plugins/infra/server/lib/sources/saved_object_mappings.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/sources/saved_object_mappings.ts rename to x-pack/plugins/infra/server/lib/sources/saved_object_mappings.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/sources/sources.test.ts b/x-pack/plugins/infra/server/lib/sources/sources.test.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/sources/sources.test.ts rename to x-pack/plugins/infra/server/lib/sources/sources.test.ts diff --git a/x-pack/legacy/plugins/infra/server/lib/sources/sources.ts b/x-pack/plugins/infra/server/lib/sources/sources.ts similarity index 99% rename from x-pack/legacy/plugins/infra/server/lib/sources/sources.ts rename to x-pack/plugins/infra/server/lib/sources/sources.ts index 2b38d81e4a8d5..5b9207a88e6e4 100644 --- a/x-pack/legacy/plugins/infra/server/lib/sources/sources.ts +++ b/x-pack/plugins/infra/server/lib/sources/sources.ts @@ -21,7 +21,7 @@ import { SourceConfigurationSavedObjectRuntimeType, StaticSourceConfigurationRuntimeType, } from './types'; -import { InfraConfig } from '../../../../../../plugins/infra/server'; +import { InfraConfig } from '../../../server'; interface Libs { config: InfraConfig; diff --git a/x-pack/legacy/plugins/infra/server/lib/sources/types.ts b/x-pack/plugins/infra/server/lib/sources/types.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/lib/sources/types.ts rename to x-pack/plugins/infra/server/lib/sources/types.ts diff --git a/x-pack/plugins/infra/server/plugin.ts b/x-pack/plugins/infra/server/plugin.ts index 0c763313fb973..ac45321e870e6 100644 --- a/x-pack/plugins/infra/server/plugin.ts +++ b/x-pack/plugins/infra/server/plugin.ts @@ -4,30 +4,158 @@ * you may not use this file except in compliance with the Elastic License. */ -import { Plugin, PluginInitializerContext } from 'src/core/server'; +import { CoreSetup, PluginInitializerContext } from 'src/core/server'; +import { Server } from 'hapi'; +import { Observable } from 'rxjs'; +import { schema, TypeOf } from '@kbn/config-schema'; +import { i18n } from '@kbn/i18n'; +import { initInfraServer } from './infra_server'; +import { InfraBackendLibs, InfraDomainLibs } from './lib/infra_types'; +import { FrameworkFieldsAdapter } from './lib/adapters/fields/framework_fields_adapter'; +import { KibanaFramework } from './lib/adapters/framework/kibana_framework_adapter'; +import { InfraKibanaLogEntriesAdapter } from './lib/adapters/log_entries/kibana_log_entries_adapter'; +import { KibanaMetricsAdapter } from './lib/adapters/metrics/kibana_metrics_adapter'; +import { InfraElasticsearchSourceStatusAdapter } from './lib/adapters/source_status'; +import { InfraFieldsDomain } from './lib/domains/fields_domain'; +import { InfraLogEntriesDomain } from './lib/domains/log_entries_domain'; +import { InfraMetricsDomain } from './lib/domains/metrics_domain'; +import { LogEntryCategoriesAnalysis, LogEntryRateAnalysis } from './lib/log_analysis'; +import { InfraSnapshot } from './lib/snapshot'; +import { InfraSourceStatus } from './lib/source_status'; +import { InfraSources } from './lib/sources'; +import { InfraServerPluginDeps } from './lib/adapters/framework'; +import { METRICS_FEATURE, LOGS_FEATURE } from './features'; +import { UsageCollector } from './usage/usage_collector'; +import { InfraStaticSourceConfiguration } from './lib/sources/types'; -export class InfraPlugin implements Plugin { - private readonly initContext: PluginInitializerContext; +export const config = { + schema: schema.object({ + query: schema.object({ + partitionSize: schema.number({ defaultValue: 75 }), + partitionFactor: schema.number({ defaultValue: 1.2 }), + }), + sources: schema.maybe( + schema.object({ + default: schema.maybe( + schema.object({ + logAlias: schema.maybe(schema.string()), + metricAlias: schema.maybe(schema.string()), + fields: schema.maybe( + schema.object({ + timestamp: schema.maybe(schema.string()), + message: schema.maybe(schema.arrayOf(schema.string())), + tiebreaker: schema.maybe(schema.string()), + host: schema.maybe(schema.string()), + container: schema.maybe(schema.string()), + pod: schema.maybe(schema.string()), + }) + ), + }) + ), + }) + ), + }), +}; - constructor(initContext: PluginInitializerContext) { - this.initContext = initContext; +export type InfraConfig = TypeOf; + +export interface KbnServer extends Server { + usage: any; +} + +const logsSampleDataLinkLabel = i18n.translate('xpack.infra.sampleDataLinkLabel', { + defaultMessage: 'Logs', +}); + +export interface InfraPluginSetup { + defineInternalSourceConfiguration: ( + sourceId: string, + sourceProperties: InfraStaticSourceConfiguration + ) => void; +} + +export class InfraServerPlugin { + private config$: Observable; + public config = {} as InfraConfig; + public libs: InfraBackendLibs | undefined; + + constructor(context: PluginInitializerContext) { + this.config$ = context.config.create(); + } + + getLibs() { + if (!this.libs) { + throw new Error('libs not set up yet'); + } + return this.libs; } - public setup() { + async setup(core: CoreSetup, plugins: InfraServerPluginDeps) { + await new Promise(resolve => { + this.config$.subscribe(configValue => { + this.config = configValue; + resolve(); + }); + }); + const framework = new KibanaFramework(core, this.config, plugins); + const sources = new InfraSources({ + config: this.config, + }); + const sourceStatus = new InfraSourceStatus( + new InfraElasticsearchSourceStatusAdapter(framework), + { + sources, + } + ); + const snapshot = new InfraSnapshot({ sources, framework }); + const logEntryCategoriesAnalysis = new LogEntryCategoriesAnalysis({ framework }); + const logEntryRateAnalysis = new LogEntryRateAnalysis({ framework }); + + // TODO: separate these out individually and do away with "domains" as a temporary group + const domainLibs: InfraDomainLibs = { + fields: new InfraFieldsDomain(new FrameworkFieldsAdapter(framework), { + sources, + }), + logEntries: new InfraLogEntriesDomain(new InfraKibanaLogEntriesAdapter(framework), { + sources, + }), + metrics: new InfraMetricsDomain(new KibanaMetricsAdapter(framework)), + }; + + this.libs = { + configuration: this.config, + framework, + logEntryCategoriesAnalysis, + logEntryRateAnalysis, + snapshot, + sources, + sourceStatus, + ...domainLibs, + }; + + plugins.features.registerFeature(METRICS_FEATURE); + plugins.features.registerFeature(LOGS_FEATURE); + + plugins.home.sampleData.addAppLinksToSampleDataset('logs', [ + { + path: `/app/logs`, + label: logsSampleDataLinkLabel, + icon: 'logsApp', + }, + ]); + + initInfraServer(this.libs); + + // Telemetry + UsageCollector.registerUsageCollector(plugins.usageCollection); + return { - __legacy: { - config: this.initContext.config, + defineInternalSourceConfiguration(sourceId, sourceProperties) { + sources.defineInternalSourceConfiguration(sourceId, sourceProperties); }, - }; + } as InfraPluginSetup; } - public start() {} - public stop() {} -} - -export interface InfraSetup { - /** @deprecated */ - __legacy: { - config: PluginInitializerContext['config']; - }; + start() {} + stop() {} } diff --git a/x-pack/legacy/plugins/infra/server/routes/inventory_metadata/index.ts b/x-pack/plugins/infra/server/routes/inventory_metadata/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/routes/inventory_metadata/index.ts rename to x-pack/plugins/infra/server/routes/inventory_metadata/index.ts diff --git a/x-pack/legacy/plugins/infra/server/routes/inventory_metadata/lib/get_cloud_metadata.ts b/x-pack/plugins/infra/server/routes/inventory_metadata/lib/get_cloud_metadata.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/routes/inventory_metadata/lib/get_cloud_metadata.ts rename to x-pack/plugins/infra/server/routes/inventory_metadata/lib/get_cloud_metadata.ts diff --git a/x-pack/legacy/plugins/infra/server/routes/ip_to_hostname.ts b/x-pack/plugins/infra/server/routes/ip_to_hostname.ts similarity index 96% rename from x-pack/legacy/plugins/infra/server/routes/ip_to_hostname.ts rename to x-pack/plugins/infra/server/routes/ip_to_hostname.ts index 5ad79b3d17a13..28b7777c1d688 100644 --- a/x-pack/legacy/plugins/infra/server/routes/ip_to_hostname.ts +++ b/x-pack/plugins/infra/server/routes/ip_to_hostname.ts @@ -7,10 +7,6 @@ import { first } from 'lodash'; import { schema } from '@kbn/config-schema'; import { InfraBackendLibs } from '../lib/infra_types'; -export interface IpToHostResponse { - host: string; -} - interface HostDoc { _source: { host: { diff --git a/x-pack/legacy/plugins/infra/server/routes/log_analysis/index.ts b/x-pack/plugins/infra/server/routes/log_analysis/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/routes/log_analysis/index.ts rename to x-pack/plugins/infra/server/routes/log_analysis/index.ts diff --git a/x-pack/legacy/plugins/infra/server/routes/log_analysis/results/index.ts b/x-pack/plugins/infra/server/routes/log_analysis/results/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/routes/log_analysis/results/index.ts rename to x-pack/plugins/infra/server/routes/log_analysis/results/index.ts diff --git a/x-pack/legacy/plugins/infra/server/routes/log_analysis/results/log_entry_categories.ts b/x-pack/plugins/infra/server/routes/log_analysis/results/log_entry_categories.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/routes/log_analysis/results/log_entry_categories.ts rename to x-pack/plugins/infra/server/routes/log_analysis/results/log_entry_categories.ts diff --git a/x-pack/legacy/plugins/infra/server/routes/log_analysis/results/log_entry_category_datasets.ts b/x-pack/plugins/infra/server/routes/log_analysis/results/log_entry_category_datasets.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/routes/log_analysis/results/log_entry_category_datasets.ts rename to x-pack/plugins/infra/server/routes/log_analysis/results/log_entry_category_datasets.ts diff --git a/x-pack/legacy/plugins/infra/server/routes/log_analysis/results/log_entry_rate.ts b/x-pack/plugins/infra/server/routes/log_analysis/results/log_entry_rate.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/routes/log_analysis/results/log_entry_rate.ts rename to x-pack/plugins/infra/server/routes/log_analysis/results/log_entry_rate.ts diff --git a/x-pack/legacy/plugins/infra/server/routes/log_analysis/validation/index.ts b/x-pack/plugins/infra/server/routes/log_analysis/validation/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/routes/log_analysis/validation/index.ts rename to x-pack/plugins/infra/server/routes/log_analysis/validation/index.ts diff --git a/x-pack/legacy/plugins/infra/server/routes/log_analysis/validation/indices.ts b/x-pack/plugins/infra/server/routes/log_analysis/validation/indices.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/routes/log_analysis/validation/indices.ts rename to x-pack/plugins/infra/server/routes/log_analysis/validation/indices.ts diff --git a/x-pack/legacy/plugins/infra/server/routes/log_entries/entries.ts b/x-pack/plugins/infra/server/routes/log_entries/entries.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/routes/log_entries/entries.ts rename to x-pack/plugins/infra/server/routes/log_entries/entries.ts diff --git a/x-pack/legacy/plugins/infra/server/routes/log_entries/highlights.ts b/x-pack/plugins/infra/server/routes/log_entries/highlights.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/routes/log_entries/highlights.ts rename to x-pack/plugins/infra/server/routes/log_entries/highlights.ts diff --git a/x-pack/legacy/plugins/infra/server/routes/log_entries/index.ts b/x-pack/plugins/infra/server/routes/log_entries/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/routes/log_entries/index.ts rename to x-pack/plugins/infra/server/routes/log_entries/index.ts diff --git a/x-pack/legacy/plugins/infra/server/routes/log_entries/item.ts b/x-pack/plugins/infra/server/routes/log_entries/item.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/routes/log_entries/item.ts rename to x-pack/plugins/infra/server/routes/log_entries/item.ts diff --git a/x-pack/legacy/plugins/infra/server/routes/log_entries/summary.ts b/x-pack/plugins/infra/server/routes/log_entries/summary.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/routes/log_entries/summary.ts rename to x-pack/plugins/infra/server/routes/log_entries/summary.ts diff --git a/x-pack/legacy/plugins/infra/server/routes/log_entries/summary_highlights.ts b/x-pack/plugins/infra/server/routes/log_entries/summary_highlights.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/routes/log_entries/summary_highlights.ts rename to x-pack/plugins/infra/server/routes/log_entries/summary_highlights.ts diff --git a/x-pack/legacy/plugins/infra/server/routes/metadata/index.ts b/x-pack/plugins/infra/server/routes/metadata/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/routes/metadata/index.ts rename to x-pack/plugins/infra/server/routes/metadata/index.ts diff --git a/x-pack/legacy/plugins/infra/server/routes/metadata/lib/get_cloud_metric_metadata.ts b/x-pack/plugins/infra/server/routes/metadata/lib/get_cloud_metric_metadata.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/routes/metadata/lib/get_cloud_metric_metadata.ts rename to x-pack/plugins/infra/server/routes/metadata/lib/get_cloud_metric_metadata.ts diff --git a/x-pack/legacy/plugins/infra/server/routes/metadata/lib/get_metric_metadata.ts b/x-pack/plugins/infra/server/routes/metadata/lib/get_metric_metadata.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/routes/metadata/lib/get_metric_metadata.ts rename to x-pack/plugins/infra/server/routes/metadata/lib/get_metric_metadata.ts diff --git a/x-pack/legacy/plugins/infra/server/routes/metadata/lib/get_node_info.ts b/x-pack/plugins/infra/server/routes/metadata/lib/get_node_info.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/routes/metadata/lib/get_node_info.ts rename to x-pack/plugins/infra/server/routes/metadata/lib/get_node_info.ts diff --git a/x-pack/legacy/plugins/infra/server/routes/metadata/lib/get_pod_node_name.ts b/x-pack/plugins/infra/server/routes/metadata/lib/get_pod_node_name.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/routes/metadata/lib/get_pod_node_name.ts rename to x-pack/plugins/infra/server/routes/metadata/lib/get_pod_node_name.ts diff --git a/x-pack/legacy/plugins/infra/server/routes/metadata/lib/has_apm_data.ts b/x-pack/plugins/infra/server/routes/metadata/lib/has_apm_data.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/routes/metadata/lib/has_apm_data.ts rename to x-pack/plugins/infra/server/routes/metadata/lib/has_apm_data.ts diff --git a/x-pack/legacy/plugins/infra/server/routes/metadata/lib/pick_feature_name.ts b/x-pack/plugins/infra/server/routes/metadata/lib/pick_feature_name.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/routes/metadata/lib/pick_feature_name.ts rename to x-pack/plugins/infra/server/routes/metadata/lib/pick_feature_name.ts diff --git a/x-pack/legacy/plugins/infra/server/routes/metrics_explorer/index.ts b/x-pack/plugins/infra/server/routes/metrics_explorer/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/routes/metrics_explorer/index.ts rename to x-pack/plugins/infra/server/routes/metrics_explorer/index.ts diff --git a/x-pack/legacy/plugins/infra/server/routes/metrics_explorer/lib/create_metrics_model.ts b/x-pack/plugins/infra/server/routes/metrics_explorer/lib/create_metrics_model.ts similarity index 96% rename from x-pack/legacy/plugins/infra/server/routes/metrics_explorer/lib/create_metrics_model.ts rename to x-pack/plugins/infra/server/routes/metrics_explorer/lib/create_metrics_model.ts index 7e47f50c76088..c537ba0d5163e 100644 --- a/x-pack/legacy/plugins/infra/server/routes/metrics_explorer/lib/create_metrics_model.ts +++ b/x-pack/plugins/infra/server/routes/metrics_explorer/lib/create_metrics_model.ts @@ -5,7 +5,7 @@ */ import { InfraMetricModelMetricType } from '../../../lib/adapters/metrics'; -import { MetricsExplorerRequestBody } from '../types'; +import { MetricsExplorerRequestBody } from '../../../../common/http_api/metrics_explorer'; import { TSVBMetricModel } from '../../../../common/inventory_models/types'; export const createMetricModel = (options: MetricsExplorerRequestBody): TSVBMetricModel => { return { diff --git a/x-pack/legacy/plugins/infra/server/routes/metrics_explorer/lib/get_dataset_for_field.ts b/x-pack/plugins/infra/server/routes/metrics_explorer/lib/get_dataset_for_field.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/routes/metrics_explorer/lib/get_dataset_for_field.ts rename to x-pack/plugins/infra/server/routes/metrics_explorer/lib/get_dataset_for_field.ts diff --git a/x-pack/legacy/plugins/infra/server/routes/metrics_explorer/lib/get_groupings.ts b/x-pack/plugins/infra/server/routes/metrics_explorer/lib/get_groupings.ts similarity index 96% rename from x-pack/legacy/plugins/infra/server/routes/metrics_explorer/lib/get_groupings.ts rename to x-pack/plugins/infra/server/routes/metrics_explorer/lib/get_groupings.ts index 7111d3e7f8ca4..47dc58997a469 100644 --- a/x-pack/legacy/plugins/infra/server/routes/metrics_explorer/lib/get_groupings.ts +++ b/x-pack/plugins/infra/server/routes/metrics_explorer/lib/get_groupings.ts @@ -6,7 +6,10 @@ import { isObject, set } from 'lodash'; import { InfraDatabaseSearchResponse } from '../../../lib/adapters/framework'; -import { MetricsExplorerRequestBody, MetricsExplorerResponse } from '../types'; +import { + MetricsExplorerRequestBody, + MetricsExplorerResponse, +} from '../../../../common/http_api/metrics_explorer'; interface GroupingAggregation { groupingsCount: { diff --git a/x-pack/legacy/plugins/infra/server/routes/metrics_explorer/lib/populate_series_with_tsvb_data.ts b/x-pack/plugins/infra/server/routes/metrics_explorer/lib/populate_series_with_tsvb_data.ts similarity index 98% rename from x-pack/legacy/plugins/infra/server/routes/metrics_explorer/lib/populate_series_with_tsvb_data.ts rename to x-pack/plugins/infra/server/routes/metrics_explorer/lib/populate_series_with_tsvb_data.ts index 347feca67aa99..3517800ea0dd1 100644 --- a/x-pack/legacy/plugins/infra/server/routes/metrics_explorer/lib/populate_series_with_tsvb_data.ts +++ b/x-pack/plugins/infra/server/routes/metrics_explorer/lib/populate_series_with_tsvb_data.ts @@ -12,7 +12,7 @@ import { MetricsExplorerSeries, MetricsExplorerRequestBody, MetricsExplorerColumn, -} from '../types'; +} from '../../../../common/http_api/metrics_explorer'; import { createMetricModel } from './create_metrics_model'; import { JsonObject } from '../../../../common/typed_json'; import { calculateMetricInterval } from '../../../utils/calculate_metric_interval'; diff --git a/x-pack/legacy/plugins/infra/server/routes/node_details/index.ts b/x-pack/plugins/infra/server/routes/node_details/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/routes/node_details/index.ts rename to x-pack/plugins/infra/server/routes/node_details/index.ts diff --git a/x-pack/legacy/plugins/infra/server/routes/snapshot/index.ts b/x-pack/plugins/infra/server/routes/snapshot/index.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/routes/snapshot/index.ts rename to x-pack/plugins/infra/server/routes/snapshot/index.ts diff --git a/x-pack/legacy/plugins/infra/server/saved_objects.ts b/x-pack/plugins/infra/server/saved_objects.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/saved_objects.ts rename to x-pack/plugins/infra/server/saved_objects.ts diff --git a/x-pack/legacy/plugins/infra/server/usage/usage_collector.ts b/x-pack/plugins/infra/server/usage/usage_collector.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/usage/usage_collector.ts rename to x-pack/plugins/infra/server/usage/usage_collector.ts diff --git a/x-pack/legacy/plugins/infra/server/utils/README.md b/x-pack/plugins/infra/server/utils/README.md similarity index 100% rename from x-pack/legacy/plugins/infra/server/utils/README.md rename to x-pack/plugins/infra/server/utils/README.md diff --git a/x-pack/legacy/plugins/infra/server/utils/calculate_metric_interval.ts b/x-pack/plugins/infra/server/utils/calculate_metric_interval.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/utils/calculate_metric_interval.ts rename to x-pack/plugins/infra/server/utils/calculate_metric_interval.ts diff --git a/x-pack/legacy/plugins/infra/server/utils/create_afterkey_handler.ts b/x-pack/plugins/infra/server/utils/create_afterkey_handler.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/utils/create_afterkey_handler.ts rename to x-pack/plugins/infra/server/utils/create_afterkey_handler.ts diff --git a/x-pack/legacy/plugins/infra/server/utils/elasticsearch_runtime_types.ts b/x-pack/plugins/infra/server/utils/elasticsearch_runtime_types.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/utils/elasticsearch_runtime_types.ts rename to x-pack/plugins/infra/server/utils/elasticsearch_runtime_types.ts diff --git a/x-pack/legacy/plugins/infra/server/utils/get_all_composite_data.ts b/x-pack/plugins/infra/server/utils/get_all_composite_data.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/utils/get_all_composite_data.ts rename to x-pack/plugins/infra/server/utils/get_all_composite_data.ts diff --git a/x-pack/legacy/plugins/infra/server/utils/get_interval_in_seconds.ts b/x-pack/plugins/infra/server/utils/get_interval_in_seconds.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/utils/get_interval_in_seconds.ts rename to x-pack/plugins/infra/server/utils/get_interval_in_seconds.ts diff --git a/x-pack/legacy/plugins/infra/server/utils/serialized_query.ts b/x-pack/plugins/infra/server/utils/serialized_query.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/utils/serialized_query.ts rename to x-pack/plugins/infra/server/utils/serialized_query.ts diff --git a/x-pack/legacy/plugins/infra/server/utils/typed_elasticsearch_mappings.ts b/x-pack/plugins/infra/server/utils/typed_elasticsearch_mappings.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/utils/typed_elasticsearch_mappings.ts rename to x-pack/plugins/infra/server/utils/typed_elasticsearch_mappings.ts diff --git a/x-pack/legacy/plugins/infra/server/utils/typed_resolvers.ts b/x-pack/plugins/infra/server/utils/typed_resolvers.ts similarity index 100% rename from x-pack/legacy/plugins/infra/server/utils/typed_resolvers.ts rename to x-pack/plugins/infra/server/utils/typed_resolvers.ts diff --git a/x-pack/legacy/plugins/infra/types/eui.d.ts b/x-pack/plugins/infra/types/eui.d.ts similarity index 100% rename from x-pack/legacy/plugins/infra/types/eui.d.ts rename to x-pack/plugins/infra/types/eui.d.ts diff --git a/x-pack/legacy/plugins/infra/types/eui_experimental.d.ts b/x-pack/plugins/infra/types/eui_experimental.d.ts similarity index 100% rename from x-pack/legacy/plugins/infra/types/eui_experimental.d.ts rename to x-pack/plugins/infra/types/eui_experimental.d.ts diff --git a/x-pack/legacy/plugins/infra/types/graphql_fields.d.ts b/x-pack/plugins/infra/types/graphql_fields.d.ts similarity index 100% rename from x-pack/legacy/plugins/infra/types/graphql_fields.d.ts rename to x-pack/plugins/infra/types/graphql_fields.d.ts diff --git a/x-pack/legacy/plugins/infra/types/redux_observable.d.ts b/x-pack/plugins/infra/types/redux_observable.d.ts similarity index 100% rename from x-pack/legacy/plugins/infra/types/redux_observable.d.ts rename to x-pack/plugins/infra/types/redux_observable.d.ts diff --git a/x-pack/plugins/observability/public/hooks/use_track_metric.tsx b/x-pack/plugins/observability/public/hooks/use_track_metric.tsx new file mode 100644 index 0000000000000..b146a80e89ea8 --- /dev/null +++ b/x-pack/plugins/observability/public/hooks/use_track_metric.tsx @@ -0,0 +1,92 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { useEffect, useMemo } from 'react'; +import { METRIC_TYPE, UiStatsMetricType } from '@kbn/analytics'; +import { UsageCollectionSetup } from 'src/plugins/usage_collection/public'; +import { useKibana } from '../../../../../src/plugins/kibana_react/public'; + +/** + * Note: The usage_collection plugin will take care of sending this data to the telemetry server. + * You can find these metrics stored at: + * stack_stats.kibana.plugins.ui_metric.{app}.{metric}(__delayed_{n}ms)? + * which will be an array of objects each containing a key, representing the metric, and + * a value, which will be a counter + */ + +type ObservabilityApp = 'infra_metrics' | 'infra_logs' | 'apm' | 'uptime'; + +interface TrackOptions { + app?: ObservabilityApp; + metricType?: UiStatsMetricType; + delay?: number; // in ms +} +type EffectDeps = unknown[]; + +interface ServiceDeps { + usageCollection: UsageCollectionSetup; // TODO: This should really be start. Looking into it. +} + +export type TrackMetricOptions = TrackOptions & { metric: string }; +export type UiTracker = ReturnType; + +export { METRIC_TYPE }; + +export function useUiTracker({ + app: defaultApp, +}: { app?: ObservabilityApp } = {}) { + const reportUiStats = useKibana().services?.usageCollection?.reportUiStats; + const trackEvent = useMemo(() => { + return ({ app = defaultApp, metric, metricType = METRIC_TYPE.COUNT }: TrackMetricOptions) => { + if (reportUiStats) { + reportUiStats(app as string, metricType, metric); + } + }; + }, [defaultApp, reportUiStats]); + return trackEvent; +} + +export function useTrackMetric( + { app, metric, metricType = METRIC_TYPE.COUNT, delay = 0 }: TrackMetricOptions, + effectDependencies: EffectDeps = [] +) { + const reportUiStats = useKibana().services?.usageCollection?.reportUiStats; + + useEffect(() => { + if (!reportUiStats) { + // eslint-disable-next-line no-console + console.log( + 'usageCollection.reportUiStats is unavailable. Ensure this is setup via .' + ); + } else { + let decoratedMetric = metric; + if (delay > 0) { + decoratedMetric += `__delayed_${delay}ms`; + } + const id = setTimeout( + () => reportUiStats(app as string, metricType, decoratedMetric), + Math.max(delay, 0) + ); + return () => clearTimeout(id); + } + // the dependencies are managed externally + // eslint-disable-next-line react-hooks/exhaustive-deps + }, effectDependencies); +} + +/** + * useTrackPageview is a convenience wrapper for tracking a pageview + * Its metrics will be found at: + * stack_stats.kibana.plugins.ui_metric.{app}.pageview__{path}(__delayed_{n}ms)? + */ +type TrackPageviewProps = TrackOptions & { path: string }; + +export function useTrackPageview( + { path, ...rest }: TrackPageviewProps, + effectDependencies: EffectDeps = [] +) { + useTrackMetric({ ...rest, metric: `pageview__${path}` }, effectDependencies); +} diff --git a/x-pack/plugins/observability/public/index.ts b/x-pack/plugins/observability/public/index.ts index c822edc3f4de8..dd8bca90cff4f 100644 --- a/x-pack/plugins/observability/public/index.ts +++ b/x-pack/plugins/observability/public/index.ts @@ -14,3 +14,13 @@ export const plugin: PluginInitializer = ( }; export * from './components/action_menu'; + +export { + useTrackPageview, + useUiTracker, + UiTracker, + TrackMetricOptions, + METRIC_TYPE, +} from './hooks/use_track_metric'; + +export * from './typings'; diff --git a/x-pack/plugins/observability/public/typings/eui_draggable/index.ts b/x-pack/plugins/observability/public/typings/eui_draggable/index.ts new file mode 100644 index 0000000000000..322966b3c982e --- /dev/null +++ b/x-pack/plugins/observability/public/typings/eui_draggable/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; + * you may not use this file except in compliance with the Elastic License. + */ + +import React from 'react'; +import { EuiDraggable, EuiDragDropContext } from '@elastic/eui'; + +type PropsOf = T extends React.ComponentType ? ComponentProps : never; +type FirstArgumentOf = Func extends (arg1: infer FirstArgument, ...rest: any[]) => any + ? FirstArgument + : never; +export type DragHandleProps = FirstArgumentOf< + Exclude['children'], React.ReactElement> +>['dragHandleProps']; +export type DropResult = FirstArgumentOf['onDragEnd']>; diff --git a/x-pack/plugins/observability/public/typings/eui_styled_components.tsx b/x-pack/plugins/observability/public/typings/eui_styled_components.tsx new file mode 100644 index 0000000000000..aab16f9d79c4b --- /dev/null +++ b/x-pack/plugins/observability/public/typings/eui_styled_components.tsx @@ -0,0 +1,45 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import React from 'react'; +import * as styledComponents from 'styled-components'; +import { ThemedStyledComponentsModule, ThemeProvider, ThemeProviderProps } from 'styled-components'; + +import euiDarkVars from '@elastic/eui/dist/eui_theme_dark.json'; +import euiLightVars from '@elastic/eui/dist/eui_theme_light.json'; + +export interface EuiTheme { + eui: typeof euiLightVars | typeof euiDarkVars; + darkMode: boolean; +} + +const EuiThemeProvider = < + OuterTheme extends styledComponents.DefaultTheme = styledComponents.DefaultTheme +>({ + darkMode = false, + ...otherProps +}: Omit, 'theme'> & { + darkMode?: boolean; +}) => ( + ({ + ...outerTheme, + eui: darkMode ? euiDarkVars : euiLightVars, + darkMode, + })} + /> +); + +const { + default: euiStyled, + css, + createGlobalStyle, + keyframes, + withTheme, +} = (styledComponents as unknown) as ThemedStyledComponentsModule; + +export { css, euiStyled, EuiThemeProvider, createGlobalStyle, keyframes, withTheme }; diff --git a/x-pack/plugins/observability/public/typings/index.ts b/x-pack/plugins/observability/public/typings/index.ts new file mode 100644 index 0000000000000..3da2febc73efd --- /dev/null +++ b/x-pack/plugins/observability/public/typings/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; + * you may not use this file except in compliance with the Elastic License. + */ + +export * from './eui_draggable'; +export * from './eui_styled_components'; diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 505e55f8dc30c..83f116ab1c306 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -7053,10 +7053,8 @@ "xpack.infra.homePage.noMetricsIndicesTitle": "メトリックインデックスがないようです。", "xpack.infra.homePage.settingsTabTitle": "設定", "xpack.infra.homePage.toolbar.kqlSearchFieldPlaceholder": "インフラストラクチャーデータを検索… (例: host.name:host-1)", - "xpack.infra.infrastructureDescription": "インフラストラクチャーを閲覧します", "xpack.infra.infrastructureMetricsExplorerPage.documentTitle": "{previousTitle} | メトリックエクスプローラー", "xpack.infra.infrastructureSnapshotPage.documentTitle": "{previousTitle} | インベントリ", - "xpack.infra.infrastructureTitle": "メトリック", "xpack.infra.kibanaMetrics.cloudIdMissingErrorMessage": "{metricId} のモデルには cloudId が必要ですが、{nodeId} に cloudId が指定されていません。", "xpack.infra.kibanaMetrics.invalidInfraMetricErrorMessage": "{id} は有効な InfraMetric ではありません", "xpack.infra.kibanaMetrics.nodeDoesNotExistErrorMessage": "{nodeId} が存在しません。", @@ -7066,10 +7064,6 @@ "xpack.infra.legendControls.maxLabel": "最高", "xpack.infra.legendControls.minLabel": "最低", "xpack.infra.legendControls.switchLabel": "自動計算範囲", - "xpack.infra.linkInfrastructureDescription": "インフラストラクチャーを閲覧します", - "xpack.infra.linkInfrastructureTitle": "メトリック", - "xpack.infra.linkLogsDescription": "ログを閲覧します", - "xpack.infra.linkLogsTitle": "ログ", "xpack.infra.linkTo.hostWithIp.error": "IP アドレス「{hostIp}」でホストが見つかりません.", "xpack.infra.linkTo.hostWithIp.loading": "IP アドレス「{hostIp}」のホストを読み込み中", "xpack.infra.logEntryActionsMenu.apmActionLabel": "APMで表示", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index fe733f0abd24b..ed583112a70cb 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -7052,10 +7052,8 @@ "xpack.infra.homePage.noMetricsIndicesTitle": "似乎您没有任何指标索引。", "xpack.infra.homePage.settingsTabTitle": "设置", "xpack.infra.homePage.toolbar.kqlSearchFieldPlaceholder": "搜索基础设施数据……(例如 host.name:host-1)", - "xpack.infra.infrastructureDescription": "浏览您的基础设施", "xpack.infra.infrastructureMetricsExplorerPage.documentTitle": "{previousTitle} | 指标浏览器", "xpack.infra.infrastructureSnapshotPage.documentTitle": "{previousTitle} | 库存", - "xpack.infra.infrastructureTitle": "指标", "xpack.infra.kibanaMetrics.cloudIdMissingErrorMessage": "{metricId} 的模型需要云 ID,但没有为 {nodeId} 提供。", "xpack.infra.kibanaMetrics.invalidInfraMetricErrorMessage": "{id} 不是有效的 InfraMetric", "xpack.infra.kibanaMetrics.nodeDoesNotExistErrorMessage": "{nodeId} 不存在。", @@ -7065,10 +7063,6 @@ "xpack.infra.legendControls.maxLabel": "最大值", "xpack.infra.legendControls.minLabel": "最小值", "xpack.infra.legendControls.switchLabel": "自动计算范围", - "xpack.infra.linkInfrastructureDescription": "浏览您的基础设施", - "xpack.infra.linkInfrastructureTitle": "指标", - "xpack.infra.linkLogsDescription": "浏览您的日志", - "xpack.infra.linkLogsTitle": "鏃ュ織", "xpack.infra.linkTo.hostWithIp.error": "未找到 IP 地址为“{hostIp}”的主机。", "xpack.infra.linkTo.hostWithIp.loading": "正在加载 IP 地址为“{hostIp}”的主机。", "xpack.infra.logEntryActionsMenu.apmActionLabel": "在 APM 中查看", diff --git a/x-pack/test/api_integration/apis/infra/ip_to_hostname.ts b/x-pack/test/api_integration/apis/infra/ip_to_hostname.ts index 5d1a519efb5b9..3821e4b5aab0e 100644 --- a/x-pack/test/api_integration/apis/infra/ip_to_hostname.ts +++ b/x-pack/test/api_integration/apis/infra/ip_to_hostname.ts @@ -6,7 +6,6 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; -import { IpToHostResponse } from '../../../../legacy/plugins/infra/server/routes/ip_to_hostname'; export default function ipToHostNameTest({ getService }: FtrProviderContext) { const supertest = getService('supertest'); @@ -27,8 +26,7 @@ export default function ipToHostNameTest({ getService }: FtrProviderContext) { .send(postBody) .expect(200); - const body: IpToHostResponse = response.body; - expect(body).to.have.property('host', 'demo-stack-mysql-01'); + expect(response.body).to.have.property('host', 'demo-stack-mysql-01'); }); it('should return 404 for invalid ip', async () => { diff --git a/x-pack/test/api_integration/apis/infra/log_analysis.ts b/x-pack/test/api_integration/apis/infra/log_analysis.ts index 2e57678d1d4c2..2f27b5d5b7021 100644 --- a/x-pack/test/api_integration/apis/infra/log_analysis.ts +++ b/x-pack/test/api_integration/apis/infra/log_analysis.ts @@ -13,11 +13,8 @@ import { LOG_ANALYSIS_GET_LOG_ENTRY_RATE_PATH, getLogEntryRateRequestPayloadRT, getLogEntryRateSuccessReponsePayloadRT, -} from '../../../../legacy/plugins/infra/common/http_api/log_analysis'; -import { - createPlainError, - throwErrors, -} from '../../../../legacy/plugins/infra/common/runtime_types'; +} from '../../../../plugins/infra/common/http_api/log_analysis'; +import { createPlainError, throwErrors } from '../../../../plugins/infra/common/runtime_types'; import { FtrProviderContext } from '../../ftr_provider_context'; const TIME_BEFORE_START = 1569934800000; diff --git a/x-pack/test/api_integration/apis/infra/log_entries.ts b/x-pack/test/api_integration/apis/infra/log_entries.ts index 8db1426a219d4..75e7750058a87 100644 --- a/x-pack/test/api_integration/apis/infra/log_entries.ts +++ b/x-pack/test/api_integration/apis/infra/log_entries.ts @@ -13,19 +13,16 @@ import { pipe } from 'fp-ts/lib/pipeable'; import { identity } from 'fp-ts/lib/function'; import { fold } from 'fp-ts/lib/Either'; -import { - createPlainError, - throwErrors, -} from '../../../../legacy/plugins/infra/common/runtime_types'; +import { createPlainError, throwErrors } from '../../../../plugins/infra/common/runtime_types'; import { LOG_ENTRIES_PATH, logEntriesRequestRT, logEntriesResponseRT, -} from '../../../../legacy/plugins/infra/common/http_api'; +} from '../../../../plugins/infra/common/http_api'; -import { sharedFragments } from '../../../../legacy/plugins/infra/common/graphql/shared'; -import { InfraTimeKey } from '../../../../legacy/plugins/infra/public/graphql/types'; +import { sharedFragments } from '../../../../plugins/infra/common/graphql/shared'; +import { InfraTimeKey } from '../../../../plugins/infra/public/graphql/types'; import { FtrProviderContext } from '../../ftr_provider_context'; const KEY_WITHIN_DATA_RANGE = { diff --git a/x-pack/test/api_integration/apis/infra/log_entry_highlights.ts b/x-pack/test/api_integration/apis/infra/log_entry_highlights.ts index d0692d4b45044..0473ddffbe807 100644 --- a/x-pack/test/api_integration/apis/infra/log_entry_highlights.ts +++ b/x-pack/test/api_integration/apis/infra/log_entry_highlights.ts @@ -12,20 +12,17 @@ import { pipe } from 'fp-ts/lib/pipeable'; import { identity } from 'fp-ts/lib/function'; import { fold } from 'fp-ts/lib/Either'; -import { - createPlainError, - throwErrors, -} from '../../../../legacy/plugins/infra/common/runtime_types'; +import { createPlainError, throwErrors } from '../../../../plugins/infra/common/runtime_types'; import { LOG_ENTRIES_HIGHLIGHTS_PATH, logEntriesHighlightsRequestRT, logEntriesHighlightsResponseRT, -} from '../../../../legacy/plugins/infra/common/http_api'; +} from '../../../../plugins/infra/common/http_api'; import { FtrProviderContext } from '../../ftr_provider_context'; -import { sharedFragments } from '../../../../legacy/plugins/infra/common/graphql/shared'; -import { InfraTimeKey } from '../../../../legacy/plugins/infra/public/graphql/types'; +import { sharedFragments } from '../../../../plugins/infra/common/graphql/shared'; +import { InfraTimeKey } from '../../../../plugins/infra/public/graphql/types'; const KEY_BEFORE_START = { time: new Date('2000-01-01T00:00:00.000Z').valueOf(), diff --git a/x-pack/test/api_integration/apis/infra/log_item.ts b/x-pack/test/api_integration/apis/infra/log_item.ts index bae2d0ebb891b..5a8e88c0aad62 100644 --- a/x-pack/test/api_integration/apis/infra/log_item.ts +++ b/x-pack/test/api_integration/apis/infra/log_item.ts @@ -10,7 +10,7 @@ import { FtrProviderContext } from '../../ftr_provider_context'; import { LOG_ENTRIES_ITEM_PATH, logEntriesItemRequestRT, -} from '../../../../legacy/plugins/infra/common/http_api'; +} from '../../../../plugins/infra/common/http_api'; const COMMON_HEADERS = { 'kbn-xsrf': 'some-xsrf-token', diff --git a/x-pack/test/api_integration/apis/infra/log_summary.ts b/x-pack/test/api_integration/apis/infra/log_summary.ts index 017b1c6f7ab45..15e503f7b4a5a 100644 --- a/x-pack/test/api_integration/apis/infra/log_summary.ts +++ b/x-pack/test/api_integration/apis/infra/log_summary.ts @@ -12,16 +12,13 @@ import { pipe } from 'fp-ts/lib/pipeable'; import { identity } from 'fp-ts/lib/function'; import { fold } from 'fp-ts/lib/Either'; -import { - createPlainError, - throwErrors, -} from '../../../../legacy/plugins/infra/common/runtime_types'; +import { createPlainError, throwErrors } from '../../../../plugins/infra/common/runtime_types'; import { LOG_ENTRIES_SUMMARY_PATH, logEntriesSummaryRequestRT, logEntriesSummaryResponseRT, -} from '../../../../legacy/plugins/infra/common/http_api/log_entries'; +} from '../../../../plugins/infra/common/http_api/log_entries'; import { FtrProviderContext } from '../../ftr_provider_context'; diff --git a/x-pack/test/api_integration/apis/infra/logs_without_millis.ts b/x-pack/test/api_integration/apis/infra/logs_without_millis.ts index ce2319259985b..9295380cfbec1 100644 --- a/x-pack/test/api_integration/apis/infra/logs_without_millis.ts +++ b/x-pack/test/api_integration/apis/infra/logs_without_millis.ts @@ -12,19 +12,16 @@ import { pipe } from 'fp-ts/lib/pipeable'; import { identity } from 'fp-ts/lib/function'; import { fold } from 'fp-ts/lib/Either'; -import { - createPlainError, - throwErrors, -} from '../../../../legacy/plugins/infra/common/runtime_types'; +import { createPlainError, throwErrors } from '../../../../plugins/infra/common/runtime_types'; import { FtrProviderContext } from '../../ftr_provider_context'; -import { sharedFragments } from '../../../../legacy/plugins/infra/common/graphql/shared'; -import { InfraTimeKey } from '../../../../legacy/plugins/infra/public/graphql/types'; +import { sharedFragments } from '../../../../plugins/infra/common/graphql/shared'; +import { InfraTimeKey } from '../../../../plugins/infra/public/graphql/types'; import { LOG_ENTRIES_SUMMARY_PATH, logEntriesSummaryRequestRT, logEntriesSummaryResponseRT, -} from '../../../../legacy/plugins/infra/common/http_api/log_entries'; +} from '../../../../plugins/infra/common/http_api/log_entries'; const COMMON_HEADERS = { 'kbn-xsrf': 'some-xsrf-token', diff --git a/x-pack/test/api_integration/apis/infra/metadata.ts b/x-pack/test/api_integration/apis/infra/metadata.ts index ac3fa06d958dd..b693881abcdf7 100644 --- a/x-pack/test/api_integration/apis/infra/metadata.ts +++ b/x-pack/test/api_integration/apis/infra/metadata.ts @@ -5,11 +5,11 @@ */ import expect from '@kbn/expect'; -import { InfraNodeType } from '../../../../legacy/plugins/infra/server/graphql/types'; +import { InfraNodeType } from '../../../../plugins/infra/server/graphql/types'; import { InfraMetadata, InfraMetadataRequest, -} from '../../../../legacy/plugins/infra/common/http_api/metadata_api'; +} from '../../../../plugins/infra/common/http_api/metadata_api'; import { FtrProviderContext } from '../../ftr_provider_context'; export default function({ getService }: FtrProviderContext) { diff --git a/x-pack/test/api_integration/apis/infra/metrics.ts b/x-pack/test/api_integration/apis/infra/metrics.ts index 432b95163b4c1..f373bb788930d 100644 --- a/x-pack/test/api_integration/apis/infra/metrics.ts +++ b/x-pack/test/api_integration/apis/infra/metrics.ts @@ -7,16 +7,13 @@ import expect from '@kbn/expect'; import { first, last } from 'lodash'; -import { InventoryMetric } from '../../../../legacy/plugins/infra/common/inventory_models/types'; -import { - InfraNodeType, - InfraTimerangeInput, -} from '../../../../legacy/plugins/infra/public/graphql/types'; +import { InventoryMetric } from '../../../../plugins/infra/common/inventory_models/types'; +import { InfraNodeType, InfraTimerangeInput } from '../../../../plugins/infra/public/graphql/types'; import { FtrProviderContext } from '../../ftr_provider_context'; import { DATES } from './constants'; -import { NodeDetailsMetricDataResponse } from '../../../../legacy/plugins/infra/common/http_api/node_details_api'; +import { NodeDetailsMetricDataResponse } from '../../../../plugins/infra/common/http_api/node_details_api'; const { min, max } = DATES['7.0.0'].hosts; interface NodeDetailsRequest { diff --git a/x-pack/test/api_integration/apis/infra/metrics_explorer.ts b/x-pack/test/api_integration/apis/infra/metrics_explorer.ts index ee81b665adbe6..1563ae208867c 100644 --- a/x-pack/test/api_integration/apis/infra/metrics_explorer.ts +++ b/x-pack/test/api_integration/apis/infra/metrics_explorer.ts @@ -8,8 +8,9 @@ import expect from '@kbn/expect'; import { first } from 'lodash'; import moment from 'moment'; import { DATES } from './constants'; -import { MetricsExplorerResponse } from '../../../../legacy/plugins/infra/server/routes/metrics_explorer/types'; import { FtrProviderContext } from '../../ftr_provider_context'; +import { metricsExplorerResponseRT } from '../../../../plugins/infra/common/http_api/metrics_explorer'; +import { decodeOrThrow } from '../../../../plugins/infra/common/runtime_types'; const { min, max } = DATES['7.0.0'].hosts; @@ -48,20 +49,17 @@ export default function({ getService }: FtrProviderContext) { .set('kbn-xsrf', 'xxx') .send(postBody) .expect(200); - const body: MetricsExplorerResponse = response.body; - expect(body).to.have.property('series'); + const body = decodeOrThrow(metricsExplorerResponseRT)(response.body); expect(body.series).length(1); const firstSeries = first(body.series); expect(firstSeries).to.have.property('id', 'ALL'); - expect(firstSeries).to.have.property('columns'); - expect(firstSeries).to.have.property('rows'); - expect(firstSeries!.columns).to.eql([ + expect(firstSeries.columns).to.eql([ { name: 'timestamp', type: 'date' }, { name: 'metric_0', type: 'number' }, { name: 'metric_1', type: 'number' }, ]); - expect(firstSeries!.rows).to.have.length(9); - expect(firstSeries!.rows![1]).to.eql({ + expect(firstSeries.rows).to.have.length(9); + expect(firstSeries.rows![1]).to.eql({ metric_0: 0.005333333333333333, metric_1: 131, timestamp: 1547571300000, @@ -92,19 +90,16 @@ export default function({ getService }: FtrProviderContext) { .set('kbn-xsrf', 'xxx') .send(postBody) .expect(200); - const body: MetricsExplorerResponse = response.body; - expect(body).to.have.property('series'); + const body = decodeOrThrow(metricsExplorerResponseRT)(response.body); expect(body.series).length(1); const firstSeries = first(body.series); expect(firstSeries).to.have.property('id', 'ALL'); - expect(firstSeries).to.have.property('columns'); - expect(firstSeries).to.have.property('rows'); - expect(firstSeries!.columns).to.eql([ + expect(firstSeries.columns).to.eql([ { name: 'timestamp', type: 'date' }, { name: 'metric_0', type: 'number' }, ]); - expect(firstSeries!.rows).to.have.length(9); - expect(firstSeries!.rows![1]).to.eql({ + expect(firstSeries.rows).to.have.length(9); + expect(firstSeries.rows![1]).to.eql({ metric_0: 0.024, timestamp: 1547571300000, }); @@ -126,15 +121,12 @@ export default function({ getService }: FtrProviderContext) { .set('kbn-xsrf', 'xxx') .send(postBody) .expect(200); - const body: MetricsExplorerResponse = response.body; - expect(body).to.have.property('series'); + const body = decodeOrThrow(metricsExplorerResponseRT)(response.body); expect(body.series).length(1); const firstSeries = first(body.series); expect(firstSeries).to.have.property('id', 'ALL'); - expect(firstSeries).to.have.property('columns'); - expect(firstSeries).to.have.property('rows'); - expect(firstSeries!.columns).to.eql([]); - expect(firstSeries!.rows).to.have.length(0); + expect(firstSeries.columns).to.eql([]); + expect(firstSeries.rows).to.have.length(0); }); it('should work with groupBy', async () => { @@ -161,25 +153,21 @@ export default function({ getService }: FtrProviderContext) { .set('kbn-xsrf', 'xxx') .send(postBody) .expect(200); - const body: MetricsExplorerResponse = response.body; - expect(body).to.have.property('series'); + const body = decodeOrThrow(metricsExplorerResponseRT)(response.body); expect(body.series).length(3); const firstSeries = first(body.series); expect(firstSeries).to.have.property('id', 'system.diskio'); - expect(firstSeries).to.have.property('columns'); - expect(firstSeries).to.have.property('rows'); - expect(firstSeries!.columns).to.eql([ + expect(firstSeries.columns).to.eql([ { name: 'timestamp', type: 'date' }, { name: 'metric_0', type: 'number' }, { name: 'groupBy', type: 'string' }, ]); - expect(firstSeries!.rows).to.have.length(9); - expect(firstSeries!.rows![1]).to.eql({ + expect(firstSeries.rows).to.have.length(9); + expect(firstSeries.rows![1]).to.eql({ groupBy: 'system.diskio', metric_0: 24, timestamp: 1547571300000, }); - expect(body).to.have.property('pageInfo'); expect(body.pageInfo).to.eql({ afterKey: 'system.fsstat', total: 12, @@ -212,12 +200,10 @@ export default function({ getService }: FtrProviderContext) { .set('kbn-xsrf', 'xxx') .send(postBody) .expect(200); - const body: MetricsExplorerResponse = response.body; - expect(body).to.have.property('series'); + const body = decodeOrThrow(metricsExplorerResponseRT)(response.body); expect(body.series).length(1); expect(body.series[0]!).to.have.property('rows'); expect(body.series[0]!.rows).length(0); - expect(body).to.have.property('pageInfo'); expect(body.pageInfo).to.eql({ afterKey: null, total: 0, @@ -248,10 +234,8 @@ export default function({ getService }: FtrProviderContext) { .set('kbn-xsrf', 'xxx') .send(postBody) .expect(200); - const body: MetricsExplorerResponse = response.body; - expect(body).to.have.property('series'); + const body = decodeOrThrow(metricsExplorerResponseRT)(response.body); expect(body.series).length(0); - expect(body).to.have.property('pageInfo'); expect(body.pageInfo).to.eql({ afterKey: null, total: 0, diff --git a/x-pack/test/api_integration/apis/infra/sources.ts b/x-pack/test/api_integration/apis/infra/sources.ts index 8e51610d208be..fb8ab1d0592a0 100644 --- a/x-pack/test/api_integration/apis/infra/sources.ts +++ b/x-pack/test/api_integration/apis/infra/sources.ts @@ -7,14 +7,14 @@ import expect from '@kbn/expect'; import gql from 'graphql-tag'; -import { sourceQuery } from '../../../../legacy/plugins/infra/public/containers/source/query_source.gql_query'; +import { sourceQuery } from '../../../../plugins/infra/public/containers/source/query_source.gql_query'; import { sourceConfigurationFieldsFragment, sourceStatusFieldsFragment, -} from '../../../../legacy/plugins/infra/public/containers/source/source_fields_fragment.gql_query'; -import { SourceQuery } from '../../../../legacy/plugins/infra/public/graphql/types'; +} from '../../../../plugins/infra/public/containers/source/source_fields_fragment.gql_query'; +import { SourceQuery } from '../../../../plugins/infra/public/graphql/types'; import { FtrProviderContext } from '../../ftr_provider_context'; -import { sharedFragments } from '../../../../legacy/plugins/infra/common/graphql/shared'; +import { sharedFragments } from '../../../../plugins/infra/common/graphql/shared'; export default function({ getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); diff --git a/x-pack/test/api_integration/apis/infra/waffle.ts b/x-pack/test/api_integration/apis/infra/waffle.ts index 1f79ad4eee4e5..80fea1cdcd295 100644 --- a/x-pack/test/api_integration/apis/infra/waffle.ts +++ b/x-pack/test/api_integration/apis/infra/waffle.ts @@ -12,9 +12,9 @@ import { InfraNodeType, InfraTimerangeInput, InfraSnapshotGroupbyInput, -} from '../../../../legacy/plugins/infra/server/graphql/types'; +} from '../../../../plugins/infra/server/graphql/types'; import { FtrProviderContext } from '../../ftr_provider_context'; -import { SnapshotNodeResponse } from '../../../../legacy/plugins/infra/common/http_api/snapshot_api'; +import { SnapshotNodeResponse } from '../../../../plugins/infra/common/http_api/snapshot_api'; import { DATES } from './constants'; interface SnapshotRequest { diff --git a/x-pack/test/api_integration/services/infraops_graphql_client.ts b/x-pack/test/api_integration/services/infraops_graphql_client.ts index 33d1a59575c17..7236bbd82f3f0 100644 --- a/x-pack/test/api_integration/services/infraops_graphql_client.ts +++ b/x-pack/test/api_integration/services/infraops_graphql_client.ts @@ -12,7 +12,7 @@ import { HttpLink } from 'apollo-link-http'; import { FtrProviderContext } from '../ftr_provider_context'; -import introspectionQueryResultData from '../../../legacy/plugins/infra/public/graphql/introspection.json'; +import introspectionQueryResultData from '../../../plugins/infra/public/graphql/introspection.json'; export function InfraOpsGraphQLClientProvider(context: FtrProviderContext) { return InfraOpsGraphQLClientFactoryProvider(context)(); diff --git a/x-pack/test/api_integration/services/infraops_source_configuration.ts b/x-pack/test/api_integration/services/infraops_source_configuration.ts index facfe485ab88a..728a58829d1ce 100644 --- a/x-pack/test/api_integration/services/infraops_source_configuration.ts +++ b/x-pack/test/api_integration/services/infraops_source_configuration.ts @@ -7,10 +7,7 @@ import gql from 'graphql-tag'; import { FtrProviderContext } from '../ftr_provider_context'; -import { - UpdateSourceInput, - UpdateSourceResult, -} from '../../../legacy/plugins/infra/public/graphql/types'; +import { UpdateSourceInput, UpdateSourceResult } from '../../../plugins/infra/public/graphql/types'; const createSourceMutation = gql` mutation createSource($sourceId: ID!, $sourceProperties: UpdateSourceInput!) { diff --git a/x-pack/test/functional/apps/endpoint/feature_controls/endpoint_spaces.ts b/x-pack/test/functional/apps/endpoint/feature_controls/endpoint_spaces.ts index bda336e73c4f8..287892903dd2b 100644 --- a/x-pack/test/functional/apps/endpoint/feature_controls/endpoint_spaces.ts +++ b/x-pack/test/functional/apps/endpoint/feature_controls/endpoint_spaces.ts @@ -42,11 +42,16 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { }); it(`endpoint management shows 'Manage Endpoints'`, async () => { - await pageObjects.common.navigateToUrlWithBrowserHistory('endpoint', '/management', { - basePath: '/s/custom_space', - ensureCurrentUrl: false, - shouldLoginIfPrompted: false, - }); + await pageObjects.common.navigateToUrlWithBrowserHistory( + 'endpoint', + '/management', + undefined, + { + basePath: '/s/custom_space', + ensureCurrentUrl: false, + shouldLoginIfPrompted: false, + } + ); await testSubjects.existOrFail('managementViewTitle'); }); }); diff --git a/x-pack/test/functional/apps/infra/feature_controls/infrastructure_security.ts b/x-pack/test/functional/apps/infra/feature_controls/infrastructure_security.ts index 4e5ea3298d894..6ab7bedb34ad1 100644 --- a/x-pack/test/functional/apps/infra/feature_controls/infrastructure_security.ts +++ b/x-pack/test/functional/apps/infra/feature_controls/infrastructure_security.ts @@ -66,7 +66,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { describe('infrastructure landing page without data', () => { it(`shows 'Change source configuration' button`, async () => { - await PageObjects.common.navigateToActualUrl('infraOps', 'home', { + await PageObjects.common.navigateToUrlWithBrowserHistory('infraOps', '', undefined, { ensureCurrentUrl: true, shouldLoginIfPrompted: false, }); @@ -89,7 +89,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { }); it(`shows Wafflemap`, async () => { - await PageObjects.common.navigateToActualUrl('infraOps', 'home', { + await PageObjects.common.navigateToUrlWithBrowserHistory('infraOps', '', undefined, { ensureCurrentUrl: true, shouldLoginIfPrompted: false, }); @@ -121,9 +121,10 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { }); it(`metrics page is visible`, async () => { - await PageObjects.common.navigateToActualUrl( + await PageObjects.common.navigateToUrlWithBrowserHistory( 'infraOps', - '/metrics/host/demo-stack-redis-01', + '/detail/host/demo-stack-redis-01', + undefined, { ensureCurrentUrl: false, shouldLoginIfPrompted: false, @@ -181,7 +182,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { describe('infrastructure landing page without data', () => { it(`doesn't show 'Change source configuration' button`, async () => { - await PageObjects.common.navigateToActualUrl('infraOps', 'home', { + await PageObjects.common.navigateToUrlWithBrowserHistory('infraOps', '', undefined, { ensureCurrentUrl: true, shouldLoginIfPrompted: false, }); @@ -204,7 +205,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { }); it(`shows Wafflemap`, async () => { - await PageObjects.common.navigateToActualUrl('infraOps', 'home', { + await PageObjects.common.navigateToUrlWithBrowserHistory('infraOps', '', undefined, { ensureCurrentUrl: true, shouldLoginIfPrompted: false, }); @@ -236,9 +237,10 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { }); it(`metrics page is visible`, async () => { - await PageObjects.common.navigateToActualUrl( + await PageObjects.common.navigateToUrlWithBrowserHistory( 'infraOps', - '/metrics/host/demo-stack-redis-01', + '/detail/host/demo-stack-redis-01', + undefined, { ensureCurrentUrl: false, shouldLoginIfPrompted: false, @@ -300,7 +302,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { }); it(`context menu allows user to view logs`, async () => { - await PageObjects.common.navigateToActualUrl('infraOps', 'home', { + await PageObjects.common.navigateToUrlWithBrowserHistory('infraOps', '', undefined, { ensureCurrentUrl: true, shouldLoginIfPrompted: false, }); @@ -366,7 +368,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { }); it(`context menu allows user to view APM traces`, async () => { - await PageObjects.common.navigateToActualUrl('infraOps', 'home', { + await PageObjects.common.navigateToUrlWithBrowserHistory('infraOps', '', undefined, { ensureCurrentUrl: true, shouldLoginIfPrompted: false, }); @@ -421,48 +423,19 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { expect(navLinks).to.not.contain(['Metrics']); }); - it(`infrastructure root renders not found page`, async () => { - await PageObjects.common.navigateToActualUrl('infraOps', '', { - ensureCurrentUrl: false, - shouldLoginIfPrompted: false, - }); - await testSubjects.existOrFail('infraNotFoundPage'); - }); - - it(`infrastructure home page renders not found page`, async () => { - await PageObjects.common.navigateToActualUrl('infraOps', 'home', { - ensureCurrentUrl: false, - shouldLoginIfPrompted: false, - }); - await testSubjects.existOrFail('infraNotFoundPage'); - }); - - it(`infrastructure landing page renders not found page`, async () => { - await PageObjects.common.navigateToActualUrl('infraOps', 'infrastructure', { - ensureCurrentUrl: false, - shouldLoginIfPrompted: false, - }); - await testSubjects.existOrFail('infraNotFoundPage'); - }); - - it(`infrastructure snapshot page renders not found page`, async () => { - await PageObjects.common.navigateToActualUrl('infraOps', 'infrastructure/inventory', { - ensureCurrentUrl: false, - shouldLoginIfPrompted: false, - }); - await testSubjects.existOrFail('infraNotFoundPage'); - }); - - it(`metrics page renders not found page`, async () => { - await PageObjects.common.navigateToActualUrl( + it(`metrics app is inaccessible and Application Not Found message is rendered`, async () => { + await PageObjects.common.navigateToApp('infraOps'); + await testSubjects.existOrFail('~appNotFoundPageContent'); + await PageObjects.common.navigateToUrlWithBrowserHistory( 'infraOps', - '/metrics/host/demo-stack-redis-01', + '/inventory', + undefined, { ensureCurrentUrl: false, shouldLoginIfPrompted: false, } ); - await testSubjects.existOrFail('infraNotFoundPage'); + await testSubjects.existOrFail('~appNotFoundPageContent'); }); }); }); diff --git a/x-pack/test/functional/apps/infra/feature_controls/infrastructure_spaces.ts b/x-pack/test/functional/apps/infra/feature_controls/infrastructure_spaces.ts index 858f8ed78a3b1..3bbcc1aa7043c 100644 --- a/x-pack/test/functional/apps/infra/feature_controls/infrastructure_spaces.ts +++ b/x-pack/test/functional/apps/infra/feature_controls/infrastructure_spaces.ts @@ -5,9 +5,6 @@ */ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../../ftr_provider_context'; -import { DATES } from '../constants'; - -const DATE_WITH_DATA = DATES.metricsAndLogs.hosts.withData; export default function({ getPageObjects, getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); @@ -21,22 +18,20 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { ]); const testSubjects = getService('testSubjects'); const appsMenu = getService('appsMenu'); - const retry = getService('retry'); describe('infrastructure spaces', () => { before(async () => { - await esArchiver.load('infra/metrics_and_logs'); + await esArchiver.load('empty_kibana'); }); after(async () => { - await esArchiver.unload('infra/metrics_and_logs'); + await esArchiver.unload('empty_kibana'); }); describe('space with no features disabled', () => { before(async () => { // we need to load the following in every situation as deleting // a space deletes all of the associated saved objects - await esArchiver.load('empty_kibana'); await spacesService.create({ id: 'custom_space', name: 'custom_space', @@ -46,7 +41,6 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { after(async () => { await spacesService.delete('custom_space'); - await esArchiver.unload('empty_kibana'); }); it('shows Metrics navlink', async () => { @@ -58,29 +52,11 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { expect(navLinks).to.contain('Metrics'); }); - it(`landing page shows Wafflemap`, async () => { - await PageObjects.common.navigateToActualUrl('infraOps', 'home', { + it(`Metrics app is accessible`, async () => { + await PageObjects.common.navigateToApp('infraOps', { basePath: '/s/custom_space', - ensureCurrentUrl: true, - }); - await PageObjects.infraHome.goToTime(DATE_WITH_DATA); - await testSubjects.existOrFail('waffleMap'); - }); - - describe('context menu', () => { - before(async () => { - await testSubjects.click('nodeContainer'); - }); - - it(`shows link to view logs`, async () => { - await retry.waitFor('context menu', () => testSubjects.exists('nodeContextMenu')); - await testSubjects.existOrFail('viewLogsContextMenuItem'); - }); - - it(`shows link to view apm traces`, async () => { - await retry.waitFor('context menu', () => testSubjects.exists('nodeContextMenu')); - await testSubjects.existOrFail('viewApmTracesContextMenuItem'); }); + await testSubjects.existOrFail('~noMetricsIndicesPrompt'); }); }); @@ -109,52 +85,22 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { expect(navLinks).not.to.contain('Metrics'); }); - it(`infrastructure root renders not found page`, async () => { - await PageObjects.common.navigateToActualUrl('infraOps', '', { - basePath: '/s/custom_space', - ensureCurrentUrl: false, - shouldLoginIfPrompted: false, - }); - await testSubjects.existOrFail('infraNotFoundPage'); - }); - - it(`infrastructure home page renders not found page`, async () => { - await PageObjects.common.navigateToActualUrl('infraOps', 'home', { - basePath: '/s/custom_space', - ensureCurrentUrl: false, - shouldLoginIfPrompted: false, - }); - await testSubjects.existOrFail('infraNotFoundPage'); - }); - - it(`infrastructure landing page renders not found page`, async () => { - await PageObjects.common.navigateToActualUrl('infraOps', 'infrastructure', { - basePath: '/s/custom_space', - ensureCurrentUrl: false, - shouldLoginIfPrompted: false, - }); - await testSubjects.existOrFail('infraNotFoundPage'); - }); - - it(`infrastructure snapshot page renders not found page`, async () => { - await PageObjects.common.navigateToActualUrl('infraOps', 'infrastructure/inventory', { + it(`metrics app is inaccessible and Application Not Found message is rendered`, async () => { + await PageObjects.common.navigateToApp('infraOps', { basePath: '/s/custom_space', - ensureCurrentUrl: false, - shouldLoginIfPrompted: false, }); - await testSubjects.existOrFail('infraNotFoundPage'); - }); - - it(`metrics page renders not found page`, async () => { - await PageObjects.common.navigateToActualUrl( + await testSubjects.existOrFail('~appNotFoundPageContent'); + await PageObjects.common.navigateToUrlWithBrowserHistory( 'infraOps', - '/metrics/host/demo-stack-redis-01', + '/inventory', + undefined, { basePath: '/s/custom_space', - ensureCurrentUrl: true, + ensureCurrentUrl: false, + shouldLoginIfPrompted: false, } ); - await testSubjects.existOrFail('infraNotFoundPage'); + await testSubjects.existOrFail('~appNotFoundPageContent'); }); }); @@ -175,30 +121,11 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { await esArchiver.unload('empty_kibana'); }); - it(`landing page shows Wafflemap`, async () => { - await PageObjects.common.navigateToActualUrl('infraOps', 'home', { + it(`Metrics app is accessible`, async () => { + await PageObjects.common.navigateToApp('infraOps', { basePath: '/s/custom_space', - ensureCurrentUrl: true, - }); - await PageObjects.infraHome.goToTime(DATE_WITH_DATA); - await testSubjects.existOrFail('waffleMap'); - }); - - describe('context menu', () => { - before(async () => { - await testSubjects.click('nodeContainer'); - }); - - it(`doesn't show link to view logs`, async () => { - await retry.waitFor('context menu', () => testSubjects.exists('~nodeContextMenu')); - const link = await testSubjects.find('~viewLogsContextMenuItem'); - expect(await link.isEnabled()).to.be(false); - }); - - it(`shows link to view apm traces`, async () => { - await retry.waitFor('context menu', () => testSubjects.exists('nodeContextMenu')); - await testSubjects.existOrFail('viewApmTracesContextMenuItem'); }); + await testSubjects.existOrFail('~noMetricsIndicesPrompt'); }); }); @@ -219,30 +146,11 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { await esArchiver.unload('empty_kibana'); }); - it(`landing page shows Wafflemap`, async () => { - await PageObjects.common.navigateToActualUrl('infraOps', 'home', { + it(`Metrics app is accessible`, async () => { + await PageObjects.common.navigateToApp('infraOps', { basePath: '/s/custom_space', - ensureCurrentUrl: true, - }); - await PageObjects.infraHome.goToTime(DATE_WITH_DATA); - await testSubjects.existOrFail('waffleMap'); - }); - - describe('context menu', () => { - before(async () => { - await testSubjects.click('nodeContainer'); - }); - - it(`shows link to view logs`, async () => { - await retry.waitFor('context menu', () => testSubjects.exists('nodeContextMenu')); - await testSubjects.existOrFail('viewLogsContextMenuItem'); - }); - - it(`doesn't show link to view apm traces`, async () => { - await retry.waitFor('context menu', () => testSubjects.exists('~nodeContextMenu')); - const link = await testSubjects.find('~viewApmTracesContextMenuItem'); - expect(await link.isEnabled()).to.be(false); }); + await testSubjects.existOrFail('~noMetricsIndicesPrompt'); }); }); }); diff --git a/x-pack/test/functional/apps/infra/feature_controls/logs_security.ts b/x-pack/test/functional/apps/infra/feature_controls/logs_security.ts index 164376d20712c..3b6859c2572cc 100644 --- a/x-pack/test/functional/apps/infra/feature_controls/logs_security.ts +++ b/x-pack/test/functional/apps/infra/feature_controls/logs_security.ts @@ -63,7 +63,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { describe('logs landing page without data', () => { it(`shows 'Change source configuration' button`, async () => { - await PageObjects.common.navigateToActualUrl('infraOps', 'logs', { + await PageObjects.common.navigateToUrlWithBrowserHistory('infraLogs', '', undefined, { ensureCurrentUrl: true, shouldLoginIfPrompted: false, }); @@ -126,7 +126,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { describe('logs landing page without data', () => { it(`doesn't show 'Change source configuration' button`, async () => { - await PageObjects.common.navigateToActualUrl('infraOps', 'logs', { + await PageObjects.common.navigateToUrlWithBrowserHistory('infraLogs', '', undefined, { ensureCurrentUrl: true, shouldLoginIfPrompted: false, }); @@ -187,12 +187,19 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { expect(navLinks).to.not.contain('Logs'); }); - it('logs landing page renders not found page', async () => { - await PageObjects.common.navigateToActualUrl('infraOps', 'logs', { - ensureCurrentUrl: true, - shouldLoginIfPrompted: false, - }); - await testSubjects.existOrFail('infraNotFoundPage'); + it(`logs app is inaccessible and Application Not Found message is rendered`, async () => { + await PageObjects.common.navigateToApp('infraLogs'); + await testSubjects.existOrFail('~appNotFoundPageContent'); + await PageObjects.common.navigateToUrlWithBrowserHistory( + 'infraLogs', + '/stream', + undefined, + { + ensureCurrentUrl: false, + shouldLoginIfPrompted: false, + } + ); + await testSubjects.existOrFail('~appNotFoundPageContent'); }); }); }); diff --git a/x-pack/test/functional/apps/infra/feature_controls/logs_spaces.ts b/x-pack/test/functional/apps/infra/feature_controls/logs_spaces.ts index 234cfca63b09a..d89fbbf1ca54b 100644 --- a/x-pack/test/functional/apps/infra/feature_controls/logs_spaces.ts +++ b/x-pack/test/functional/apps/infra/feature_controls/logs_spaces.ts @@ -49,7 +49,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { describe('logs landing page without data', () => { it(`shows 'Change source configuration' button`, async () => { - await PageObjects.common.navigateToActualUrl('infraOps', 'logs', { + await PageObjects.common.navigateToUrlWithBrowserHistory('infraLogs', '', undefined, { basePath: '/s/custom_space', ensureCurrentUrl: true, shouldLoginIfPrompted: false, @@ -86,13 +86,22 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { expect(navLinks).to.not.contain('Logs'); }); - it('logs landing page renders not found page', async () => { - await PageObjects.common.navigateToActualUrl('infraOps', 'logs', { + it(`logs app is inaccessible and Application Not Found message is rendered`, async () => { + await PageObjects.common.navigateToApp('infraLogs', { basePath: '/s/custom_space', - ensureCurrentUrl: true, - shouldLoginIfPrompted: false, }); - await testSubjects.existOrFail('infraNotFoundPage'); + await testSubjects.existOrFail('~appNotFoundPageContent'); + await PageObjects.common.navigateToUrlWithBrowserHistory( + 'infraLogs', + '/stream', + undefined, + { + basePath: '/s/custom_space', + ensureCurrentUrl: false, + shouldLoginIfPrompted: false, + } + ); + await testSubjects.existOrFail('~appNotFoundPageContent'); }); }); }); diff --git a/x-pack/test/functional/apps/infra/link_to.ts b/x-pack/test/functional/apps/infra/link_to.ts index 738dc7efd8fd9..7f803d9c3d0c1 100644 --- a/x-pack/test/functional/apps/infra/link_to.ts +++ b/x-pack/test/functional/apps/infra/link_to.ts @@ -18,23 +18,26 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { const location = { hash: '', pathname: '/link-to/logs', - search: '?time=1565707203194&filter=trace.id:433b4651687e18be2c6c8e3b11f53d09', + search: 'time=1565707203194&filter=trace.id:433b4651687e18be2c6c8e3b11f53d09', state: undefined, }; const expectedSearchString = "sourceId=default&logPosition=(position:(tiebreaker:0,time:1565707203194),streamLive:!f)&logFilter=(expression:'trace.id:433b4651687e18be2c6c8e3b11f53d09',kind:kuery)"; const expectedRedirectPath = '/logs/stream?'; - await pageObjects.common.navigateToActualUrl( - 'infraOps', - `${location.pathname}${location.search}` + await pageObjects.common.navigateToUrlWithBrowserHistory( + 'infraLogs', + location.pathname, + location.search, + { + ensureCurrentUrl: false, + } ); await retry.tryForTime(5000, async () => { const currentUrl = await browser.getCurrentUrl(); - const [, currentHash] = decodeURIComponent(currentUrl).split('#'); - // Account for unpredictable location of the g parameter in the search string - expect(currentHash.slice(0, expectedRedirectPath.length)).to.be(expectedRedirectPath); - expect(currentHash.slice(expectedRedirectPath.length)).to.contain(expectedSearchString); + const decodedUrl = decodeURIComponent(currentUrl); + expect(decodedUrl).to.contain(expectedRedirectPath); + expect(decodedUrl).to.contain(expectedSearchString); }); }); }); diff --git a/x-pack/test/functional/apps/infra/metrics_source_configuration.ts b/x-pack/test/functional/apps/infra/metrics_source_configuration.ts index 8f5c765cec6ad..d334fa7956be4 100644 --- a/x-pack/test/functional/apps/infra/metrics_source_configuration.ts +++ b/x-pack/test/functional/apps/infra/metrics_source_configuration.ts @@ -38,7 +38,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { }); it('can change the metric indices to a pattern that matches nothing', async () => { - await pageObjects.common.navigateToActualUrl('infraOps', 'infrastructure/settings'); + await pageObjects.common.navigateToUrlWithBrowserHistory('infraOps', '/settings'); const nameInput = await infraSourceConfigurationForm.getNameInput(); await nameInput.clearValueWithKeyboard({ charByChar: true }); @@ -57,7 +57,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { }); it('can change the metric indices back to a pattern that matches something', async () => { - await pageObjects.common.navigateToActualUrl('infraOps', 'infrastructure/settings'); + await pageObjects.common.navigateToUrlWithBrowserHistory('infraOps', '/settings'); const metricIndicesInput = await infraSourceConfigurationForm.getMetricIndicesInput(); await metricIndicesInput.clearValueWithKeyboard({ charByChar: true }); diff --git a/x-pack/test/functional/config.js b/x-pack/test/functional/config.js index a29753b05b8e9..78b2b7c75b586 100644 --- a/x-pack/test/functional/config.js +++ b/x-pack/test/functional/config.js @@ -133,11 +133,10 @@ export default async function({ readConfigFile }) { pathname: '/', }, infraOps: { - pathname: '/app/infra', + pathname: '/app/metrics', }, infraLogs: { - pathname: '/app/infra', - hash: '/logs', + pathname: '/app/logs', }, canvas: { pathname: '/app/canvas', diff --git a/x-pack/test/functional/page_objects/infra_logs_page.ts b/x-pack/test/functional/page_objects/infra_logs_page.ts index 1c58f8dc41eba..8f554729328bb 100644 --- a/x-pack/test/functional/page_objects/infra_logs_page.ts +++ b/x-pack/test/functional/page_objects/infra_logs_page.ts @@ -19,7 +19,7 @@ export function InfraLogsPageProvider({ getPageObjects, getService }: FtrProvide }, async navigateToTab(logsUiTab: LogsUiTab) { - await pageObjects.common.navigateToActualUrl('infraLogs', `/logs/${logsUiTab}`); + await pageObjects.common.navigateToUrlWithBrowserHistory('infraLogs', `/${logsUiTab}`); }, async getLogStream() { diff --git a/x-pack/legacy/plugins/infra/types/rison_node.d.ts b/x-pack/typings/rison_node.d.ts similarity index 100% rename from x-pack/legacy/plugins/infra/types/rison_node.d.ts rename to x-pack/typings/rison_node.d.ts diff --git a/yarn.lock b/yarn.lock index c992f7f02b883..ac432faf3c1e2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4903,11 +4903,6 @@ resolved "https://registry.yarnpkg.com/@types/boom/-/boom-7.2.0.tgz#19c36cbb5811a7493f0f2e37f31d42b28df1abc1" integrity sha512-HonbGsHFbskh9zRAzA6tabcw18mCOsSEOL2ibGAuVqk6e7nElcRmWO5L4UfIHpDbWBWw+eZYFdsQ1+MEGgpcVA== -"@types/boom@7.2.1": - version "7.2.1" - resolved "https://registry.yarnpkg.com/@types/boom/-/boom-7.2.1.tgz#a21e21ba08cc49d17b26baef98e1a77ee4d6cdb0" - integrity sha512-kOiap+kSa4DPoookJXQGQyKy1rjZ55tgfKAh9F0m1NUdukkcwVzpSnXPMH42a5L+U++ugdQlh/xFJu/WAdr1aw== - "@types/browserslist-useragent@^3.0.0": version "3.0.0" resolved "https://registry.yarnpkg.com/@types/browserslist-useragent/-/browserslist-useragent-3.0.0.tgz#d425c9818182ce71ce53866798cee9c7d41d6e53" @@ -8687,13 +8682,6 @@ boom@5.x.x: dependencies: hoek "4.x.x" -boom@7.3.0: - version "7.3.0" - resolved "https://registry.yarnpkg.com/boom/-/boom-7.3.0.tgz#733a6d956d33b0b1999da3fe6c12996950d017b9" - integrity sha512-Swpoyi2t5+GhOEGw8rEsKvTxFLIDiiKoUc2gsoV6Lyr43LHBIzch3k2MvYUs8RTROrIkVJ3Al0TkaOGjnb+B6A== - dependencies: - hoek "6.x.x" - boom@7.x.x, boom@^7.1.0, boom@^7.2.0: version "7.2.2" resolved "https://registry.yarnpkg.com/boom/-/boom-7.2.2.tgz#ac92101451aa5cea901aed07d881dd32b4f08345"