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

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

Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
Roman 2022-12-27 13:13:38 +02:00
parent 4c44b76f24
commit 5f843259dd
9 changed files with 36 additions and 30 deletions

View File

@ -2,6 +2,5 @@
<profile version="1.0"> <profile version="1.0">
<option name="myName" value="Project Default" /> <option name="myName" value="Project Default" />
<inspection_tool class="ES6PreferShortImport" enabled="true" level="INFORMATION" enabled_by_default="true" /> <inspection_tool class="ES6PreferShortImport" enabled="true" level="INFORMATION" enabled_by_default="true" />
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
</profile> </profile>
</component> </component>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EslintConfiguration">
<option name="fix-on-save" value="true" />
</component>
</project>

View File

@ -3,19 +3,24 @@
* 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 { getInjectable } from "@ogre-tools/injectable"; import { getInjectable } from "@ogre-tools/injectable";
import isAllowedResourceInjectable from "../../../../../utils/is-allowed-resource.injectable";
import { frontEndRouteInjectionToken } from "../../../../front-end-route-injection-token"; import { frontEndRouteInjectionToken } from "../../../../front-end-route-injection-token";
import {
shouldShowResourceInjectionToken,
} from "../../../../../cluster-store/allowed-resources-injection-token";
const ingressClassesesRouteInjectable = getInjectable({ const ingressClassesesRouteInjectable = getInjectable({
id: "ingress-classes-route", id: "ingress-classes-route",
instantiate: (di) => { instantiate: (di) => {
const isAllowedResource = di.inject(isAllowedResourceInjectable, "ingressclasses"); const isEnabled = di.inject(shouldShowResourceInjectionToken, {
apiName: "ingresses",
group: "networking.k8s.io",
});
return { return {
path: "/ingress-classes", path: "/ingress-classes",
clusterFrame: true, clusterFrame: true,
isEnabled: isAllowedResource, isEnabled,
}; };
}, },

View File

@ -3,7 +3,8 @@
* 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 { KubeObject, KubeObjectMetadata, KubeObjectScope } from "../kube-object"; import type { KubeObjectMetadata, KubeObjectScope } from "../kube-object";
import { KubeObject } from "../kube-object";
import { KubeApi } from "../kube-api"; import { KubeApi } from "../kube-api";
export class IngressClassApi extends KubeApi<IngressClass> { export class IngressClassApi extends KubeApi<IngressClass> {
@ -19,25 +20,25 @@ export type IngressClassMetadata = KubeObjectMetadata<KubeObjectScope.Namespace>
"name": string; "name": string;
"labels"?: { "labels"?: {
[name: string]: string | undefined; [name: string]: string | undefined;
"app.kubernetes.io/component"?: "controller" "app.kubernetes.io/component"?: "controller";
} };
"annotations"?: { "annotations"?: {
[name: string]: string | undefined; [name: string]: string | undefined;
"ingressclass.kubernetes.io/is-default-class"?: "true", "ingressclass.kubernetes.io/is-default-class"?: "true";
} };
}; };
export interface IngressClassParametersReference { export interface IngressClassParametersReference {
"apiGroup": string; // k8s.example.net "apiGroup": string; // k8s.example.net
"scope": "Namespace" | "Cluster" "scope": "Namespace" | "Cluster";
"kind": "ClusterIngressParameter" | "IngressParameter" "kind": "ClusterIngressParameter" | "IngressParameter";
"name": string; // external-config-1 "name": string; // external-config-1
"namespace"?: string; // namespaced for IngressClass must be defined in `spec.parameters.namespace` instead of `metadata.namespace` (!) "namespace"?: string; // namespaced for IngressClass must be defined in `spec.parameters.namespace` instead of `metadata.namespace` (!)
} }
export interface IngressClassSpec { export interface IngressClassSpec {
controller: string; // example.com/ingress-controller controller: string; // example.com/ingress-controller
parameters?: IngressClassParametersReference, parameters?: IngressClassParametersReference;
} }
export interface IngressClassStatus { export interface IngressClassStatus {

View File

@ -5,7 +5,7 @@
export type KubeResource = export type KubeResource =
"namespaces" | "nodes" | "events" | "resourcequotas" | "services" | "limitranges" | "leases" | "namespaces" | "nodes" | "events" | "resourcequotas" | "services" | "limitranges" | "leases" |
"secrets" | "configmaps" | "ingresses" | "networkpolicies" | "persistentvolumeclaims" | "persistentvolumes" | "storageclasses" | "secrets" | "configmaps" | "ingresses" | "ingressclasses" | "networkpolicies" | "persistentvolumeclaims" | "persistentvolumes" | "storageclasses" |
"pods" | "daemonsets" | "deployments" | "statefulsets" | "replicasets" | "jobs" | "cronjobs" | "pods" | "daemonsets" | "deployments" | "statefulsets" | "replicasets" | "jobs" | "cronjobs" |
"endpoints" | "customresourcedefinitions" | "horizontalpodautoscalers" | "podsecuritypolicies" | "poddisruptionbudgets" | "endpoints" | "customresourcedefinitions" | "horizontalpodautoscalers" | "podsecuritypolicies" | "poddisruptionbudgets" |
"priorityclasses" | "runtimeclasses" | "priorityclasses" | "runtimeclasses" |
@ -91,7 +91,7 @@ export const apiResourceRecord: Record<KubeResource, KubeApiResourceData> = {
kind: "IngressClass", kind: "IngressClass",
group: "networking.k8s.io", group: "networking.k8s.io",
namespaced: true, namespaced: true,
} },
jobs: { jobs: {
kind: "Job", kind: "Job",
group: "batch", group: "batch",

View File

@ -4,7 +4,7 @@
*/ */
import { getInjectable } from "@ogre-tools/injectable"; import { getInjectable } from "@ogre-tools/injectable";
import { import {
routeSpecificComponentInjectionToken routeSpecificComponentInjectionToken,
} from "../../routes/route-specific-component-injection-token"; } from "../../routes/route-specific-component-injection-token";
import ingressClassesesRouteInjectable import ingressClassesesRouteInjectable
from "../../../common/front-end-routing/routes/cluster/network/ingress-class/ingress-classeses-route.injectable"; from "../../../common/front-end-routing/routes/cluster/network/ingress-class/ingress-classeses-route.injectable";

View File

@ -4,18 +4,23 @@
*/ */
import { getInjectable } 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";
import ingressClassApiInjectable import ingressClassApiInjectable
from "../../../common/k8s-api/endpoints/ingress-class.api.injectable"; from "../../../common/k8s-api/endpoints/ingress-class.api.injectable";
import { IngressClassStore } from "./ingress-class-store"; import { IngressClassStore } from "./ingress-class-store";
import clusterFrameContextForNamespacedResourcesInjectable
from "../../cluster-frame-context/for-namespaced-resources.injectable";
const ingressClassStoreInjectable = getInjectable({ const ingressClassStoreInjectable = getInjectable({
id: "ingress-class-store", id: "ingress-class-store",
instantiate: (di) => { instantiate: (di) => {
return new IngressClassStore( const api = di.inject(ingressClassApiInjectable);
di.inject(ingressClassApiInjectable),
); return new IngressClassStore({
context: di.inject(clusterFrameContextForNamespacedResourcesInjectable),
}, api);
}, },
injectionToken: kubeObjectStoreInjectionToken, injectionToken: kubeObjectStoreInjectionToken,
}); });

View File

@ -71,8 +71,8 @@ const NonInjectedIngressClasses = observer((props: Dependencies) => {
sortBy: columnId.apiGroup, sortBy: columnId.apiGroup,
id: columnId.apiGroup, id: columnId.apiGroup,
}, },
{ title: "Scope", className: styles.scope, sortBy: columnId.scope, id: columnId.scope, }, { title: "Scope", className: styles.scope, sortBy: columnId.scope, id: columnId.scope },
{ 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 // TODO: add "is-default" icon/marker + some actions how to "set as default" for each IngressClass

View File

@ -3,12 +3,14 @@
* 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 { getInjectable } from "@ogre-tools/injectable"; import { getInjectable } from "@ogre-tools/injectable";
import { computed, IComputedValue } from "mobx"; import type { IComputedValue } from "mobx";
import { computed } from "mobx";
import ingressesRouteInjectable import ingressesRouteInjectable
from "../../../common/front-end-routing/routes/cluster/network/ingresses/ingresses-route.injectable"; from "../../../common/front-end-routing/routes/cluster/network/ingresses/ingresses-route.injectable";
import type {
SidebarItemRegistration } from "../layout/sidebar-items.injectable";
import { import {
SidebarItemRegistration, sidebarItemsInjectionToken,
sidebarItemsInjectionToken
} from "../layout/sidebar-items.injectable"; } from "../layout/sidebar-items.injectable";
import { networkSidebarItemId } from "../+network/network-sidebar-items.injectable"; import { networkSidebarItemId } from "../+network/network-sidebar-items.injectable";
import routeIsActiveInjectable from "../../routes/route-is-active.injectable"; import routeIsActiveInjectable from "../../routes/route-is-active.injectable";