diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/analysis/sections/log_rate/index.tsx b/x-pack/legacy/plugins/infra/public/pages/logs/analysis/sections/log_rate/index.tsx index 8a23d7ac09111..c03a4817e4d4c 100644 --- a/x-pack/legacy/plugins/infra/public/pages/logs/analysis/sections/log_rate/index.tsx +++ b/x-pack/legacy/plugins/infra/public/pages/logs/analysis/sections/log_rate/index.tsx @@ -13,12 +13,10 @@ import { EuiTitle, } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import React, { useState } from 'react'; +import React from 'react'; import { GetLogEntryRateSuccessResponsePayload } from '../../../../../../common/http_api/log_analysis/results/log_entry_rate'; import { ChartView } from './chart'; -import { isValidLogRateView, LogRateView, LogRateViewSwitcher } from './log_rate_view_switcher'; -import { TableView } from './table'; import { TimeRange } from '../../../../../../common/http_api/shared/time_range'; export const LogRateResults = ({ @@ -41,8 +39,6 @@ export const LogRateResults = ({ { defaultMessage: 'Loading log rate results' } ); - const [viewMode, setViewMode] = useState('chart'); - return ( <> @@ -74,22 +70,7 @@ export const LogRateResults = ({ } /> ) : ( - <> - - - (isValidLogRateView(id) ? setViewMode(id) : undefined)} - /> - - - - {viewMode === 'chart' ? ( - - ) : ( - - )} - + )} ); diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/analysis/sections/log_rate/log_rate_view_switcher.tsx b/x-pack/legacy/plugins/infra/public/pages/logs/analysis/sections/log_rate/log_rate_view_switcher.tsx deleted file mode 100644 index 43280d5c02ead..0000000000000 --- a/x-pack/legacy/plugins/infra/public/pages/logs/analysis/sections/log_rate/log_rate_view_switcher.tsx +++ /dev/null @@ -1,60 +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 { EuiButtonGroup, EuiButtonGroupProps } from '@elastic/eui'; -import { i18n } from '@kbn/i18n'; -import React from 'react'; - -export type LogRateView = 'chart' | 'table'; - -export const isValidLogRateView = (maybeView: string): maybeView is LogRateView => - ['chart', 'table'].includes(maybeView); - -interface LogRateViewSwitcherProps { - selectedView: LogRateView; - onChange: EuiButtonGroupProps['onChange']; -} - -const chartLabel = i18n.translate( - 'xpack.infra.logs.analysis.logRateSection.viewSwitcher.chartLabel', - { defaultMessage: 'Rate chart' } -); -const tableLabel = i18n.translate( - 'xpack.infra.logs.analysis.logRateSection.viewSwitcher.tableLabel', - { defaultMessage: 'Anomaly table' } -); -const legendLabel = i18n.translate( - 'xpack.infra.logs.analysis.logRateSection.viewSwitcher.legendLabel', - { defaultMessage: 'Switch between the log rate chart and the anomalies table view' } -); - -const buttons = [ - { - id: 'chart', - label: chartLabel, - iconType: 'apps', - }, - { - id: 'table', - label: tableLabel, - iconType: 'editorUnorderedList', - }, -]; - -export const LogRateViewSwitcher: React.FunctionComponent = ({ - selectedView, - onChange, -}) => { - return ( - - ); -}; diff --git a/x-pack/legacy/plugins/infra/public/pages/logs/analysis/sections/log_rate/table.tsx b/x-pack/legacy/plugins/infra/public/pages/logs/analysis/sections/log_rate/table.tsx deleted file mode 100644 index 19bfaacf5d5df..0000000000000 --- a/x-pack/legacy/plugins/infra/public/pages/logs/analysis/sections/log_rate/table.tsx +++ /dev/null @@ -1,96 +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 React, { useMemo } from 'react'; -import { i18n } from '@kbn/i18n'; -import moment from 'moment'; -import { EuiInMemoryTable } from '@elastic/eui'; -import { GetLogEntryRateSuccessResponsePayload } from '../../../../../../common/http_api/log_analysis/results/log_entry_rate'; -import { useKibanaUiSetting } from '../../../../../utils/use_kibana_ui_setting'; - -interface Props { - data: GetLogEntryRateSuccessResponsePayload['data']; -} - -const startTimeLabel = i18n.translate( - 'xpack.infra.logs.analysis.logRateSection.table.startTimeLabel', - { defaultMessage: 'Start time' } -); -const anomalyScoreLabel = i18n.translate( - 'xpack.infra.logs.analysis.logRateSection.table.anomalyScoreLabel', - { defaultMessage: 'Anomaly score' } -); -const actualLogEntryRateLabel = i18n.translate( - 'xpack.infra.logs.analysis.logRateSection.table.actualLogEntryRateLabel', - { defaultMessage: 'Actual rate' } -); -const typicalLogEntryRateLabel = i18n.translate( - 'xpack.infra.logs.analysis.logRateSection.table.typicalLogEntryRateLabel', - { defaultMessage: 'Typical rate' } -); - -export const TableView = ({ data }: Props) => { - const [dateFormat] = useKibanaUiSetting('dateFormat'); - - const formattedAnomalies = useMemo(() => { - return data.histogramBuckets.reduce((acc: any, bucket) => { - if (bucket.anomalies.length > 0) { - bucket.anomalies.forEach(anomaly => { - const formattedAnomaly = { - startTime: moment(anomaly.startTime).format(dateFormat || 'Y-MM-DD HH:mm:ss.SSS'), - anomalyScore: Number(anomaly.anomalyScore).toFixed(3), - typicalLogEntryRate: Number(anomaly.typicalLogEntryRate).toFixed(3), - actualLogEntryRate: Number(anomaly.actualLogEntryRate).toFixed(3), - }; - acc.push(formattedAnomaly); - }); - return acc; - } else { - return acc; - } - }, []); - }, [data]); - - const columns = [ - { - field: 'startTime', - name: startTimeLabel, - sortable: true, - 'data-test-subj': 'startTimeCell', - }, - { - field: 'anomalyScore', - name: anomalyScoreLabel, - sortable: true, - 'data-test-subj': 'anomalyScoreCell', - }, - { - field: 'actualLogEntryRate', - name: actualLogEntryRateLabel, - sortable: true, - 'data-test-subj': 'actualLogEntryRateCell', - }, - { - field: 'typicalLogEntryRate', - name: typicalLogEntryRateLabel, - sortable: true, - 'data-test-subj': 'typicalLogEntryRateCell', - }, - ]; - - const initialSorting = { - sort: { - field: 'anomalyScore', - direction: 'desc', - }, - }; - - return ( - <> - - - ); -}; diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index d656ff273a4c6..3014653cc7dea 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -5321,13 +5321,6 @@ "xpack.infra.header.logsTitle": "ログ", "xpack.infra.homePage.settingsTabTitle": "設定", "xpack.infra.kibanaMetrics.cloudIdMissingErrorMessage": "{metricId} のモデルには cloudId が必要ですが、{nodeId} に cloudId が指定されていません。", - "xpack.infra.logs.analysis.logRateSection.table.actualLogEntryRateLabel": "実際のレート", - "xpack.infra.logs.analysis.logRateSection.table.anomalyScoreLabel": "異常スコア", - "xpack.infra.logs.analysis.logRateSection.table.startTimeLabel": "開始時刻", - "xpack.infra.logs.analysis.logRateSection.table.typicalLogEntryRateLabel": "平均レート", - "xpack.infra.logs.analysis.logRateSection.viewSwitcher.chartLabel": "レートチャート", - "xpack.infra.logs.analysis.logRateSection.viewSwitcher.legendLabel": "ログレートチャートと異常表ビューを切り替えます", - "xpack.infra.logs.analysis.logRateSection.viewSwitcher.tableLabel": "異常表", "xpack.infra.logs.analysis.logRateSectionAnomalySeriesName": "異常", "xpack.infra.logs.analysis.logRateSectionAreaSeriesName": "期待値", "xpack.infra.logs.analysis.logRateSectionLineSeriesName": "15 分ごとのログエントリー (平均)", @@ -11534,4 +11527,4 @@ "xpack.fileUpload.fileParser.noFileProvided": "エラー、ファイルが提供されていません", "xpack.fileUpload.jsonIndexFilePicker.errorGettingIndexName": "インデックス名の取得中にエラーが発生: {errorMessage}" } -} +} \ No newline at end of file diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 7bcabe581fe77..781043f6c7279 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -5324,13 +5324,6 @@ "xpack.infra.header.logsTitle": "Logs", "xpack.infra.homePage.settingsTabTitle": "设置", "xpack.infra.kibanaMetrics.cloudIdMissingErrorMessage": "{metricId} 的模型需要云 ID,但没有为 {nodeId} 提供。", - "xpack.infra.logs.analysis.logRateSection.table.actualLogEntryRateLabel": "实际速率", - "xpack.infra.logs.analysis.logRateSection.table.anomalyScoreLabel": "异常分数", - "xpack.infra.logs.analysis.logRateSection.table.startTimeLabel": "开始时间", - "xpack.infra.logs.analysis.logRateSection.table.typicalLogEntryRateLabel": "通常速率", - "xpack.infra.logs.analysis.logRateSection.viewSwitcher.chartLabel": "速率图表", - "xpack.infra.logs.analysis.logRateSection.viewSwitcher.legendLabel": "在日志速率图表和异常表视图间切换", - "xpack.infra.logs.analysis.logRateSection.viewSwitcher.tableLabel": "异常表", "xpack.infra.logs.analysis.logRateSectionAnomalySeriesName": "异常", "xpack.infra.logs.analysis.logRateSectionAreaSeriesName": "预期", "xpack.infra.logs.analysis.logRateSectionLineSeriesName": "每 15 分钟日志条目数(平均值)", @@ -11536,4 +11529,4 @@ "xpack.fileUpload.fileParser.noFileProvided": "错误,未提供任何文件", "xpack.fileUpload.jsonIndexFilePicker.errorGettingIndexName": "检索索引名称时出错:{errorMessage}" } -} +} \ No newline at end of file