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,9 +6,9 @@ import { DrawerTitle } from "../drawer";
|
||||
import { KubeEventDetails } from "../+events/kube-event-details";
|
||||
import { observer } from "mobx-react";
|
||||
import { KubeObjectDetailsProps } from "../kube-object";
|
||||
import { clusterRoleApi, Role, roleApi } from "../../api/endpoints";
|
||||
import { apiManager } from "../../api/api-manager";
|
||||
import { Role } from "../../api/endpoints";
|
||||
import { KubeObjectMeta } from "../kube-object/kube-object-meta";
|
||||
import { kubeObjectDetailRegistry } from "../../api/kube-object-detail-registry";
|
||||
|
||||
interface Props extends KubeObjectDetailsProps<Role> {
|
||||
}
|
||||
@@ -66,6 +66,18 @@ export class RoleDetails extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
apiManager.registerViews([roleApi, clusterRoleApi], {
|
||||
Details: RoleDetails,
|
||||
})
|
||||
kubeObjectDetailRegistry.add({
|
||||
kind: "Role",
|
||||
apiVersions: ["rbac.authorization.k8s.io/v1"],
|
||||
components: {
|
||||
Details: (props) => <RoleDetails {...props}/>
|
||||
}
|
||||
})
|
||||
|
||||
kubeObjectDetailRegistry.add({
|
||||
kind: "ClusterRole",
|
||||
apiVersions: ["rbac.authorization.k8s.io/v1"],
|
||||
components: {
|
||||
Details: (props) => <RoleDetails {...props}/>
|
||||
}
|
||||
})
|
||||
@@ -5,12 +5,10 @@ import { observer } from "mobx-react";
|
||||
import { Trans } from "@lingui/macro";
|
||||
import { RouteComponentProps } from "react-router";
|
||||
import { IRolesRouteParams } from "../+user-management/user-management.route";
|
||||
import { KubeObjectMenu, KubeObjectMenuProps } from "../kube-object/kube-object-menu";
|
||||
import { rolesStore } from "./roles.store";
|
||||
import { clusterRoleApi, Role, roleApi } from "../../api/endpoints";
|
||||
import { Role } from "../../api/endpoints";
|
||||
import { KubeObjectListLayout } from "../kube-object";
|
||||
import { AddRoleDialog } from "./add-role-dialog";
|
||||
import { apiManager } from "../../api/api-manager";
|
||||
|
||||
enum sortBy {
|
||||
name = "name",
|
||||
@@ -48,9 +46,6 @@ export class Roles extends React.Component<Props> {
|
||||
role.getNs() || "-",
|
||||
role.getAge(),
|
||||
]}
|
||||
renderItemMenu={(item: Role) => {
|
||||
return <RoleMenu object={item}/>
|
||||
}}
|
||||
addRemoveButtons={{
|
||||
onAdd: () => AddRoleDialog.open(),
|
||||
addTooltip: <Trans>Create new Role</Trans>,
|
||||
@@ -61,13 +56,3 @@ export class Roles extends React.Component<Props> {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export function RoleMenu(props: KubeObjectMenuProps<Role>) {
|
||||
return (
|
||||
<KubeObjectMenu {...props}/>
|
||||
)
|
||||
}
|
||||
|
||||
apiManager.registerViews([roleApi, clusterRoleApi], {
|
||||
Menu: RoleMenu,
|
||||
});
|
||||
Reference in new issue
Block a user