From faa57fd7a912e7fceaf2c96c1d2c76db6fc500be Mon Sep 17 00:00:00 2001 From: Chris Roberson Date: Mon, 17 Dec 2018 14:38:21 -0500 Subject: [PATCH] [Monitoring] Stop a new request when one is inflight (#27253) * Convert all pages to use the base controlller, then add logic in there to stop a new request when one is inflight * Reuse the promise * Undo logstash changes * Update in catch too * Add unit test * Fix cluster name showing up * Update broken test * Just use updateDataPromise --- .../components/elasticsearch/index/index.js | 4 +- .../components/kibana/detail_status/index.js | 4 + .../logstash/detail_status/index.js | 3 + .../monitoring/public/directives/all.js | 1 - .../directives/cluster/overview/index.js | 40 ----- .../public/directives/main/index.html | 2 +- .../public/directives/main/index.js | 2 + .../public/views/__tests__/base_controller.js | 19 +++ .../public/views/base_controller.js | 18 ++- .../public/views/cluster/overview/index.html | 2 +- .../public/views/cluster/overview/index.js | 58 ++++--- .../elasticsearch/index/advanced/index.html | 4 +- .../elasticsearch/index/advanced/index.js | 80 ++++------ .../views/elasticsearch/index/index.html | 4 +- .../public/views/elasticsearch/index/index.js | 104 ++++++------- .../elasticsearch/node/advanced/index.js | 80 ++++------ .../views/elasticsearch/node/index.html | 8 +- .../public/views/elasticsearch/node/index.js | 121 +++++++------- .../public/views/kibana/instance/index.js | 147 ++++++++---------- .../public/views/kibana/overview/index.js | 98 +++++------- .../apps/monitoring/kibana/instance.js | 2 +- 21 files changed, 355 insertions(+), 446 deletions(-) delete mode 100644 x-pack/plugins/monitoring/public/directives/cluster/overview/index.js 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 8caf0d0b48b4..395fd3084e5e 100644 --- a/x-pack/plugins/monitoring/public/components/elasticsearch/index/index.js +++ b/x-pack/plugins/monitoring/public/components/elasticsearch/index/index.js @@ -18,9 +18,9 @@ import { MonitoringTimeseriesContainer } from '../../chart'; import { ShardAllocation } from '../shard_allocation/shard_allocation'; export const Index = ({ + scope, indexSummary, metrics, - scope, kbnUrl, ...props }) => { @@ -51,7 +51,7 @@ export const Index = ({ ))} - + diff --git a/x-pack/plugins/monitoring/public/components/kibana/detail_status/index.js b/x-pack/plugins/monitoring/public/components/kibana/detail_status/index.js index 0322f6259128..2bc90e9ff9b8 100644 --- a/x-pack/plugins/monitoring/public/components/kibana/detail_status/index.js +++ b/x-pack/plugins/monitoring/public/components/kibana/detail_status/index.js @@ -21,6 +21,10 @@ function DetailStatusUI({ stats, intl }) { const metrics = [ { + label: intl.formatMessage({ + id: 'xpack.monitoring.kibana.detailStatus.transportAddressLabel', + defaultMessage: 'Transport Address' + }), value: transportAddress, 'data-test-subj': 'transportAddress' }, diff --git a/x-pack/plugins/monitoring/public/components/logstash/detail_status/index.js b/x-pack/plugins/monitoring/public/components/logstash/detail_status/index.js index ce95eac5a39b..4d96a42e2259 100644 --- a/x-pack/plugins/monitoring/public/components/logstash/detail_status/index.js +++ b/x-pack/plugins/monitoring/public/components/logstash/detail_status/index.js @@ -22,6 +22,9 @@ function DetailStatusUi({ stats, intl }) { const firstMetrics = [ { + label: intl.formatMessage({ + id: 'xpack.monitoring.logstash.detailStatus.transportAddressLabel', defaultMessage: 'Transport Address' + }), value: httpAddress, 'data-test-subj': 'httpAddress' }, diff --git a/x-pack/plugins/monitoring/public/directives/all.js b/x-pack/plugins/monitoring/public/directives/all.js index 4aca3c22fd8a..60d8f88c759c 100644 --- a/x-pack/plugins/monitoring/public/directives/all.js +++ b/x-pack/plugins/monitoring/public/directives/all.js @@ -7,7 +7,6 @@ import './main'; import './chart'; import './sparkline'; -import './cluster/overview'; import './cluster/listing'; import './elasticsearch/cluster_status'; import './elasticsearch/index_summary'; diff --git a/x-pack/plugins/monitoring/public/directives/cluster/overview/index.js b/x-pack/plugins/monitoring/public/directives/cluster/overview/index.js deleted file mode 100644 index 17439f890886..000000000000 --- a/x-pack/plugins/monitoring/public/directives/cluster/overview/index.js +++ /dev/null @@ -1,40 +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 from 'react'; -import ReactDOM from 'react-dom'; -import { Overview } from 'plugins/monitoring/components/cluster/overview'; -import { uiModules } from 'ui/modules'; -import { I18nProvider } from '@kbn/i18n/react'; - -const uiModule = uiModules.get('monitoring/directives', []); -uiModule.directive('monitoringClusterOverview', (kbnUrl, showLicenseExpiration) => { - return { - restrict: 'E', - scope: { cluster: '=' }, - link(scope, $el) { - - const changeUrl = target => { - scope.$evalAsync(() => { - kbnUrl.changePath(target); - }); - }; - - scope.$watch('cluster', cluster => { - ReactDOM.render(( - - - - ), $el[0]); - }); - - } - }; -}); diff --git a/x-pack/plugins/monitoring/public/directives/main/index.html b/x-pack/plugins/monitoring/public/directives/main/index.html index d21c9cfba59a..83b45939ce49 100644 --- a/x-pack/plugins/monitoring/public/directives/main/index.html +++ b/x-pack/plugins/monitoring/public/directives/main/index.html @@ -253,7 +253,7 @@