mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Adding tooltip for subnamespace badge
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
78e77f7536
commit
1489264953
@ -871,6 +871,7 @@ exports[`<NamespaceTreeView /> once the subscribe resolves renders namespace wit
|
||||
<span
|
||||
class="subnamespaceBadge"
|
||||
data-testid="subnamespace-badge-for-service-1-1"
|
||||
id="namespace-details-badge-for-service-1-1"
|
||||
>
|
||||
S
|
||||
</span>
|
||||
|
||||
@ -50,7 +50,10 @@ function NonInjectableNamespaceTreeView({ root, namespaceStore, getDetailsUrl }:
|
||||
{child.getName()}
|
||||
</Link>
|
||||
{" "}
|
||||
<SubnamespaceBadge namespace={child} />
|
||||
<SubnamespaceBadge
|
||||
id={`namespace-details-badge-for-${child.getId()}`}
|
||||
namespace={child}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
>
|
||||
|
||||
@ -2,23 +2,31 @@ import styles from "./subnamespace-badge.module.scss";
|
||||
|
||||
import React from "react";
|
||||
import type { Namespace } from "../../../common/k8s-api/endpoints";
|
||||
import { Tooltip } from "../tooltip";
|
||||
|
||||
interface SubnamespaceBadgeProps extends React.HTMLAttributes<HTMLSpanElement> {
|
||||
namespace: Namespace;
|
||||
id: string;
|
||||
}
|
||||
|
||||
export function SubnamespaceBadge({ namespace, ...other }: SubnamespaceBadgeProps) {
|
||||
export function SubnamespaceBadge({ namespace, id, ...other }: SubnamespaceBadgeProps) {
|
||||
if (!namespace.getAnnotations().find(annotation => annotation.includes("hnc.x-k8s.io/subnamespace-of"))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<span
|
||||
className={styles.subnamespaceBadge}
|
||||
data-testid={`subnamespace-badge-for-${namespace.getId()}`}
|
||||
{...other}
|
||||
>
|
||||
S
|
||||
</span>
|
||||
<>
|
||||
<span
|
||||
className={styles.subnamespaceBadge}
|
||||
data-testid={`subnamespace-badge-for-${namespace.getId()}`}
|
||||
id={id}
|
||||
{...other}
|
||||
>
|
||||
S
|
||||
</span>
|
||||
<Tooltip targetId={id}>
|
||||
Subnamespace
|
||||
</Tooltip>
|
||||
</>
|
||||
);
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user