[CCR] Fix row actions in follower index and auto-follow pattern tables (#84433)
* Fixed auto follow actions * Created a provider for all follower index table actions to fix modal auto-closing * Moved i18n texts into a const to avoid duplication * Removed unnecessary imports and added index.js file for follower_index_actions_provider imports * Fixed wrong imports deletion * Fixed wrong imports deletion Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
ae9df69028
commit
4ae84a00a5
|
@ -0,0 +1,34 @@
|
||||||
|
/*
|
||||||
|
* 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 { FollowerIndexPauseProvider } from './follower_index_pause_provider';
|
||||||
|
import { FollowerIndexResumeProvider } from './follower_index_resume_provider';
|
||||||
|
import { FollowerIndexUnfollowProvider } from './follower_index_unfollow_provider';
|
||||||
|
|
||||||
|
export const FollowerIndexActionsProvider = (props) => {
|
||||||
|
return (
|
||||||
|
<FollowerIndexPauseProvider>
|
||||||
|
{(pauseFollowerIndex) => (
|
||||||
|
<FollowerIndexResumeProvider>
|
||||||
|
{(resumeFollowerIndex) => (
|
||||||
|
<FollowerIndexUnfollowProvider>
|
||||||
|
{(unfollowLeaderIndex) => {
|
||||||
|
const { children } = props;
|
||||||
|
return children(() => ({
|
||||||
|
pauseFollowerIndex,
|
||||||
|
resumeFollowerIndex,
|
||||||
|
unfollowLeaderIndex,
|
||||||
|
}));
|
||||||
|
}}
|
||||||
|
</FollowerIndexUnfollowProvider>
|
||||||
|
)}
|
||||||
|
</FollowerIndexResumeProvider>
|
||||||
|
)}
|
||||||
|
</FollowerIndexPauseProvider>
|
||||||
|
);
|
||||||
|
};
|
|
@ -11,9 +11,9 @@ import { i18n } from '@kbn/i18n';
|
||||||
import { FormattedMessage } from '@kbn/i18n/react';
|
import { FormattedMessage } from '@kbn/i18n/react';
|
||||||
import { EuiConfirmModal, EuiOverlayMask } from '@elastic/eui';
|
import { EuiConfirmModal, EuiOverlayMask } from '@elastic/eui';
|
||||||
|
|
||||||
import { pauseFollowerIndex } from '../store/actions';
|
import { pauseFollowerIndex } from '../../store/actions';
|
||||||
import { arrify } from '../../../common/services/utils';
|
import { arrify } from '../../../../common/services/utils';
|
||||||
import { areAllSettingsDefault } from '../services/follower_index_default_settings';
|
import { areAllSettingsDefault } from '../../services/follower_index_default_settings';
|
||||||
|
|
||||||
class FollowerIndexPauseProviderUi extends PureComponent {
|
class FollowerIndexPauseProviderUi extends PureComponent {
|
||||||
static propTypes = {
|
static propTypes = {
|
|
@ -10,10 +10,10 @@ import { connect } from 'react-redux';
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
import { FormattedMessage } from '@kbn/i18n/react';
|
import { FormattedMessage } from '@kbn/i18n/react';
|
||||||
import { EuiConfirmModal, EuiLink, EuiOverlayMask } from '@elastic/eui';
|
import { EuiConfirmModal, EuiLink, EuiOverlayMask } from '@elastic/eui';
|
||||||
import { reactRouterNavigate } from '../../../../../../src/plugins/kibana_react/public';
|
import { reactRouterNavigate } from '../../../../../../../src/plugins/kibana_react/public';
|
||||||
import { routing } from '../services/routing';
|
import { routing } from '../../services/routing';
|
||||||
import { resumeFollowerIndex } from '../store/actions';
|
import { resumeFollowerIndex } from '../../store/actions';
|
||||||
import { arrify } from '../../../common/services/utils';
|
import { arrify } from '../../../../common/services/utils';
|
||||||
|
|
||||||
class FollowerIndexResumeProviderUi extends PureComponent {
|
class FollowerIndexResumeProviderUi extends PureComponent {
|
||||||
static propTypes = {
|
static propTypes = {
|
|
@ -11,8 +11,8 @@ import { i18n } from '@kbn/i18n';
|
||||||
import { FormattedMessage } from '@kbn/i18n/react';
|
import { FormattedMessage } from '@kbn/i18n/react';
|
||||||
import { EuiConfirmModal, EuiOverlayMask } from '@elastic/eui';
|
import { EuiConfirmModal, EuiOverlayMask } from '@elastic/eui';
|
||||||
|
|
||||||
import { unfollowLeaderIndex } from '../store/actions';
|
import { unfollowLeaderIndex } from '../../store/actions';
|
||||||
import { arrify } from '../../../common/services/utils';
|
import { arrify } from '../../../../common/services/utils';
|
||||||
|
|
||||||
class FollowerIndexUnfollowProviderUi extends PureComponent {
|
class FollowerIndexUnfollowProviderUi extends PureComponent {
|
||||||
static propTypes = {
|
static propTypes = {
|
|
@ -0,0 +1,10 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export { FollowerIndexActionsProvider } from './follower_index_actions_provider';
|
||||||
|
export { FollowerIndexPauseProvider } from './follower_index_pause_provider';
|
||||||
|
export { FollowerIndexResumeProvider } from './follower_index_resume_provider';
|
||||||
|
export { FollowerIndexUnfollowProvider } from './follower_index_unfollow_provider';
|
|
@ -12,9 +12,10 @@ export { AutoFollowPatternForm } from './auto_follow_pattern_form';
|
||||||
export { AutoFollowPatternDeleteProvider } from './auto_follow_pattern_delete_provider';
|
export { AutoFollowPatternDeleteProvider } from './auto_follow_pattern_delete_provider';
|
||||||
export { AutoFollowPatternPageTitle } from './auto_follow_pattern_page_title';
|
export { AutoFollowPatternPageTitle } from './auto_follow_pattern_page_title';
|
||||||
export { AutoFollowPatternIndicesPreview } from './auto_follow_pattern_indices_preview';
|
export { AutoFollowPatternIndicesPreview } from './auto_follow_pattern_indices_preview';
|
||||||
export { FollowerIndexPauseProvider } from './follower_index_pause_provider';
|
export { FollowerIndexPauseProvider } from './follower_index_actions_providers';
|
||||||
export { FollowerIndexResumeProvider } from './follower_index_resume_provider';
|
export { FollowerIndexResumeProvider } from './follower_index_actions_providers';
|
||||||
export { FollowerIndexUnfollowProvider } from './follower_index_unfollow_provider';
|
export { FollowerIndexUnfollowProvider } from './follower_index_actions_providers';
|
||||||
|
export { FollowerIndexActionsProvider } from './follower_index_actions_providers';
|
||||||
export { FollowerIndexForm } from './follower_index_form';
|
export { FollowerIndexForm } from './follower_index_form';
|
||||||
export { FollowerIndexPageTitle } from './follower_index_page_title';
|
export { FollowerIndexPageTitle } from './follower_index_page_title';
|
||||||
export { FormEntryRow } from './form_entry_row';
|
export { FormEntryRow } from './form_entry_row';
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* you may not use this file except in compliance with the Elastic License.
|
* 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 PropTypes from 'prop-types';
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
import {
|
import {
|
||||||
|
@ -13,7 +13,6 @@ import {
|
||||||
EuiLoadingKibana,
|
EuiLoadingKibana,
|
||||||
EuiOverlayMask,
|
EuiOverlayMask,
|
||||||
EuiHealth,
|
EuiHealth,
|
||||||
EuiIcon,
|
|
||||||
} from '@elastic/eui';
|
} from '@elastic/eui';
|
||||||
import { API_STATUS, UIM_AUTO_FOLLOW_PATTERN_SHOW_DETAILS_CLICK } from '../../../../../constants';
|
import { API_STATUS, UIM_AUTO_FOLLOW_PATTERN_SHOW_DETAILS_CLICK } from '../../../../../constants';
|
||||||
import {
|
import {
|
||||||
|
@ -23,6 +22,33 @@ import {
|
||||||
import { routing } from '../../../../../services/routing';
|
import { routing } from '../../../../../services/routing';
|
||||||
import { trackUiMetric } from '../../../../../services/track_ui_metric';
|
import { trackUiMetric } from '../../../../../services/track_ui_metric';
|
||||||
|
|
||||||
|
const actionI18nTexts = {
|
||||||
|
pause: i18n.translate(
|
||||||
|
'xpack.crossClusterReplication.autoFollowPatternList.table.actionPauseDescription',
|
||||||
|
{
|
||||||
|
defaultMessage: 'Pause replication',
|
||||||
|
}
|
||||||
|
),
|
||||||
|
resume: i18n.translate(
|
||||||
|
'xpack.crossClusterReplication.autoFollowPatternList.table.actionResumeDescription',
|
||||||
|
{
|
||||||
|
defaultMessage: 'Resume replication',
|
||||||
|
}
|
||||||
|
),
|
||||||
|
edit: i18n.translate(
|
||||||
|
'xpack.crossClusterReplication.autoFollowPatternList.table.actionEditDescription',
|
||||||
|
{
|
||||||
|
defaultMessage: 'Edit auto-follow pattern',
|
||||||
|
}
|
||||||
|
),
|
||||||
|
delete: i18n.translate(
|
||||||
|
'xpack.crossClusterReplication.autoFollowPatternList.table.actionDeleteDescription',
|
||||||
|
{
|
||||||
|
defaultMessage: 'Delete auto-follow pattern',
|
||||||
|
}
|
||||||
|
),
|
||||||
|
};
|
||||||
|
|
||||||
const getFilteredPatterns = (autoFollowPatterns, queryText) => {
|
const getFilteredPatterns = (autoFollowPatterns, queryText) => {
|
||||||
if (queryText) {
|
if (queryText) {
|
||||||
const normalizedSearchText = queryText.toLowerCase();
|
const normalizedSearchText = queryText.toLowerCase();
|
||||||
|
@ -93,7 +119,7 @@ export class AutoFollowPatternTable extends PureComponent {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
getTableColumns() {
|
getTableColumns(deleteAutoFollowPattern) {
|
||||||
const { selectAutoFollowPattern } = this.props;
|
const { selectAutoFollowPattern } = this.props;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
@ -200,88 +226,34 @@ export class AutoFollowPatternTable extends PureComponent {
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
{
|
{
|
||||||
render: ({ name, active }) => {
|
name: actionI18nTexts.pause,
|
||||||
const label = active
|
description: actionI18nTexts.pause,
|
||||||
? i18n.translate(
|
icon: 'pause',
|
||||||
'xpack.crossClusterReplication.autoFollowPatternList.table.actionPauseDescription',
|
onClick: (item) => this.props.pauseAutoFollowPattern(item.name),
|
||||||
{
|
available: (item) => item.active,
|
||||||
defaultMessage: 'Pause replication',
|
'data-test-subj': 'contextMenuPauseButton',
|
||||||
}
|
|
||||||
)
|
|
||||||
: i18n.translate(
|
|
||||||
'xpack.crossClusterReplication.autoFollowPatternList.table.actionResumeDescription',
|
|
||||||
{
|
|
||||||
defaultMessage: 'Resume replication',
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<span
|
|
||||||
onClick={(event) => {
|
|
||||||
if (event.stopPropagation) {
|
|
||||||
event.stopPropagation();
|
|
||||||
}
|
|
||||||
if (active) {
|
|
||||||
this.props.pauseAutoFollowPattern(name);
|
|
||||||
} else {
|
|
||||||
this.props.resumeAutoFollowPattern(name);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
data-test-subj={active ? 'contextMenuPauseButton' : 'contextMenuResumeButton'}
|
|
||||||
>
|
|
||||||
<EuiIcon
|
|
||||||
aria-label={label}
|
|
||||||
type={active ? 'pause' : 'play'}
|
|
||||||
className="euiContextMenu__icon"
|
|
||||||
/>
|
|
||||||
<span>{label}</span>
|
|
||||||
</span>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
render: ({ name }) => {
|
name: actionI18nTexts.resume,
|
||||||
const label = i18n.translate(
|
description: actionI18nTexts.resume,
|
||||||
'xpack.crossClusterReplication.autoFollowPatternList.table.actionEditDescription',
|
icon: 'play',
|
||||||
{
|
onClick: (item) => this.props.resumeAutoFollowPattern(item.name),
|
||||||
defaultMessage: 'Edit auto-follow pattern',
|
available: (item) => !item.active,
|
||||||
}
|
'data-test-subj': 'contextMenuResumeButton',
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<span
|
|
||||||
onClick={() => routing.navigate(routing.getAutoFollowPatternPath(name))}
|
|
||||||
data-test-subj="contextMenuEditButton"
|
|
||||||
>
|
|
||||||
<EuiIcon aria-label={label} type="pencil" className="euiContextMenu__icon" />
|
|
||||||
<span>{label}</span>
|
|
||||||
</span>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
render: ({ name }) => {
|
name: actionI18nTexts.edit,
|
||||||
const label = i18n.translate(
|
description: actionI18nTexts.edit,
|
||||||
'xpack.crossClusterReplication.autoFollowPatternList.table.actionDeleteDescription',
|
icon: 'pencil',
|
||||||
{
|
onClick: (item) => routing.navigate(routing.getAutoFollowPatternPath(item.name)),
|
||||||
defaultMessage: 'Delete auto-follow pattern',
|
'data-test-subj': 'contextMenuEditButton',
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<AutoFollowPatternDeleteProvider>
|
|
||||||
{(deleteAutoFollowPattern) => (
|
|
||||||
<span
|
|
||||||
onClick={() => deleteAutoFollowPattern(name)}
|
|
||||||
data-test-subj="contextMenuDeleteButton"
|
|
||||||
>
|
|
||||||
<EuiIcon aria-label={label} type="trash" className="euiContextMenu__icon" />
|
|
||||||
<span>{label}</span>
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
</AutoFollowPatternDeleteProvider>
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: actionI18nTexts.delete,
|
||||||
|
description: actionI18nTexts.delete,
|
||||||
|
icon: 'trash',
|
||||||
|
onClick: (item) => deleteAutoFollowPattern(item.name),
|
||||||
|
'data-test-subj': 'contextMenuDeleteButton',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
width: '100px',
|
width: '100px',
|
||||||
|
@ -339,11 +311,13 @@ export class AutoFollowPatternTable extends PureComponent {
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<AutoFollowPatternDeleteProvider>
|
||||||
|
{(deleteAutoFollowPattern) => (
|
||||||
|
<>
|
||||||
<EuiInMemoryTable
|
<EuiInMemoryTable
|
||||||
items={filteredAutoFollowPatterns}
|
items={filteredAutoFollowPatterns}
|
||||||
itemId="name"
|
itemId="name"
|
||||||
columns={this.getTableColumns()}
|
columns={this.getTableColumns(deleteAutoFollowPattern)}
|
||||||
search={search}
|
search={search}
|
||||||
pagination={pagination}
|
pagination={pagination}
|
||||||
sorting={sorting}
|
sorting={sorting}
|
||||||
|
@ -358,7 +332,9 @@ export class AutoFollowPatternTable extends PureComponent {
|
||||||
data-test-subj="autoFollowPatternListTable"
|
data-test-subj="autoFollowPatternListTable"
|
||||||
/>
|
/>
|
||||||
{this.renderLoading()}
|
{this.renderLoading()}
|
||||||
</Fragment>
|
</>
|
||||||
|
)}
|
||||||
|
</AutoFollowPatternDeleteProvider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,12 +4,11 @@
|
||||||
* you may not use this file except in compliance with the Elastic License.
|
* 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 PropTypes from 'prop-types';
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
import { FormattedMessage } from '@kbn/i18n/react';
|
import { FormattedMessage } from '@kbn/i18n/react';
|
||||||
import {
|
import {
|
||||||
EuiIcon,
|
|
||||||
EuiHealth,
|
EuiHealth,
|
||||||
EuiInMemoryTable,
|
EuiInMemoryTable,
|
||||||
EuiLink,
|
EuiLink,
|
||||||
|
@ -17,15 +16,38 @@ import {
|
||||||
EuiOverlayMask,
|
EuiOverlayMask,
|
||||||
} from '@elastic/eui';
|
} from '@elastic/eui';
|
||||||
import { API_STATUS, UIM_FOLLOWER_INDEX_SHOW_DETAILS_CLICK } from '../../../../../constants';
|
import { API_STATUS, UIM_FOLLOWER_INDEX_SHOW_DETAILS_CLICK } from '../../../../../constants';
|
||||||
import {
|
import { FollowerIndexActionsProvider } from '../../../../../components';
|
||||||
FollowerIndexPauseProvider,
|
|
||||||
FollowerIndexResumeProvider,
|
|
||||||
FollowerIndexUnfollowProvider,
|
|
||||||
} from '../../../../../components';
|
|
||||||
import { routing } from '../../../../../services/routing';
|
import { routing } from '../../../../../services/routing';
|
||||||
import { trackUiMetric } from '../../../../../services/track_ui_metric';
|
import { trackUiMetric } from '../../../../../services/track_ui_metric';
|
||||||
import { ContextMenu } from '../context_menu';
|
import { ContextMenu } from '../context_menu';
|
||||||
|
|
||||||
|
const actionI18nTexts = {
|
||||||
|
pause: i18n.translate(
|
||||||
|
'xpack.crossClusterReplication.followerIndexList.table.actionPauseDescription',
|
||||||
|
{
|
||||||
|
defaultMessage: 'Pause replication',
|
||||||
|
}
|
||||||
|
),
|
||||||
|
resume: i18n.translate(
|
||||||
|
'xpack.crossClusterReplication.followerIndexList.table.actionResumeDescription',
|
||||||
|
{
|
||||||
|
defaultMessage: 'Resume replication',
|
||||||
|
}
|
||||||
|
),
|
||||||
|
edit: i18n.translate(
|
||||||
|
'xpack.crossClusterReplication.followerIndexList.table.actionEditDescription',
|
||||||
|
{
|
||||||
|
defaultMessage: 'Edit follower index',
|
||||||
|
}
|
||||||
|
),
|
||||||
|
unfollow: i18n.translate(
|
||||||
|
'xpack.crossClusterReplication.followerIndexList.table.actionUnfollowDescription',
|
||||||
|
{
|
||||||
|
defaultMessage: 'Unfollow leader index',
|
||||||
|
}
|
||||||
|
),
|
||||||
|
};
|
||||||
|
|
||||||
const getFilteredIndices = (followerIndices, queryText) => {
|
const getFilteredIndices = (followerIndices, queryText) => {
|
||||||
if (queryText) {
|
if (queryText) {
|
||||||
const normalizedSearchText = queryText.toLowerCase();
|
const normalizedSearchText = queryText.toLowerCase();
|
||||||
|
@ -101,91 +123,43 @@ export class FollowerIndicesTable extends PureComponent {
|
||||||
routing.navigate(uri);
|
routing.navigate(uri);
|
||||||
};
|
};
|
||||||
|
|
||||||
getTableColumns() {
|
getTableColumns(actionHandlers) {
|
||||||
const { selectFollowerIndex } = this.props;
|
const { selectFollowerIndex } = this.props;
|
||||||
|
|
||||||
const actions = [
|
const actions = [
|
||||||
/* Pause or resume follower index */
|
/* Pause follower index */
|
||||||
{
|
{
|
||||||
render: (followerIndex) => {
|
name: actionI18nTexts.pause,
|
||||||
const { name, isPaused } = followerIndex;
|
description: actionI18nTexts.pause,
|
||||||
const label = isPaused
|
icon: 'pause',
|
||||||
? i18n.translate(
|
onClick: (item) => actionHandlers.pauseFollowerIndex(item),
|
||||||
'xpack.crossClusterReplication.followerIndexList.table.actionResumeDescription',
|
available: (item) => !item.isPaused,
|
||||||
{
|
'data-test-subj': 'pauseButton',
|
||||||
defaultMessage: 'Resume replication',
|
|
||||||
}
|
|
||||||
)
|
|
||||||
: i18n.translate(
|
|
||||||
'xpack.crossClusterReplication.followerIndexList.table.actionPauseDescription',
|
|
||||||
{
|
|
||||||
defaultMessage: 'Pause replication',
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
return isPaused ? (
|
|
||||||
<FollowerIndexResumeProvider>
|
|
||||||
{(resumeFollowerIndex) => (
|
|
||||||
<span onClick={() => resumeFollowerIndex(name)} data-test-subj="resumeButton">
|
|
||||||
<EuiIcon aria-label={label} type="play" className="euiContextMenu__icon" />
|
|
||||||
<span>{label}</span>
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
</FollowerIndexResumeProvider>
|
|
||||||
) : (
|
|
||||||
<FollowerIndexPauseProvider>
|
|
||||||
{(pauseFollowerIndex) => (
|
|
||||||
<span
|
|
||||||
onClick={() => pauseFollowerIndex(followerIndex)}
|
|
||||||
data-test-subj="pauseButton"
|
|
||||||
>
|
|
||||||
<EuiIcon aria-label={label} type="pause" className="euiContextMenu__icon" />
|
|
||||||
<span>{label}</span>
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
</FollowerIndexPauseProvider>
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
/* Resume follower index */
|
||||||
|
{
|
||||||
|
name: actionI18nTexts.resume,
|
||||||
|
description: actionI18nTexts.resume,
|
||||||
|
icon: 'play',
|
||||||
|
onClick: (item) => actionHandlers.resumeFollowerIndex(item.name),
|
||||||
|
available: (item) => item.isPaused,
|
||||||
|
'data-test-subj': 'resumeButton',
|
||||||
},
|
},
|
||||||
/* Edit follower index */
|
/* Edit follower index */
|
||||||
{
|
{
|
||||||
render: ({ name }) => {
|
name: actionI18nTexts.edit,
|
||||||
const label = i18n.translate(
|
description: actionI18nTexts.edit,
|
||||||
'xpack.crossClusterReplication.followerIndexList.table.actionEditDescription',
|
onClick: (item) => this.editFollowerIndex(item.name),
|
||||||
{
|
icon: 'pencil',
|
||||||
defaultMessage: 'Edit follower index',
|
'data-test-subj': 'editButton',
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<span onClick={() => this.editFollowerIndex(name)} data-test-subj="editButton">
|
|
||||||
<EuiIcon aria-label={label} type="pencil" className="euiContextMenu__icon" />
|
|
||||||
<span>{label}</span>
|
|
||||||
</span>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
/* Unfollow leader index */
|
/* Unfollow leader index */
|
||||||
{
|
{
|
||||||
render: ({ name }) => {
|
name: actionI18nTexts.unfollow,
|
||||||
const label = i18n.translate(
|
description: actionI18nTexts.unfollow,
|
||||||
'xpack.crossClusterReplication.followerIndexList.table.actionUnfollowDescription',
|
onClick: (item) => actionHandlers.unfollowLeaderIndex(item.name),
|
||||||
{
|
icon: 'indexFlush',
|
||||||
defaultMessage: 'Unfollow leader index',
|
'data-test-subj': 'unfollowButton',
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<FollowerIndexUnfollowProvider>
|
|
||||||
{(unfollowLeaderIndex) => (
|
|
||||||
<span onClick={() => unfollowLeaderIndex(name)} data-test-subj="unfollowButton">
|
|
||||||
<EuiIcon aria-label={label} type="indexFlush" className="euiContextMenu__icon" />
|
|
||||||
<span>{label}</span>
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
</FollowerIndexUnfollowProvider>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -321,11 +295,15 @@ export class FollowerIndicesTable extends PureComponent {
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<FollowerIndexActionsProvider>
|
||||||
|
{(getActionHandlers) => {
|
||||||
|
const actionHandlers = getActionHandlers();
|
||||||
|
return (
|
||||||
|
<>
|
||||||
<EuiInMemoryTable
|
<EuiInMemoryTable
|
||||||
items={filteredIndices}
|
items={filteredIndices}
|
||||||
itemId="name"
|
itemId="name"
|
||||||
columns={this.getTableColumns()}
|
columns={this.getTableColumns(actionHandlers)}
|
||||||
search={search}
|
search={search}
|
||||||
pagination={pagination}
|
pagination={pagination}
|
||||||
sorting={sorting}
|
sorting={sorting}
|
||||||
|
@ -340,7 +318,10 @@ export class FollowerIndicesTable extends PureComponent {
|
||||||
data-test-subj="followerIndexListTable"
|
data-test-subj="followerIndexListTable"
|
||||||
/>
|
/>
|
||||||
{this.renderLoading()}
|
{this.renderLoading()}
|
||||||
</Fragment>
|
</>
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
</FollowerIndexActionsProvider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue