From 6c3750dc92364c7fc7a196bf485e81e3dca37a17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ester=20Mart=C3=AD=20Vilaseca?= Date: Wed, 20 Oct 2021 18:54:41 +0200 Subject: [PATCH] [Stack monitoring] Remove getAngularInjector and duplicated angular components (#115593) * remove getAngularInjector and old angular components * Remove suffix from CcrShardReact component * Remove suffix from ElasticsearchOverviewReact component * Remove suffix from indexReact component * Remove suffix from NodeReact component * Remove suffix from ShardActivityReact * Remove suffix from ShardAllocationReact component and its childs * Fix import * fix translations Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> # Conflicts: # x-pack/plugins/monitoring/public/components/elasticsearch/node/node.js --- .../pages/elasticsearch/ccr_shard_page.tsx | 4 +- .../pages/elasticsearch/index_page.tsx | 4 +- .../pages/elasticsearch/node_page.tsx | 4 +- .../pages/elasticsearch/overview.tsx | 4 +- .../components/chart/get_chart_options.js | 13 +- .../__snapshots__/ccr_shard.test.js.snap | 2 +- .../ccr_shard_react.test.js.snap | 185 ------------------ .../elasticsearch/ccr_shard/ccr_shard.js | 73 ++++--- .../elasticsearch/ccr_shard/ccr_shard.test.js | 8 - .../ccr_shard/ccr_shard_react.js | 145 -------------- .../ccr_shard/ccr_shard_react.test.js | 82 -------- .../elasticsearch/ccr_shard/index.js | 1 - .../public/components/elasticsearch/index.ts | 3 +- .../components/elasticsearch/index/index.js | 3 +- .../elasticsearch/index/index_react.js | 70 ------- .../components/elasticsearch/node/index.ts | 1 - .../components/elasticsearch/node/node.d.ts | 1 - .../components/elasticsearch/node/node.js | 18 +- .../elasticsearch/node/node_react.d.ts | 19 -- .../elasticsearch/node/node_react.js | 99 ---------- .../elasticsearch/overview/index.ts | 3 +- .../elasticsearch/overview/overview.d.ts | 18 -- .../elasticsearch/overview/overview_react.js | 66 ------- .../elasticsearch/shard_activity/index.js | 1 - .../shard_activity/parse_props.js | 12 +- .../shard_activity/shard_activity.js | 122 ++++++------ .../shard_activity/shard_activity_react.js | 156 --------------- .../components/cluster_view.js | 79 ++------ .../components/cluster_view_react.js | 29 --- .../shard_allocation/components/table_head.js | 11 +- .../components/table_head_react.js | 99 ---------- .../elasticsearch/shard_allocation/index.js | 1 - .../shard_allocation/shard_allocation.js | 12 +- .../shard_allocation_react.js | 83 -------- .../monitoring/public/components/index.ts | 2 +- .../monitoring/public/components/logs/logs.js | 14 +- .../plugins/monitoring/public/legacy_shims.ts | 6 - .../translations/translations/ja-JP.json | 1 - .../translations/translations/zh-CN.json | 1 - 39 files changed, 136 insertions(+), 1319 deletions(-) delete mode 100644 x-pack/plugins/monitoring/public/components/elasticsearch/ccr_shard/__snapshots__/ccr_shard_react.test.js.snap delete mode 100644 x-pack/plugins/monitoring/public/components/elasticsearch/ccr_shard/ccr_shard_react.js delete mode 100644 x-pack/plugins/monitoring/public/components/elasticsearch/ccr_shard/ccr_shard_react.test.js delete mode 100644 x-pack/plugins/monitoring/public/components/elasticsearch/index/index_react.js delete mode 100644 x-pack/plugins/monitoring/public/components/elasticsearch/node/node_react.d.ts delete mode 100644 x-pack/plugins/monitoring/public/components/elasticsearch/node/node_react.js delete mode 100644 x-pack/plugins/monitoring/public/components/elasticsearch/overview/overview.d.ts delete mode 100644 x-pack/plugins/monitoring/public/components/elasticsearch/overview/overview_react.js delete mode 100644 x-pack/plugins/monitoring/public/components/elasticsearch/shard_activity/shard_activity_react.js delete mode 100644 x-pack/plugins/monitoring/public/components/elasticsearch/shard_allocation/components/cluster_view_react.js delete mode 100644 x-pack/plugins/monitoring/public/components/elasticsearch/shard_allocation/components/table_head_react.js delete mode 100644 x-pack/plugins/monitoring/public/components/elasticsearch/shard_allocation/shard_allocation_react.js diff --git a/x-pack/plugins/monitoring/public/application/pages/elasticsearch/ccr_shard_page.tsx b/x-pack/plugins/monitoring/public/application/pages/elasticsearch/ccr_shard_page.tsx index ab06179efbb04a..8d7b9add409da3 100644 --- a/x-pack/plugins/monitoring/public/application/pages/elasticsearch/ccr_shard_page.tsx +++ b/x-pack/plugins/monitoring/public/application/pages/elasticsearch/ccr_shard_page.tsx @@ -13,7 +13,7 @@ import { PageTemplate } from '../page_template'; import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; import { GlobalStateContext } from '../../contexts/global_state_context'; // @ts-ignore -import { CcrShardReact } from '../../../components/elasticsearch/ccr_shard'; +import { CcrShard } from '../../../components/elasticsearch/ccr_shard'; import { ComponentProps } from '../../route_init'; import { SetupModeRenderer, SetupModeProps } from '../../../components/renderers/setup_mode'; import { SetupModeContext } from '../../../components/setup_mode/setup_mode_context'; @@ -113,7 +113,7 @@ export const ElasticsearchCcrShardPage: React.FC = ({ clusters } render={({ flyoutComponent, bottomBarComponent }: SetupModeProps) => ( {flyoutComponent} - + {bottomBarComponent} )} diff --git a/x-pack/plugins/monitoring/public/application/pages/elasticsearch/index_page.tsx b/x-pack/plugins/monitoring/public/application/pages/elasticsearch/index_page.tsx index edc10cda5509c7..b0e91ac20fb30b 100644 --- a/x-pack/plugins/monitoring/public/application/pages/elasticsearch/index_page.tsx +++ b/x-pack/plugins/monitoring/public/application/pages/elasticsearch/index_page.tsx @@ -11,7 +11,7 @@ import { find } from 'lodash'; import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; import { GlobalStateContext } from '../../contexts/global_state_context'; // @ts-ignore -import { IndexReact } from '../../../components/elasticsearch/index/index_react'; +import { Index } from '../../../components/elasticsearch/index/index'; import { ComponentProps } from '../../route_init'; import { SetupModeRenderer, SetupModeProps } from '../../../components/renderers/setup_mode'; import { SetupModeContext } from '../../../components/setup_mode/setup_mode_context'; @@ -118,7 +118,7 @@ export const ElasticsearchIndexPage: React.FC = ({ clusters }) = render={({ setupMode, flyoutComponent, bottomBarComponent }: SetupModeProps) => ( {flyoutComponent} - = ({ clusters }) => render={({ setupMode, flyoutComponent, bottomBarComponent }: SetupModeProps) => ( {flyoutComponent} - = ({ clusters } const shardActivityData = shardActivity && filterShardActivityData(shardActivity); // no filter on data = null return ( -

- September 27, 2018 1:32:09 PM + September 27, 2018 9:32:09 AM

diff --git a/x-pack/plugins/monitoring/public/components/elasticsearch/ccr_shard/__snapshots__/ccr_shard_react.test.js.snap b/x-pack/plugins/monitoring/public/components/elasticsearch/ccr_shard/__snapshots__/ccr_shard_react.test.js.snap deleted file mode 100644 index 9302c86a222b15..00000000000000 --- a/x-pack/plugins/monitoring/public/components/elasticsearch/ccr_shard/__snapshots__/ccr_shard_react.test.js.snap +++ /dev/null @@ -1,185 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`CcrShardReact that is renders an exception properly 1`] = ` - - - -`; - -exports[`CcrShardReact that it renders normally 1`] = ` - - - - - - - - - - - - - - - - - - - - - - -

- -

- - } - id="ccrLatestStat" - initialIsOpen={false} - isLoading={false} - isLoadingMessage={false} - paddingSize="l" - > - -

- September 27, 2018 9:32:09 AM -

-
- - - { - "read_exceptions": [], - "follower_global_checkpoint": 3049, - "follower_index": "follower", - "follower_max_seq_no": 3049, - "last_requested_seq_no": 3049, - "leader_global_checkpoint": 3049, - "leader_index": "leader", - "leader_max_seq_no": 3049, - "mapping_version": 2, - "number_of_concurrent_reads": 1, - "number_of_concurrent_writes": 0, - "number_of_failed_bulk_operations": 0, - "failed_read_requests": 0, - "operations_written": 3050, - "number_of_queued_writes": 0, - "number_of_successful_bulk_operations": 3050, - "number_of_successful_fetches": 3050, - "operations_received": 3050, - "shard_id": 0, - "time_since_last_read_millis": 9402, - "total_fetch_time_millis": 44128980, - "total_index_time_millis": 41827, - "total_transferred_bytes": 234156 -} - -
-
-
-`; diff --git a/x-pack/plugins/monitoring/public/components/elasticsearch/ccr_shard/ccr_shard.js b/x-pack/plugins/monitoring/public/components/elasticsearch/ccr_shard/ccr_shard.js index ef16c119d8613c..9765d83e31f41c 100644 --- a/x-pack/plugins/monitoring/public/components/elasticsearch/ccr_shard/ccr_shard.js +++ b/x-pack/plugins/monitoring/public/components/elasticsearch/ccr_shard/ccr_shard.js @@ -5,8 +5,8 @@ * 2.0. */ -import React, { Fragment, PureComponent } from 'react'; -import { Legacy } from '../../../legacy_shims'; +import React, { Fragment } from 'react'; +import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; import { EuiPage, EuiPageBody, @@ -28,9 +28,11 @@ import { FormattedMessage } from '@kbn/i18n/react'; import { i18n } from '@kbn/i18n'; import { AlertsCallout } from '../../../alerts/callout'; -export class CcrShard extends PureComponent { - renderCharts() { - const { metrics } = this.props; +export function CcrShard(props) { + const { services } = useKibana(); + const timezone = services.uiSettings?.get('dateFormat:tz'); + const { metrics, stat, timestamp, oldestStat, formattedLeader, alerts } = props; + const renderCharts = () => { const seriesToShow = [metrics.ccr_sync_lag_ops, metrics.ccr_sync_lag_time]; const charts = seriesToShow.map((data, index) => ( @@ -42,10 +44,9 @@ export class CcrShard extends PureComponent { )); return {charts}; - } + }; - renderErrors() { - const { stat } = this.props; + const renderErrors = () => { if (stat.read_exceptions && stat.read_exceptions.length > 0) { return ( @@ -91,13 +92,9 @@ export class CcrShard extends PureComponent { ); } return null; - } - - renderLatestStat() { - const { stat, timestamp } = this.props; - const injector = Legacy.shims.getAngularInjector(); - const timezone = injector.get('config').get('dateFormat:tz'); + }; + const renderLatestStat = () => { return ( ); - } - - render() { - const { stat, oldestStat, formattedLeader, alerts } = this.props; + }; - return ( - - - - - - - - - {this.renderErrors()} - {this.renderCharts()} - - {this.renderLatestStat()} - - - ); - } + return ( + + + + + + + + + {renderErrors()} + {renderCharts()} + + {renderLatestStat()} + + + ); } diff --git a/x-pack/plugins/monitoring/public/components/elasticsearch/ccr_shard/ccr_shard.test.js b/x-pack/plugins/monitoring/public/components/elasticsearch/ccr_shard/ccr_shard.test.js index 90d9efecce40a6..6b7b43016baf9a 100644 --- a/x-pack/plugins/monitoring/public/components/elasticsearch/ccr_shard/ccr_shard.test.js +++ b/x-pack/plugins/monitoring/public/components/elasticsearch/ccr_shard/ccr_shard.test.js @@ -9,14 +9,6 @@ import React from 'react'; import { shallow } from 'enzyme'; import { CcrShard } from './ccr_shard'; -jest.mock('../../../legacy_shims', () => { - return { - Legacy: { - shims: { getAngularInjector: () => ({ get: () => ({ get: () => 'utc' }) }) }, - }, - }; -}); - jest.mock('../../chart', () => ({ MonitoringTimeseriesContainer: () => 'MonitoringTimeseriesContainer', })); diff --git a/x-pack/plugins/monitoring/public/components/elasticsearch/ccr_shard/ccr_shard_react.js b/x-pack/plugins/monitoring/public/components/elasticsearch/ccr_shard/ccr_shard_react.js deleted file mode 100644 index 65586d602c85e2..00000000000000 --- a/x-pack/plugins/monitoring/public/components/elasticsearch/ccr_shard/ccr_shard_react.js +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React, { Fragment } from 'react'; -import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; -import { - EuiPage, - EuiPageBody, - EuiPanel, - EuiFlexGroup, - EuiFlexItem, - EuiSpacer, - EuiTitle, - EuiBasicTable, - EuiCodeBlock, - EuiTextColor, - EuiHorizontalRule, - EuiAccordion, -} from '@elastic/eui'; -import { MonitoringTimeseriesContainer } from '../../chart'; -import { Status } from './status'; -import { formatDateTimeLocal } from '../../../../common/formatting'; -import { FormattedMessage } from '@kbn/i18n/react'; -import { i18n } from '@kbn/i18n'; -import { AlertsCallout } from '../../../alerts/callout'; - -export function CcrShardReact(props) { - const { services } = useKibana(); - const timezone = services.uiSettings?.get('dateFormat:tz'); - const { metrics, stat, timestamp, oldestStat, formattedLeader, alerts } = props; - const renderCharts = () => { - const seriesToShow = [metrics.ccr_sync_lag_ops, metrics.ccr_sync_lag_time]; - - const charts = seriesToShow.map((data, index) => ( - - - - - - )); - - return {charts}; - }; - - const renderErrors = () => { - if (stat.read_exceptions && stat.read_exceptions.length > 0) { - return ( - - - -

- - - -

-
- - -
- -
- ); - } - return null; - }; - - const renderLatestStat = () => { - return ( - -

- -

- - } - paddingSize="l" - > - - -

{formatDateTimeLocal(timestamp, timezone)}

-
- - {JSON.stringify(stat, null, 2)} -
-
- ); - }; - - return ( - - - - - - - - - {renderErrors()} - {renderCharts()} - - {renderLatestStat()} - - - ); -} diff --git a/x-pack/plugins/monitoring/public/components/elasticsearch/ccr_shard/ccr_shard_react.test.js b/x-pack/plugins/monitoring/public/components/elasticsearch/ccr_shard/ccr_shard_react.test.js deleted file mode 100644 index afd289a33457a9..00000000000000 --- a/x-pack/plugins/monitoring/public/components/elasticsearch/ccr_shard/ccr_shard_react.test.js +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React from 'react'; -import { shallow } from 'enzyme'; -import { CcrShardReact } from './ccr_shard_react'; - -jest.mock('../../../legacy_shims', () => { - return { - Legacy: { - shims: { getAngularInjector: () => ({ get: () => ({ get: () => 'utc' }) }) }, - }, - }; -}); - -jest.mock('../../chart', () => ({ - MonitoringTimeseriesContainer: () => 'MonitoringTimeseriesContainer', -})); - -describe('CcrShardReact', () => { - const props = { - formattedLeader: 'leader on remote', - metrics: [], - stat: { - read_exceptions: [], - follower_global_checkpoint: 3049, - follower_index: 'follower', - follower_max_seq_no: 3049, - last_requested_seq_no: 3049, - leader_global_checkpoint: 3049, - leader_index: 'leader', - leader_max_seq_no: 3049, - mapping_version: 2, - number_of_concurrent_reads: 1, - number_of_concurrent_writes: 0, - number_of_failed_bulk_operations: 0, - failed_read_requests: 0, - operations_written: 3050, - number_of_queued_writes: 0, - number_of_successful_bulk_operations: 3050, - number_of_successful_fetches: 3050, - operations_received: 3050, - shard_id: 0, - time_since_last_read_millis: 9402, - total_fetch_time_millis: 44128980, - total_index_time_millis: 41827, - total_transferred_bytes: 234156, - }, - oldestStat: { - failed_read_requests: 0, - operations_written: 2976, - }, - timestamp: '2018-09-27T13:32:09.412Z', - }; - - test('that it renders normally', () => { - const component = shallow(); - expect(component).toMatchSnapshot(); - }); - - test('that is renders an exception properly', () => { - const localProps = { - ...props, - stat: { - ...props.stat, - read_exceptions: [ - { - type: 'something_is_wrong', - reason: 'not sure but something happened', - }, - ], - }, - }; - - const component = shallow(); - expect(component.find('EuiPanel').get(0)).toMatchSnapshot(); - }); -}); diff --git a/x-pack/plugins/monitoring/public/components/elasticsearch/ccr_shard/index.js b/x-pack/plugins/monitoring/public/components/elasticsearch/ccr_shard/index.js index 036a21e9b8a721..4cfd362b8ab0c2 100644 --- a/x-pack/plugins/monitoring/public/components/elasticsearch/ccr_shard/index.js +++ b/x-pack/plugins/monitoring/public/components/elasticsearch/ccr_shard/index.js @@ -6,4 +6,3 @@ */ export { CcrShard } from './ccr_shard'; -export { CcrShardReact } from './ccr_shard_react'; diff --git a/x-pack/plugins/monitoring/public/components/elasticsearch/index.ts b/x-pack/plugins/monitoring/public/components/elasticsearch/index.ts index 657617c698696b..2cb688689438cd 100644 --- a/x-pack/plugins/monitoring/public/components/elasticsearch/index.ts +++ b/x-pack/plugins/monitoring/public/components/elasticsearch/index.ts @@ -6,8 +6,7 @@ */ export { ElasticsearchOverview } from './overview'; -export { ElasticsearchOverviewReact } from './overview'; export { ElasticsearchNodes } from './nodes'; -export { NodeReact } from './node'; +export { Node } from './node'; export { ElasticsearchIndices } from './indices'; export { ElasticsearchMLJobs } from './ml_jobs'; diff --git a/x-pack/plugins/monitoring/public/components/elasticsearch/index/index.js b/x-pack/plugins/monitoring/public/components/elasticsearch/index/index.js index 294fc15ce4c478..9bdaa513998b57 100644 --- a/x-pack/plugins/monitoring/public/components/elasticsearch/index/index.js +++ b/x-pack/plugins/monitoring/public/components/elasticsearch/index/index.js @@ -22,7 +22,6 @@ import { Logs } from '../../logs'; import { AlertsCallout } from '../../../alerts/callout'; export const Index = ({ - scope, indexSummary, metrics, clusterUuid, @@ -63,7 +62,7 @@ export const Index = ({ - + diff --git a/x-pack/plugins/monitoring/public/components/elasticsearch/index/index_react.js b/x-pack/plugins/monitoring/public/components/elasticsearch/index/index_react.js deleted file mode 100644 index 70bac52a0926c4..00000000000000 --- a/x-pack/plugins/monitoring/public/components/elasticsearch/index/index_react.js +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React from 'react'; -import { - EuiPage, - EuiPageContent, - EuiPageBody, - EuiPanel, - EuiSpacer, - EuiFlexGrid, - EuiFlexItem, -} from '@elastic/eui'; -import { IndexDetailStatus } from '../index_detail_status'; -import { MonitoringTimeseriesContainer } from '../../chart'; -import { ShardAllocationReact } from '../shard_allocation/shard_allocation_react'; -import { Logs } from '../../logs'; -import { AlertsCallout } from '../../../alerts/callout'; - -export const IndexReact = ({ - indexSummary, - metrics, - clusterUuid, - indexUuid, - logs, - alerts, - ...props -}) => { - const metricsToShow = [ - metrics.index_mem, - metrics.index_size, - metrics.index_search_request_rate, - metrics.index_request_rate, - metrics.index_segment_count, - metrics.index_document_count, - ]; - - return ( - - - - - - - - - - - {metricsToShow.map((metric, index) => ( - - - - - ))} - - - - - - - - - - - ); -}; diff --git a/x-pack/plugins/monitoring/public/components/elasticsearch/node/index.ts b/x-pack/plugins/monitoring/public/components/elasticsearch/node/index.ts index 3b7153c5940d93..074749ae06e833 100644 --- a/x-pack/plugins/monitoring/public/components/elasticsearch/node/index.ts +++ b/x-pack/plugins/monitoring/public/components/elasticsearch/node/index.ts @@ -7,4 +7,3 @@ export { NodeStatusIcon } from './status_icon'; export { Node } from './node'; -export { NodeReact } from './node_react'; diff --git a/x-pack/plugins/monitoring/public/components/elasticsearch/node/node.d.ts b/x-pack/plugins/monitoring/public/components/elasticsearch/node/node.d.ts index 9d7a062e942bbb..17f05d98ee042d 100644 --- a/x-pack/plugins/monitoring/public/components/elasticsearch/node/node.d.ts +++ b/x-pack/plugins/monitoring/public/components/elasticsearch/node/node.d.ts @@ -15,6 +15,5 @@ export interface NodeProps { alerts: unknown; nodeId: unknown; clusterUuid: unknown; - scope: unknown; [key: string]: any; } diff --git a/x-pack/plugins/monitoring/public/components/elasticsearch/node/node.js b/x-pack/plugins/monitoring/public/components/elasticsearch/node/node.js index 3570f75df73341..5c69e72341f48c 100644 --- a/x-pack/plugins/monitoring/public/components/elasticsearch/node/node.js +++ b/x-pack/plugins/monitoring/public/components/elasticsearch/node/node.js @@ -15,22 +15,14 @@ import { EuiFlexItem, EuiPanel, } from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n/react'; import { NodeDetailStatus } from '../node_detail_status'; -import { Logs } from '../../logs/'; +import { Logs } from '../../logs'; import { MonitoringTimeseriesContainer } from '../../chart'; -import { ShardAllocation } from '../shard_allocation/shard_allocation'; import { AlertsCallout } from '../../../alerts/callout'; +import { ShardAllocation } from '../shard_allocation'; -export const Node = ({ - nodeSummary, - metrics, - logs, - alerts, - nodeId, - clusterUuid, - scope, - ...props -}) => { +export const Node = ({ nodeSummary, metrics, logs, alerts, nodeId, clusterUuid, ...props }) => { /* // This isn't doing anything due to a possible bug. https://github.com/elastic/kibana/issues/106309 if (alerts) { @@ -82,7 +74,7 @@ export const Node = ({ - + diff --git a/x-pack/plugins/monitoring/public/components/elasticsearch/node/node_react.d.ts b/x-pack/plugins/monitoring/public/components/elasticsearch/node/node_react.d.ts deleted file mode 100644 index e0c4f6b301fdb1..00000000000000 --- a/x-pack/plugins/monitoring/public/components/elasticsearch/node/node_react.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { FunctionComponent } from 'react'; - -export const NodeReact: FunctionComponent; -export interface NodeReactProps { - nodeSummary: unknown; - metrics: unknown; - logs: unknown; - alerts: unknown; - nodeId: unknown; - clusterUuid: unknown; - [key: string]: any; -} diff --git a/x-pack/plugins/monitoring/public/components/elasticsearch/node/node_react.js b/x-pack/plugins/monitoring/public/components/elasticsearch/node/node_react.js deleted file mode 100644 index 38b03d1aa748f5..00000000000000 --- a/x-pack/plugins/monitoring/public/components/elasticsearch/node/node_react.js +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React from 'react'; -import { - EuiPage, - EuiPageContent, - EuiPageBody, - EuiSpacer, - EuiFlexGrid, - EuiFlexItem, - EuiPanel, - EuiScreenReaderOnly, -} from '@elastic/eui'; -import { FormattedMessage } from '@kbn/i18n/react'; -import { NodeDetailStatus } from '../node_detail_status'; -import { Logs } from '../../logs'; -import { MonitoringTimeseriesContainer } from '../../chart'; -import { AlertsCallout } from '../../../alerts/callout'; -import { ShardAllocationReact } from '../shard_allocation'; - -export const NodeReact = ({ - nodeSummary, - metrics, - logs, - alerts, - nodeId, - clusterUuid, - ...props -}) => { - /* - // This isn't doing anything due to a possible bug. https://github.com/elastic/kibana/issues/106309 - if (alerts) { - for (const alertTypeId of Object.keys(alerts)) { - const alertInstance = alerts[alertTypeId]; - for (const { meta } of alertInstance.states) { - const metricList = get(meta, 'metrics', []); - for (const metric of metricList) { - if (metrics[metric]) { - metrics[metric].alerts = metrics[metric].alerts || {}; - metrics[metric].alerts[alertTypeId] = alertInstance; - } - } - } - } - } - */ - const metricsToShow = [ - metrics.node_jvm_mem, - metrics.node_mem, - metrics.node_total_io, - metrics.node_cpu_metric, - metrics.node_load_average, - metrics.node_latency, - metrics.node_segment_count, - ]; - - return ( - - - -

- -

-
- - - - - - - - {metricsToShow.map((metric, index) => ( - - - - - ))} - - - - - - - - - - -
-
- ); -}; diff --git a/x-pack/plugins/monitoring/public/components/elasticsearch/overview/index.ts b/x-pack/plugins/monitoring/public/components/elasticsearch/overview/index.ts index dd7e63c14fc53c..b56c381395ef72 100644 --- a/x-pack/plugins/monitoring/public/components/elasticsearch/overview/index.ts +++ b/x-pack/plugins/monitoring/public/components/elasticsearch/overview/index.ts @@ -5,6 +5,5 @@ * 2.0. */ -export { ElasticsearchOverview } from './overview'; // @ts-ignore -export { ElasticsearchOverviewReact } from './overview_react'; +export { ElasticsearchOverview } from './overview'; diff --git a/x-pack/plugins/monitoring/public/components/elasticsearch/overview/overview.d.ts b/x-pack/plugins/monitoring/public/components/elasticsearch/overview/overview.d.ts deleted file mode 100644 index d4c893f87cbd20..00000000000000 --- a/x-pack/plugins/monitoring/public/components/elasticsearch/overview/overview.d.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 - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { FunctionComponent } from 'react'; - -export const ElasticsearchOverview: FunctionComponent; -export interface ElasticsearchOverviewProps { - clusterStatus: unknown; - metrics: unknown; - logs: unknown; - cluster: unknown; - shardActivity: unknown; - [key: string]: any; -} diff --git a/x-pack/plugins/monitoring/public/components/elasticsearch/overview/overview_react.js b/x-pack/plugins/monitoring/public/components/elasticsearch/overview/overview_react.js deleted file mode 100644 index ff4e531e31744e..00000000000000 --- a/x-pack/plugins/monitoring/public/components/elasticsearch/overview/overview_react.js +++ /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 - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React from 'react'; -import { ClusterStatus } from '../cluster_status'; -import { ShardActivityReact } from '../shard_activity'; -import { MonitoringTimeseriesContainer } from '../../chart'; -import { - EuiPage, - EuiFlexGrid, - EuiFlexItem, - EuiPanel, - EuiSpacer, - EuiPageBody, - EuiPageContent, -} from '@elastic/eui'; -import { Logs } from '../../logs/logs'; - -export function ElasticsearchOverviewReact({ - clusterStatus, - metrics, - logs, - cluster, - shardActivity, - ...props -}) { - const metricsToShow = [ - metrics.cluster_search_request_rate, - metrics.cluster_query_latency, - metrics.cluster_index_request_rate, - metrics.cluster_index_latency, - ]; - - return ( - - - - - - - - - {metricsToShow.map((metric, index) => ( - - - - - ))} - - - - - - - - - - - - - ); -} diff --git a/x-pack/plugins/monitoring/public/components/elasticsearch/shard_activity/index.js b/x-pack/plugins/monitoring/public/components/elasticsearch/shard_activity/index.js index 8c0b8b4c9c82de..bcdbbe715f86e7 100644 --- a/x-pack/plugins/monitoring/public/components/elasticsearch/shard_activity/index.js +++ b/x-pack/plugins/monitoring/public/components/elasticsearch/shard_activity/index.js @@ -6,4 +6,3 @@ */ export { ShardActivity } from './shard_activity'; -export { ShardActivityReact } from './shard_activity_react'; diff --git a/x-pack/plugins/monitoring/public/components/elasticsearch/shard_activity/parse_props.js b/x-pack/plugins/monitoring/public/components/elasticsearch/shard_activity/parse_props.js index 1f0ed47adf3876..9a102c52aa1f11 100644 --- a/x-pack/plugins/monitoring/public/components/elasticsearch/shard_activity/parse_props.js +++ b/x-pack/plugins/monitoring/public/components/elasticsearch/shard_activity/parse_props.js @@ -5,7 +5,6 @@ * 2.0. */ -import { Legacy } from '../../../legacy_shims'; import { capitalize } from 'lodash'; import { formatMetric } from '../../../lib/format_number'; import { formatDateTimeLocal } from '../../../../common/formatting'; @@ -42,21 +41,12 @@ export const parseProps = (props) => { const { files, size } = index; - let thisTimezone; - // react version passes timezone while Angular uses injector - if (!timezone) { - const injector = Legacy.shims.getAngularInjector(); - thisTimezone = injector.get('config').get('dateFormat:tz'); - } else { - thisTimezone = timezone; - } - return { name: indexName || index.name, shard: `${id} / ${isPrimary ? 'Primary' : 'Replica'}`, relocationType: type === 'PRIMARY_RELOCATION' ? 'Primary Relocation' : normalizeString(type), stage: normalizeString(stage), - startTime: formatDateTimeLocal(startTimeInMillis, thisTimezone), + startTime: formatDateTimeLocal(startTimeInMillis, timezone), totalTime: formatMetric(Math.floor(totalTimeInMillis / 1000), '00:00:00'), isCopiedFromPrimary: !isPrimary || type === 'PRIMARY_RELOCATION', sourceName: source.name === undefined ? 'n/a' : source.name, diff --git a/x-pack/plugins/monitoring/public/components/elasticsearch/shard_activity/shard_activity.js b/x-pack/plugins/monitoring/public/components/elasticsearch/shard_activity/shard_activity.js index 7b939f0fee8e6d..e55cb793574a9f 100644 --- a/x-pack/plugins/monitoring/public/components/elasticsearch/shard_activity/shard_activity.js +++ b/x-pack/plugins/monitoring/public/components/elasticsearch/shard_activity/shard_activity.js @@ -15,6 +15,7 @@ import { FilesProgress, BytesProgress, TranslogProgress } from './progress'; import { parseProps } from './parse_props'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; +import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; const columns = [ { @@ -67,14 +68,19 @@ const columns = [ }, ]; -export class ShardActivity extends React.Component { - constructor(props) { - super(props); - this.getNoDataMessage = this.getNoDataMessage.bind(this); - } - - getNoDataMessage() { - if (this.props.showShardActivityHistory) { +export const ShardActivity = (props) => { + const { + data: rawData, + sorting, + pagination, + onTableChange, + toggleShardActivityHistory, + showShardActivityHistory, + } = props; + const { services } = useKibana(); + const timezone = services.uiSettings?.get('dateFormat:tz'); + const getNoDataMessage = () => { + if (showShardActivityHistory) { return i18n.translate('xpack.monitoring.elasticsearch.shardActivity.noDataMessage', { defaultMessage: 'There are no historical shard activity records for the selected time range.', @@ -92,7 +98,7 @@ export class ShardActivity extends React.Component { defaultMessage="Try viewing {shardActivityHistoryLink}." values={{ shardActivityHistoryLink: ( - +
); - } - - render() { - // data prop is an array of table row data, or null (which triggers no data message) - const { - data: rawData, - sorting, - pagination, - onTableChange, - toggleShardActivityHistory, - showShardActivityHistory, - } = this.props; - - if (rawData === null) { - return null; - } + }; - const rows = rawData.map(parseProps); + const rows = rawData.map((data) => parseProps({ ...data, timezone })); - return ( - - - -

- -

-
-
- - + + +

- } - onChange={toggleShardActivityHistory} - checked={showShardActivityHistory} - /> - - - - ); - } -} +

+
+
+ + + } + onChange={toggleShardActivityHistory} + checked={showShardActivityHistory} + /> + + +
+ ); +}; diff --git a/x-pack/plugins/monitoring/public/components/elasticsearch/shard_activity/shard_activity_react.js b/x-pack/plugins/monitoring/public/components/elasticsearch/shard_activity/shard_activity_react.js deleted file mode 100644 index cc219ff0fff321..00000000000000 --- a/x-pack/plugins/monitoring/public/components/elasticsearch/shard_activity/shard_activity_react.js +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React, { Fragment } from 'react'; -import { EuiText, EuiTitle, EuiLink, EuiSpacer, EuiSwitch } from '@elastic/eui'; -import { EuiMonitoringTable } from '../../table'; -import { RecoveryIndex } from './recovery_index'; -import { TotalTime } from './total_time'; -import { SourceDestination } from './source_destination'; -import { FilesProgress, BytesProgress, TranslogProgress } from './progress'; -import { parseProps } from './parse_props'; -import { i18n } from '@kbn/i18n'; -import { FormattedMessage } from '@kbn/i18n/react'; -import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; - -const columns = [ - { - name: i18n.translate('xpack.monitoring.kibana.shardActivity.indexTitle', { - defaultMessage: 'Index', - }), - field: 'name', - render: (_name, shard) => , - }, - { - name: i18n.translate('xpack.monitoring.kibana.shardActivity.stageTitle', { - defaultMessage: 'Stage', - }), - field: 'stage', - }, - { - name: i18n.translate('xpack.monitoring.kibana.shardActivity.totalTimeTitle', { - defaultMessage: 'Total Time', - }), - field: null, - render: (shard) => , - }, - { - name: i18n.translate('xpack.monitoring.kibana.shardActivity.sourceDestinationTitle', { - defaultMessage: 'Source / Destination', - }), - field: null, - render: (shard) => , - }, - { - name: i18n.translate('xpack.monitoring.kibana.shardActivity.filesTitle', { - defaultMessage: 'Files', - }), - field: null, - render: (shard) => , - }, - { - name: i18n.translate('xpack.monitoring.kibana.shardActivity.bytesTitle', { - defaultMessage: 'Bytes', - }), - field: null, - render: (shard) => , - }, - { - name: i18n.translate('xpack.monitoring.kibana.shardActivity.translogTitle', { - defaultMessage: 'Translog', - }), - field: null, - render: (shard) => , - }, -]; - -export const ShardActivityReact = (props) => { - const { - data: rawData, - sorting, - pagination, - onTableChange, - toggleShardActivityHistory, - showShardActivityHistory, - } = props; - const { services } = useKibana(); - const timezone = services.uiSettings?.get('dateFormat:tz'); - const getNoDataMessage = () => { - if (showShardActivityHistory) { - return i18n.translate('xpack.monitoring.elasticsearch.shardActivity.noDataMessage', { - defaultMessage: - 'There are no historical shard activity records for the selected time range.', - }); - } - return ( - - -
- - - - ), - }} - /> -
- ); - }; - - const rows = rawData.map((data) => parseProps({ ...data, timezone })); - - return ( - - - -

- -

-
-
- - - } - onChange={toggleShardActivityHistory} - checked={showShardActivityHistory} - /> - - -
- ); -}; diff --git a/x-pack/plugins/monitoring/public/components/elasticsearch/shard_allocation/components/cluster_view.js b/x-pack/plugins/monitoring/public/components/elasticsearch/shard_allocation/components/cluster_view.js index a637703a98cdc9..a004c7fae8e958 100644 --- a/x-pack/plugins/monitoring/public/components/elasticsearch/shard_allocation/components/cluster_view.js +++ b/x-pack/plugins/monitoring/public/components/elasticsearch/shard_allocation/components/cluster_view.js @@ -8,67 +8,22 @@ import React from 'react'; import { TableHead } from './table_head'; import { TableBody } from './table_body'; -import { i18n } from '@kbn/i18n'; -export class ClusterView extends React.Component { - static displayName = i18n.translate( - 'xpack.monitoring.elasticsearch.shardAllocation.clusterViewDisplayName', - { - defaultMessage: 'ClusterView', - } +export const ClusterView = (props) => { + return ( + + + +
); - - constructor(props) { - super(props); - - this.state = { - labels: props.scope.labels || [], - showing: props.scope.showing || [], - shardStats: props.scope.pageData.shardStats, - showSystemIndices: props.showSystemIndices, - toggleShowSystemIndices: props.toggleShowSystemIndices, - }; - } - - setShowing = (data) => { - if (data) { - this.setState({ showing: data }); - } - }; - - setShardStats = (stats) => { - this.setState({ shardStats: stats }); - }; - - UNSAFE_componentWillMount() { - this.props.scope.$watch('showing', this.setShowing); - this.props.scope.$watch(() => this.props.scope.pageData.shardStats, this.setShardStats); - } - - hasUnassigned = () => { - return ( - this.state.showing.length && - this.state.showing[0].unassigned && - this.state.showing[0].unassigned.length - ); - }; - - render() { - return ( - - - -
- ); - } -} +}; diff --git a/x-pack/plugins/monitoring/public/components/elasticsearch/shard_allocation/components/cluster_view_react.js b/x-pack/plugins/monitoring/public/components/elasticsearch/shard_allocation/components/cluster_view_react.js deleted file mode 100644 index 2d0c4b59df4b81..00000000000000 --- a/x-pack/plugins/monitoring/public/components/elasticsearch/shard_allocation/components/cluster_view_react.js +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React from 'react'; -import { TableHeadReact } from './table_head_react'; -import { TableBody } from './table_body'; - -export const ClusterViewReact = (props) => { - return ( - - - -
- ); -}; diff --git a/x-pack/plugins/monitoring/public/components/elasticsearch/shard_allocation/components/table_head.js b/x-pack/plugins/monitoring/public/components/elasticsearch/shard_allocation/components/table_head.js index d4d4da050d37a8..b5316bb624a800 100644 --- a/x-pack/plugins/monitoring/public/components/elasticsearch/shard_allocation/components/table_head.js +++ b/x-pack/plugins/monitoring/public/components/elasticsearch/shard_allocation/components/table_head.js @@ -14,18 +14,15 @@ class IndexLabel extends React.Component { constructor(props) { super(props); this.state = { - showSystemIndices: props.scope.showSystemIndices, + showSystemIndices: props.showSystemIndices, }; this.toggleShowSystemIndicesState = this.toggleShowSystemIndicesState.bind(this); } - // See also public/directives/index_listing/index toggleShowSystemIndicesState(e) { const isChecked = e.target.checked; this.setState({ showSystemIndices: isChecked }); - this.props.scope.$evalAsync(() => { - this.props.toggleShowSystemIndices(isChecked); - }); + this.props.toggleShowSystemIndices(isChecked); } render() { @@ -70,7 +67,7 @@ export class TableHead extends React.Component { } render() { - const propLabels = this.props.scope.labels || []; + const propLabels = this.props.labels || []; const labelColumns = propLabels .map((label) => { const column = { @@ -81,8 +78,8 @@ export class TableHead extends React.Component { // override text label content with a JSX component column.content = ( ); } else { diff --git a/x-pack/plugins/monitoring/public/components/elasticsearch/shard_allocation/components/table_head_react.js b/x-pack/plugins/monitoring/public/components/elasticsearch/shard_allocation/components/table_head_react.js deleted file mode 100644 index 5f914792ec70ba..00000000000000 --- a/x-pack/plugins/monitoring/public/components/elasticsearch/shard_allocation/components/table_head_react.js +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React from 'react'; -import { i18n } from '@kbn/i18n'; -import { EuiFlexGroup, EuiFlexItem, EuiSwitch } from '@elastic/eui'; -import { FormattedMessage } from '@kbn/i18n/react'; - -class IndexLabel extends React.Component { - constructor(props) { - super(props); - this.state = { - showSystemIndices: props.showSystemIndices, - }; - this.toggleShowSystemIndicesState = this.toggleShowSystemIndicesState.bind(this); - } - - toggleShowSystemIndicesState(e) { - const isChecked = e.target.checked; - this.setState({ showSystemIndices: isChecked }); - this.props.toggleShowSystemIndices(isChecked); - } - - render() { - return ( - - - - - - - - - ); - } -} - -// eslint-disable-next-line react/no-multi-comp -export class TableHeadReact extends React.Component { - constructor(props) { - super(props); - } - - createColumn({ key, content }) { - return ( - - {content} - - ); - } - - render() { - const propLabels = this.props.labels || []; - const labelColumns = propLabels - .map((label) => { - const column = { - key: label.content.toLowerCase(), - }; - - if (label.showToggleSystemIndicesComponent) { - // override text label content with a JSX component - column.content = ( - - ); - } else { - column.content = label.content; - } - - return column; - }) - .map(this.createColumn); - - return ( - - {labelColumns} - - ); - } -} diff --git a/x-pack/plugins/monitoring/public/components/elasticsearch/shard_allocation/index.js b/x-pack/plugins/monitoring/public/components/elasticsearch/shard_allocation/index.js index dd4121b69574c4..247bad7527846f 100644 --- a/x-pack/plugins/monitoring/public/components/elasticsearch/shard_allocation/index.js +++ b/x-pack/plugins/monitoring/public/components/elasticsearch/shard_allocation/index.js @@ -6,4 +6,3 @@ */ export { ShardAllocation } from './shard_allocation'; -export { ShardAllocationReact } from './shard_allocation_react'; diff --git a/x-pack/plugins/monitoring/public/components/elasticsearch/shard_allocation/shard_allocation.js b/x-pack/plugins/monitoring/public/components/elasticsearch/shard_allocation/shard_allocation.js index f02b93eba8f903..7ca24853a9ccbc 100644 --- a/x-pack/plugins/monitoring/public/components/elasticsearch/shard_allocation/shard_allocation.js +++ b/x-pack/plugins/monitoring/public/components/elasticsearch/shard_allocation/shard_allocation.js @@ -9,10 +9,10 @@ import React from 'react'; import { EuiTitle, EuiBadge, EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import { i18n } from '@kbn/i18n'; -import { ClusterView } from './components/cluster_view'; import './shard_allocation.scss'; +import { ClusterView } from './components/cluster_view'; -export const ShardAllocation = ({ scope, type, shardStats }) => { +export const ShardAllocation = (props) => { const types = [ { label: i18n.translate('xpack.monitoring.elasticsearch.shardAllocation.primaryLabel', { @@ -77,13 +77,7 @@ export const ShardAllocation = ({ scope, type, shardStats }) => { ))} - + ); }; diff --git a/x-pack/plugins/monitoring/public/components/elasticsearch/shard_allocation/shard_allocation_react.js b/x-pack/plugins/monitoring/public/components/elasticsearch/shard_allocation/shard_allocation_react.js deleted file mode 100644 index 502d93d5411d2d..00000000000000 --- a/x-pack/plugins/monitoring/public/components/elasticsearch/shard_allocation/shard_allocation_react.js +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React from 'react'; -import { EuiTitle, EuiBadge, EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui'; -import { FormattedMessage } from '@kbn/i18n/react'; -import { i18n } from '@kbn/i18n'; -import './shard_allocation.scss'; -import { ClusterViewReact } from './components/cluster_view_react'; - -export const ShardAllocationReact = (props) => { - const types = [ - { - label: i18n.translate('xpack.monitoring.elasticsearch.shardAllocation.primaryLabel', { - defaultMessage: 'Primary', - }), - color: 'primary', - }, - { - label: i18n.translate('xpack.monitoring.elasticsearch.shardAllocation.replicaLabel', { - defaultMessage: 'Replica', - }), - color: 'secondary', - }, - { - label: i18n.translate('xpack.monitoring.elasticsearch.shardAllocation.relocatingLabel', { - defaultMessage: 'Relocating', - }), - color: 'accent', - }, - { - label: i18n.translate('xpack.monitoring.elasticsearch.shardAllocation.initializingLabel', { - defaultMessage: 'Initializing', - }), - color: 'default', - }, - { - label: i18n.translate( - 'xpack.monitoring.elasticsearch.shardAllocation.unassignedPrimaryLabel', - { - defaultMessage: 'Unassigned Primary', - } - ), - color: 'danger', - }, - { - label: i18n.translate( - 'xpack.monitoring.elasticsearch.shardAllocation.unassignedReplicaLabel', - { - defaultMessage: 'Unassigned Replica', - } - ), - color: 'warning', - }, - ]; - - return ( -
- -

- -

-
- - - {types.map((type) => ( - - {type.label} - - ))} - - - -
- ); -}; diff --git a/x-pack/plugins/monitoring/public/components/index.ts b/x-pack/plugins/monitoring/public/components/index.ts index 6f0b9bb88667fb..b8e9adbf27fa30 100644 --- a/x-pack/plugins/monitoring/public/components/index.ts +++ b/x-pack/plugins/monitoring/public/components/index.ts @@ -12,4 +12,4 @@ export { NoData } from './no_data'; export { License } from './license'; export { PageLoading } from './page_loading'; -export { ElasticsearchOverview, ElasticsearchNodes, ElasticsearchIndices } from './elasticsearch'; +export { ElasticsearchNodes, ElasticsearchIndices } from './elasticsearch'; diff --git a/x-pack/plugins/monitoring/public/components/logs/logs.js b/x-pack/plugins/monitoring/public/components/logs/logs.js index 3021240a157d3b..52c1c1373caf54 100644 --- a/x-pack/plugins/monitoring/public/components/logs/logs.js +++ b/x-pack/plugins/monitoring/public/components/logs/logs.js @@ -16,18 +16,8 @@ import { FormattedMessage } from '@kbn/i18n/react'; import { Reason } from './reason'; const getFormattedDateTimeLocal = (timestamp) => { - try { - const injector = Legacy.shims.getAngularInjector(); - const timezone = injector.get('config').get('dateFormat:tz'); - return formatDateTimeLocal(timestamp, timezone); - } catch (error) { - if (error.message === 'Angular has been removed.') { - const timezone = Legacy.shims.uiSettings?.get('dateFormat:tz'); - return formatDateTimeLocal(timestamp, timezone); - } else { - throw error; - } - } + const timezone = Legacy.shims.uiSettings?.get('dateFormat:tz'); + return formatDateTimeLocal(timestamp, timezone); }; const columnTimestampTitle = i18n.translate('xpack.monitoring.logs.listing.timestampTitle', { diff --git a/x-pack/plugins/monitoring/public/legacy_shims.ts b/x-pack/plugins/monitoring/public/legacy_shims.ts index 48484421839bd7..7c7e7642cac810 100644 --- a/x-pack/plugins/monitoring/public/legacy_shims.ts +++ b/x-pack/plugins/monitoring/public/legacy_shims.ts @@ -37,14 +37,9 @@ export interface KFetchKibanaOptions { prependBasePath?: boolean; } -const angularNoop = () => { - throw new Error('Angular has been removed.'); -}; - export interface IShims { toastNotifications: CoreStart['notifications']['toasts']; capabilities: CoreStart['application']['capabilities']; - getAngularInjector: typeof angularNoop; getBasePath: () => string; getInjected: (name: string, defaultValue?: unknown) => unknown; breadcrumbs: { @@ -84,7 +79,6 @@ export class Legacy { this._shims = { toastNotifications: core.notifications.toasts, capabilities: core.application.capabilities, - getAngularInjector: angularNoop, getBasePath: (): string => core.http.basePath.get(), getInjected: (name: string, defaultValue?: unknown): string | unknown => core.injectedMetadata.getInjectedVar(name, defaultValue), diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 07b9519f34050a..36973fa248d24b 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -18201,7 +18201,6 @@ "xpack.monitoring.elasticsearch.shardActivity.totalTimeTooltip": "開始:{startTime}", "xpack.monitoring.elasticsearch.shardActivity.unknownTargetAddressContent": "不明", "xpack.monitoring.elasticsearch.shardActivityTitle": "シャードアクティビティ", - "xpack.monitoring.elasticsearch.shardAllocation.clusterViewDisplayName": "ClusterView", "xpack.monitoring.elasticsearch.shardAllocation.decorateShards.relocatingFromTextMessage": "{nodeName} から移動しています", "xpack.monitoring.elasticsearch.shardAllocation.decorateShards.relocatingToTextMessage": "{nodeName} に移動しています", "xpack.monitoring.elasticsearch.shardAllocation.initializingLabel": "初期化中", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 9e872393869e4e..bfc02c540ef44f 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -18477,7 +18477,6 @@ "xpack.monitoring.elasticsearch.shardActivity.totalTimeTooltip": "已启动:{startTime}", "xpack.monitoring.elasticsearch.shardActivity.unknownTargetAddressContent": "未知", "xpack.monitoring.elasticsearch.shardActivityTitle": "分片活动", - "xpack.monitoring.elasticsearch.shardAllocation.clusterViewDisplayName": "ClusterView", "xpack.monitoring.elasticsearch.shardAllocation.decorateShards.relocatingFromTextMessage": "正在从 {nodeName} 迁移", "xpack.monitoring.elasticsearch.shardAllocation.decorateShards.relocatingToTextMessage": "正在迁移至 {nodeName}", "xpack.monitoring.elasticsearch.shardAllocation.initializingLabel": "正在初始化",