diff --git a/libs/locales/lib/en/translation.json b/libs/locales/lib/en/translation.json index 4e5e1995bf..269fdf0806 100644 --- a/libs/locales/lib/en/translation.json +++ b/libs/locales/lib/en/translation.json @@ -597,6 +597,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", diff --git a/libs/ui-lib/lib/cim/components/InfraEnv/InfraTableToolbar.tsx b/libs/ui-lib/lib/cim/components/InfraEnv/InfraTableToolbar.tsx index 43490a18f7..f2e4601122 100644 --- a/libs/ui-lib/lib/cim/components/InfraEnv/InfraTableToolbar.tsx +++ b/libs/ui-lib/lib/cim/components/InfraEnv/InfraTableToolbar.tsx @@ -226,21 +226,27 @@ const InfraTableToolbar: React.FC = ({ )} > - {Object.entries(hostLabels).map(([label, count]) => ( - - - {label} - - {count || 0} - - + {Object.keys(hostLabels).length > 0 ? ( + Object.entries(hostLabels).map(([label, count]) => ( + + + {label} + + {count || 0} + + + + )) + ) : ( + + {t('ai:No labels available')} - ))} + )} diff --git a/libs/ui-lib/lib/common/components/hosts/tableUtils.tsx b/libs/ui-lib/lib/common/components/hosts/tableUtils.tsx index 3f6ce8ab60..9b28c3a0f0 100644 --- a/libs/ui-lib/lib/common/components/hosts/tableUtils.tsx +++ b/libs/ui-lib/lib/common/components/hosts/tableUtils.tsx @@ -394,15 +394,18 @@ export const labelsColumn = (t: TFunction): TableRow => ({ cell: (host) => { const labels = getHostLabels(host); return { - title: ( - - {Object.entries(labels).map(([key, value], index) => ( - - ))} - - ), + title: + Object.entries(labels).length > 0 ? ( + + {Object.entries(labels).map(([key, value], index) => ( + + ))} + + ) : ( + '--' + ), props: { 'data-testid': 'host-labels' }, }; },