mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[i18n] Translate server/status (#26806)
* Translate server -> status * Fix issues
This commit is contained in:
parent
2118402b2b
commit
a1b9179daa
2 changed files with 20 additions and 9 deletions
|
@ -18,11 +18,14 @@
|
|||
*/
|
||||
|
||||
import _ from 'lodash';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
export const all = [
|
||||
export const getAll = () => [
|
||||
{
|
||||
id: 'red',
|
||||
title: 'Red',
|
||||
title: i18n.translate('server.status.redTitle', {
|
||||
defaultMessage: 'Red'
|
||||
}),
|
||||
icon: 'danger',
|
||||
uiColor: 'danger',
|
||||
severity: 1000,
|
||||
|
@ -32,7 +35,9 @@ export const all = [
|
|||
},
|
||||
{
|
||||
id: 'uninitialized',
|
||||
title: 'Uninitialized',
|
||||
title: i18n.translate('server.status.uninitializedTitle', {
|
||||
defaultMessage: 'Uninitialized'
|
||||
}),
|
||||
icon: 'spinner',
|
||||
uiColor: 'default',
|
||||
severity: 900,
|
||||
|
@ -42,7 +47,9 @@ export const all = [
|
|||
},
|
||||
{
|
||||
id: 'yellow',
|
||||
title: 'Yellow',
|
||||
title: i18n.translate('server.status.yellowTitle', {
|
||||
defaultMessage: 'Yellow'
|
||||
}),
|
||||
icon: 'warning',
|
||||
uiColor: 'warning',
|
||||
severity: 800,
|
||||
|
@ -54,7 +61,9 @@ export const all = [
|
|||
},
|
||||
{
|
||||
id: 'green',
|
||||
title: 'Green',
|
||||
title: i18n.translate('server.status.greenTitle', {
|
||||
defaultMessage: 'Green'
|
||||
}),
|
||||
icon: 'success',
|
||||
uiColor: 'secondary',
|
||||
severity: 0,
|
||||
|
@ -64,7 +73,9 @@ export const all = [
|
|||
},
|
||||
{
|
||||
id: 'disabled',
|
||||
title: 'Disabled',
|
||||
title: i18n.translate('server.status.disabledTitle', {
|
||||
defaultMessage: 'Disabled'
|
||||
}),
|
||||
severity: -1,
|
||||
icon: 'toggle-off',
|
||||
uiColor: 'default',
|
||||
|
@ -74,7 +85,7 @@ export const all = [
|
|||
}
|
||||
];
|
||||
|
||||
export const allById = _.indexBy(exports.all, 'id');
|
||||
export const getAllById = () => _.indexBy(exports.getAll(), 'id');
|
||||
|
||||
export const defaults = {
|
||||
icon: 'question',
|
||||
|
@ -82,5 +93,5 @@ export const defaults = {
|
|||
};
|
||||
|
||||
export function get(id) {
|
||||
return exports.allById[id] || _.defaults({ id: id }, exports.defaults);
|
||||
return exports.getAllById()[id] || _.defaults({ id: id }, exports.defaults);
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ export default class Status extends EventEmitter {
|
|||
}
|
||||
}
|
||||
|
||||
states.all.forEach(function (state) {
|
||||
states.getAll().forEach(function (state) {
|
||||
Status.prototype[state.id] = function (message) {
|
||||
if (this.state === 'disabled') return;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue