From 5691dcff696cbd04f78830787da358957c04bc2d Mon Sep 17 00:00:00 2001 From: Tim Sullivan Date: Fri, 15 Jun 2018 14:28:29 -0700 Subject: [PATCH] [Monitoring] Improve User Experience of Enabling Monitoring Collection (#19451) * [Monitoring/No Data] Show a "still waiting" link after 19s * minor bug fix: spinner if _interval_ updating * update "we tried" * some wording changes on activating / trying to activate monitoring * cancel the setTimeout when component gets unmounted * more wording tweaks * update snapshot --- .../collection_enabled/collection_enabled.js | 28 +++++++++++++++++-- .../collection_interval.test.js.snap | 11 ++++++++ .../collection_interval.js | 4 +-- .../__snapshots__/we_tried.test.js.snap | 18 ++---------- .../components/no_data/reasons/we_tried.js | 18 ++---------- 5 files changed, 43 insertions(+), 36 deletions(-) diff --git a/x-pack/plugins/monitoring/public/components/no_data/explanations/collection_enabled/collection_enabled.js b/x-pack/plugins/monitoring/public/components/no_data/explanations/collection_enabled/collection_enabled.js index e40ad5d235a5..9f94ad56d3e8 100644 --- a/x-pack/plugins/monitoring/public/components/no_data/explanations/collection_enabled/collection_enabled.js +++ b/x-pack/plugins/monitoring/public/components/no_data/explanations/collection_enabled/collection_enabled.js @@ -23,11 +23,25 @@ export class ExplainCollectionEnabled extends React.Component { constructor(props) { super(props); this.handleClick = this.handleClick.bind(this); + this.waitedTooLongTimer = null; + + this.state = { + waitedTooLong: false + }; + } + + componentWillUnmount() { + clearInterval(this.waitedTooLongTimer); } handleClick() { const { enabler } = this.props; enabler.enableCollectionEnabled(); + + // wait 19 seconds, show link to reload + this.waitedTooLongTimer = setTimeout(() => { + this.setState({ waitedTooLong: true }); + }, 19 * 1000); } render() { @@ -72,6 +86,13 @@ export class ExplainCollectionEnabled extends React.Component { ); + + const stillWaiting = this.state.waitedTooLong ? ( +

+ Still waiting? +

+ ) : null; + const renderSuccess = () => ( @@ -80,13 +101,14 @@ export class ExplainCollectionEnabled extends React.Component {

- When the data is in your - cluster, your monitoring - dashboard will show up here. This only takes a few seconds. + When the data is in your cluster, your monitoring dashboard will + show up here. This might take a few seconds.

+ + {stillWaiting}
); diff --git a/x-pack/plugins/monitoring/public/components/no_data/explanations/collection_interval/__tests__/__snapshots__/collection_interval.test.js.snap b/x-pack/plugins/monitoring/public/components/no_data/explanations/collection_interval/__tests__/__snapshots__/collection_interval.test.js.snap index d87fa54f9660..f1c95d3531fe 100644 --- a/x-pack/plugins/monitoring/public/components/no_data/explanations/collection_interval/__tests__/__snapshots__/collection_interval.test.js.snap +++ b/x-pack/plugins/monitoring/public/components/no_data/explanations/collection_interval/__tests__/__snapshots__/collection_interval.test.js.snap @@ -199,18 +199,28 @@ exports[`ExplainCollectionInterval collection interval setting updates should sh data-test-subj="enableCollectionInterval" fill={true} iconSide="left" + isLoading={true} onClick={[Function]} type="button" >