Skip to content

Commit

Permalink
[Monitoring] Clearer MB migration state on the overview page (#41898)
Browse files Browse the repository at this point in the history
* Just show an icon if action is necessary, otherwise show nothing

* Update copy

* Update copy based on state

* Updated logic and copy

* Update copy
  • Loading branch information
chrisronline authored Jul 31, 2019
1 parent b230ceb commit 976d976
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
EuiBadge,
EuiToolTip,
EuiFlexGroup,
EuiIcon
} from '@elastic/eui';
import { LicenseText } from './license_text';
import { i18n } from '@kbn/i18n';
Expand Down Expand Up @@ -161,30 +162,44 @@ export function ElasticsearchPanel(props) {

const setupModeElasticsearchData = get(setupMode.data, 'elasticsearch');
let setupModeNodesData = null;
if (setupMode.enabled && setupMode.data) {
const migratedNodesCount = Object.values(setupModeElasticsearchData.byUuid).filter(node => node.isFullyMigrated).length;
const totalNodesCount = Object.values(setupModeElasticsearchData.byUuid).length;
if (setupMode.enabled && setupModeElasticsearchData) {
const {
totalUniqueInstanceCount,
totalUniqueFullyMigratedCount,
totalUniquePartiallyMigratedCount
} = setupModeElasticsearchData;
const allMonitoredByMetricbeat = totalUniqueInstanceCount > 0 &&
(totalUniqueFullyMigratedCount === totalUniqueInstanceCount || totalUniquePartiallyMigratedCount === totalUniqueInstanceCount);
const internalCollectionOn = totalUniquePartiallyMigratedCount > 0;
if (!allMonitoredByMetricbeat || internalCollectionOn) {
let tooltipText = null;

const badgeColor = migratedNodesCount === totalNodesCount
? 'secondary'
: 'danger';
if (!allMonitoredByMetricbeat) {
tooltipText = i18n.translate('xpack.monitoring.cluster.overview.elasticsearchPanel.setupModeNodesTooltip.oneInternal', {
defaultMessage: `There's at least one node that isn't being monitored using Metricbeat. Click the flag icon to visit the nodes
listing page and find out more information about the status of each node.`
});
}
else if (internalCollectionOn) {
tooltipText = i18n.translate('xpack.monitoring.cluster.overview.elasticsearchPanel.setupModeNodesTooltip.disableInternal', {
defaultMessage: `All nodes are being monitored using Metricbeat but internal collection still needs to be turned off. Click the
flag icon to visit the nodes listing page and disable internal collection.`
});
}

setupModeNodesData = (
<EuiFlexItem grow={false}>
<EuiToolTip
position="top"
content={i18n.translate('xpack.monitoring.cluster.overview.esPanel.setupModeNodesTooltip', {
defaultMessage: `These numbers indicate how many detected monitored nodes versus how many
detected total nodes. If there are more detected nodes than monitored nodes, click the Nodes
link and you will be guided in how to setup monitoring for the missing node.`
})}
>
<EuiBadge color={badgeColor}>
{formatNumber(migratedNodesCount, 'int_commas')}/{formatNumber(totalNodesCount, 'int_commas')}
</EuiBadge>
</EuiToolTip>
</EuiFlexItem>
);
setupModeNodesData = (
<EuiFlexItem grow={false}>
<EuiToolTip
position="top"
content={tooltipText}
>
<EuiLink onClick={goToNodes}>
<EuiIcon type="flag" color="warning"/>
</EuiLink>
</EuiToolTip>
</EuiFlexItem>
);
}
}

const showMlJobs = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
EuiDescriptionListTitle,
EuiDescriptionListDescription,
EuiHorizontalRule,
EuiBadge,
EuiIcon,
EuiToolTip
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
Expand All @@ -42,29 +42,43 @@ export function KibanaPanel(props) {
const setupModeKibanaData = get(setupMode.data, 'kibana');
let setupModeInstancesData = null;
if (setupMode.enabled && setupMode.data) {
const migratedNodesCount = Object.values(setupModeKibanaData.byUuid).filter(node => node.isFullyMigrated).length;
const totalNodesCount = Object.values(setupModeKibanaData.byUuid).length;
const {
totalUniqueInstanceCount,
totalUniqueFullyMigratedCount,
totalUniquePartiallyMigratedCount
} = setupModeKibanaData;
const allMonitoredByMetricbeat = totalUniqueInstanceCount > 0 &&
(totalUniqueFullyMigratedCount === totalUniqueInstanceCount || totalUniquePartiallyMigratedCount === totalUniqueInstanceCount);
const internalCollectionOn = totalUniquePartiallyMigratedCount > 0;
if (!allMonitoredByMetricbeat || internalCollectionOn) {
let tooltipText = null;

const badgeColor = migratedNodesCount === totalNodesCount
? 'secondary'
: 'danger';
if (!allMonitoredByMetricbeat) {
tooltipText = i18n.translate('xpack.monitoring.cluster.overview.kibanaPanel.setupModeNodesTooltip.oneInternal', {
defaultMessage: `There's at least one instance that isn't being monitored using Metricbeat. Click the flag
icon to visit the instances listing page and find out more information about the status of each instance.`
});
}
else if (internalCollectionOn) {
tooltipText = i18n.translate('xpack.monitoring.cluster.overview.kibanaPanel.setupModeNodesTooltip.disableInternal', {
defaultMessage: `All instances are being monitored using Metricbeat but internal collection still needs to be turned
off. Click the flag icon to visit the instances listing page and disable internal collection.`
});
}

setupModeInstancesData = (
<EuiFlexItem grow={false}>
<EuiToolTip
position="top"
content={i18n.translate('xpack.monitoring.cluster.overview.kibanaPanel.setupModeNodesTooltip', {
defaultMessage: `These numbers indicate how many detected monitored instances versus how many
detected total instances. If there are more detected instances than monitored instances, click
the instances link and you will be guided in how to setup monitoring for the missing node.`
})}
>
<EuiBadge color={badgeColor}>
{formatNumber(migratedNodesCount, 'int_commas')}/{formatNumber(totalNodesCount, 'int_commas')}
</EuiBadge>
</EuiToolTip>
</EuiFlexItem>
);
setupModeInstancesData = (
<EuiFlexItem grow={false}>
<EuiToolTip
position="top"
content={tooltipText}
>
<EuiLink onClick={goToInstances}>
<EuiIcon type="flag" color="warning"/>
</EuiLink>
</EuiToolTip>
</EuiFlexItem>
);
}
}

return (
Expand Down

0 comments on commit 976d976

Please sign in to comment.