Skip to content

Commit

Permalink
addressed feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
igoristic committed Dec 19, 2019
1 parent af981e3 commit bd8e24f
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,16 @@ const getColumns = (kbnUrl, scope) => [
field: 'status',
sortable: true,
render: severity => {
const severityIcon = mapSeverity(severity);

if (!severityIcon || !severityIcon.title) {
return null;
}
const severityIconDefaults = {
title: i18n.translate('xpack.monitoring.alerts.severityTitle.unknown', {
defaultMessage: 'Unknown',
}),
color: 'subdued',
value: i18n.translate('xpack.monitoring.alerts.severityValue.unknown', {
defaultMessage: 'N/A',
}),
};
const severityIcon = { ...severityIconDefaults, ...mapSeverity(severity) };

return (
<EuiToolTip content={severityIcon.title} position="bottom">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ export function AlertsIndicator({ alerts }) {
}
})();

if (!tooltipText) {
return null;
}

return (
<EuiToolTip content={tooltipText} position="bottom" trigger="hover">
<EuiHealth color={severityIcon.color} data-test-subj="alertIcon">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,12 @@ const IsAlertsSupported = props => {
return <span>{props.children}</span>;
}

const message = alertsMeta.message || clusterMeta.message;

if (!message || !message.length) {
return null;
}
const message =
alertsMeta.message ||
clusterMeta.message ||
i18n.translate('xpack.monitoring.cluster.listing.unknownHealthMessage', {
defaultMessage: 'Unknown',
});

return (
<EuiToolTip content={message} position="bottom">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,19 @@ import { ListingCallOut } from '../../setup_mode/listing_callout';

const getNodeTooltip = node => {
const { nodeTypeLabel, nodeTypeClass } = node;

const nodeTypeLabelContent =
nodeTypeLabel ||
i18n.translate('xpack.monitoring.elasticsearch.nodes.unknownNodeTypeLabel', {
defaultMessage: 'Unknown',
});
const nodeTypeClassIcon = nodeTypeClass || 'empty';

if (nodeTypeLabel) {
return (
<>
<EuiToolTip position="bottom" content={nodeTypeLabel}>
{nodeTypeClass && <EuiIcon type={nodeTypeClass} />}
<EuiToolTip position="bottom" content={nodeTypeLabelContent}>
<EuiIcon type={nodeTypeClassIcon} />
</EuiToolTip>{' '}
&nbsp;
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@
import React from 'react';
import { EuiIcon, EuiLink, EuiFlexGroup, EuiFlexItem, EuiToolTip } from '@elastic/eui';
import { SourceTooltip } from './source_tooltip';
import { i18n } from '@kbn/i18n';

export const SourceDestination = props => {
const { sourceName, targetName, targetTransportAddress } = props;
const targetTransportAddressContent =
targetTransportAddress ||
i18n.translate('xpack.monitoring.elasticsearch.shardActivity.unknownTargetAddressContent', {
defaultMessage: 'Unknown',
});
return (
<EuiFlexGroup gutterSize="s" alignItems="center" wrap>
<EuiFlexItem grow={false}>
Expand All @@ -18,13 +24,11 @@ export const SourceDestination = props => {
<EuiFlexItem grow={false}>
<EuiIcon type="arrowRight" size="s" />
</EuiFlexItem>
{targetTransportAddress && (
<EuiFlexItem grow={false}>
<EuiToolTip content={targetTransportAddress} position="bottom">
<EuiLink>{targetName}</EuiLink>
</EuiToolTip>
</EuiFlexItem>
)}
<EuiFlexItem grow={false}>
<EuiToolTip content={targetTransportAddressContent} position="bottom">
<EuiLink>{targetName}</EuiLink>
</EuiToolTip>
</EuiFlexItem>
</EuiFlexGroup>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,14 @@ export class Shard extends React.Component {
const classification = classes + ' ' + shard.shard;

let shardUi = <EuiBadge color={color}>{shard.shard}</EuiBadge>;

if (this.state.tooltipVisible && shard.tooltip_message) {
const tooltipContent =
shard.tooltip_message ||
i18n.translate('xpack.monitoring.elasticsearch.shardAllocation.shardDisplayName', {
defaultMessage: 'Shard',
});
if (this.state.tooltipVisible) {
shardUi = (
<EuiToolTip content={shard.tooltip_message} position="bottom" data-test-subj="shardTooltip">
<EuiToolTip content={tooltipContent} position="bottom" data-test-subj="shardTooltip">
<p>{shardUi}</p>
</EuiToolTip>
);
Expand All @@ -110,7 +114,7 @@ export class Shard extends React.Component {
onMouseEnter={this.toggle}
onMouseLeave={this.toggle}
className={classes}
data-shard-tooltip={this.props.shard.tooltip_message}
data-shard-tooltip={tooltipContent}
data-shard-classification={classification}
data-test-subj="shardIcon"
>
Expand Down

0 comments on commit bd8e24f

Please sign in to comment.