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
@@ -3,7 +3,7 @@ import "./role-binding-details.scss"
|
||||
import React from "react";
|
||||
import { t, Trans } from "@lingui/macro";
|
||||
import { AddRemoveButtons } from "../add-remove-buttons";
|
||||
import { clusterRoleBindingApi, IRoleBindingSubject, RoleBinding, roleBindingApi } from "../../api/endpoints";
|
||||
import { IRoleBindingSubject, RoleBinding } from "../../api/endpoints";
|
||||
import { autobind, prevDefault } from "../../utils";
|
||||
import { Table, TableCell, TableHead, TableRow } from "../table";
|
||||
import { ConfirmDialog } from "../confirm-dialog";
|
||||
@@ -15,8 +15,8 @@ import { roleBindingsStore } from "./role-bindings.store";
|
||||
import { AddRoleBindingDialog } from "./add-role-binding-dialog";
|
||||
import { KubeObjectDetailsProps } from "../kube-object";
|
||||
import { _i18n } from "../../i18n";
|
||||
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<RoleBinding> {
|
||||
}
|
||||
@@ -125,6 +125,17 @@ export class RoleBindingDetails extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
apiManager.registerViews([roleBindingApi, clusterRoleBindingApi], {
|
||||
Details: RoleBindingDetails,
|
||||
});
|
||||
kubeObjectDetailRegistry.add({
|
||||
kind: "RoleBinding",
|
||||
apiVersions: ["rbac.authorization.k8s.io/v1"],
|
||||
components: {
|
||||
Details: (props) => <RoleBindingDetails {...props} />
|
||||
}
|
||||
})
|
||||
kubeObjectDetailRegistry.add({
|
||||
kind: "ClusterRoleBinding",
|
||||
apiVersions: ["rbac.authorization.k8s.io/v1"],
|
||||
components: {
|
||||
Details: (props) => <RoleBindingDetails {...props} />
|
||||
}
|
||||
})
|
||||
@@ -54,9 +54,6 @@ export class RoleBindings extends React.Component<Props> {
|
||||
binding.getNs() || "-",
|
||||
binding.getAge(),
|
||||
]}
|
||||
renderItemMenu={(item: RoleBinding) => {
|
||||
return <RoleBindingMenu object={item}/>
|
||||
}}
|
||||
addRemoveButtons={{
|
||||
onAdd: () => AddRoleBindingDialog.open(),
|
||||
addTooltip: <Trans>Create new RoleBinding</Trans>,
|
||||
@@ -65,13 +62,3 @@ export class RoleBindings extends React.Component<Props> {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export function RoleBindingMenu(props: KubeObjectMenuProps<RoleBinding>) {
|
||||
return (
|
||||
<KubeObjectMenu {...props}/>
|
||||
)
|
||||
}
|
||||
|
||||
apiManager.registerViews([roleBindingApi, clusterRoleBindingApi], {
|
||||
Menu: RoleBindingMenu,
|
||||
})
|
||||
Reference in new issue
Block a user