From 83d6fd447d94ae4045317fed8318cca455ede9a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81bastien?= Date: Tue, 22 Jan 2019 17:45:46 +0100 Subject: [PATCH 01/11] Avoid parsing empty string to integer + don't allow negative value for number inputs --- .../public/app/components/form_entry_row.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/cross_cluster_replication/public/app/components/form_entry_row.js b/x-pack/plugins/cross_cluster_replication/public/app/components/form_entry_row.js index bfc7d8e3c6c7b..354c7a2227451 100644 --- a/x-pack/plugins/cross_cluster_replication/public/app/components/form_entry_row.js +++ b/x-pack/plugins/cross_cluster_replication/public/app/components/form_entry_row.js @@ -49,7 +49,15 @@ export class FormEntryRow extends PureComponent { onFieldChange = (value) => { const { field, onValueUpdate, type } = this.props; const isNumber = type === 'number'; - onValueUpdate({ [field]: isNumber ? parseInt(value, 10) : value }); + + let valueParsed = value; + + if (isNumber) { + valueParsed = !!value ? parseInt(value, 10) : value; // make sure we don't send NaN value + valueParsed = valueParsed && valueParsed < 0 ? 0 : valueParsed; // make sure we don't send negative value + } + + onValueUpdate({ [field]: valueParsed }); } renderField = (isInvalid) => { From ff691836c8ae254eb7055e9a21fcb440eb9ed247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81bastien?= Date: Wed, 23 Jan 2019 15:28:07 +0100 Subject: [PATCH 02/11] Add missing "type" property to FormEntryRow --- .../app/components/follower_index_form/follower_index_form.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/cross_cluster_replication/public/app/components/follower_index_form/follower_index_form.js b/x-pack/plugins/cross_cluster_replication/public/app/components/follower_index_form/follower_index_form.js index 1d91c96d266ad..240e6ba2b84dc 100644 --- a/x-pack/plugins/cross_cluster_replication/public/app/components/follower_index_form/follower_index_form.js +++ b/x-pack/plugins/cross_cluster_replication/public/app/components/follower_index_form/follower_index_form.js @@ -512,7 +512,7 @@ export const FollowerIndexForm = injectI18n( {advancedSettingsFields.map((advancedSetting) => { - const { field, title, description, label, helpText, defaultValue } = advancedSetting; + const { field, title, description, label, helpText, defaultValue, type } = advancedSetting; return ( From 7cd920c31e0ea00a272e97d6e089e802cbae8767 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81bastien?= Date: Mon, 28 Jan 2019 08:36:56 +0100 Subject: [PATCH 03/11] Fix translation display in remote cluster dropdown --- .../app/components/remote_clusters_form_field.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/x-pack/plugins/cross_cluster_replication/public/app/components/remote_clusters_form_field.js b/x-pack/plugins/cross_cluster_replication/public/app/components/remote_clusters_form_field.js index 33f9072068a08..7e6465f00a198 100644 --- a/x-pack/plugins/cross_cluster_replication/public/app/components/remote_clusters_form_field.js +++ b/x-pack/plugins/cross_cluster_replication/public/app/components/remote_clusters_form_field.js @@ -99,13 +99,10 @@ export const RemoteClustersFormField = injectI18n( const hasClusters = Boolean(remoteClusters.length); const remoteClustersOptions = hasClusters ? remoteClusters.map(({ name, isConnected }) => ({ value: name, - text: isConnected ? name : ( - - ), + text: isConnected ? name : this.props.intl.formatMessage({ + id: 'xpack.crossClusterReplication.forms.remoteClusterDropdownNotConnected', + defaultMessage: '{name} (not connected)', + }, { name }), 'data-test-subj': `option-${name}` })) : []; const errorMessage = this.renderErrorMessage(); From 6442d957a2cd91125385afd631b0be9ea0d992f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81bastien?= Date: Mon, 28 Jan 2019 09:51:10 +0100 Subject: [PATCH 04/11] Fix wrong endpoint for auto-follow stats + show api server error in auto-follow pattern form --- .../auto_follow_pattern_add.container.js | 4 ++-- .../cross_cluster_replication/public/app/services/api.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/cross_cluster_replication/public/app/sections/auto_follow_pattern_add/auto_follow_pattern_add.container.js b/x-pack/plugins/cross_cluster_replication/public/app/sections/auto_follow_pattern_add/auto_follow_pattern_add.container.js index 6cee0f21236b2..f7d47b57dac33 100644 --- a/x-pack/plugins/cross_cluster_replication/public/app/sections/auto_follow_pattern_add/auto_follow_pattern_add.container.js +++ b/x-pack/plugins/cross_cluster_replication/public/app/sections/auto_follow_pattern_add/auto_follow_pattern_add.container.js @@ -14,8 +14,8 @@ import { AutoFollowPatternAdd as AutoFollowPatternAddView } from './auto_follow_ const scope = SECTIONS.AUTO_FOLLOW_PATTERN; const mapStateToProps = (state) => ({ - apiStatus: getApiStatus(scope)(state), - apiError: getApiError(scope)(state), + apiStatus: getApiStatus(`${scope}-save`)(state), + apiError: getApiError(`${scope}-save`)(state), }); const mapDispatchToProps = dispatch => ({ diff --git a/x-pack/plugins/cross_cluster_replication/public/app/services/api.js b/x-pack/plugins/cross_cluster_replication/public/app/services/api.js index d122b1fbf17ff..e357eed443b2f 100644 --- a/x-pack/plugins/cross_cluster_replication/public/app/services/api.js +++ b/x-pack/plugins/cross_cluster_replication/public/app/services/api.js @@ -95,7 +95,7 @@ export const updateFollowerIndex = (id, followerIndex) => ( /* Stats */ export const loadAutoFollowStats = () => ( - httpClient.get(`${apiPrefixIndexManagement}/stats/auto-follow`).then(extractData) + httpClient.get(`${apiPrefix}/stats/auto-follow`).then(extractData) ); /* Indices */ From c4147f899879af442e8e394f3c4bf601b31069ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81bastien?= Date: Mon, 28 Jan 2019 10:42:12 +0100 Subject: [PATCH 05/11] Improve UX when remote cluster api requests fail --- .../auto_follow_pattern_add.js | 13 ++----------- .../auto_follow_pattern_edit.js | 12 ++---------- .../follower_index_add/follower_index_add.js | 13 ++----------- .../follower_index_edit/follower_index_edit.js | 6 +----- 4 files changed, 7 insertions(+), 37 deletions(-) diff --git a/x-pack/plugins/cross_cluster_replication/public/app/sections/auto_follow_pattern_add/auto_follow_pattern_add.js b/x-pack/plugins/cross_cluster_replication/public/app/sections/auto_follow_pattern_add/auto_follow_pattern_add.js index 3a30e5f1b036f..99900d0fdd596 100644 --- a/x-pack/plugins/cross_cluster_replication/public/app/sections/auto_follow_pattern_add/auto_follow_pattern_add.js +++ b/x-pack/plugins/cross_cluster_replication/public/app/sections/auto_follow_pattern_add/auto_follow_pattern_add.js @@ -20,7 +20,6 @@ import { AutoFollowPatternPageTitle, RemoteClustersProvider, SectionLoading, - SectionError, } from '../../components'; export const AutoFollowPatternAdd = injectI18n( @@ -41,7 +40,7 @@ export const AutoFollowPatternAdd = injectI18n( } render() { - const { saveAutoFollowPattern, apiStatus, apiError, intl, match: { url: currentUrl } } = this.props; + const { saveAutoFollowPattern, apiStatus, apiError, match: { url: currentUrl } } = this.props; return ( @@ -67,20 +66,12 @@ export const AutoFollowPatternAdd = injectI18n( ); } - if (error) { - const title = intl.formatMessage({ - id: 'xpack.crossClusterReplication.autoFollowPatternCreateForm.loadingRemoteClustersErrorTitle', - defaultMessage: 'Error loading remote clusters', - }); - return ; - } - return ( ); diff --git a/x-pack/plugins/cross_cluster_replication/public/app/sections/auto_follow_pattern_edit/auto_follow_pattern_edit.js b/x-pack/plugins/cross_cluster_replication/public/app/sections/auto_follow_pattern_edit/auto_follow_pattern_edit.js index 64b6cd56a2495..5099555daa6d8 100644 --- a/x-pack/plugins/cross_cluster_replication/public/app/sections/auto_follow_pattern_edit/auto_follow_pattern_edit.js +++ b/x-pack/plugins/cross_cluster_replication/public/app/sections/auto_follow_pattern_edit/auto_follow_pattern_edit.js @@ -119,7 +119,7 @@ export const AutoFollowPatternEdit = injectI18n( } render() { - const { saveAutoFollowPattern, apiStatus, apiError, autoFollowPattern, intl, match: { url: currentUrl } } = this.props; + const { saveAutoFollowPattern, apiStatus, apiError, autoFollowPattern, match: { url: currentUrl } } = this.props; return ( ; - } - return ( diff --git a/x-pack/plugins/cross_cluster_replication/public/app/sections/follower_index_add/follower_index_add.js b/x-pack/plugins/cross_cluster_replication/public/app/sections/follower_index_add/follower_index_add.js index 2e12804d37f40..460c22393db1b 100644 --- a/x-pack/plugins/cross_cluster_replication/public/app/sections/follower_index_add/follower_index_add.js +++ b/x-pack/plugins/cross_cluster_replication/public/app/sections/follower_index_add/follower_index_add.js @@ -20,7 +20,6 @@ import { FollowerIndexPageTitle, RemoteClustersProvider, SectionLoading, - SectionError, } from '../../components'; export const FollowerIndexAdd = injectI18n( @@ -41,7 +40,7 @@ export const FollowerIndexAdd = injectI18n( } render() { - const { saveFollowerIndex, clearApiError, apiStatus, apiError, intl, match: { url: currentUrl } } = this.props; + const { saveFollowerIndex, clearApiError, apiStatus, apiError, match: { url: currentUrl } } = this.props; return ( ; - } - return ( diff --git a/x-pack/plugins/cross_cluster_replication/public/app/sections/follower_index_edit/follower_index_edit.js b/x-pack/plugins/cross_cluster_replication/public/app/sections/follower_index_edit/follower_index_edit.js index 25f12267bfa33..370d4f53aca53 100644 --- a/x-pack/plugins/cross_cluster_replication/public/app/sections/follower_index_edit/follower_index_edit.js +++ b/x-pack/plugins/cross_cluster_replication/public/app/sections/follower_index_edit/follower_index_edit.js @@ -242,17 +242,13 @@ export const FollowerIndexEdit = injectI18n( ); } - if (error) { - remoteClusters = []; - } - return ( From 3bda0dff881bd44d9ceb82c03dea57a4b888be0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81bastien?= Date: Mon, 28 Jan 2019 11:53:39 +0100 Subject: [PATCH 06/11] Move header follower indices & auto-follow patterns header to their list component --- .../auto_follow_pattern_list.js | 101 ++++++++++++---- .../follower_indices_list.js | 103 ++++++++++++---- .../public/app/sections/home/home.js | 112 +----------------- 3 files changed, 163 insertions(+), 153 deletions(-) diff --git a/x-pack/plugins/cross_cluster_replication/public/app/sections/home/auto_follow_pattern_list/auto_follow_pattern_list.js b/x-pack/plugins/cross_cluster_replication/public/app/sections/home/auto_follow_pattern_list/auto_follow_pattern_list.js index 50dd65b2bb27c..b13c420038eaa 100644 --- a/x-pack/plugins/cross_cluster_replication/public/app/sections/home/auto_follow_pattern_list/auto_follow_pattern_list.js +++ b/x-pack/plugins/cross_cluster_replication/public/app/sections/home/auto_follow_pattern_list/auto_follow_pattern_list.js @@ -7,12 +7,19 @@ import React, { PureComponent, Fragment } from 'react'; import PropTypes from 'prop-types'; import { injectI18n, FormattedMessage } from '@kbn/i18n/react'; -import { EuiButton, EuiEmptyPrompt } from '@elastic/eui'; +import { + EuiButton, + EuiEmptyPrompt, + EuiFlexGroup, + EuiFlexItem, + EuiText, + EuiSpacer, +} from '@elastic/eui'; import routing from '../../../services/routing'; import { extractQueryParams } from '../../../services/query_params'; import { API_STATUS } from '../../../constants'; -import { SectionLoading, SectionError } from '../../../components'; +import { SectionLoading, SectionError, SectionUnauthorized } from '../../../components'; import { AutoFollowPatternTable, DetailPanel } from './components'; const REFRESH_RATE_MS = 30000; @@ -88,6 +95,71 @@ export const AutoFollowPatternList = injectI18n( clearInterval(this.interval); } + renderHeader() { + const { isAuthorized } = this.props; + return ( + + + + +

+ +

+
+
+ + + {isAuthorized && ( + + + + )} + +
+ + +
+ ); + } + + renderContent() { + const { autoFollowPatterns, apiStatus, apiError, isAuthorized, intl } = this.props; + if (!isAuthorized) { + return ( + + + + ); + } + + if (apiError) { + const title = intl.formatMessage({ + id: 'xpack.crossClusterReplication.autoFollowPatternList.loadingErrorTitle', + defaultMessage: 'Error loading auto-follow patterns', + }); + return ; + } + + if (apiStatus === API_STATUS.IDLE && !autoFollowPatterns.length) { + return this.renderEmpty(); + } + + return this.renderList(); + } + renderEmpty() { return ( ; - } - - return this.renderList(); + return ( + + {this.renderHeader()} + {this.renderContent()} + + ); } } ); diff --git a/x-pack/plugins/cross_cluster_replication/public/app/sections/home/follower_indices_list/follower_indices_list.js b/x-pack/plugins/cross_cluster_replication/public/app/sections/home/follower_indices_list/follower_indices_list.js index b20c375e9d4ac..d83915e665960 100644 --- a/x-pack/plugins/cross_cluster_replication/public/app/sections/home/follower_indices_list/follower_indices_list.js +++ b/x-pack/plugins/cross_cluster_replication/public/app/sections/home/follower_indices_list/follower_indices_list.js @@ -7,12 +7,19 @@ import React, { PureComponent, Fragment } from 'react'; import PropTypes from 'prop-types'; import { injectI18n, FormattedMessage } from '@kbn/i18n/react'; -import { EuiButton, EuiEmptyPrompt } from '@elastic/eui'; +import { + EuiButton, + EuiEmptyPrompt, + EuiFlexGroup, + EuiFlexItem, + EuiText, + EuiSpacer, +} from '@elastic/eui'; import routing from '../../../services/routing'; import { extractQueryParams } from '../../../services/query_params'; import { API_STATUS } from '../../../constants'; -import { SectionLoading, SectionError } from '../../../components'; +import { SectionLoading, SectionError, SectionUnauthorized } from '../../../components'; import { FollowerIndicesTable, DetailPanel } from './components'; const REFRESH_RATE_MS = 30000; @@ -84,6 +91,73 @@ export const FollowerIndicesList = injectI18n( clearInterval(this.interval); } + renderHeader() { + const { isAuthorized } = this.props; + + return ( + + + + +

+ +

+
+
+ + + {isAuthorized && ( + + + + )} + +
+ + +
+ ); + } + + renderContent() { + const { followerIndices, apiStatus, apiError, isAuthorized, intl } = this.props; + + if (!isAuthorized) { + return ( + + + + ); + } + + if (apiError) { + const title = intl.formatMessage({ + id: 'xpack.crossClusterReplication.followerIndexList.loadingErrorTitle', + defaultMessage: 'Error loading follower indices', + }); + return ; + } + + if (apiStatus === API_STATUS.IDLE && !followerIndices.length) { + return this.renderEmpty(); + } + + return this.renderList(); + } + renderEmpty() { return ( ; - } - - return this.renderList(); + return ( + + {this.renderHeader()} + {this.renderContent()} + + ); } } ); diff --git a/x-pack/plugins/cross_cluster_replication/public/app/sections/home/home.js b/x-pack/plugins/cross_cluster_replication/public/app/sections/home/home.js index 3181b5aebf2bf..72e1e8d3ad32a 100644 --- a/x-pack/plugins/cross_cluster_replication/public/app/sections/home/home.js +++ b/x-pack/plugins/cross_cluster_replication/public/app/sections/home/home.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import React, { PureComponent, Fragment } from 'react'; +import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; import { Route, Switch } from 'react-router-dom'; import { injectI18n, FormattedMessage } from '@kbn/i18n/react'; @@ -13,15 +13,11 @@ import { MANAGEMENT_BREADCRUMB } from 'ui/management'; import { BASE_PATH } from '../../../../common/constants'; import { - EuiButton, - EuiFlexGroup, - EuiFlexItem, EuiPageBody, EuiPageContent, EuiSpacer, EuiTab, EuiTabs, - EuiText, EuiTitle, } from '@elastic/eui'; @@ -29,7 +25,6 @@ import { listBreadcrumb } from '../../services/breadcrumbs'; import routing from '../../services/routing'; import { AutoFollowPatternList } from './auto_follow_pattern_list'; import { FollowerIndicesList } from './follower_indices_list'; -import { SectionUnauthorized } from '../../components'; export const CrossClusterReplicationHome = injectI18n( class extends PureComponent { @@ -77,108 +72,6 @@ export const CrossClusterReplicationHome = injectI18n( routing.navigate(`/${section}`); } - getHeaderSection() { - if(this.state.activeSection === 'follower_indices') { - const { isFollowerIndexApiAuthorized, followerIndices } = this.props; - - - // We want to show the title when the user isn't authorized. - if (isFollowerIndexApiAuthorized && !followerIndices.length) { - return null; - } - - return ( - - - - -

- -

-
-
- - - {isFollowerIndexApiAuthorized && ( - - - - )} - -
- - -
- ); - } else { - const { isAutoFollowApiAuthorized, autoFollowPatterns } = this.props; - - // We want to show the title when the user isn't authorized. - if (isAutoFollowApiAuthorized && !autoFollowPatterns.length) { - return null; - } - - return ( - - - - -

- -

-
-
- - - {isAutoFollowApiAuthorized && ( - - - - )} - -
- - -
- ); - } - } - - getUnauthorizedSection() { - const { isAutoFollowApiAuthorized } = this.props; - if (!isAutoFollowApiAuthorized) { - return ( - - - - ); - } - } - render() { return ( @@ -208,9 +101,6 @@ export const CrossClusterReplicationHome = injectI18n( - {this.getHeaderSection()} - {this.getUnauthorizedSection()} - From 79b3590d9d55e71b33c46e39766e569ad44f0fe5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81bastien?= Date: Mon, 28 Jan 2019 12:20:52 +0100 Subject: [PATCH 07/11] Refactor Remote clusters list component for better errors handling --- .../remote_cluster_list.js | 170 +++++++++--------- 1 file changed, 81 insertions(+), 89 deletions(-) diff --git a/x-pack/plugins/remote_clusters/public/sections/remote_cluster_list/remote_cluster_list.js b/x-pack/plugins/remote_clusters/public/sections/remote_cluster_list/remote_cluster_list.js index bc9878a883226..7fcc84d019f71 100644 --- a/x-pack/plugins/remote_clusters/public/sections/remote_cluster_list/remote_cluster_list.js +++ b/x-pack/plugins/remote_clusters/public/sections/remote_cluster_list/remote_cluster_list.js @@ -88,18 +88,37 @@ export const RemoteClusterList = injectI18n( clearInterval(this.interval); } - getHeaderSection() { + getHeaderSection(isAuthorized) { return ( - - -

- -

-
-
+ + + + +

+ +

+
+
+ + { isAuthorized && ( + + + + + + )} +
+ +
); } @@ -124,20 +143,16 @@ export const RemoteClusterList = injectI18n( defaultMessage: 'Permission error', }); return ( - - {this.getHeaderSection()} - - - - - + + + ); } @@ -155,17 +170,13 @@ export const RemoteClusterList = injectI18n( defaultMessage: 'Error loading remote clusters', }); return ( - - {this.getHeaderSection()} - - - {statusCode} {errorString} - - + + {statusCode} {errorString} + ); } @@ -208,58 +219,37 @@ export const RemoteClusterList = injectI18n( ); } - renderList() { - const { isLoading, clusters } = this.props; - - let table; - - if (isLoading) { - table = ( - - - - - - - - - - - - - - ); - } else { - table = ; - } - + renderLoading() { return ( - - - {this.getHeaderSection()} - - - + + + + + + + + - - - + + + + + ); + } - {table} + renderList() { + const { clusters } = this.props; + return ( + + ); @@ -267,28 +257,30 @@ export const RemoteClusterList = injectI18n( render() { const { isLoading, clusters, clusterLoadError } = this.props; + const isEmpty = !isLoading && !clusters.length; + const isAuthorized = !clusterLoadError || clusterLoadError.status !== 403; let content; if (clusterLoadError) { - if (clusterLoadError.status === 403) { + if (!isAuthorized) { content = this.renderNoPermission(); } else { content = this.renderError(clusterLoadError); } - } else if (!isLoading && !clusters.length) { + } else if (isEmpty) { content = this.renderEmpty(); + } else if (isLoading) { + content = this.renderLoading(); } else { content = this.renderList(); } return ( - + + {!isEmpty && this.getHeaderSection(isAuthorized)} {content} - {this.renderBlockingAction()} From 9f35f2a2281aea221fc1836d2ec6916fe8d992f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81bastien?= Date: Mon, 28 Jan 2019 12:36:28 +0100 Subject: [PATCH 08/11] Fix empty prompt in follower indices & auto-follow patterns list --- .../auto_follow_pattern_list.js | 13 ++++++++----- .../follower_indices_list/follower_indices_list.js | 12 +++++++----- .../remote_cluster_list/remote_cluster_list.js | 3 ++- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/x-pack/plugins/cross_cluster_replication/public/app/sections/home/auto_follow_pattern_list/auto_follow_pattern_list.js b/x-pack/plugins/cross_cluster_replication/public/app/sections/home/auto_follow_pattern_list/auto_follow_pattern_list.js index b13c420038eaa..bedad49c55e82 100644 --- a/x-pack/plugins/cross_cluster_replication/public/app/sections/home/auto_follow_pattern_list/auto_follow_pattern_list.js +++ b/x-pack/plugins/cross_cluster_replication/public/app/sections/home/auto_follow_pattern_list/auto_follow_pattern_list.js @@ -132,8 +132,8 @@ export const AutoFollowPatternList = injectI18n( ); } - renderContent() { - const { autoFollowPatterns, apiStatus, apiError, isAuthorized, intl } = this.props; + renderContent(isEmpty) { + const { apiError, isAuthorized, intl } = this.props; if (!isAuthorized) { return ( @@ -153,7 +153,7 @@ export const AutoFollowPatternList = injectI18n( return ; } - if (apiStatus === API_STATUS.IDLE && !autoFollowPatterns.length) { + if (isEmpty) { return this.renderEmpty(); } @@ -228,10 +228,13 @@ export const AutoFollowPatternList = injectI18n( } render() { + const { autoFollowPatterns, apiStatus, } = this.props; + const isEmpty = apiStatus === API_STATUS.IDLE && !autoFollowPatterns.length; + return ( - {this.renderHeader()} - {this.renderContent()} + {!isEmpty && this.renderHeader()} + {this.renderContent(isEmpty)} ); } diff --git a/x-pack/plugins/cross_cluster_replication/public/app/sections/home/follower_indices_list/follower_indices_list.js b/x-pack/plugins/cross_cluster_replication/public/app/sections/home/follower_indices_list/follower_indices_list.js index d83915e665960..2a25554d0acf2 100644 --- a/x-pack/plugins/cross_cluster_replication/public/app/sections/home/follower_indices_list/follower_indices_list.js +++ b/x-pack/plugins/cross_cluster_replication/public/app/sections/home/follower_indices_list/follower_indices_list.js @@ -129,8 +129,8 @@ export const FollowerIndicesList = injectI18n( ); } - renderContent() { - const { followerIndices, apiStatus, apiError, isAuthorized, intl } = this.props; + renderContent(isEmpty) { + const { apiError, isAuthorized, intl } = this.props; if (!isAuthorized) { return ( @@ -151,7 +151,7 @@ export const FollowerIndicesList = injectI18n( return ; } - if (apiStatus === API_STATUS.IDLE && !followerIndices.length) { + if (isEmpty) { return this.renderEmpty(); } @@ -226,10 +226,12 @@ export const FollowerIndicesList = injectI18n( } render() { + const { followerIndices, apiStatus } = this.props; + const isEmpty = apiStatus === API_STATUS.IDLE && !followerIndices.length; return ( - {this.renderHeader()} - {this.renderContent()} + {!isEmpty && this.renderHeader()} + {this.renderContent(isEmpty)} ); } diff --git a/x-pack/plugins/remote_clusters/public/sections/remote_cluster_list/remote_cluster_list.js b/x-pack/plugins/remote_clusters/public/sections/remote_cluster_list/remote_cluster_list.js index 7fcc84d019f71..698d66fc57086 100644 --- a/x-pack/plugins/remote_clusters/public/sections/remote_cluster_list/remote_cluster_list.js +++ b/x-pack/plugins/remote_clusters/public/sections/remote_cluster_list/remote_cluster_list.js @@ -259,6 +259,7 @@ export const RemoteClusterList = injectI18n( const { isLoading, clusters, clusterLoadError } = this.props; const isEmpty = !isLoading && !clusters.length; const isAuthorized = !clusterLoadError || clusterLoadError.status !== 403; + const isHeaderVisible = clusterLoadError || !isEmpty; let content; @@ -279,7 +280,7 @@ export const RemoteClusterList = injectI18n( return ( - {!isEmpty && this.getHeaderSection(isAuthorized)} + {(isHeaderVisible) && this.getHeaderSection(isAuthorized)} {content} {this.renderBlockingAction()} From 867c1c3ce427cabbcd7a3face0657f8ed936e8d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81bastien?= Date: Tue, 29 Jan 2019 12:17:25 +0100 Subject: [PATCH 09/11] Small refactor --- .../public/app/components/form_entry_row.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/x-pack/plugins/cross_cluster_replication/public/app/components/form_entry_row.js b/x-pack/plugins/cross_cluster_replication/public/app/components/form_entry_row.js index 354c7a2227451..533559c7cd604 100644 --- a/x-pack/plugins/cross_cluster_replication/public/app/components/form_entry_row.js +++ b/x-pack/plugins/cross_cluster_replication/public/app/components/form_entry_row.js @@ -53,8 +53,7 @@ export class FormEntryRow extends PureComponent { let valueParsed = value; if (isNumber) { - valueParsed = !!value ? parseInt(value, 10) : value; // make sure we don't send NaN value - valueParsed = valueParsed && valueParsed < 0 ? 0 : valueParsed; // make sure we don't send negative value + valueParsed = !!value ? Math.max(0, parseInt(value, 10)) : value; // make sure we don't send NaN value or a negative number } onValueUpdate({ [field]: valueParsed }); From 9a30779ce5cb72e687292c370880320c4dc71899 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81bastien?= Date: Wed, 30 Jan 2019 11:24:20 +0100 Subject: [PATCH 10/11] Update test snapshot --- .../__snapshots__/remote_cluster_list.test.js.snap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugins/remote_clusters/public/sections/remote_cluster_list/__snapshots__/remote_cluster_list.test.js.snap b/x-pack/plugins/remote_clusters/public/sections/remote_cluster_list/__snapshots__/remote_cluster_list.test.js.snap index 0f8537289951f..f87ba977b06e5 100644 --- a/x-pack/plugins/remote_clusters/public/sections/remote_cluster_list/__snapshots__/remote_cluster_list.test.js.snap +++ b/x-pack/plugins/remote_clusters/public/sections/remote_cluster_list/__snapshots__/remote_cluster_list.test.js.snap @@ -5,7 +5,7 @@ exports[`RemoteClusterList renders empty state when loading is complete and ther class="euiPageBody" >
Date: Wed, 30 Jan 2019 11:41:35 +0100 Subject: [PATCH 11/11] Fix regression in Auto-follow pattern list header --- .../auto_follow_pattern_list.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/x-pack/plugins/cross_cluster_replication/public/app/sections/home/auto_follow_pattern_list/auto_follow_pattern_list.js b/x-pack/plugins/cross_cluster_replication/public/app/sections/home/auto_follow_pattern_list/auto_follow_pattern_list.js index 3cbba93c1f1be..f541370fe247d 100644 --- a/x-pack/plugins/cross_cluster_replication/public/app/sections/home/auto_follow_pattern_list/auto_follow_pattern_list.js +++ b/x-pack/plugins/cross_cluster_replication/public/app/sections/home/auto_follow_pattern_list/auto_follow_pattern_list.js @@ -104,8 +104,9 @@ export const AutoFollowPatternList = injectI18n(

@@ -114,13 +115,13 @@ export const AutoFollowPatternList = injectI18n( {isAuthorized && ( )}