Skip to content

Commit c28f77e

Browse files
committed
PR feedback
1 parent 8b39c90 commit c28f77e

File tree

9 files changed

+30
-37
lines changed

9 files changed

+30
-37
lines changed

x-pack/plugins/cross_cluster_replication/public/app/components/follower_index_pause_provider.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class Provider extends PureComponent {
8383
<p>
8484
<FormattedMessage
8585
id="xpack.crossClusterReplication.pauseFollowerIndex.confirmModal.multiplePauseDescription"
86-
defaultMessage="These follower indices will paused:"
86+
defaultMessage="These follower indices will be paused:"
8787
/>
8888
</p>
8989
<ul>{ids.map(id => <li key={id}>{id}</li>)}</ul>

x-pack/plugins/cross_cluster_replication/public/app/components/follower_index_resume_provider.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class Provider extends PureComponent {
8383
<p>
8484
<FormattedMessage
8585
id="xpack.crossClusterReplication.resumeFollowerIndex.confirmModal.multipleResumeDescription"
86-
defaultMessage="These follower indices will resumed:"
86+
defaultMessage="These follower indices will be resumed:"
8787
/>
8888
</p>
8989
<ul>{ids.map(id => <li key={id}>{id}</li>)}</ul>

x-pack/plugins/cross_cluster_replication/public/app/components/follower_index_unfollow_provider.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
EuiOverlayMask,
1313
} from '@elastic/eui';
1414

15-
import { unfollowFollowerIndex } from '../store/actions';
15+
import { unfollowLeaderIndex } from '../store/actions';
1616
import { arrify } from '../../../common/services/utils';
1717

1818
class Provider extends PureComponent {
@@ -27,12 +27,12 @@ class Provider extends PureComponent {
2727
event.stopPropagation();
2828
};
2929

30-
unfollowFollowerIndex = (id) => {
30+
unfollowLeaderIndex = (id) => {
3131
this.setState({ isModalOpen: true, ids: arrify(id) });
3232
};
3333

3434
onConfirm = () => {
35-
this.props.unfollowFollowerIndex(this.state.ids);
35+
this.props.unfollowLeaderIndex(this.state.ids);
3636
this.setState({ isModalOpen: false, ids: null });
3737
}
3838

@@ -48,11 +48,11 @@ class Provider extends PureComponent {
4848
const isSingle = ids.length === 1;
4949
const title = isSingle
5050
? intl.formatMessage({
51-
id: 'xpack.crossClusterReplication.unfollowFollowerIndex.confirmModal.unfollowSingleTitle',
51+
id: 'xpack.crossClusterReplication.unfollowLeaderIndex.confirmModal.unfollowSingleTitle',
5252
defaultMessage: 'Unfollow leader index of follower index \'{name}\'?',
5353
}, { name: ids[0] })
5454
: intl.formatMessage({
55-
id: 'xpack.crossClusterReplication.unfollowFollowerIndex.confirmModal.unfollowMultipleTitle',
55+
id: 'xpack.crossClusterReplication.unfollowLeaderIndex.confirmModal.unfollowMultipleTitle',
5656
defaultMessage: 'Unfollow leader indices of {count} follower indices?',
5757
}, { count: ids.length });
5858

@@ -65,14 +65,14 @@ class Provider extends PureComponent {
6565
onConfirm={this.onConfirm}
6666
cancelButtonText={
6767
intl.formatMessage({
68-
id: 'xpack.crossClusterReplication.unfollowFollowerIndex.confirmModal.cancelButtonText',
68+
id: 'xpack.crossClusterReplication.unfollowLeaderIndex.confirmModal.cancelButtonText',
6969
defaultMessage: 'Cancel',
7070
})
7171
}
7272
buttonColor="danger"
7373
confirmButtonText={
7474
intl.formatMessage({
75-
id: 'xpack.crossClusterReplication.unfollowFollowerIndex.confirmModal.confirmButtonText',
75+
id: 'xpack.crossClusterReplication.unfollowLeaderIndex.confirmModal.confirmButtonText',
7676
defaultMessage: 'Unfollow',
7777
})
7878
}
@@ -82,7 +82,7 @@ class Provider extends PureComponent {
8282
<Fragment>
8383
<p>
8484
<FormattedMessage
85-
id="xpack.crossClusterReplication.unfollowFollowerIndex.confirmModal.singleUnfollowDescription"
85+
id="xpack.crossClusterReplication.unfollowLeaderIndex.confirmModal.singleUnfollowDescription"
8686
defaultMessage="This follower index will be paused, closed, and converted into a regular index."
8787
/>
8888
</p>
@@ -91,7 +91,7 @@ class Provider extends PureComponent {
9191
<Fragment>
9292
<p>
9393
<FormattedMessage
94-
id="xpack.crossClusterReplication.unfollowFollowerIndex.confirmModal.multipleUnfollowDescription"
94+
id="xpack.crossClusterReplication.unfollowLeaderIndex.confirmModal.multipleUnfollowDescription"
9595
defaultMessage="These follower indices will be paused, closed, and converted into regular indices:"
9696
/>
9797
</p>
@@ -109,15 +109,15 @@ class Provider extends PureComponent {
109109

110110
return (
111111
<Fragment>
112-
{children(this.unfollowFollowerIndex)}
112+
{children(this.unfollowLeaderIndex)}
113113
{isModalOpen && this.renderModal()}
114114
</Fragment>
115115
);
116116
}
117117
}
118118

119119
const mapDispatchToProps = (dispatch) => ({
120-
unfollowFollowerIndex: (id) => dispatch(unfollowFollowerIndex(id)),
120+
unfollowLeaderIndex: (id) => dispatch(unfollowLeaderIndex(id)),
121121
});
122122

123123
export const FollowerIndexUnfollowProvider = connect(

x-pack/plugins/cross_cluster_replication/public/app/sections/home/follower_indices_list/components/context_menu/context_menu.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,8 @@ export class ContextMenuUi extends Component {
3232
followerIndices: PropTypes.array.isRequired,
3333
}
3434

35-
constructor(props) {
36-
super(props);
37-
38-
this.state = {
39-
isPopoverOpen: false,
40-
};
35+
state = {
36+
isPopoverOpen: false,
4137
}
4238

4339
onButtonClick = () => {
@@ -74,7 +70,6 @@ export class ContextMenuUi extends Component {
7470
<EuiButton
7571
data-test-subj="followerIndexContextMenuButton"
7672
iconSide={iconSide}
77-
// aria-label={`${entity} options`}
7873
onClick={this.onButtonClick}
7974
iconType={iconType}
8075
fill
@@ -108,7 +103,7 @@ export class ContextMenuUi extends Component {
108103
<EuiContextMenuPanel>
109104

110105
{
111-
activeFollowerIndexNames ? (
106+
activeFollowerIndexNames.length ? (
112107
<FollowerIndexPauseProvider>
113108
{(pauseFollowerIndex) => (
114109
<EuiContextMenuItem
@@ -146,10 +141,10 @@ export class ContextMenuUi extends Component {
146141
}
147142

148143
<FollowerIndexUnfollowProvider>
149-
{(unfollowFollowerIndex) => (
144+
{(unfollowLeaderIndex) => (
150145
<EuiContextMenuItem
151146
icon="indexFlush"
152-
onClick={() => unfollowFollowerIndex(followerIndexNames)}
147+
onClick={() => unfollowLeaderIndex(followerIndexNames)}
153148
>
154149
<FormattedMessage
155150
id="xpack.crossClusterReplication.followerIndex.contextMenu.unfollowLabel"

x-pack/plugins/cross_cluster_replication/public/app/sections/home/follower_indices_list/components/follower_indices_table/follower_indices_table.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,12 @@ export const FollowerIndicesTable = injectI18n(
187187
delay="long"
188188
>
189189
<FollowerIndexUnfollowProvider>
190-
{(unfollowFollowerIndex) => (
190+
{(unfollowLeaderIndex) => (
191191
<EuiButtonIcon
192192
aria-label={label}
193193
iconType="indexFlush"
194194
color="danger"
195-
onClick={() => unfollowFollowerIndex(name)}
195+
onClick={() => unfollowLeaderIndex(name)}
196196
/>
197197
)}
198198
</FollowerIndexUnfollowProvider>

x-pack/plugins/cross_cluster_replication/public/app/services/api.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,17 @@ export const createFollowerIndex = (followerIndex) => (
7676

7777
export const pauseFollowerIndex = (id) => {
7878
const ids = arrify(id).map(_id => encodeURIComponent(_id)).join(',');
79-
return httpClient.put(`${apiPrefix}/follower_indices/${encodeURIComponent(ids)}/pause`).then(extractData);
79+
return httpClient.put(`${apiPrefix}/follower_indices/${ids}/pause`).then(extractData);
8080
};
8181

8282
export const resumeFollowerIndex = (id) => {
8383
const ids = arrify(id).map(_id => encodeURIComponent(_id)).join(',');
84-
return httpClient.put(`${apiPrefix}/follower_indices/${encodeURIComponent(ids)}/resume`).then(extractData);
84+
return httpClient.put(`${apiPrefix}/follower_indices/${ids}/resume`).then(extractData);
8585
};
8686

87-
export const unfollowFollowerIndex = (id) => {
87+
export const unfollowLeaderIndex = (id) => {
8888
const ids = arrify(id).map(_id => encodeURIComponent(_id)).join(',');
89-
return httpClient.put(`${apiPrefix}/follower_indices/${encodeURIComponent(ids)}/unfollow`).then(extractData);
89+
return httpClient.put(`${apiPrefix}/follower_indices/${ids}/unfollow`).then(extractData);
9090
};
9191

9292
/* Stats */

x-pack/plugins/cross_cluster_replication/public/app/store/actions/follower_index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
createFollowerIndex as createFollowerIndexRequest,
1414
pauseFollowerIndex as pauseFollowerIndexRequest,
1515
resumeFollowerIndex as resumeFollowerIndexRequest,
16-
unfollowFollowerIndex as unfollowFollowerIndexRequest,
16+
unfollowLeaderIndex as unfollowLeaderIndexRequest,
1717
} from '../../services/api';
1818
import * as t from '../action_types';
1919
import { sendApiRequest } from './api';
@@ -175,13 +175,13 @@ export const resumeFollowerIndex = (id) => (
175175
})
176176
);
177177

178-
export const unfollowFollowerIndex = (id) => (
178+
export const unfollowLeaderIndex = (id) => (
179179
sendApiRequest({
180180
label: t.FOLLOWER_INDEX_UNFOLLOW,
181181
status: API_STATUS.DELETING,
182182
scope: `${scope}-delete`,
183183
handler: async () => (
184-
unfollowFollowerIndexRequest(id)
184+
unfollowLeaderIndexRequest(id)
185185
),
186186
onSuccess(response, dispatch, getState) {
187187
/**

x-pack/plugins/cross_cluster_replication/server/client/elasticsearch_ccr.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,10 @@ export const elasticsearchJsPlugin = (Client, config, components) => {
126126
}
127127
}
128128
],
129-
needBody: true,
130129
method: 'POST'
131130
});
132131

133-
ccr.unfollowFollowerIndex = ca({
132+
ccr.unfollowLeaderIndex = ca({
134133
urls: [
135134
{
136135
fmt: '/<%=id%>/_ccr/unfollow',

x-pack/plugins/cross_cluster_replication/server/routes/api/follower_index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,7 @@ export const registerFollowerIndexRoutes = (server) => {
154154
const errors = [];
155155

156156
await Promise.all(ids.map((_id) => (
157-
// TODO: Remove empty body when fixed in ES: https://github.com/elastic/elasticsearch/issues/37022
158-
callWithRequest('ccr.resumeFollowerIndex', { id: _id, body: {} })
157+
callWithRequest('ccr.resumeFollowerIndex', { id: _id })
159158
.then(() => itemsResumed.push(_id))
160159
.catch(err => {
161160
if (isEsError(err)) {
@@ -200,7 +199,7 @@ export const registerFollowerIndexRoutes = (server) => {
200199
await callWithRequest('indices.close', { index: _id });
201200

202201
// Unfollow leader
203-
await callWithRequest('ccr.unfollowFollowerIndex', { id: _id });
202+
await callWithRequest('ccr.unfollowLeaderIndex', { id: _id });
204203

205204
// Push success
206205
itemsUnfollowed.push(_id);

0 commit comments

Comments
 (0)