Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -7,8 +7,9 @@

import { EuiButtonEmpty, EuiScreenReaderOnly, EuiToolTip, useEuiFontSize } from '@elastic/eui';
import React, { useCallback, useState } from 'react';
import { i18n } from '@kbn/i18n';
import styled from '@emotion/styled';
import type { InventoryItemType } from '@kbn/metrics-data-access-plugin/common';
import { i18n } from '@kbn/i18n';
import type {
InfraWaffleMapGroup,
InfraWaffleMapOptions,
Expand All @@ -19,9 +20,10 @@ interface Props {
group: InfraWaffleMapGroup;
isChild?: boolean;
options: InfraWaffleMapOptions;
nodeType: InventoryItemType;
}

export const GroupName: React.FC<Props> = ({ onDrilldown, group, isChild, options }) => {
export const GroupName: React.FC<Props> = ({ onDrilldown, group, isChild, options, nodeType }) => {
const [a11yAnnouncement, setA11yAnnouncement] = useState('');

const handleClick = useCallback(
Expand Down Expand Up @@ -69,19 +71,29 @@ export const GroupName: React.FC<Props> = ({ onDrilldown, group, isChild, option
<Name>
<EuiToolTip position="top" content={group.name}>
<EuiButtonEmpty
aria-label={i18n.translate('xpack.infra.inventory.groupBySelectorButtonLabel', {
defaultMessage: 'Group by {group}',
values: { group: group.name },
})}
style={buttonStyle}
aria-label={i18n.translate(
'xpack.infra.inventory.groupBySelectorButton.ariaLabel',
{
defaultMessage: 'Group by {group}',
values: { group: group.name },
}
)}
css={buttonStyle}
onClick={handleClick}
data-test-subj="groupNameButton"
>
{group.name}
</EuiButtonEmpty>
</EuiToolTip>
</Name>
<Count>{group.count}</Count>
<Count
aria-label={i18n.translate('xpack.infra.inventory.groupByCount.ariaLabel', {
defaultMessage: '{count} {nodeType} in this group',
values: { nodeType, count: group.count },
})}
>
{group.count}
</Count>
</Inner>
</GroupNameContainer>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ interface Props {
export const GroupOfGroups: React.FC<Props> = (props) => {
return (
<GroupOfGroupsContainer>
<GroupName group={props.group} onDrilldown={props.onDrilldown} options={props.options} />
<GroupName
group={props.group}
onDrilldown={props.onDrilldown}
options={props.options}
nodeType={props.nodeType}
/>
<Groups>
{props.group.groups.map((group) => (
<GroupOfNodes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,13 @@ export const GroupOfNodes = React.memo<Props>(

return (
<GroupOfNodesContainer style={{ width }}>
<GroupName group={group} onDrilldown={onDrilldown} isChild={isChild} options={options} />
<GroupName
group={group}
onDrilldown={onDrilldown}
isChild={isChild}
options={options}
nodeType={nodeType}
/>
<Nodes>
{group.width ? (
group.nodes.map((node) => (
Expand Down