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
@@ -2,16 +2,15 @@ import "./endpoint-details.scss"
|
||||
|
||||
import React from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import { t, Trans } from "@lingui/macro";
|
||||
import { DrawerItem, DrawerTitle } from "../drawer";
|
||||
import { Badge } from "../badge";
|
||||
import { Trans } from "@lingui/macro";
|
||||
import { DrawerTitle } from "../drawer";
|
||||
import { KubeEventDetails } from "../+events/kube-event-details";
|
||||
import { KubeObjectDetailsProps } from "../kube-object";
|
||||
import { Endpoint, endpointApi } from "../../api/endpoints";
|
||||
import { Endpoint } from "../../api/endpoints";
|
||||
import { _i18n } from "../../i18n";
|
||||
import { apiManager } from "../../api/api-manager";
|
||||
import { KubeObjectMeta } from "../kube-object/kube-object-meta";
|
||||
import { EndpointSubsetList } from "./endpoint-subset-list";
|
||||
import { kubeObjectDetailRegistry } from "../../api/kube-object-detail-registry";
|
||||
|
||||
interface Props extends KubeObjectDetailsProps<Endpoint> {
|
||||
}
|
||||
@@ -39,6 +38,10 @@ export class EndpointDetails extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
apiManager.registerViews(endpointApi, {
|
||||
Details: EndpointDetails,
|
||||
kubeObjectDetailRegistry.add({
|
||||
kind: "Endpoints",
|
||||
apiVersions: ["v1"],
|
||||
components: {
|
||||
Details: (props) => <EndpointDetails {...props} />
|
||||
}
|
||||
})
|
||||
@@ -47,9 +47,6 @@ export class Endpoints extends React.Component<Props> {
|
||||
endpoint.toString(),
|
||||
endpoint.getAge(),
|
||||
]}
|
||||
renderItemMenu={(item: Endpoint) => {
|
||||
return <EndpointMenu object={item}/>
|
||||
}}
|
||||
tableProps={{
|
||||
customRowHeights: (item: Endpoint, lineHeight, paddings) => {
|
||||
const lines = item.getEndpointSubsets().length || 1;
|
||||
@@ -60,13 +57,3 @@ export class Endpoints extends React.Component<Props> {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export function EndpointMenu(props: KubeObjectMenuProps<Endpoint>) {
|
||||
return (
|
||||
<KubeObjectMenu {...props}/>
|
||||
)
|
||||
}
|
||||
|
||||
apiManager.registerViews(endpointApi, {
|
||||
Menu: EndpointMenu
|
||||
})
|
||||
Reference in new issue
Block a user