-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add follower badge to index management (#29177)
* add follower badge to index management * fixing i18n id
- Loading branch information
1 parent
bfa417c
commit a95be51
Showing
4 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
x-pack/plugins/cross_cluster_replication/cross_cluster_replication_data.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
x-pack/plugins/cross_cluster_replication/public/extend_index_management/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ | |
|
||
import './register_ccr_section'; | ||
import './register_routes'; | ||
import './extend_index_management'; |