mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
handling IngressClass drawer details
Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
parent
bd1b559e93
commit
ab0c9cc760
@ -18,6 +18,7 @@ export * from "./endpoint.api";
|
|||||||
export * from "./events.api";
|
export * from "./events.api";
|
||||||
export * from "./horizontal-pod-autoscaler.api";
|
export * from "./horizontal-pod-autoscaler.api";
|
||||||
export * from "./ingress.api";
|
export * from "./ingress.api";
|
||||||
|
export * from "./ingress-class.api";
|
||||||
export * from "./job.api";
|
export * from "./job.api";
|
||||||
export * from "./lease.api";
|
export * from "./lease.api";
|
||||||
export * from "./limit-range.api";
|
export * from "./limit-range.api";
|
||||||
|
|||||||
@ -51,7 +51,7 @@ export class IngressClass extends KubeObject<IngressClassMetadata, IngressClassS
|
|||||||
static readonly namespaced = true;
|
static readonly namespaced = true;
|
||||||
static readonly apiBase = "/apis/networking.k8s.io/v1/ingressclasses";
|
static readonly apiBase = "/apis/networking.k8s.io/v1/ingressclasses";
|
||||||
|
|
||||||
getIngressCtrl(): string {
|
getController(): string {
|
||||||
return this.spec.controller;
|
return this.spec.controller;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,3 +6,4 @@
|
|||||||
export * from "./ingresses";
|
export * from "./ingresses";
|
||||||
export * from "./ingress-details";
|
export * from "./ingress-details";
|
||||||
export * from "./ingress-classes";
|
export * from "./ingress-classes";
|
||||||
|
export * from "./ingress-class-details";
|
||||||
|
|||||||
@ -0,0 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.IngressClassDetails {
|
||||||
|
--titles-color: var(--textColorSecondary);
|
||||||
|
}
|
||||||
@ -0,0 +1,63 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import styles from "./ingress-class-details.module.scss";
|
||||||
|
|
||||||
|
import React from "react";
|
||||||
|
import { observer } from "mobx-react";
|
||||||
|
import { DrawerItem, DrawerTitle } from "../drawer";
|
||||||
|
import type { IngressClass } from "../../../common/k8s-api/endpoints";
|
||||||
|
import type { KubeObjectDetailsProps } from "../kube-object-details";
|
||||||
|
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||||
|
|
||||||
|
export interface IngressClassDetailsProps extends KubeObjectDetailsProps<IngressClass> {
|
||||||
|
}
|
||||||
|
|
||||||
|
@observer
|
||||||
|
class NonInjectedIngressDetails extends React.Component<IngressClassDetailsProps> {
|
||||||
|
renderParameters() {
|
||||||
|
const { object: ingressClass } = this.props;
|
||||||
|
|
||||||
|
if (!ingressClass.spec.parameters) return;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<DrawerTitle>Parameters</DrawerTitle>
|
||||||
|
<DrawerItem name="Name">
|
||||||
|
{ingressClass.getCtrlName()}
|
||||||
|
</DrawerItem>
|
||||||
|
<DrawerItem name="Namespace">
|
||||||
|
{ingressClass.getCtrlNs()}
|
||||||
|
</DrawerItem>
|
||||||
|
<DrawerItem name="Scope">
|
||||||
|
{ingressClass.getCtrlScope()}
|
||||||
|
</DrawerItem>
|
||||||
|
<DrawerItem name="Kind">
|
||||||
|
{ingressClass.getCtrlKind()}
|
||||||
|
</DrawerItem>
|
||||||
|
<DrawerItem name="API Group">
|
||||||
|
{ingressClass.getCtrlApiGroup()}
|
||||||
|
</DrawerItem>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { object: ingressClass } = this.props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={styles.IngressClassDetails}>
|
||||||
|
<DrawerItem name="Controller">
|
||||||
|
{ingressClass.getController()}
|
||||||
|
</DrawerItem>
|
||||||
|
{this.renderParameters()}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const IngressClassDetails = withInjectables<{}, IngressClassDetailsProps>(NonInjectedIngressDetails, {
|
||||||
|
getProps: (di, props) => (props),
|
||||||
|
});
|
||||||
@ -3,7 +3,7 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import assert from "assert";
|
import assert from "assert";
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import {
|
import {
|
||||||
kubeObjectStoreInjectionToken,
|
kubeObjectStoreInjectionToken,
|
||||||
} from "../../../common/k8s-api/api-manager/manager.injectable";
|
} from "../../../common/k8s-api/api-manager/manager.injectable";
|
||||||
@ -28,7 +28,6 @@ const ingressClassStoreInjectable = getInjectable({
|
|||||||
},
|
},
|
||||||
|
|
||||||
injectionToken: kubeObjectStoreInjectionToken,
|
injectionToken: kubeObjectStoreInjectionToken,
|
||||||
lifecycle: lifecycleEnum.transient,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default ingressClassStoreInjectable;
|
export default ingressClassStoreInjectable;
|
||||||
|
|||||||
@ -15,7 +15,6 @@ import ingressClassStoreInjectable from "./ingress-class-store.injectable";
|
|||||||
import type { IngressClass } from "../../../common/k8s-api/endpoints/ingress-class.api";
|
import type { IngressClass } from "../../../common/k8s-api/endpoints/ingress-class.api";
|
||||||
import { cssNames } from "../../utils";
|
import { cssNames } from "../../utils";
|
||||||
import { Icon } from "../icon";
|
import { Icon } from "../icon";
|
||||||
import { Badge } from "../badge";
|
|
||||||
|
|
||||||
enum columnId {
|
enum columnId {
|
||||||
name = "name",
|
name = "name",
|
||||||
@ -45,14 +44,14 @@ const NonInjectedIngressClasses = observer((props: Dependencies) => {
|
|||||||
sortingCallbacks={{
|
sortingCallbacks={{
|
||||||
[columnId.name]: (resource: IngressClass) => resource.getCtrlName(),
|
[columnId.name]: (resource: IngressClass) => resource.getCtrlName(),
|
||||||
[columnId.namespace]: (resource: IngressClass) => resource.getCtrlNs(),
|
[columnId.namespace]: (resource: IngressClass) => resource.getCtrlNs(),
|
||||||
[columnId.controller]: (resource: IngressClass) => resource.getIngressCtrl(),
|
[columnId.controller]: (resource: IngressClass) => resource.getController(),
|
||||||
[columnId.apiGroup]: (resource: IngressClass) => resource.getCtrlApiGroup(),
|
[columnId.apiGroup]: (resource: IngressClass) => resource.getCtrlApiGroup(),
|
||||||
[columnId.scope]: (resource: IngressClass) => resource.getCtrlScope(),
|
[columnId.scope]: (resource: IngressClass) => resource.getCtrlScope(),
|
||||||
[columnId.kind]: (resource: IngressClass) => resource.getCtrlKind(),
|
[columnId.kind]: (resource: IngressClass) => resource.getCtrlKind(),
|
||||||
}}
|
}}
|
||||||
searchFilters={[
|
searchFilters={[
|
||||||
(resource: IngressClass) => resource.getSearchFields(),
|
(resource: IngressClass) => resource.getSearchFields(),
|
||||||
(resource: IngressClass) => resource.getIngressCtrl(),
|
(resource: IngressClass) => resource.getController(),
|
||||||
(resource: IngressClass) => resource.getCtrlApiGroup(),
|
(resource: IngressClass) => resource.getCtrlApiGroup(),
|
||||||
(resource: IngressClass) => resource.getCtrlScope(),
|
(resource: IngressClass) => resource.getCtrlScope(),
|
||||||
(resource: IngressClass) => resource.getCtrlKind(),
|
(resource: IngressClass) => resource.getCtrlKind(),
|
||||||
@ -95,7 +94,7 @@ const NonInjectedIngressClasses = observer((props: Dependencies) => {
|
|||||||
)}
|
)}
|
||||||
</div>,
|
</div>,
|
||||||
ingressClass.getCtrlNs(),
|
ingressClass.getCtrlNs(),
|
||||||
<Badge label={ingressClass.getIngressCtrl()} tooltip={ingressClass.getIngressCtrl()} />,
|
ingressClass.getController(),
|
||||||
ingressClass.getCtrlApiGroup(),
|
ingressClass.getCtrlApiGroup(),
|
||||||
ingressClass.getCtrlScope(),
|
ingressClass.getCtrlScope(),
|
||||||
ingressClass.getCtrlKind(),
|
ingressClass.getCtrlKind(),
|
||||||
|
|||||||
@ -0,0 +1,33 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
|
*/
|
||||||
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
|
import { kubeObjectDetailItemInjectionToken } from "../kube-object-detail-item-injection-token";
|
||||||
|
import { computed } from "mobx";
|
||||||
|
import { IngressClassDetails } from "../../../+network-ingresses";
|
||||||
|
import { kubeObjectMatchesToKindAndApiVersion } from "../kube-object-matches-to-kind-and-api-version";
|
||||||
|
import currentKubeObjectInDetailsInjectable from "../../current-kube-object-in-details.injectable";
|
||||||
|
|
||||||
|
const ingressClassDetailItemInjectable = getInjectable({
|
||||||
|
id: "ingress-class-detail-item",
|
||||||
|
|
||||||
|
instantiate: (di) => {
|
||||||
|
const kubeObject = di.inject(currentKubeObjectInDetailsInjectable);
|
||||||
|
|
||||||
|
return {
|
||||||
|
Component: IngressClassDetails,
|
||||||
|
enabled: computed(() => isIngressClass(kubeObject.value.get()?.object)),
|
||||||
|
orderNumber: 10,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
injectionToken: kubeObjectDetailItemInjectionToken,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const isIngressClass = kubeObjectMatchesToKindAndApiVersion("IngressClass", [
|
||||||
|
"networking.k8s.io/v1",
|
||||||
|
"extensions/v1beta1",
|
||||||
|
]);
|
||||||
|
|
||||||
|
export default ingressClassDetailItemInjectable;
|
||||||
Loading…
Reference in New Issue
Block a user