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
+9
-5
@@ -9,13 +9,13 @@ import { DrawerItem, DrawerTitle } from "../drawer";
|
||||
import { disposeOnUnmount, observer } from "mobx-react";
|
||||
import { secretsStore } from "../+config-secrets/secrets.store";
|
||||
import { Link } from "react-router-dom";
|
||||
import { Secret, ServiceAccount, serviceAccountsApi } from "../../api/endpoints";
|
||||
import { Secret, ServiceAccount } from "../../api/endpoints";
|
||||
import { KubeEventDetails } from "../+events/kube-event-details";
|
||||
import { getDetailsUrl } from "../../navigation";
|
||||
import { KubeObjectDetailsProps } from "../kube-object";
|
||||
import { apiManager } from "../../api/api-manager";
|
||||
import { KubeObjectMeta } from "../kube-object/kube-object-meta";
|
||||
import { Icon } from "../icon";
|
||||
import { kubeObjectDetailRegistry } from "../../api/kube-object-detail-registry";
|
||||
|
||||
interface Props extends KubeObjectDetailsProps<ServiceAccount> {
|
||||
}
|
||||
@@ -132,6 +132,10 @@ export class ServiceAccountsDetails extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
apiManager.registerViews(serviceAccountsApi, {
|
||||
Details: ServiceAccountsDetails
|
||||
})
|
||||
kubeObjectDetailRegistry.add({
|
||||
kind: "ServiceAccount",
|
||||
apiVersions: ["v1"],
|
||||
components: {
|
||||
Details: (props) => <ServiceAccountsDetails {...props} />
|
||||
}
|
||||
})
|
||||
@@ -13,7 +13,7 @@ import { KubeObjectListLayout } from "../kube-object";
|
||||
import { IServiceAccountsRouteParams } from "../+user-management";
|
||||
import { serviceAccountsStore } from "./service-accounts.store";
|
||||
import { CreateServiceAccountDialog } from "./create-service-account-dialog";
|
||||
import { apiManager } from "../../api/api-manager";
|
||||
import { kubeObjectMenuRegistry } from "../../api/kube-object-menu-registry";
|
||||
|
||||
enum sortBy {
|
||||
name = "name",
|
||||
@@ -64,18 +64,20 @@ export class ServiceAccounts extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
export function ServiceAccountMenu(props: KubeObjectMenuProps<ServiceAccount>) {
|
||||
function ServiceAccountMenu(props: KubeObjectMenuProps<ServiceAccount>) {
|
||||
const { object, toolbar } = props;
|
||||
return (
|
||||
<KubeObjectMenu {...props}>
|
||||
<MenuItem onClick={() => openServiceAccountKubeConfig(object)}>
|
||||
<Icon material="insert_drive_file" title="Kubeconfig File" interactive={toolbar}/>
|
||||
<span className="title"><Trans>Kubeconfig</Trans></span>
|
||||
</MenuItem>
|
||||
</KubeObjectMenu>
|
||||
<MenuItem onClick={() => openServiceAccountKubeConfig(object)}>
|
||||
<Icon material="insert_drive_file" title="Kubeconfig File" interactive={toolbar}/>
|
||||
<span className="title"><Trans>Kubeconfig</Trans></span>
|
||||
</MenuItem>
|
||||
)
|
||||
}
|
||||
|
||||
apiManager.registerViews(serviceAccountsApi, {
|
||||
Menu: ServiceAccountMenu,
|
||||
kubeObjectMenuRegistry.add({
|
||||
kind: "ServiceAccount",
|
||||
apiVersions: ["v1"],
|
||||
components: {
|
||||
MenuItem: ServiceAccountMenu
|
||||
}
|
||||
})
|
||||
Reference in new issue
Block a user