mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Implement breadcrumbs for deleting different kube objects
This was done in a naive way by disregarding stuff such as: - Avoidance of shared global state (dependency inversion principle) - Unit testing - Minimal implementation over defensive code (elvis, just in case) - Full understanding for use cases of all different kube objects Signed-off-by: Janne Savolainen <janne.savolainen@houston-inc.com>
This commit is contained in:
parent
304941d397
commit
10eb95ae67
@ -27,6 +27,8 @@ import { MenuActions, MenuActionsProps } from "../menu/menu-actions";
|
||||
import { hideDetails } from "../kube-detail-params";
|
||||
import { apiManager } from "../../../common/k8s-api/api-manager";
|
||||
import { KubeObjectMenuRegistry } from "../../../extensions/registries/kube-object-menu-registry";
|
||||
import identity from "lodash/identity";
|
||||
import { catalogEntityRegistry } from "../../api/catalog-entity-registry";
|
||||
|
||||
export interface KubeObjectMenuProps<T> extends MenuActionsProps {
|
||||
object: T | null | undefined;
|
||||
@ -74,8 +76,17 @@ export class KubeObjectMenu<T extends KubeObject> extends React.Component<KubeOb
|
||||
return null;
|
||||
}
|
||||
|
||||
const breadcrumbParts = [
|
||||
catalogEntityRegistry.activeEntity?.metadata?.name,
|
||||
object.getNs(),
|
||||
object.kind,
|
||||
object.getName(),
|
||||
];
|
||||
|
||||
const breadcrumb = breadcrumbParts.filter(identity).join("/");
|
||||
|
||||
return (
|
||||
<p>Remove {object.kind} <b>{object.getName()}</b>?</p>
|
||||
<p>Remove <b>{breadcrumb}</b>?</p>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user