mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Explicitly initialize registries
- Helps moves towards turning on banning CyclicImports Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
c18df6bcae
commit
6d10f011e5
101 files changed
+1178
-1087
No files matched your search
@@ -32,7 +32,8 @@ import { apiManager } from "../../api/api-manager";
|
||||
import { crdStore } from "../+custom-resources/crd.store";
|
||||
import { CrdResourceDetails } from "../+custom-resources";
|
||||
import { KubeObjectMenu } from "./kube-object-menu";
|
||||
import { kubeObjectDetailRegistry } from "../../api/kube-object-detail-registry";
|
||||
import type { CustomResourceDefinition } from "../../api/endpoints";
|
||||
import { KubeObjectDetailRegistry } from "../../api/kube-object-detail-registry";
|
||||
|
||||
/**
|
||||
* Used to store `object.selfLink` to show more info about resource in the details panel.
|
||||
@@ -139,20 +140,33 @@ export class KubeObjectDetails extends React.Component {
|
||||
render() {
|
||||
const { object, isLoading, loadingError, isCrdInstance } = this;
|
||||
const isOpen = !!(object || isLoading || loadingError);
|
||||
let title = "";
|
||||
let details: React.ReactNode[];
|
||||
|
||||
if (object) {
|
||||
const { kind, getName } = object;
|
||||
if (!object) {
|
||||
return (
|
||||
<Drawer
|
||||
className="KubeObjectDetails flex column"
|
||||
open={isOpen}
|
||||
title=""
|
||||
toolbar={<KubeObjectMenu object={object} toolbar={true} />}
|
||||
onClose={hideDetails}
|
||||
>
|
||||
{isLoading && <Spinner center />}
|
||||
{loadingError && <div className="box center">{loadingError}</div>}
|
||||
</Drawer>
|
||||
);
|
||||
}
|
||||
|
||||
title = `${kind}: ${getName()}`;
|
||||
details = kubeObjectDetailRegistry.getItemsForKind(object.kind, object.apiVersion).map((item, index) => {
|
||||
return <item.components.Details object={object} key={`object-details-${index}`}/>;
|
||||
});
|
||||
const { kind, getName } = object;
|
||||
const title = `${kind}: ${getName()}`;
|
||||
const details = KubeObjectDetailRegistry
|
||||
.getInstance()
|
||||
.getItemsForKind(object.kind, object.apiVersion)
|
||||
.map((item, index) => (
|
||||
<item.components.Details object={object} key={`object-details-${index}`} />
|
||||
));
|
||||
|
||||
if (isCrdInstance && details.length === 0) {
|
||||
details.push(<CrdResourceDetails object={object}/>);
|
||||
}
|
||||
if (isCrdInstance && details.length === 0) {
|
||||
details.push(<CrdResourceDetails object={object as CustomResourceDefinition}/>);
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -26,7 +26,7 @@ import { editResourceTab } from "../dock/edit-resource.store";
|
||||
import { MenuActions, MenuActionsProps } from "../menu/menu-actions";
|
||||
import { hideDetails } from "./kube-object-details";
|
||||
import { apiManager } from "../../api/api-manager";
|
||||
import { kubeObjectMenuRegistry } from "../../../extensions/registries/kube-object-menu-registry";
|
||||
import { KubeObjectMenuRegistry } from "../../../extensions/registries/kube-object-menu-registry";
|
||||
|
||||
export interface KubeObjectMenuProps<T> extends MenuActionsProps {
|
||||
object: T | null | undefined;
|
||||
@@ -88,7 +88,8 @@ export class KubeObjectMenu<T extends KubeObject> extends React.Component<KubeOb
|
||||
return [];
|
||||
}
|
||||
|
||||
return kubeObjectMenuRegistry
|
||||
return KubeObjectMenuRegistry
|
||||
.getInstance()
|
||||
.getItemsForKind(object.kind, object.apiVersion)
|
||||
.map(({components: { MenuItem }}, index) => (
|
||||
<MenuItem
|
||||
|
||||
Reference in new issue
Block a user