1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/src/renderer/components/+network-ingresses/ingress-class-details.tsx
Roman 1456e1e597
New resource view: Network -> Ingress Classes (#6808)
* added backbone for k8s-api/endpoints/ingress-class.api

Signed-off-by: Roman <ixrock@gmail.com>

* added ingress-class store, naming clean up

Signed-off-by: Roman <ixrock@gmail.com>

* navigate to ingress-classses injectable

Signed-off-by: Roman <ixrock@gmail.com>

* added new sidebar item: "Network -> Ingress Classes"

Signed-off-by: Roman <ixrock@gmail.com>

* added explicit returning type for `ingresses-sidebar-items.injectable`

Signed-off-by: Roman <ixrock@gmail.com>

* added initial ingress-class table-view + magic route-component.injectable

Signed-off-by: Roman <ixrock@gmail.com>

* fix: show loaded items from api into IngressClasses view

Signed-off-by: Roman <ixrock@gmail.com>

* fix: new bugs after master merging (with conflicts!), looks like breaking change if those apis where exported

Signed-off-by: Roman <ixrock@gmail.com>

* fix lint

Signed-off-by: Roman <ixrock@gmail.com>

* added icon-marker to see default ingress class in the list

Signed-off-by: Roman <ixrock@gmail.com>

* Page refresh is broken in development mode #6818 (upcoming fix)

Signed-off-by: Roman <ixrock@gmail.com>

* added "set as default" menu action for ingress classes

Signed-off-by: Roman <ixrock@gmail.com>

* fix: consistent sidebar items order by janne's request

Signed-off-by: Roman <ixrock@gmail.com>

* chore, fix lint

Signed-off-by: Roman <ixrock@gmail.com>

* fix: incorrect icons layout in ingress-class details

Signed-off-by: Roman <ixrock@gmail.com>

* some fixes, improved items search by values from `spec.parameters.*`

Signed-off-by: Roman <ixrock@gmail.com>

* fix: duplicating/overcaching items with each page visiting (Nnetwork -> Ingress classes)

Signed-off-by: Roman <ixrock@gmail.com>

* handling IngressClass drawer details

Signed-off-by: Roman <ixrock@gmail.com>

* fixes: remove duplicating / allow editing IngressClass items (due api's "namespaced=true")

Signed-off-by: Roman <ixrock@gmail.com>

* fix: incorrect `apiName` for `front-end-routing/cluster/network/ingress-class`

Signed-off-by: Roman <ixrock@gmail.com>

* fix: IngressClass proper metadata typing

Signed-off-by: Roman <ixrock@gmail.com>

* allow to mark as default IngressClass from menu item

Signed-off-by: Roman <ixrock@gmail.com>

* fix lint

Signed-off-by: Roman <ixrock@gmail.com>

* fixes & responding to comments

Signed-off-by: Roman <ixrock@gmail.com>

Signed-off-by: Roman <ixrock@gmail.com>
2023-01-05 13:26:04 -05:00

65 lines
1.9 KiB
TypeScript

/**
* 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 { withInjectables } from "@ogre-tools/injectable-react";
import { DrawerItem, DrawerTitle } from "../drawer";
import type { IngressClass } from "../../../common/k8s-api/endpoints";
import type { KubeObjectDetailsProps } from "../kube-object-details";
import { Badge } from "../badge";
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">
<Badge label={ingressClass.getController()} />
</DrawerItem>
{this.renderParameters()}
</div>
);
}
}
export const IngressClassDetails = withInjectables<{}, IngressClassDetailsProps>(NonInjectedIngressDetails, {
getProps: (di, props) => (props),
});