diff --git a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/node_details/tabs/processes/index.tsx b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/node_details/tabs/processes/index.tsx index dc82e9a58db52..f20ad2bdb4552 100644 --- a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/node_details/tabs/processes/index.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/node_details/tabs/processes/index.tsx @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import React, { useMemo, useState, useCallback } from 'react'; +import React, { useMemo, useState } from 'react'; import { debounce } from 'lodash'; import { i18n } from '@kbn/i18n'; import { EuiSearchBar, EuiSpacer, EuiEmptyPrompt, EuiButton } from '@elastic/eui'; diff --git a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/node_details/tabs/processes/process_row.tsx b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/node_details/tabs/processes/process_row.tsx index f95d360a06c9c..4718ed09dc9b2 100644 --- a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/node_details/tabs/processes/process_row.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/node_details/tabs/processes/process_row.tsx @@ -4,9 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import React, { useState, useMemo } from 'react'; -import moment from 'moment'; -import { first, last } from 'lodash'; +import React, { useState } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiTableRow, @@ -22,16 +20,7 @@ import { EuiButton, EuiSpacer, } from '@elastic/eui'; -import { Axis, Chart, Settings, Position, TooltipValue, niceTimeFormatter } from '@elastic/charts'; import { AutoSizer } from '../../../../../../../components/auto_sizer'; -import { createFormatter } from '../../../../../../../../common/formatters'; -import { useUiSetting } from '../../../../../../../../../../../src/plugins/kibana_react/public'; -import { getChartTheme } from '../../../../../metrics_explorer/components/helpers/get_chart_theme'; -import { calculateDomain } from '../../../../../metrics_explorer/components/helpers/calculate_domain'; -import { MetricsExplorerChartType } from '../../../../../metrics_explorer/hooks/use_metrics_explorer_options'; -import { MetricExplorerSeriesChart } from '../../../../../metrics_explorer/components/series_chart'; -import { MetricsExplorerAggregation } from '../../../../../../../../common/http_api'; -import { Color } from '../../../../../../../../common/color_palette'; import { euiStyled } from '../../../../../../../../../observability/public'; import { Process } from './types'; import { ProcessRowCharts } from './process_row_charts'; @@ -131,76 +120,6 @@ export const ProcessRow = ({ cells, item }: Props) => { ); }; -interface ProcessChartProps { - timeseries: Process['timeseries']['x']; - color: Color; - label: string; -} -const ProcessChart = ({ timeseries, color, label }: ProcessChartProps) => { - const chartMetric = { - color, - aggregation: 'avg' as MetricsExplorerAggregation, - label, - }; - const isDarkMode = useUiSetting('theme:darkMode'); - - const dateFormatter = useMemo(() => { - if (!timeseries) return () => ''; - const firstTimestamp = first(timeseries.rows)?.timestamp; - const lastTimestamp = last(timeseries.rows)?.timestamp; - - if (firstTimestamp == null || lastTimestamp == null) { - return (value: number) => `${value}`; - } - - return niceTimeFormatter([firstTimestamp, lastTimestamp]); - }, [timeseries]); - - const yAxisFormatter = createFormatter('percent'); - - const tooltipProps = { - headerFormatter: (tooltipValue: TooltipValue) => - moment(tooltipValue.value).format('Y-MM-DD HH:mm:ss.SSS'), - }; - - const dataDomain = calculateDomain(timeseries, [chartMetric], false); - const domain = dataDomain - ? { - max: dataDomain.max * 1.1, // add 10% headroom. - min: dataDomain.min, - } - : { max: 0, min: 0 }; - - return ( - - - - - - - - - ); -}; - export const CodeLine = euiStyled(EuiCode).attrs({ transparentBackground: true, })` @@ -228,22 +147,3 @@ const ExpandedRowCell = euiStyled(EuiTableRowCell).attrs({ padding: 0 ${(props) => props.theme.eui.paddingSizes.m}; background-color: ${(props) => props.theme.eui.euiColorLightestShade}; `; - -const ChartContainer = euiStyled.div` - width: 300px; - height: 140px; -`; - -const cpuMetricLabel = i18n.translate( - 'xpack.infra.metrics.nodeDetails.processes.expandedRowLabelCPU', - { - defaultMessage: 'CPU', - } -); - -const memoryMetricLabel = i18n.translate( - 'xpack.infra.metrics.nodeDetails.processes.expandedRowLabelMemory', - { - defaultMessage: 'Memory', - } -); diff --git a/x-pack/plugins/infra/server/lib/host_details/process_list_chart.ts b/x-pack/plugins/infra/server/lib/host_details/process_list_chart.ts index 94363dece60a9..11df1937764c8 100644 --- a/x-pack/plugins/infra/server/lib/host_details/process_list_chart.ts +++ b/x-pack/plugins/infra/server/lib/host_details/process_list_chart.ts @@ -9,6 +9,7 @@ import { ProcessListAPIChartRequest, ProcessListAPIChartQueryAggregation, ProcessListAPIRow, + ProcessListAPIChartResponse, } from '../../../common/http_api'; import { ESSearchClient } from '../metrics/types'; import { CMDLINE_FIELD } from './common'; @@ -119,7 +120,7 @@ export const getProcessListChart = async ( ) ) ); - return timeseries; + return timeseries as ProcessListAPIChartResponse; } catch (e) { throw e; }