Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/translate monitoring elasticsearch part 2 #24734

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
c7ec189
Merge pull request #1 from elastic/master
Nox911 Sep 24, 2018
fa01b88
Merge pull request #2 from elastic/master
Nox911 Sep 27, 2018
70f6c7e
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Sep 27, 2018
68587a0
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Sep 28, 2018
42aa7d3
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Oct 2, 2018
efeaefe
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Oct 2, 2018
8a054ed
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Oct 8, 2018
b0d1660
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Oct 16, 2018
62b6ad1
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Oct 17, 2018
acbad4b
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Oct 18, 2018
a850650
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Oct 22, 2018
0a200ce
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Oct 25, 2018
b2a8244
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Oct 29, 2018
8765f49
Translate monitoring -> view -> elasticsearch
Nox911 Oct 29, 2018
943550e
Merge branch 'master' into feature/translate-monitoring-elasticsearch…
Nox911 Oct 29, 2018
74c236e
Fix issues
Nox911 Oct 29, 2018
c617035
Translate monitoring - view - elasticsearch and kibana
Nox911 Oct 29, 2018
749f8b5
Merge branch 'master' into feature/translate-monitoring-elasticsearch…
Nox911 Oct 30, 2018
676a8cb
Fix issues
Nox911 Oct 30, 2018
b4b979e
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Oct 30, 2018
5567113
Fix issues
Nox911 Oct 31, 2018
04ccfc5
Fix issues
Nox911 Oct 31, 2018
d349a4f
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Oct 31, 2018
b2d62d9
Merge branch 'master' into feature/translate-monitoring-elasticsearch…
Nox911 Oct 31, 2018
625b59b
Merge branch 'master' into feature/translate-monitoring-elasticsearch…
Nox911 Nov 1, 2018
ae285b9
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Nov 2, 2018
22a459c
Merge branch 'master' into feature/translate-monitoring-elasticsearch…
Nox911 Nov 2, 2018
3051641
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Nov 5, 2018
e65ec67
Merge branch 'master' into feature/translate-monitoring-elasticsearch…
Nox911 Nov 5, 2018
4c4babf
Fix placeholder value
Nox911 Nov 6, 2018
bc2f43c
Merge branch 'master' into feature/translate-monitoring-elasticsearch…
maryia-lapata Nov 14, 2018
e638ba9
Merge branch 'master' into feature/translate-monitoring-elasticsearch…
maryia-lapata Nov 15, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,48 @@ import { LARGE_ABBREVIATED, LARGE_BYTES } from '../../../../common/formatting';
import {
EuiLink,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { I18nProvider } from '@kbn/i18n/react';

const filterFields = [ 'job_id', 'state', 'node.name' ];
const columns = [
{ title: 'Job ID', sortKey: 'job_id', sortOrder: SORT_ASCENDING },
{ title: 'State', sortKey: 'state' },
{ title: 'Processed Records', sortKey: 'data_counts.processed_record_count' },
{ title: 'Model Size', sortKey: 'model_size_stats.model_bytes' },
{ title: 'Forecasts', sortKey: 'forecasts_stats.total' },
{ title: 'Node', sortKey: 'node.name' }
{
title: i18n.translate('xpack.monitoring.elasticsearch.mlJobListing.jobIdTitle', {
defaultMessage: 'Job ID'
}),
sortKey: 'job_id',
sortOrder: SORT_ASCENDING
},
{
title: i18n.translate('xpack.monitoring.elasticsearch.mlJobListing.stateTitle', {
defaultMessage: 'State'
}),
sortKey: 'state'
},
{
title: i18n.translate('xpack.monitoring.elasticsearch.mlJobListing.processedRecordsTitle', {
defaultMessage: 'Processed Records'
}),
sortKey: 'data_counts.processed_record_count'
},
{
title: i18n.translate('xpack.monitoring.elasticsearch.mlJobListing.modelSizeTitle', {
defaultMessage: 'Model Size'
}),
sortKey: 'model_size_stats.model_bytes'
},
{
title: i18n.translate('xpack.monitoring.elasticsearch.mlJobListing.forecastsTitle', {
defaultMessage: 'Forecasts'
}),
sortKey: 'forecasts_stats.total'
},
{
title: i18n.translate('xpack.monitoring.elasticsearch.mlJobListing.nodeTitle', {
defaultMessage: 'Node'
}),
sortKey: 'node.name'
}
];
const jobRowFactory = (scope, kbnUrl) => {
const goToNode = nodeId => {
Expand All @@ -45,7 +77,9 @@ const jobRowFactory = (scope, kbnUrl) => {
</EuiLink>
);
}
return 'N/A';
return i18n.translate('xpack.monitoring.elasticsearch.mlJobListing.noDataLabel', {
defaultMessage: 'N/A'
});
};

return function JobRow(props) {
Expand All @@ -68,7 +102,7 @@ const jobRowFactory = (scope, kbnUrl) => {
};

const uiModule = uiModules.get('monitoring/directives', []);
uiModule.directive('monitoringMlListing', kbnUrl => {
uiModule.directive('monitoringMlListing', (kbnUrl, i18n) => {
return {
restrict: 'E',
scope: {
Expand All @@ -84,13 +118,24 @@ uiModule.directive('monitoringMlListing', kbnUrl => {
const getNoDataMessage = filterText => {
if (filterText) {
return (
`There are no Machine Learning Jobs that match the filter [${filterText.trim()}] or the time range.
Try changing the filter or time range.`
i18n('xpack.monitoring.elasticsearch.mlJobListing.noFilteredJobsDescription', {
// eslint-disable-next-line max-len
defaultMessage: 'There are no Machine Learning Jobs that match the filter [{filterText}] or the time range. Try changing the filter or time range.',
Nox911 marked this conversation as resolved.
Show resolved Hide resolved
values: {
filterText: filterText.trim()
}
})
);
}
return 'There are no Machine Learning Jobs that match your query. Try changing the time range selection.';
return i18n('xpack.monitoring.elasticsearch.mlJobListing.noJobsDescription', {
defaultMessage: 'There are no Machine Learning Jobs that match your query. Try changing the time range selection.'
});
};

const filterJobsPlaceholder = i18n('xpack.monitoring.elasticsearch.mlJobListing.filterJobsPlaceholder', {
defaultMessage: 'Filter Jobs…'
});

scope.$watch('jobs', (jobs = []) => {
const mlTable = (
<I18nProvider>
Expand All @@ -102,7 +147,7 @@ Try changing the filter or time range.`
sortKey={scope.sortKey}
sortOrder={scope.sortOrder}
onNewState={scope.onNewState}
placeholder="Filter Jobs..."
placeholder={filterJobsPlaceholder}
filterFields={filterFields}
columns={columns}
rowComponent={jobRowFactory(scope, kbnUrl)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@
import React from 'react';
import { TableHead } from './tableHead';
import { TableBody } from './tableBody';
import { i18n } from '@kbn/i18n';

export class ClusterView extends React.Component {
static displayName = 'ClusterView';
static displayName = i18n.translate('xpack.monitoring.elasticsearch.shardAllocation.clusterViewDisplayName', {
defaultMessage: 'ClusterView',
});

constructor(props) {
super(props);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@
import React from 'react';
import { calculateClass } from '../lib/calculateClass';
import { vents } from '../lib/vents';
import { i18n } from '@kbn/i18n';

export class Shard extends React.Component {
static displayName = 'Shard';
static displayName = i18n.translate('xpack.monitoring.elasticsearch.shardAllocation.shardDisplayName', {
defaultMessage: 'Shard',
});
state = { tooltipVisible: false };

componentDidMount() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import React from 'react';
import { Unassigned } from './unassigned';
import { Assigned } from './assigned';
import { FormattedMessage } from '@kbn/i18n/react';
import { i18n } from '@kbn/i18n';

const ShardRow = props => {
let unassigned;
Expand All @@ -34,7 +36,9 @@ const ShardRow = props => {
};

export class TableBody extends React.Component {
static displayName = 'TableBody';
static displayName = i18n.translate('xpack.monitoring.elasticsearch.shardAllocation.tableBodyDisplayName', {
defaultMessage: 'TableBody',
});

createRow = (data, index) => {
return (
Expand All @@ -55,7 +59,10 @@ export class TableBody extends React.Component {
<td colSpan={this.props.cols}>
<div>
<p style={{ margin: '10px 0' }} className="text-center lead">
There are no shards allocated.
<FormattedMessage
id="xpack.monitoring.elasticsearch.shardAllocation.tableBody.noShardsAllocatedDescription"
defaultMessage="There are no shards allocated."
/>
</p>
</div>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
EuiFlexItem,
EuiSwitch,
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';

class IndexLabel extends React.Component {

Expand All @@ -38,7 +39,10 @@ class IndexLabel extends React.Component {
<EuiFlexItem
grow={false}
>
Indices
<FormattedMessage
id="xpack.monitoring.elasticsearch.shardAllocation.tableHead.indicesLabel"
defaultMessage="Indices"
/>
</EuiFlexItem>
<EuiFlexItem>
<EuiSwitch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@
import _ from 'lodash';
import React from 'react';
import { Shard } from './shard';
import { i18n } from '@kbn/i18n';

export class Unassigned extends React.Component {
static displayName = 'Unassigned';
static displayName = i18n.translate('xpack.monitoring.elasticsearch.shardAllocation.unassignedDisplayName', {
defaultMessage: 'Unassigned',
});

createShard = (shard) => {
const type = shard.primary ? 'primary' : 'replica';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import React from 'react';
import ReactDOM from 'react-dom';
import { ClusterView } from '../components/clusterView';
import { uiModules } from 'ui/modules';
import { I18nProvider } from '@kbn/i18n/react';

const uiModule = uiModules.get('monitoring/directives', []);
uiModule.directive('clusterView', kbnUrl => {
Expand All @@ -26,12 +27,14 @@ uiModule.directive('clusterView', kbnUrl => {
},
link: function (scope, element) {
ReactDOM.render(
<ClusterView
scope={scope}
kbnUrl={kbnUrl}
showSystemIndices={scope.showSystemIndices}
toggleShowSystemIndices={scope.toggleShowSystemIndices}
/>,
<I18nProvider>
<ClusterView
scope={scope}
kbnUrl={kbnUrl}
showSystemIndices={scope.showSystemIndices}
toggleShowSystemIndices={scope.toggleShowSystemIndices}
/>
</I18nProvider>,
element[0]
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,49 @@
<div class="page-row">
<div class="monCluster">
<h1 class="monClusterTitle">Shard Legend</h1>
<h1
class="monClusterTitle"
i18n-id="xpack.monitoring.elasticsearch.shardAllocation.shardLegendTitle"
i18n-default-message="Shard Legend"
></h1>
<div class="legend">
<span class="shard">&nbsp;</span>
<span class="shard-label">Primary</span>
<span
class="shard-label"
i18n-id="xpack.monitoring.elasticsearch.shardAllocation.primaryLabel"
i18n-default-message="Primary"
></span>
<span class="shard replica">&nbsp;</span>
<span class="shard-label">Replica</span>
<span
class="shard-label"
i18n-id="xpack.monitoring.elasticsearch.shardAllocation.replicaLabel"
i18n-default-message="Replica"
></span>
<span class="shard relocating">&nbsp;</span>
<span class="shard-label">Relocating</span>
<span
class="shard-label"
i18n-id="xpack.monitoring.elasticsearch.shardAllocation.relocatingLabel"
i18n-default-message="Relocating"
></span>
<span class="shard initializing">&nbsp;</span>
<span class="shard-label">Initializing</span>
<span
class="shard-label"
i18n-id="xpack.monitoring.elasticsearch.shardAllocation.initializingLabel"
i18n-default-message="Initializing"
></span>
<span class="shard emergency" ng-if="isIndexView">&nbsp;</span>
<span class="shard-label" ng-if="isIndexView">Unassigned Primary</span>
<span
class="shard-label"
ng-if="isIndexView"
i18n-id="xpack.monitoring.elasticsearch.shardAllocation.unassignedPrimaryLabel"
i18n-default-message="Unassigned Primary"
></span>
<span class="shard unassigned replica" ng-if="isIndexView">&nbsp;</span>
<span class="shard-label" ng-if="isIndexView">Unassigned Replica</span>
<span
class="shard-label"
ng-if="isIndexView"
i18n-id="xpack.monitoring.elasticsearch.shardAllocation.unassignedReplicaLabel"
i18n-default-message="Unassigned Replica"
></span>
</div>
<cluster-view
shard-stats="shardStats"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@


import { capitalize, find, get, includes } from 'lodash';
import { i18n } from '@kbn/i18n';

export function decorateShards(shards, nodes) {
function getTooltipMessage(shard) {
Expand All @@ -15,10 +16,20 @@ export function decorateShards(shards, nodes) {
// messages for relocating node
if (nodeName) {
if (shard.state === 'INITIALIZING') {
return `Relocating from ${nodeName}`;
return i18n.translate('xpack.monitoring.elasticsearch.shardAllocation.decorateShards.relocatingFromTextMessage', {
defaultMessage: 'Relocating from {nodeName}',
values: {
nodeName
}
});
}
if (shard.state === 'RELOCATING') {
return `Relocating to ${nodeName}`;
return i18n.translate('xpack.monitoring.elasticsearch.shardAllocation.decorateShards.relocatingToTextMessage', {
defaultMessage: 'Relocating to {nodeName}',
values: {
nodeName
}
});
}
}
return capitalize(shard.state.toLowerCase());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,33 @@

// The ui had different columns in different order depending on the
// $scope.view variable. This provides a lookup for the column headers

import { i18n } from '@kbn/i18n';

export const labels = {
// "index detail" page shows nodes on which index shards are allocated
index: [
{ content: 'Nodes' }
{ content: i18n.translate('xpack.monitoring.elasticsearch.shardAllocation.labels.nodesLabel', {
defaultMessage: 'Nodes',
})
}
],
indexWithUnassigned: [
{ content: 'Unassigned' },
{ content: 'Nodes' }
{ content: i18n.translate('xpack.monitoring.elasticsearch.shardAllocation.labels.unassignedLabel', {
defaultMessage: 'Unassigned',
})
},
{ content: i18n.translate('xpack.monitoring.elasticsearch.shardAllocation.labels.unassignedNodesLabel', {
defaultMessage: 'Nodes',
})
}
],
// "node detail" page shows the indexes that have shards on this node
node: [
{
content: 'Indices',
content: i18n.translate('xpack.monitoring.elasticsearch.shardAllocation.labels.indicesLabel', {
defaultMessage: 'Indices',
}),
showToggleSystemIndicesComponent: true // tell the TableHead component to inject checkbox JSX to show/hide system indices
}
]
Expand Down
Loading