1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Simplify a way of getting cluster name

Signed-off-by: Janne Savolainen <janne.savolainen@houston-inc.com>
This commit is contained in:
Janne Savolainen 2021-11-04 10:27:13 +02:00 committed by Janne Savolainen
parent 29d0634729
commit d9e8821d33
2 changed files with 10 additions and 12 deletions

View File

@ -24,7 +24,7 @@ import { editResourceTab } from "../../dock/edit-resource.store";
import { hideDetails } from "../../kube-detail-params";
import { apiManager } from "../../../../common/k8s-api/api-manager";
import { KubeObjectMenuRegistry } from "../../../../extensions/registries";
import { catalogEntityRegistry } from "../../../api/catalog-entity-registry";
import { getActiveClusterEntity } from "../../../api/catalog-entity-registry";
interface Props {
@ -34,13 +34,14 @@ interface Props {
export const InjectNaive = ({ Component, ...props }: Props) => {
const kubeObjectMenuRegistry = KubeObjectMenuRegistry.getInstance();
const cluster = getActiveClusterEntity();
return (
<Component
editResourceTab={editResourceTab}
hideDetails={hideDetails}
apiManager={apiManager}
kubeObjectMenuRegistry={kubeObjectMenuRegistry}
catalogEntityRegistry={catalogEntityRegistry}
cluster={cluster}
{...props} />);
};

View File

@ -25,12 +25,9 @@ import type { KubeObject } from "../../../common/k8s-api/kube-object";
import { MenuActions, MenuActionsProps } from "../menu/menu-actions";
import identity from "lodash/identity";
import type {
IHasGettableItemsForKind,
} from "../../../extensions/registries";
import type { CatalogEntityRegistry } from "../../api/catalog-entity-registry";
import type { IHasGettableItemsForKind } from "../../../extensions/registries";
import type { IGettableStore } from "../../../common/k8s-api/api-manager";
import type { Cluster } from "../../../main/cluster";
export interface KubeObjectMenuProps<T> extends MenuActionsProps {
@ -42,9 +39,9 @@ export interface KubeObjectMenuProps<T> extends MenuActionsProps {
interface KubeObjectMenuDependencies<T> extends KubeObjectMenuProps<T>{
apiManager: IGettableStore,
kubeObjectMenuRegistry: IHasGettableItemsForKind
cluster: Cluster,
hideDetails: Function,
editResourceTab: Function,
catalogEntityRegistry: CatalogEntityRegistry,
}
export class KubeObjectMenu<T extends KubeObject> extends React.Component<KubeObjectMenuDependencies<T>> {
@ -53,7 +50,7 @@ export class KubeObjectMenu<T extends KubeObject> extends React.Component<KubeOb
apiManager,
hideDetails,
editResourceTab,
catalogEntityRegistry,
cluster,
kubeObjectMenuRegistry,
} = this.props;
@ -62,7 +59,7 @@ export class KubeObjectMenu<T extends KubeObject> extends React.Component<KubeOb
editResourceTab,
hideDetails,
kubeObjectMenuRegistry,
catalogEntityRegistry,
cluster,
};
}
@ -106,7 +103,7 @@ export class KubeObjectMenu<T extends KubeObject> extends React.Component<KubeOb
}
const breadcrumbParts = [
this.dependencies.catalogEntityRegistry.activeEntity?.metadata?.name,
this.dependencies.cluster?.name,
object.getNs(),
object.kind,
object.getName(),