Skip to content

Commit

Permalink
Fixes #37648 - Show complete hostgroup name in host overview and table
Browse files Browse the repository at this point in the history
  • Loading branch information
kmalyjur authored and MariaAga committed Jul 22, 2024
1 parent b5638c7 commit 51d8f35
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const DetailsCard = ({
comment,
owner_id: ownerID,
owner_name: ownerName,
hostgroup_title: hostgroupTitle,
hostgroup_name: hostgroupName,
hostgroup_id: hostgroupId,
permissions: {
Expand Down Expand Up @@ -120,18 +121,24 @@ const DetailsCard = ({
justifyContent={{ default: 'justifyContentSpaceBetween' }}
>
<FlexItem>
<Button
ouiaId="host-group-link"
component="a"
href={foremanUrl(
`/hosts?search=hostgroup="${hostgroupName}"`
<span>
{hostgroupTitle?.substring(
0,
hostgroupTitle?.lastIndexOf(hostgroupName)
)}
variant="link"
target="_blank"
isInline
>
{hostgroupName}
</Button>
<Button
ouiaId="host-group-link"
component="a"
href={foremanUrl(
`/hosts?search=hostgroup="${hostgroupName}"`
)}
variant="link"
target="_blank"
isInline
>
{hostgroupName}
</Button>
</span>
</FlexItem>
<FlexItem>
<Button
Expand Down Expand Up @@ -196,6 +203,7 @@ DetailsCard.propTypes = {
status: PropTypes.string,
hostDetails: PropTypes.shape({
comment: PropTypes.string,
hostgroup_title: PropTypes.string,
hostgroup_name: PropTypes.string,
hostgroup_id: PropTypes.number,
ip: PropTypes.string,
Expand All @@ -212,6 +220,7 @@ DetailsCard.defaultProps = {
status: STATUS.PENDING,
hostDetails: {
comment: undefined,
hostgroup_title: undefined,
hostgroup_name: undefined,
hostgroup_id: undefined,
ip: undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const SystemPropertiesCard = ({ status, hostDetails }) => {
organization_name: organization,
owner_name: ownerName,
domain_name: domain,
hostgroup_name: hostgroupName,
hostgroup_title: hostgroupTitle,
owner_type: ownerType,
} = hostDetails;
return (
Expand Down Expand Up @@ -103,7 +103,7 @@ const SystemPropertiesCard = ({ status, hostDetails }) => {
status={status}
emptyState={<DefaultLoaderEmptyState />}
>
{hostgroupName}
{hostgroupTitle}
</SkeletonLoader>
</DescriptionListDescription>
</DescriptionListGroup>
Expand Down Expand Up @@ -164,7 +164,7 @@ const SystemPropertiesCard = ({ status, hostDetails }) => {
SystemPropertiesCard.propTypes = {
status: PropTypes.string,
hostDetails: PropTypes.shape({
hostgroup_name: PropTypes.string,
hostgroup_title: PropTypes.string,
model_name: PropTypes.string,
organization_name: PropTypes.string,
location_name: PropTypes.string,
Expand All @@ -184,7 +184,7 @@ SystemPropertiesCard.defaultProps = {
model_name: undefined,
organization_name: undefined,
location_name: undefined,
hostgroup_name: undefined,
hostgroup_title: undefined,
owner_type: undefined,
owner_name: undefined,
domain_name: undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,16 @@ const coreHostsIndexColumns = [
{
columnName: 'hostgroup',
title: __('Host group'),
wrapper: hostDetails => (
<a href={`/hostgroups/${hostDetails?.hostgroup_id}/edit`}>
{hostDetails?.hostgroup_name}
</a>
),
wrapper: hostDetails => {
const fullTitle = hostDetails?.hostgroup_title;
const name = hostDetails?.hostgroup_name;
return (
<span>
{fullTitle?.substring(0, fullTitle?.lastIndexOf(name))}
<a href={`/hostgroups/${hostDetails?.hostgroup_id}/edit`}>{name}</a>
</span>
);
},
isSorted: true,
weight: 100,
},
Expand Down

0 comments on commit 51d8f35

Please sign in to comment.