Skip to content

Commit c6bb804

Browse files
authored
Merge pull request #135 from aali309/viewAppSetToolTip
Proper tooltip alignment on `Owner` field
2 parents b2cb05d + fb604ea commit c6bb804

File tree

5 files changed

+39
-14
lines changed

5 files changed

+39
-14
lines changed

locales/en/public.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,6 @@
2727
"Reason": "Reason",
2828
"Message": "Message",
2929
"No conditions found": "No conditions found",
30-
"No owner": "No owner"
30+
"No owner": "No owner",
31+
"View {{kind}}": "View {{kind}}"
3132
}

locales/ja/public.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,6 @@
2727
"Reason": "Reason",
2828
"Message": "Message",
2929
"No conditions found": "No conditions found",
30-
"No owner": "No owner"
30+
"No owner": "No owner",
31+
"View {{kind}}": "View {{kind}}"
3132
}

locales/ko/public.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,6 @@
2727
"Reason": "Reason",
2828
"Message": "Message",
2929
"No conditions found": "No conditions found",
30-
"No owner": "No owner"
30+
"No owner": "No owner",
31+
"View {{kind}}": "View {{kind}}"
3132
}

locales/zh/public.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,6 @@
2727
"Reason": "Reason",
2828
"Message": "Message",
2929
"No conditions found": "No conditions found",
30-
"No owner": "No owner"
30+
"No owner": "No owner",
31+
"View {{kind}}": "View {{kind}}"
3132
}

src/gitops/utils/components/OwnerReferences/owner-references.tsx

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,23 +45,44 @@ export const OwnerReferences: React.FC<OwnerReferencesProps> = ({ resource }) =>
4545
}
4646

4747
return (
48-
<Tooltip key={o.uid} content={<div>View {model.kind}</div>} position="top">
48+
<OwnerReferenceLink
49+
key={o.uid}
50+
owner={o}
51+
model={model}
52+
namespace={resource.metadata.namespace}
53+
/>
54+
);
55+
});
56+
return owners.length ? (
57+
<>{owners}</>
58+
) : (
59+
<span className="pf-v6-u-text-color-subtle">{t('public~No owner')}</span>
60+
);
61+
};
62+
63+
type OwnerReferenceLinkProps = {
64+
owner: OwnerReference;
65+
model: K8sModel;
66+
namespace: string;
67+
};
68+
69+
const OwnerReferenceLink: React.FC<OwnerReferenceLinkProps> = ({ owner, model, namespace }) => {
70+
const { t } = useGitOpsTranslation();
71+
72+
return (
73+
<Tooltip content={<div>{t('public~View {{kind}}', { kind: model.kind })}</div>} position="top">
74+
<span className="pf-v6-u-display-inline-block">
4975
<ResourceLink
50-
namespace={resource.metadata.namespace}
76+
namespace={namespace}
5177
groupVersionKind={{
5278
group: model.apiGroup,
5379
version: model.apiVersion,
5480
kind: model.kind,
5581
}}
56-
name={o.name}
82+
name={owner.name}
5783
/>
58-
</Tooltip>
59-
);
60-
});
61-
return owners.length ? (
62-
<>{owners}</>
63-
) : (
64-
<span className="pf-v6-u-text-color-subtle">{t('public~No owner')}</span>
84+
</span>
85+
</Tooltip>
6586
);
6687
};
6788

0 commit comments

Comments
 (0)