1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

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

Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
Roman 2022-12-27 14:40:18 +02:00
parent 3845c7bc67
commit fffdc62ccb
3 changed files with 49 additions and 2 deletions

View File

@ -0,0 +1,19 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
import type { IngressClass } from "../../../common/k8s-api/endpoints/ingress-class.api";
// TODO: figure out if this needs to be injectable
export const ingressClassSetDefaultInjectable = getInjectable({
id: "ingressClassSetDefaultInjectable",
instantiate() {
return (item: IngressClass) => {
console.log("TODO: implement set-default ingress-class api call(s)", item);
};
},
lifecycle: lifecycleEnum.singleton,
});

View File

@ -29,4 +29,15 @@
&.kind { &.kind {
} }
} }
:global(.Icon) {
&.set_default_icon {
filter: brightness(.75);
&:hover {
filter: brightness(1.5);
}
}
}
} }

View File

@ -13,6 +13,9 @@ import { withInjectables } from "@ogre-tools/injectable-react";
import type { IngressClassStore } from "./ingress-class-store"; import type { IngressClassStore } from "./ingress-class-store";
import ingressClassStoreInjectable from "./ingress-class-store.injectable"; 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 { Icon } from "../icon";
import { cssNames } from "../../utils";
import { KubeObjectMenu } from "../kube-object-menu";
enum columnId { enum columnId {
name = "name", name = "name",
@ -75,14 +78,28 @@ const NonInjectedIngressClasses = observer((props: Dependencies) => {
{ title: "Kind", className: styles.kind, sortBy: columnId.kind, id: columnId.kind }, { title: "Kind", className: styles.kind, sortBy: columnId.kind, id: columnId.kind },
]} ]}
renderTableContents={(ingressClass: IngressClass) => [ renderTableContents={(ingressClass: IngressClass) => [
// TODO: add "is-default" icon/marker + some actions how to "set as default" for each IngressClass <div key={ingressClass.getId()} className={cssNames(styles.name)}>
ingressClass.getName(), {ingressClass.getName()}
{" "}
{ingressClass.isDefault && (
<Icon
small
material="star"
tooltip="Is default class for ingresses (when not specified)"
className={styles.set_default_icon}
/>
)}
</div>,
ingressClass.getController(), ingressClass.getController(),
ingressClass.getNs(), ingressClass.getNs(),
ingressClass.getApiGroup(), ingressClass.getApiGroup(),
ingressClass.getScope(), ingressClass.getScope(),
ingressClass.getKind(), ingressClass.getKind(),
]} ]}
renderItemMenu={item => (
// TODO: customize menu + add set-default.injectable.ts item (?)
<KubeObjectMenu object={item} />
)}
/> />
</SiblingsInTabLayout> </SiblingsInTabLayout>
); );