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
|
<span
|
||||||
class="subnamespaceBadge"
|
class="subnamespaceBadge"
|
||||||
data-testid="subnamespace-badge-for-service-1-1"
|
data-testid="subnamespace-badge-for-service-1-1"
|
||||||
|
id="namespace-details-badge-for-service-1-1"
|
||||||
>
|
>
|
||||||
S
|
S
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@ -50,7 +50,10 @@ function NonInjectableNamespaceTreeView({ root, namespaceStore, getDetailsUrl }:
|
|||||||
{child.getName()}
|
{child.getName()}
|
||||||
</Link>
|
</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 React from "react";
|
||||||
import type { Namespace } from "../../../common/k8s-api/endpoints";
|
import type { Namespace } from "../../../common/k8s-api/endpoints";
|
||||||
|
import { Tooltip } from "../tooltip";
|
||||||
|
|
||||||
interface SubnamespaceBadgeProps extends React.HTMLAttributes<HTMLSpanElement> {
|
interface SubnamespaceBadgeProps extends React.HTMLAttributes<HTMLSpanElement> {
|
||||||
namespace: Namespace;
|
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"))) {
|
if (!namespace.getAnnotations().find(annotation => annotation.includes("hnc.x-k8s.io/subnamespace-of"))) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<span
|
<>
|
||||||
className={styles.subnamespaceBadge}
|
<span
|
||||||
data-testid={`subnamespace-badge-for-${namespace.getId()}`}
|
className={styles.subnamespaceBadge}
|
||||||
{...other}
|
data-testid={`subnamespace-badge-for-${namespace.getId()}`}
|
||||||
>
|
id={id}
|
||||||
S
|
{...other}
|
||||||
</span>
|
>
|
||||||
|
S
|
||||||
|
</span>
|
||||||
|
<Tooltip targetId={id}>
|
||||||
|
Subnamespace
|
||||||
|
</Tooltip>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user