mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
* add follower badge to index management * fixing i18n id
This commit is contained in:
parent
dcff105622
commit
12a17f4885
4 changed files with 62 additions and 1 deletions
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* 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 const ccrDataEnricher = async (indicesList, callWithRequest) => {
|
||||
if (!indicesList || !indicesList.length) {
|
||||
return indicesList;
|
||||
}
|
||||
const params = {
|
||||
path: '/_all/_ccr/info',
|
||||
method: 'GET',
|
||||
};
|
||||
try {
|
||||
const { follower_indices: followerIndices } = await callWithRequest('transport.request', params);
|
||||
return indicesList.map(index => {
|
||||
const isFollowerIndex = !!followerIndices.find((followerIndex) => {
|
||||
return followerIndex.follower_index === index.name;
|
||||
});
|
||||
return {
|
||||
...index,
|
||||
isFollowerIndex
|
||||
};
|
||||
});
|
||||
} catch (e) {
|
||||
return indicesList;
|
||||
}
|
||||
|
||||
};
|
|
@ -8,7 +8,8 @@ import { resolve } from 'path';
|
|||
import { PLUGIN } from './common/constants';
|
||||
import { registerLicenseChecker } from './server/lib/register_license_checker';
|
||||
import { registerRoutes } from './server/routes/register_routes';
|
||||
|
||||
import { ccrDataEnricher } from './cross_cluster_replication_data';
|
||||
import { addIndexManagementDataEnricher } from '../index_management/index_management_data';
|
||||
export function crossClusterReplication(kibana) {
|
||||
return new kibana.Plugin({
|
||||
id: PLUGIN.ID,
|
||||
|
@ -41,6 +42,11 @@ export function crossClusterReplication(kibana) {
|
|||
init: function initCcrPlugin(server) {
|
||||
registerLicenseChecker(server);
|
||||
registerRoutes(server);
|
||||
if (
|
||||
server.config().get('xpack.ccr.ui.enabled')
|
||||
) {
|
||||
addIndexManagementDataEnricher(ccrDataEnricher);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* 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 { i18n } from '@kbn/i18n';
|
||||
import {
|
||||
addBadgeExtension
|
||||
} from '../../../index_management/public/index_management_extensions';
|
||||
import { get } from 'lodash';
|
||||
|
||||
const propertyPath = 'isFollowerIndex';
|
||||
export const followerBadgeExtension = {
|
||||
matchIndex: (index) => {
|
||||
return get(index, propertyPath);
|
||||
},
|
||||
label: i18n.translate('xpack.crossClusterReplication.indexMgmtBadge.followerLabel', {
|
||||
defaultMessage: 'Follower',
|
||||
}),
|
||||
color: 'default'
|
||||
};
|
||||
|
||||
addBadgeExtension(followerBadgeExtension);
|
||||
|
|
@ -6,3 +6,4 @@
|
|||
|
||||
import './register_ccr_section';
|
||||
import './register_routes';
|
||||
import './extend_index_management';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue