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:
parent
29d0634729
commit
d9e8821d33
@ -24,7 +24,7 @@ import { editResourceTab } from "../../dock/edit-resource.store";
|
|||||||
import { hideDetails } from "../../kube-detail-params";
|
import { hideDetails } from "../../kube-detail-params";
|
||||||
import { apiManager } from "../../../../common/k8s-api/api-manager";
|
import { apiManager } from "../../../../common/k8s-api/api-manager";
|
||||||
import { KubeObjectMenuRegistry } from "../../../../extensions/registries";
|
import { KubeObjectMenuRegistry } from "../../../../extensions/registries";
|
||||||
import { catalogEntityRegistry } from "../../../api/catalog-entity-registry";
|
import { getActiveClusterEntity } from "../../../api/catalog-entity-registry";
|
||||||
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@ -34,13 +34,14 @@ interface Props {
|
|||||||
|
|
||||||
export const InjectNaive = ({ Component, ...props }: Props) => {
|
export const InjectNaive = ({ Component, ...props }: Props) => {
|
||||||
const kubeObjectMenuRegistry = KubeObjectMenuRegistry.getInstance();
|
const kubeObjectMenuRegistry = KubeObjectMenuRegistry.getInstance();
|
||||||
|
const cluster = getActiveClusterEntity();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Component
|
<Component
|
||||||
editResourceTab={editResourceTab}
|
editResourceTab={editResourceTab}
|
||||||
hideDetails={hideDetails}
|
hideDetails={hideDetails}
|
||||||
apiManager={apiManager}
|
apiManager={apiManager}
|
||||||
kubeObjectMenuRegistry={kubeObjectMenuRegistry}
|
kubeObjectMenuRegistry={kubeObjectMenuRegistry}
|
||||||
catalogEntityRegistry={catalogEntityRegistry}
|
cluster={cluster}
|
||||||
{...props} />);
|
{...props} />);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -25,12 +25,9 @@ import type { KubeObject } from "../../../common/k8s-api/kube-object";
|
|||||||
import { MenuActions, MenuActionsProps } from "../menu/menu-actions";
|
import { MenuActions, MenuActionsProps } from "../menu/menu-actions";
|
||||||
import identity from "lodash/identity";
|
import identity from "lodash/identity";
|
||||||
|
|
||||||
import type {
|
import type { IHasGettableItemsForKind } from "../../../extensions/registries";
|
||||||
IHasGettableItemsForKind,
|
|
||||||
} from "../../../extensions/registries";
|
|
||||||
|
|
||||||
import type { CatalogEntityRegistry } from "../../api/catalog-entity-registry";
|
|
||||||
import type { IGettableStore } from "../../../common/k8s-api/api-manager";
|
import type { IGettableStore } from "../../../common/k8s-api/api-manager";
|
||||||
|
import type { Cluster } from "../../../main/cluster";
|
||||||
|
|
||||||
|
|
||||||
export interface KubeObjectMenuProps<T> extends MenuActionsProps {
|
export interface KubeObjectMenuProps<T> extends MenuActionsProps {
|
||||||
@ -42,9 +39,9 @@ export interface KubeObjectMenuProps<T> extends MenuActionsProps {
|
|||||||
interface KubeObjectMenuDependencies<T> extends KubeObjectMenuProps<T>{
|
interface KubeObjectMenuDependencies<T> extends KubeObjectMenuProps<T>{
|
||||||
apiManager: IGettableStore,
|
apiManager: IGettableStore,
|
||||||
kubeObjectMenuRegistry: IHasGettableItemsForKind
|
kubeObjectMenuRegistry: IHasGettableItemsForKind
|
||||||
|
cluster: Cluster,
|
||||||
hideDetails: Function,
|
hideDetails: Function,
|
||||||
editResourceTab: Function,
|
editResourceTab: Function,
|
||||||
catalogEntityRegistry: CatalogEntityRegistry,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class KubeObjectMenu<T extends KubeObject> extends React.Component<KubeObjectMenuDependencies<T>> {
|
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,
|
apiManager,
|
||||||
hideDetails,
|
hideDetails,
|
||||||
editResourceTab,
|
editResourceTab,
|
||||||
catalogEntityRegistry,
|
cluster,
|
||||||
kubeObjectMenuRegistry,
|
kubeObjectMenuRegistry,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
@ -62,7 +59,7 @@ export class KubeObjectMenu<T extends KubeObject> extends React.Component<KubeOb
|
|||||||
editResourceTab,
|
editResourceTab,
|
||||||
hideDetails,
|
hideDetails,
|
||||||
kubeObjectMenuRegistry,
|
kubeObjectMenuRegistry,
|
||||||
catalogEntityRegistry,
|
cluster,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,7 +103,7 @@ export class KubeObjectMenu<T extends KubeObject> extends React.Component<KubeOb
|
|||||||
}
|
}
|
||||||
|
|
||||||
const breadcrumbParts = [
|
const breadcrumbParts = [
|
||||||
this.dependencies.catalogEntityRegistry.activeEntity?.metadata?.name,
|
this.dependencies.cluster?.name,
|
||||||
object.getNs(),
|
object.getNs(),
|
||||||
object.kind,
|
object.kind,
|
||||||
object.getName(),
|
object.getName(),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user