Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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 @@ -51,7 +51,7 @@ export const Index = ({
))}
</EuiFlexGrid>
<EuiSpacer size="m"/>
<ShardAllocation scope={scope} {...props} kbnUrl={kbnUrl} type="index" />
<ShardAllocation scope={scope} kbnUrl={kbnUrl} type="index" />
</EuiPageContent>
</EuiPageBody>
</EuiPage>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,6 @@ monitoring-shard-allocation {
font: 10px sans-serif;
border-left: 1px solid $euiColorEmptyShade;
position: relative;

.shard-tooltip {
padding: 5px;
bottom: 25px;
left: 0;
position: absolute;
border: 1px solid $euiColorLightShade;
white-space: nowrap;
}
}

.legend {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import React from 'react';
import { calculateClass } from '../lib/calculate_class';
import { vents } from '../lib/vents';
import { i18n } from '@kbn/i18n';
import { EuiTextColor } from '@elastic/eui';
import { EuiTextColor, EuiToolTip } from '@elastic/eui';

function getColor(classes) {
return classes.split(' ').reduce((color, cls) => {
Expand Down Expand Up @@ -80,23 +80,24 @@ export class Shard extends React.Component {

render() {
const shard = this.props.shard;
let tooltip;
if (this.state.tooltipVisible) {
tooltip = (
<div
className="shard-tooltip"
data-test-subj="shardTooltip"
data-tooltip-content={this.props.shard.tooltip_message}
>
{this.props.shard.tooltip_message}
</div>
);
}

const classes = calculateClass(shard);
const color = getColor(classes);
const classification = classes + ' ' + shard.shard;

let shardUi = (
<EuiTextColor color={color}>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this color code working? In the screenshot, the color doesn't match any of the badge colors. Perhaps the shardUi should be a badge instead of a dark block of text with a color that may not show well on that background?

{shard.shard}
</EuiTextColor>
);

if (this.state.tooltipVisible) {
shardUi = (
<EuiToolTip content={this.props.shard.tooltip_message} position="bottom" data-test-subj="shardTooltip">
<p>{shardUi}</p>
</EuiToolTip>
);
}

// data attrs for automated testing verification
return (
<div
Expand All @@ -107,9 +108,7 @@ export class Shard extends React.Component {
data-shard-classification={classification}
data-test-subj="shardIcon"
>
<EuiTextColor color={color}>
{tooltip}{shard.shard}
</EuiTextColor>
{shardUi}
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,13 @@ uiRoutes.when('/elasticsearch/indices/:index', {
}

const shards = data.shards;
data.totalCount = shards.length;
data.showing = transformer(shards, data.nodes);
$scope.totalCount = shards.length;
$scope.showing = transformer(shards, data.nodes);
$scope.labels = labels.node;
if (shards.some((shard) => shard.state === 'UNASSIGNED')) {
data.labels = labels.indexWithUnassigned;
$scope.labels = labels.indexWithUnassigned;
} else {
data.labels = labels.index;
$scope.labels = labels.index;
}

this.renderReact(
Expand Down