mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
* 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>
113 lines
4.0 KiB
TypeScript
113 lines
4.0 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-classes.module.scss";
|
|
|
|
import React from "react";
|
|
import { observer } from "mobx-react";
|
|
import { KubeObjectListLayout } from "../kube-object-list-layout";
|
|
import { SiblingsInTabLayout } from "../layout/siblings-in-tab-layout";
|
|
import { withInjectables } from "@ogre-tools/injectable-react";
|
|
import type { IngressClassStore } from "./ingress-class-store";
|
|
import ingressClassStoreInjectable from "./ingress-class-store.injectable";
|
|
import type { IngressClass } from "../../../common/k8s-api/endpoints/ingress-class.api";
|
|
import { cssNames } from "../../utils";
|
|
import { Icon } from "../icon";
|
|
|
|
enum columnId {
|
|
name = "name",
|
|
namespace = "namespace",
|
|
controller = "controller",
|
|
apiGroup = "apiGroup",
|
|
scope = "scope", // "Namespace" | "Cluster"
|
|
kind = "kind", // "ClusterIngressParameter" | "IngressParameter"
|
|
}
|
|
|
|
interface Dependencies {
|
|
store: IngressClassStore;
|
|
}
|
|
|
|
const NonInjectedIngressClasses = observer((props: Dependencies) => {
|
|
const {
|
|
store,
|
|
} = props;
|
|
|
|
return (
|
|
<SiblingsInTabLayout>
|
|
<KubeObjectListLayout
|
|
isConfigurable
|
|
tableId="network_ingress_classess"
|
|
className={styles.IngressClasses}
|
|
store={store}
|
|
sortingCallbacks={{
|
|
[columnId.name]: (resource: IngressClass) => resource.getCtrlName(),
|
|
[columnId.namespace]: (resource: IngressClass) => resource.getCtrlNs(),
|
|
[columnId.controller]: (resource: IngressClass) => resource.getController(),
|
|
[columnId.apiGroup]: (resource: IngressClass) => resource.getCtrlApiGroup(),
|
|
[columnId.scope]: (resource: IngressClass) => resource.getCtrlScope(),
|
|
[columnId.kind]: (resource: IngressClass) => resource.getCtrlKind(),
|
|
}}
|
|
searchFilters={[
|
|
(resource: IngressClass) => resource.getSearchFields(),
|
|
(resource: IngressClass) => resource.getController(),
|
|
(resource: IngressClass) => resource.getCtrlApiGroup(),
|
|
(resource: IngressClass) => resource.getCtrlScope(),
|
|
(resource: IngressClass) => resource.getCtrlKind(),
|
|
]}
|
|
renderHeaderTitle="Ingress Classes"
|
|
renderTableHeader={[
|
|
{ title: "Name", className: styles.name, sortBy: columnId.name, id: columnId.name },
|
|
{
|
|
title: "Namespace",
|
|
className: styles.namespace,
|
|
sortBy: columnId.namespace,
|
|
id: columnId.namespace,
|
|
},
|
|
{
|
|
title: "Controller",
|
|
className: styles.controller,
|
|
sortBy: columnId.controller,
|
|
id: columnId.controller,
|
|
},
|
|
{
|
|
title: "API Group",
|
|
className: styles.apiGroup,
|
|
sortBy: columnId.apiGroup,
|
|
id: columnId.apiGroup,
|
|
},
|
|
{ title: "Scope", className: styles.scope, sortBy: columnId.scope, id: columnId.scope },
|
|
{ title: "Kind", className: styles.kind, sortBy: columnId.kind, id: columnId.kind },
|
|
]}
|
|
renderTableContents={(ingressClass: IngressClass) => [
|
|
<div key={ingressClass.getId()} className={cssNames(styles.name)}>
|
|
{ingressClass.getName()}
|
|
{" "}
|
|
{ingressClass.isDefault && (
|
|
<Icon
|
|
small
|
|
material="star"
|
|
tooltip="Is default class for ingresses (when not specified)"
|
|
className={styles.set_default_icon}
|
|
/>
|
|
)}
|
|
</div>,
|
|
ingressClass.getCtrlNs(),
|
|
ingressClass.getController(),
|
|
ingressClass.getCtrlApiGroup(),
|
|
ingressClass.getCtrlScope(),
|
|
ingressClass.getCtrlKind(),
|
|
]}
|
|
/>
|
|
</SiblingsInTabLayout>
|
|
);
|
|
});
|
|
|
|
export const IngressClasses = withInjectables<Dependencies>(NonInjectedIngressClasses, {
|
|
getProps: (di, props) => ({
|
|
...props,
|
|
store: di.inject(ingressClassStoreInjectable),
|
|
}),
|
|
});
|