mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Allow extensions to register kube-object menus + details (#1108)
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
1 parent
91bef77997
commit
99db7aca19
101 files changed
+7858
-1604
No files matched your search
@@ -6,14 +6,14 @@ import { observer } from "mobx-react";
|
||||
import { Trans } from "@lingui/macro";
|
||||
import { DrawerItem } from "../drawer";
|
||||
import { cssNames } from "../../utils";
|
||||
import { Namespace, namespacesApi } from "../../api/endpoints";
|
||||
import { Namespace } from "../../api/endpoints";
|
||||
import { KubeObjectDetailsProps } from "../kube-object";
|
||||
import { Link } from "react-router-dom";
|
||||
import { getDetailsUrl } from "../../navigation";
|
||||
import { Spinner } from "../spinner";
|
||||
import { resourceQuotaStore } from "../+config-resource-quotas/resource-quotas.store";
|
||||
import { apiManager } from "../../api/api-manager";
|
||||
import { KubeObjectMeta } from "../kube-object/kube-object-meta";
|
||||
import { kubeObjectDetailRegistry } from "../../api/kube-object-detail-registry";
|
||||
|
||||
interface Props extends KubeObjectDetailsProps<Namespace> {
|
||||
}
|
||||
@@ -56,6 +56,10 @@ export class NamespaceDetails extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
apiManager.registerViews(namespacesApi, {
|
||||
Details: NamespaceDetails
|
||||
});
|
||||
kubeObjectDetailRegistry.add({
|
||||
kind: "Namespace",
|
||||
apiVersions: ["v1"],
|
||||
components: {
|
||||
Details: (props) => <NamespaceDetails {...props} />
|
||||
}
|
||||
})
|
||||
@@ -53,9 +53,6 @@ export class Namespaces extends React.Component<Props> {
|
||||
item.getAge(),
|
||||
{ title: item.getStatus(), className: item.getStatus().toLowerCase() },
|
||||
]}
|
||||
renderItemMenu={(item: Namespace) => {
|
||||
return <NamespaceMenu object={item}/>
|
||||
}}
|
||||
addRemoveButtons={{
|
||||
addTooltip: <Trans>Add Namespace</Trans>,
|
||||
onAdd: () => AddNamespaceDialog.open(),
|
||||
@@ -69,13 +66,3 @@ export class Namespaces extends React.Component<Props> {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export function NamespaceMenu(props: KubeObjectMenuProps<Namespace>) {
|
||||
return (
|
||||
<KubeObjectMenu {...props}/>
|
||||
)
|
||||
}
|
||||
|
||||
apiManager.registerViews(namespacesApi, {
|
||||
Menu: NamespaceMenu,
|
||||
});
|
||||
Reference in new issue
Block a user