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
1 change: 1 addition & 0 deletions libs/locales/lib/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,7 @@
"ai:No hosts selected": "No hosts selected",
"ai:No IP collisions in network": "No IP collisions in network",
"ai:No label available": "No label available",
"ai:No labels available": "No labels available",
"ai:No location": "No location",
"ai:No matching events": "No matching events",
"ai:No namespace with hosts is available": "No namespace with hosts is available",
Expand Down
34 changes: 20 additions & 14 deletions libs/ui-lib/lib/cim/components/InfraEnv/InfraTableToolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -226,21 +226,27 @@ const InfraTableToolbar: React.FC<InfraTableToolbarProps> = ({
)}
>
<DropdownGroup label={t('ai:Labels')}>
{Object.entries(hostLabels).map(([label, count]) => (
<DropdownItem
hasCheckbox
key={`host-label-${label}`}
value={label}
isSelected={labelFilter?.includes(label)}
>
<Split hasGutter>
<SplitItem>{label}</SplitItem>
<SplitItem>
<Badge isRead>{count || 0}</Badge>
</SplitItem>
</Split>
{Object.keys(hostLabels).length > 0 ? (
Object.entries(hostLabels).map(([label, count]) => (
<DropdownItem
hasCheckbox
key={`host-label-${label}`}
value={label}
isSelected={labelFilter?.includes(label)}
>
<Split hasGutter>
<SplitItem>{label}</SplitItem>
<SplitItem>
<Badge isRead>{count || 0}</Badge>
</SplitItem>
</Split>
</DropdownItem>
))
) : (
<DropdownItem key="no-labels" isDisabled>
{t('ai:No labels available')}
</DropdownItem>
))}
)}
</DropdownGroup>
</Dropdown>
</ToolbarFilter>
Expand Down
21 changes: 12 additions & 9 deletions libs/ui-lib/lib/common/components/hosts/tableUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -394,15 +394,18 @@ export const labelsColumn = (t: TFunction): TableRow<Host> => ({
cell: (host) => {
const labels = getHostLabels(host);
return {
title: (
<LabelGroup>
{Object.entries(labels).map(([key, value], index) => (
<Label key={`${host.id}-host-label-${index}`} isCompact>
{key} = {value}
</Label>
))}
</LabelGroup>
),
title:
Object.entries(labels).length > 0 ? (
<LabelGroup>
{Object.entries(labels).map(([key, value], index) => (
<Label key={`${host.id}-host-label-${index}`} isCompact>
{key} = {value}
</Label>
))}
</LabelGroup>
) : (
'--'
),
props: { 'data-testid': 'host-labels' },
};
},
Expand Down
Loading