mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix issues with crd plugins (#243)
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
parent
298636b8f1
commit
4cd616bf65
@ -241,21 +241,21 @@ export class ClusterIssuer extends Issuer {
|
||||
|
||||
export const certificatesApi = new KubeApi({
|
||||
kind: Certificate.kind,
|
||||
apiBase: "/apis/certmanager.k8s.io/v1alpha1/certificates",
|
||||
apiBase: "/apis/cert-manager.io/v1alpha2/certificates",
|
||||
isNamespaced: true,
|
||||
objectConstructor: Certificate,
|
||||
});
|
||||
|
||||
export const issuersApi = new KubeApi({
|
||||
kind: Issuer.kind,
|
||||
apiBase: "/apis/certmanager.k8s.io/v1alpha1/issuers",
|
||||
apiBase: "/apis/cert-manager.io/v1alpha2/issuers",
|
||||
isNamespaced: true,
|
||||
objectConstructor: Issuer,
|
||||
});
|
||||
|
||||
export const clusterIssuersApi = new KubeApi({
|
||||
kind: ClusterIssuer.kind,
|
||||
apiBase: "/apis/certmanager.k8s.io/v1alpha1/clusterissuers",
|
||||
apiBase: "/apis/cert-manager.io/v1alpha2/clusterissuers",
|
||||
isNamespaced: false,
|
||||
objectConstructor: ClusterIssuer,
|
||||
});
|
||||
|
||||
@ -39,24 +39,6 @@ export class Config extends React.Component {
|
||||
url: resourceQuotaURL({ query }),
|
||||
path: resourceQuotaRoute.path,
|
||||
},
|
||||
{
|
||||
title: <Trans>Certificates</Trans>,
|
||||
component: Certificates,
|
||||
url: certificatesURL({ query }),
|
||||
path: certificatesURL(),
|
||||
},
|
||||
{
|
||||
title: <Trans>Issuers</Trans>,
|
||||
component: Issuers,
|
||||
url: issuersURL({ query }),
|
||||
path: issuersURL(),
|
||||
},
|
||||
{
|
||||
title: <Trans>Cluster Issuers</Trans>,
|
||||
component: ClusterIssuers,
|
||||
url: clusterIssuersURL(),
|
||||
path: clusterIssuersURL(),
|
||||
},
|
||||
{
|
||||
title: <Trans>HPA</Trans>,
|
||||
component: HorizontalPodAutoscalers,
|
||||
|
||||
@ -101,5 +101,5 @@ export function CertificateMenu(props: KubeObjectMenuProps<Certificate>) {
|
||||
|
||||
apiManager.registerViews(certificatesApi, {
|
||||
List: Certificates,
|
||||
Menu: CertificateMenu,
|
||||
Menu: CertificateMenu
|
||||
})
|
||||
@ -14,9 +14,6 @@ export class CRDStore extends KubeObjectStore<CustomResourceDefinition> {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
// auto-load crd-s for building sub-menus
|
||||
this.loadAll();
|
||||
|
||||
// auto-init stores for crd-s
|
||||
reaction(() => this.items.toJS(), items => {
|
||||
items.forEach(this.initStore);
|
||||
|
||||
@ -69,7 +69,7 @@ export class KubeObjectDetails extends React.Component {
|
||||
const { kind, getName, selfLink } = object;
|
||||
title = `${kind}: ${getName()}`;
|
||||
apiComponents = apiManager.getViews(selfLink);
|
||||
if (isCrdInstance) {
|
||||
if (isCrdInstance && !apiComponents.Details) {
|
||||
apiComponents.Details = CrdResourceDetails
|
||||
apiComponents.Menu = CrdResourceMenu
|
||||
}
|
||||
|
||||
@ -4,20 +4,13 @@ import * as React from "react";
|
||||
import { observable, reaction } from "mobx";
|
||||
import { disposeOnUnmount, observer } from "mobx-react";
|
||||
import { matchPath, RouteProps } from "react-router-dom";
|
||||
import { Trans } from "@lingui/macro";
|
||||
import { createStorage, cssNames, isElectron } from "../../utils";
|
||||
import { createStorage, cssNames } from "../../utils";
|
||||
import { Tab, Tabs } from "../tabs";
|
||||
import { Icon } from "../icon";
|
||||
import { openUserKubeConfig } from "../kubeconfig-dialog";
|
||||
import { Sidebar } from "./sidebar";
|
||||
import { configStore } from "../../config.store";
|
||||
import { ErrorBoundary } from "../error-boundary";
|
||||
import { Dock } from "../dock";
|
||||
import { MenuItem } from "../menu";
|
||||
import { MenuActions } from "../menu/menu-actions";
|
||||
import { navigate, navigation } from "../../navigation";
|
||||
import { i18nStore } from "../../i18n";
|
||||
import { Badge } from "../badge";
|
||||
import { themeStore } from "../../theme.store";
|
||||
|
||||
export interface TabRoute extends RouteProps {
|
||||
@ -54,9 +47,8 @@ export class MainLayout extends React.Component<Props> {
|
||||
|
||||
render() {
|
||||
const { className, contentClass, headerClass, tabs, footer, footerClass, children } = this.props;
|
||||
const { clusterName, username, lensVersion, kubectlAccess } = configStore.config;
|
||||
const { clusterName } = configStore.config;
|
||||
const { pathname } = navigation.location;
|
||||
const { languages, setLocale, activeLang } = i18nStore;
|
||||
return (
|
||||
<div className={cssNames("MainLayout", className, themeStore.activeTheme.type)}>
|
||||
<header className={cssNames("flex gaps align-center", headerClass)}>
|
||||
|
||||
@ -42,6 +42,10 @@ interface Props {
|
||||
|
||||
@observer
|
||||
export class Sidebar extends React.Component<Props> {
|
||||
async componentDidMount() {
|
||||
if (!crdStore.isLoaded) crdStore.loadAll()
|
||||
}
|
||||
|
||||
renderCustomResources() {
|
||||
return Object.entries(crdStore.groups).map(([group, crds]) => {
|
||||
const submenus = crds.map(crd => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user