From dc5a1e602bf5278e2c045cbd864d7bbbaa056264 Mon Sep 17 00:00:00 2001 From: Jen Huang Date: Mon, 28 Jan 2019 16:25:27 -0800 Subject: [PATCH 1/5] Delete remote cluster settings before updating --- .../routes/api/remote_clusters/register_update_route.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/x-pack/plugins/remote_clusters/server/routes/api/remote_clusters/register_update_route.js b/x-pack/plugins/remote_clusters/server/routes/api/remote_clusters/register_update_route.js index caabe49093726..bf09a331f46c3 100644 --- a/x-pack/plugins/remote_clusters/server/routes/api/remote_clusters/register_update_route.js +++ b/x-pack/plugins/remote_clusters/server/routes/api/remote_clusters/register_update_route.js @@ -37,6 +37,12 @@ export function registerUpdateRoute(server) { } try { + // Delete existing cluster settings + // This is a workaround for: https://github.com/elastic/elasticsearch/issues/37799 + const deleteClusterPayload = serializeCluster({ name }); + await callWithRequest('cluster.putSettings', { body: deleteClusterPayload }); + + // Update cluster as new settings const updateClusterPayload = serializeCluster({ name, seeds, skipUnavailable }); const response = await callWithRequest('cluster.putSettings', { body: updateClusterPayload }); const acknowledged = get(response, 'acknowledged'); From 5daf739c3bbf5d0ceef82d8d7a848f70b86d51d9 Mon Sep 17 00:00:00 2001 From: Jen Huang Date: Mon, 28 Jan 2019 16:39:52 -0800 Subject: [PATCH 2/5] Fix detail panel z-index --- .../components/detail_panel/detail_panel.js | 1 + 1 file changed, 1 insertion(+) diff --git a/x-pack/plugins/cross_cluster_replication/public/app/sections/home/follower_indices_list/components/detail_panel/detail_panel.js b/x-pack/plugins/cross_cluster_replication/public/app/sections/home/follower_indices_list/components/detail_panel/detail_panel.js index 7f8cc8131e49a..e6d8f752601e1 100644 --- a/x-pack/plugins/cross_cluster_replication/public/app/sections/home/follower_indices_list/components/detail_panel/detail_panel.js +++ b/x-pack/plugins/cross_cluster_replication/public/app/sections/home/follower_indices_list/components/detail_panel/detail_panel.js @@ -502,6 +502,7 @@ export class DetailPanelUi extends Component { aria-labelledby="followerIndexDetailsFlyoutTitle" size="m" maxWidth={600} + style={{ zIndex: 5999 }} // Prevent context menu popover appearing above confirmation modal > From 7d243b351841ae87f90263778a07af286d7ad8a3 Mon Sep 17 00:00:00 2001 From: Jen Huang Date: Mon, 28 Jan 2019 17:00:56 -0800 Subject: [PATCH 3/5] Remove default descriptor from follower index detail panel setting values --- .../components/detail_panel/detail_panel.js | 39 +++++-------------- 1 file changed, 10 insertions(+), 29 deletions(-) diff --git a/x-pack/plugins/cross_cluster_replication/public/app/sections/home/follower_indices_list/components/detail_panel/detail_panel.js b/x-pack/plugins/cross_cluster_replication/public/app/sections/home/follower_indices_list/components/detail_panel/detail_panel.js index e6d8f752601e1..3e3e93af0ff3d 100644 --- a/x-pack/plugins/cross_cluster_replication/public/app/sections/home/follower_indices_list/components/detail_panel/detail_panel.js +++ b/x-pack/plugins/cross_cluster_replication/public/app/sections/home/follower_indices_list/components/detail_panel/detail_panel.js @@ -36,8 +36,6 @@ import 'brace/theme/textmate'; import { ContextMenu } from '../context_menu'; import { API_STATUS } from '../../../../../constants'; -import { isSettingDefault } from '../../../../../services/follower_index_default_settings'; - export class DetailPanelUi extends Component { static propTypes = { @@ -47,23 +45,6 @@ export class DetailPanelUi extends Component { closeDetailPanel: PropTypes.func.isRequired, } - renderSetting(name, value) { - if(isSettingDefault(name, value)) { - return ( - - {value}{' '} - - - - - ); - } - return value; - } - renderFollowerIndex() { const { followerIndex: { @@ -183,7 +164,7 @@ export class DetailPanelUi extends Component { - {this.renderSetting('maxReadRequestOperationCount', maxReadRequestOperationCount)} + {maxReadRequestOperationCount} @@ -198,7 +179,7 @@ export class DetailPanelUi extends Component { - {this.renderSetting('maxOutstandingReadRequests', maxOutstandingReadRequests)} + {maxOutstandingReadRequests} @@ -217,7 +198,7 @@ export class DetailPanelUi extends Component { - {this.renderSetting('maxReadRequestSize', maxReadRequestSize)} + {maxReadRequestSize} @@ -232,7 +213,7 @@ export class DetailPanelUi extends Component { - {this.renderSetting('maxWriteRequestOperationCount', maxWriteRequestOperationCount)} + {maxWriteRequestOperationCount} @@ -251,7 +232,7 @@ export class DetailPanelUi extends Component { - {this.renderSetting('maxWriteRequestSize', maxWriteRequestSize)} + {maxWriteRequestSize} @@ -266,7 +247,7 @@ export class DetailPanelUi extends Component { - {this.renderSetting('maxOutstandingWriteRequests', maxOutstandingWriteRequests)} + {maxOutstandingWriteRequests} @@ -285,7 +266,7 @@ export class DetailPanelUi extends Component { - {this.renderSetting('maxWriteBufferCount', maxWriteBufferCount)} + {maxWriteBufferCount} @@ -300,7 +281,7 @@ export class DetailPanelUi extends Component { - {this.renderSetting('maxWriteBufferSize', maxWriteBufferSize)} + {maxWriteBufferSize} @@ -319,7 +300,7 @@ export class DetailPanelUi extends Component { - {this.renderSetting('maxRetryDelay', maxRetryDelay)} + {maxRetryDelay} @@ -334,7 +315,7 @@ export class DetailPanelUi extends Component { - {this.renderSetting('readPollTimeout', readPollTimeout)} + {readPollTimeout} From 79336a3645819b2f3398fb987559d562dfc17efc Mon Sep 17 00:00:00 2001 From: Jen Huang Date: Mon, 28 Jan 2019 17:26:57 -0800 Subject: [PATCH 4/5] Follower index confirm action copy adjustments --- .../follower_index_pause_provider.js | 63 ++++++++++++++----- .../follower_index_resume_provider.js | 22 +++++-- .../follower_index_unfollow_provider.js | 8 ++- .../components/context_menu/context_menu.js | 8 +-- .../follower_indices_table.js | 5 +- .../follower_index_default_settings.js | 4 ++ 6 files changed, 80 insertions(+), 30 deletions(-) diff --git a/x-pack/plugins/cross_cluster_replication/public/app/components/follower_index_pause_provider.js b/x-pack/plugins/cross_cluster_replication/public/app/components/follower_index_pause_provider.js index fdd284641c800..2b6804770a421 100644 --- a/x-pack/plugins/cross_cluster_replication/public/app/components/follower_index_pause_provider.js +++ b/x-pack/plugins/cross_cluster_replication/public/app/components/follower_index_pause_provider.js @@ -15,6 +15,7 @@ import { import { pauseFollowerIndex } from '../store/actions'; import { arrify } from '../../../common/services/utils'; +import { areAllSettingsDefault } from '../services/follower_index_default_settings'; class Provider extends PureComponent { static propTypes = { @@ -23,7 +24,7 @@ class Provider extends PureComponent { state = { isModalOpen: false, - ids: null + indices: [] } onMouseOverModal = (event) => { @@ -32,13 +33,13 @@ class Provider extends PureComponent { event.stopPropagation(); }; - pauseFollowerIndex = (id) => { - this.setState({ isModalOpen: true, ids: arrify(id) }); + pauseFollowerIndex = (index) => { + this.setState({ isModalOpen: true, indices: arrify(index) }); }; onConfirm = () => { - this.props.pauseFollowerIndex(this.state.ids); - this.setState({ isModalOpen: false, ids: null }); + this.props.pauseFollowerIndex(this.state.indices.map(index => index.name)); + this.setState({ isModalOpen: false, indices: [] }); this.props.onConfirm && this.props.onConfirm(); } @@ -50,17 +51,18 @@ class Provider extends PureComponent { renderModal = () => { const { intl } = this.props; - const { ids } = this.state; - const isSingle = ids.length === 1; + const { indices } = this.state; + const isSingle = indices.length === 1; const title = isSingle ? intl.formatMessage({ id: 'xpack.crossClusterReplication.pauseFollowerIndex.confirmModal.pauseSingleTitle', defaultMessage: 'Pause follower index \'{name}\'?', - }, { name: ids[0] }) + }, { name: indices[0].name }) : intl.formatMessage({ id: 'xpack.crossClusterReplication.pauseFollowerIndex.confirmModal.pauseMultipleTitle', defaultMessage: 'Pause {count} follower indices?', - }, { count: ids.length }); + }, { count: indices.length }); + const hasCustomSettings = indices.some(index => !areAllSettingsDefault(index)); return ( @@ -75,24 +77,51 @@ class Provider extends PureComponent { defaultMessage: 'Cancel', }) } - buttonColor="primary" + buttonColor={hasCustomSettings ? 'danger' : 'primary'} confirmButtonText={ - intl.formatMessage({ + hasCustomSettings ? intl.formatMessage({ + id: 'xpack.crossClusterReplication.pauseFollowerIndex.confirmModal.confirmButtonTextWithSettingWarning', + defaultMessage: 'Pause and revert advanced settings to defaults', + }) : intl.formatMessage({ id: 'xpack.crossClusterReplication.pauseFollowerIndex.confirmModal.confirmButtonText', defaultMessage: 'Pause', }) } onMouseOver={this.onMouseOverModal} > - {!isSingle && ( + {isSingle ? ( + + { + hasCustomSettings ? ( +

+ +

+ ) : null + } +
+ ) : (

- + { + hasCustomSettings ? ( + + ) : ( + + ) + }

-
    {ids.map(id =>
  • {id}
  • )}
+
    {indices.map(index =>
  • {index.name}
  • )}
)} diff --git a/x-pack/plugins/cross_cluster_replication/public/app/components/follower_index_resume_provider.js b/x-pack/plugins/cross_cluster_replication/public/app/components/follower_index_resume_provider.js index 7f8ca4ca65c5a..9338af8fca96a 100644 --- a/x-pack/plugins/cross_cluster_replication/public/app/components/follower_index_resume_provider.js +++ b/x-pack/plugins/cross_cluster_replication/public/app/components/follower_index_resume_provider.js @@ -10,9 +10,11 @@ import { connect } from 'react-redux'; import { injectI18n, FormattedMessage } from '@kbn/i18n/react'; import { EuiConfirmModal, + EuiLink, EuiOverlayMask, } from '@elastic/eui'; +import routing from '../services/routing'; import { resumeFollowerIndex } from '../store/actions'; import { arrify } from '../../../common/services/utils'; @@ -79,7 +81,7 @@ class Provider extends PureComponent { confirmButtonText={ intl.formatMessage({ id: 'xpack.crossClusterReplication.resumeFollowerIndex.confirmModal.confirmButtonText', - defaultMessage: 'Resume', + defaultMessage: 'Resume using default advanced settings', }) } onMouseOver={this.onMouseOverModal} @@ -88,8 +90,18 @@ class Provider extends PureComponent {

+ + + ), + }} />

) : ( @@ -97,8 +109,8 @@ class Provider extends PureComponent {

    {ids.map(id =>
  • {id}
  • )}
diff --git a/x-pack/plugins/cross_cluster_replication/public/app/components/follower_index_unfollow_provider.js b/x-pack/plugins/cross_cluster_replication/public/app/components/follower_index_unfollow_provider.js index dc26655c74200..8e058e29d594f 100644 --- a/x-pack/plugins/cross_cluster_replication/public/app/components/follower_index_unfollow_provider.js +++ b/x-pack/plugins/cross_cluster_replication/public/app/components/follower_index_unfollow_provider.js @@ -89,7 +89,9 @@ class Provider extends PureComponent {

@@ -98,7 +100,9 @@ class Provider extends PureComponent {

    {ids.map(id =>
  • {id}
  • )}
diff --git a/x-pack/plugins/cross_cluster_replication/public/app/sections/home/follower_indices_list/components/context_menu/context_menu.js b/x-pack/plugins/cross_cluster_replication/public/app/sections/home/follower_indices_list/components/context_menu/context_menu.js index fc1c55cb11261..0c2bda19441a1 100644 --- a/x-pack/plugins/cross_cluster_replication/public/app/sections/home/follower_indices_list/components/context_menu/context_menu.js +++ b/x-pack/plugins/cross_cluster_replication/public/app/sections/home/follower_indices_list/components/context_menu/context_menu.js @@ -84,7 +84,7 @@ export class ContextMenuUi extends PureComponent { ); const pausedFollowerIndexNames = followerIndices.filter(({ isPaused }) => isPaused).map((index) => index.name); - const activeFollowerIndexNames = followerIndices.filter(({ isPaused }) => !isPaused).map((index) => index.name); + const activeFollowerIndices = followerIndices.filter(({ isPaused }) => !isPaused); return ( { - activeFollowerIndexNames.length ? ( + activeFollowerIndices.length ? ( {(pauseFollowerIndex) => ( pauseFollowerIndex(activeFollowerIndexNames)} + onClick={() => pauseFollowerIndex(activeFollowerIndices)} > )} diff --git a/x-pack/plugins/cross_cluster_replication/public/app/sections/home/follower_indices_list/components/follower_indices_table/follower_indices_table.js b/x-pack/plugins/cross_cluster_replication/public/app/sections/home/follower_indices_list/components/follower_indices_table/follower_indices_table.js index e15b665898416..aa112af3e3a6c 100644 --- a/x-pack/plugins/cross_cluster_replication/public/app/sections/home/follower_indices_list/components/follower_indices_table/follower_indices_table.js +++ b/x-pack/plugins/cross_cluster_replication/public/app/sections/home/follower_indices_list/components/follower_indices_table/follower_indices_table.js @@ -73,7 +73,8 @@ export const FollowerIndicesTable = injectI18n( const actions = [ /* Pause or resume follower index */ { - render: ({ name, isPaused }) => { + render: (followerIndex) => { + const { name, isPaused } = followerIndex; const label = isPaused ? intl.formatMessage({ id: 'xpack.crossClusterReplication.followerIndexList.table.actionResumeDescription', @@ -100,7 +101,7 @@ export const FollowerIndicesTable = injectI18n( ) : ( {(pauseFollowerIndex) => ( - pauseFollowerIndex(name)}> + pauseFollowerIndex(followerIndex)}> { export const isSettingDefault = (name, value) => { return getSettingDefault(name) === value; }; + +export const areAllSettingsDefault = (settings) => { + return Object.keys(defaultSettings).every((name) => isSettingDefault(name, settings[name])); +}; From 983bc9d5b9caff5afa057a8197a02ea0955a1d43 Mon Sep 17 00:00:00 2001 From: Jen Huang Date: Wed, 30 Jan 2019 12:58:29 -0800 Subject: [PATCH 5/5] Change z-index styling to use EUI vars --- .../plugins/cross_cluster_replication/public/app/_app.scss | 7 +++++++ .../components/detail_panel/detail_panel.js | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/cross_cluster_replication/public/app/_app.scss b/x-pack/plugins/cross_cluster_replication/public/app/_app.scss index 9e5c487d42a86..5ee862b1d9e44 100644 --- a/x-pack/plugins/cross_cluster_replication/public/app/_app.scss +++ b/x-pack/plugins/cross_cluster_replication/public/app/_app.scss @@ -5,3 +5,10 @@ .ccrFollowerIndicesHelpText { transform: translateY(-3px); } + +/** + * 1. Prevent context menu popover appearing above confirmation modal + */ +.ccrFollowerIndicesDetailPanel { + z-index: $euiZMask - 1; /* 1 */ +} diff --git a/x-pack/plugins/cross_cluster_replication/public/app/sections/home/follower_indices_list/components/detail_panel/detail_panel.js b/x-pack/plugins/cross_cluster_replication/public/app/sections/home/follower_indices_list/components/detail_panel/detail_panel.js index 3e3e93af0ff3d..ce8b40cfb5a2e 100644 --- a/x-pack/plugins/cross_cluster_replication/public/app/sections/home/follower_indices_list/components/detail_panel/detail_panel.js +++ b/x-pack/plugins/cross_cluster_replication/public/app/sections/home/follower_indices_list/components/detail_panel/detail_panel.js @@ -478,12 +478,12 @@ export class DetailPanelUi extends Component { return (