mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
convert all KubeApis to injectable with legacy global backups
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
56e5c601a8
commit
1031d754f6
19
src/common/k8s-api/endpoints/cluster.api.injectable.ts
Normal file
19
src/common/k8s-api/endpoints/cluster.api.injectable.ts
Normal 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 } from "@ogre-tools/injectable";
|
||||||
|
import assert from "assert";
|
||||||
|
import { createStoresAndApisInjectionToken } from "../create-stores-apis.token";
|
||||||
|
import { ClusterApi } from "./cluster.api";
|
||||||
|
|
||||||
|
const clusterApiInjectable = getInjectable({
|
||||||
|
id: "cluster-api",
|
||||||
|
instantiate: (di) => {
|
||||||
|
assert(di.inject(createStoresAndApisInjectionToken), "clusterApi is only available in certain environments");
|
||||||
|
|
||||||
|
return new ClusterApi();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default clusterApiInjectable;
|
||||||
@ -6,12 +6,19 @@
|
|||||||
import type { MetricData, IMetricsReqParams } from "./metrics.api";
|
import type { MetricData, IMetricsReqParams } from "./metrics.api";
|
||||||
import { metricsApi } from "./metrics.api";
|
import { metricsApi } from "./metrics.api";
|
||||||
import { KubeObject } from "../kube-object";
|
import { KubeObject } from "../kube-object";
|
||||||
|
import type { DerivedKubeApiOptions, IgnoredKubeApiOptions } from "../kube-api";
|
||||||
import { KubeApi } from "../kube-api";
|
import { KubeApi } from "../kube-api";
|
||||||
import { isClusterPageContext } from "../../utils/cluster-id-url-parsing";
|
|
||||||
|
|
||||||
export class ClusterApi extends KubeApi<Cluster> {
|
export class ClusterApi extends KubeApi<Cluster> {
|
||||||
static kind = "Cluster";
|
static kind = "Cluster";
|
||||||
static namespaced = true;
|
static namespaced = true;
|
||||||
|
|
||||||
|
constructor(opts: DerivedKubeApiOptions & IgnoredKubeApiOptions = {}) {
|
||||||
|
super({
|
||||||
|
...opts,
|
||||||
|
objectConstructor: Cluster,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getMetricsByNodeNames(nodeNames: string[], params?: IMetricsReqParams): Promise<ClusterMetricData> {
|
export function getMetricsByNodeNames(nodeNames: string[], params?: IMetricsReqParams): Promise<ClusterMetricData> {
|
||||||
@ -106,18 +113,3 @@ export class Cluster extends KubeObject {
|
|||||||
return ClusterStatus.ACTIVE;
|
return ClusterStatus.ACTIVE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Only available within kubernetes cluster pages
|
|
||||||
*/
|
|
||||||
let clusterApi: ClusterApi;
|
|
||||||
|
|
||||||
if (isClusterPageContext()) { // initialize automatically only when within a cluster iframe/context
|
|
||||||
clusterApi = new ClusterApi({
|
|
||||||
objectConstructor: Cluster,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export {
|
|
||||||
clusterApi,
|
|
||||||
};
|
|
||||||
|
|||||||
@ -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 } from "@ogre-tools/injectable";
|
||||||
|
import assert from "assert";
|
||||||
|
import { createStoresAndApisInjectionToken } from "../create-stores-apis.token";
|
||||||
|
import { ComponentStatusApi } from "./component-status.api";
|
||||||
|
|
||||||
|
const componentStatusApiInjectable = getInjectable({
|
||||||
|
id: "component-status-api",
|
||||||
|
instantiate: (di) => {
|
||||||
|
assert(di.inject(createStoresAndApisInjectionToken), "componentStatusApi is only available in certain environments");
|
||||||
|
|
||||||
|
return new ComponentStatusApi();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default componentStatusApiInjectable;
|
||||||
@ -4,16 +4,17 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { KubeObject } from "../kube-object";
|
import { KubeObject } from "../kube-object";
|
||||||
|
import type { DerivedKubeApiOptions } from "../kube-api";
|
||||||
import { KubeApi } from "../kube-api";
|
import { KubeApi } from "../kube-api";
|
||||||
|
|
||||||
export interface IComponentStatusCondition {
|
export interface ComponentStatusCondition {
|
||||||
type: string;
|
type: string;
|
||||||
status: string;
|
status: string;
|
||||||
message: string;
|
message: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ComponentStatus {
|
export interface ComponentStatus {
|
||||||
conditions: IComponentStatusCondition[];
|
conditions: ComponentStatusCondition[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ComponentStatus extends KubeObject {
|
export class ComponentStatus extends KubeObject {
|
||||||
@ -26,6 +27,11 @@ export class ComponentStatus extends KubeObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const componentStatusApi = new KubeApi({
|
export class ComponentStatusApi extends KubeApi<ComponentStatus> {
|
||||||
objectConstructor: ComponentStatus,
|
constructor(opts: DerivedKubeApiOptions = {}) {
|
||||||
});
|
super({
|
||||||
|
...opts,
|
||||||
|
objectConstructor: ComponentStatus,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
19
src/common/k8s-api/endpoints/config-map.api.injectable.ts
Normal file
19
src/common/k8s-api/endpoints/config-map.api.injectable.ts
Normal 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 } from "@ogre-tools/injectable";
|
||||||
|
import assert from "assert";
|
||||||
|
import { ConfigMapApi } from ".";
|
||||||
|
import { createStoresAndApisInjectionToken } from "../create-stores-apis.token";
|
||||||
|
|
||||||
|
const configMapApiInjectable = getInjectable({
|
||||||
|
id: "config-map-api",
|
||||||
|
instantiate: (di) => {
|
||||||
|
assert(di.inject(createStoresAndApisInjectionToken), "configMapApi is only available in certain environments");
|
||||||
|
|
||||||
|
return new ConfigMapApi();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default configMapApiInjectable;
|
||||||
@ -9,7 +9,6 @@ import type { KubeJsonApiData } from "../kube-json-api";
|
|||||||
import type { DerivedKubeApiOptions } from "../kube-api";
|
import type { DerivedKubeApiOptions } from "../kube-api";
|
||||||
import { KubeApi } from "../kube-api";
|
import { KubeApi } from "../kube-api";
|
||||||
import { autoBind } from "../../utils";
|
import { autoBind } from "../../utils";
|
||||||
import { isClusterPageContext } from "../../utils/cluster-id-url-parsing";
|
|
||||||
|
|
||||||
export interface ConfigMapData extends KubeJsonApiData<KubeObjectMetadata<KubeObjectScope.Namespace>, void, void> {
|
export interface ConfigMapData extends KubeJsonApiData<KubeObjectMetadata<KubeObjectScope.Namespace>, void, void> {
|
||||||
data?: Partial<Record<string, string>>;
|
data?: Partial<Record<string, string>>;
|
||||||
@ -48,7 +47,3 @@ export class ConfigMapApi extends KubeApi<ConfigMap, ConfigMapData> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const configMapApi = isClusterPageContext()
|
|
||||||
? new ConfigMapApi()
|
|
||||||
: undefined as never;
|
|
||||||
@ -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 } from "@ogre-tools/injectable";
|
||||||
|
import assert from "assert";
|
||||||
|
import { createStoresAndApisInjectionToken } from "../create-stores-apis.token";
|
||||||
|
import { CustomResourceDefinitionApi } from "./custom-resource-definition.api";
|
||||||
|
|
||||||
|
const customResourceDefinitionApiInjectable = getInjectable({
|
||||||
|
id: "custom-resource-definition-api",
|
||||||
|
instantiate: (di) => {
|
||||||
|
assert(di.inject(createStoresAndApisInjectionToken), "customResourceDefinitionApi is only available in certain environments");
|
||||||
|
|
||||||
|
return new CustomResourceDefinitionApi();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default customResourceDefinitionApiInjectable;
|
||||||
@ -10,7 +10,6 @@ import type { BaseKubeObjectCondition, KubeObjectScope } from "../kube-object";
|
|||||||
import { KubeObject } from "../kube-object";
|
import { KubeObject } from "../kube-object";
|
||||||
import type { DerivedKubeApiOptions } from "../kube-api";
|
import type { DerivedKubeApiOptions } from "../kube-api";
|
||||||
import { KubeApi } from "../kube-api";
|
import { KubeApi } from "../kube-api";
|
||||||
import { isClusterPageContext } from "../../utils/cluster-id-url-parsing";
|
|
||||||
|
|
||||||
interface AdditionalPrinterColumnsCommon {
|
interface AdditionalPrinterColumnsCommon {
|
||||||
name: string;
|
name: string;
|
||||||
@ -233,7 +232,3 @@ export class CustomResourceDefinitionApi extends KubeApi<CustomResourceDefinitio
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const crdApi = isClusterPageContext()
|
|
||||||
? new CustomResourceDefinitionApi()
|
|
||||||
: undefined as never;
|
|
||||||
19
src/common/k8s-api/endpoints/endpoint.api.injectable.ts
Normal file
19
src/common/k8s-api/endpoints/endpoint.api.injectable.ts
Normal 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 } from "@ogre-tools/injectable";
|
||||||
|
import assert from "assert";
|
||||||
|
import { createStoresAndApisInjectionToken } from "../create-stores-apis.token";
|
||||||
|
import { EndpointsApi } from "./endpoint.api";
|
||||||
|
|
||||||
|
const endpointsApiInjectable = getInjectable({
|
||||||
|
id: "endpoints-api",
|
||||||
|
instantiate: (di) => {
|
||||||
|
assert(di.inject(createStoresAndApisInjectionToken), "endpointsApi is only available in certain environments");
|
||||||
|
|
||||||
|
return new EndpointsApi();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default endpointsApiInjectable;
|
||||||
@ -9,7 +9,6 @@ import { KubeObject } from "../kube-object";
|
|||||||
import type { DerivedKubeApiOptions } from "../kube-api";
|
import type { DerivedKubeApiOptions } from "../kube-api";
|
||||||
import { KubeApi } from "../kube-api";
|
import { KubeApi } from "../kube-api";
|
||||||
import type { KubeJsonApiData } from "../kube-json-api";
|
import type { KubeJsonApiData } from "../kube-json-api";
|
||||||
import { isClusterPageContext } from "../../utils/cluster-id-url-parsing";
|
|
||||||
|
|
||||||
export function formatEndpointSubset(subset: EndpointSubset): string {
|
export function formatEndpointSubset(subset: EndpointSubset): string {
|
||||||
const { addresses, ports } = subset;
|
const { addresses, ports } = subset;
|
||||||
@ -116,7 +115,3 @@ export class EndpointsApi extends KubeApi<Endpoints, EndpointsData> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const endpointsApi = isClusterPageContext()
|
|
||||||
? new EndpointsApi()
|
|
||||||
: undefined as never;
|
|
||||||
|
|||||||
19
src/common/k8s-api/endpoints/events.api.injectable.ts
Normal file
19
src/common/k8s-api/endpoints/events.api.injectable.ts
Normal 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 } from "@ogre-tools/injectable";
|
||||||
|
import assert from "assert";
|
||||||
|
import { createStoresAndApisInjectionToken } from "../create-stores-apis.token";
|
||||||
|
import { KubeEventApi } from "./events.api";
|
||||||
|
|
||||||
|
const kubeEventApiInjectable = getInjectable({
|
||||||
|
id: "kube-event-api",
|
||||||
|
instantiate: (di) => {
|
||||||
|
assert(di.inject(createStoresAndApisInjectionToken), "kubeEventApi is only available in certain environments");
|
||||||
|
|
||||||
|
return new KubeEventApi();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default kubeEventApiInjectable;
|
||||||
@ -9,7 +9,6 @@ import { KubeObject } from "../kube-object";
|
|||||||
import { formatDuration } from "../../utils/formatDuration";
|
import { formatDuration } from "../../utils/formatDuration";
|
||||||
import type { DerivedKubeApiOptions } from "../kube-api";
|
import type { DerivedKubeApiOptions } from "../kube-api";
|
||||||
import { KubeApi } from "../kube-api";
|
import { KubeApi } from "../kube-api";
|
||||||
import { isClusterPageContext } from "../../utils/cluster-id-url-parsing";
|
|
||||||
import type { KubeJsonApiData } from "../kube-json-api";
|
import type { KubeJsonApiData } from "../kube-json-api";
|
||||||
|
|
||||||
export interface EventSeries {
|
export interface EventSeries {
|
||||||
@ -140,7 +139,3 @@ export class KubeEventApi extends KubeApi<KubeEvent, KubeEventData> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const eventApi = isClusterPageContext()
|
|
||||||
? new KubeEventApi()
|
|
||||||
: undefined as never;
|
|
||||||
|
|||||||
@ -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 } from "@ogre-tools/injectable";
|
||||||
|
import assert from "assert";
|
||||||
|
import { createStoresAndApisInjectionToken } from "../create-stores-apis.token";
|
||||||
|
import { HorizontalPodAutoscalerApi } from "./horizontal-pod-autoscaler.api";
|
||||||
|
|
||||||
|
const horizontalPodAutoscalerApiInjectable = getInjectable({
|
||||||
|
id: "horizontal-pod-autoscaler-api",
|
||||||
|
instantiate: (di) => {
|
||||||
|
assert(di.inject(createStoresAndApisInjectionToken), "horizontalPodAutoscalerApi is only available in certain environments");
|
||||||
|
|
||||||
|
return new HorizontalPodAutoscalerApi();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default horizontalPodAutoscalerApiInjectable;
|
||||||
@ -7,7 +7,6 @@ import type { BaseKubeObjectCondition, KubeObjectScope, LabelSelector } from "..
|
|||||||
import { KubeObject } from "../kube-object";
|
import { KubeObject } from "../kube-object";
|
||||||
import type { DerivedKubeApiOptions } from "../kube-api";
|
import type { DerivedKubeApiOptions } from "../kube-api";
|
||||||
import { KubeApi } from "../kube-api";
|
import { KubeApi } from "../kube-api";
|
||||||
import { isClusterPageContext } from "../../utils/cluster-id-url-parsing";
|
|
||||||
import type { OptionVarient } from "../../utils";
|
import type { OptionVarient } from "../../utils";
|
||||||
|
|
||||||
export enum HpaMetricType {
|
export enum HpaMetricType {
|
||||||
@ -260,7 +259,3 @@ export class HorizontalPodAutoscalerApi extends KubeApi<HorizontalPodAutoscaler>
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const horizontalPodAutoscalerApi = isClusterPageContext()
|
|
||||||
? new HorizontalPodAutoscalerApi()
|
|
||||||
: undefined as never;
|
|
||||||
@ -9,22 +9,22 @@
|
|||||||
export * from "./cluster.api";
|
export * from "./cluster.api";
|
||||||
export * from "./cluster-role.api";
|
export * from "./cluster-role.api";
|
||||||
export * from "./cluster-role-binding.api";
|
export * from "./cluster-role-binding.api";
|
||||||
export * from "./configmap.api";
|
export * from "./config-map.api";
|
||||||
export * from "./crd.api";
|
export * from "./custom-resource-definition.api";
|
||||||
export * from "./cron-job.api";
|
export * from "./cron-job.api";
|
||||||
export * from "./daemon-set.api";
|
export * from "./daemon-set.api";
|
||||||
export * from "./deployment.api";
|
export * from "./deployment.api";
|
||||||
export * from "./endpoint.api";
|
export * from "./endpoint.api";
|
||||||
export * from "./events.api";
|
export * from "./events.api";
|
||||||
export * from "./hpa.api";
|
export * from "./horizontal-pod-autoscaler.api";
|
||||||
export * from "./ingress.api";
|
export * from "./ingress.api";
|
||||||
export * from "./job.api";
|
export * from "./job.api";
|
||||||
export * from "./limit-range.api";
|
export * from "./limit-range.api";
|
||||||
export * from "./namespaces.api";
|
export * from "./namespace.api";
|
||||||
export * from "./network-policy.api";
|
export * from "./network-policy.api";
|
||||||
export * from "./nodes.api";
|
export * from "./node.api";
|
||||||
export * from "./persistent-volume.api";
|
export * from "./persistent-volume.api";
|
||||||
export * from "./persistent-volume-claims.api";
|
export * from "./persistent-volume-claim.api";
|
||||||
export * from "./pod.api";
|
export * from "./pod.api";
|
||||||
export * from "./pod-disruption-budget.api";
|
export * from "./pod-disruption-budget.api";
|
||||||
export * from "./pod-metrics.api";
|
export * from "./pod-metrics.api";
|
||||||
|
|||||||
19
src/common/k8s-api/endpoints/ingress.api.injectable.ts
Normal file
19
src/common/k8s-api/endpoints/ingress.api.injectable.ts
Normal 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 } from "@ogre-tools/injectable";
|
||||||
|
import assert from "assert";
|
||||||
|
import { createStoresAndApisInjectionToken } from "../create-stores-apis.token";
|
||||||
|
import { IngressApi } from "./ingress.api";
|
||||||
|
|
||||||
|
const ingressApiInjectable = getInjectable({
|
||||||
|
id: "ingress-api",
|
||||||
|
instantiate: (di) => {
|
||||||
|
assert(di.inject(createStoresAndApisInjectionToken), "ingressApi is only available in certain environments");
|
||||||
|
|
||||||
|
return new IngressApi();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default ingressApiInjectable;
|
||||||
@ -10,7 +10,6 @@ import type { MetricData } from "./metrics.api";
|
|||||||
import { metricsApi } from "./metrics.api";
|
import { metricsApi } from "./metrics.api";
|
||||||
import type { DerivedKubeApiOptions, IgnoredKubeApiOptions } from "../kube-api";
|
import type { DerivedKubeApiOptions, IgnoredKubeApiOptions } from "../kube-api";
|
||||||
import { KubeApi } from "../kube-api";
|
import { KubeApi } from "../kube-api";
|
||||||
import { isClusterPageContext } from "../../utils/cluster-id-url-parsing";
|
|
||||||
import type { RequireExactlyOne } from "type-fest";
|
import type { RequireExactlyOne } from "type-fest";
|
||||||
|
|
||||||
export class IngressApi extends KubeApi<Ingress> {
|
export class IngressApi extends KubeApi<Ingress> {
|
||||||
@ -230,7 +229,3 @@ export function computeRuleDeclarations(ingress: Ingress, rule: IngressRule): Co
|
|||||||
export function computeRouteDeclarations(ingress: Ingress): ComputedIngressRoute[] {
|
export function computeRouteDeclarations(ingress: Ingress): ComputedIngressRoute[] {
|
||||||
return ingress.getRules().flatMap(rule => computeRuleDeclarations(ingress, rule));
|
return ingress.getRules().flatMap(rule => computeRuleDeclarations(ingress, rule));
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ingressApi = isClusterPageContext()
|
|
||||||
? new IngressApi()
|
|
||||||
: undefined as never;
|
|
||||||
|
|||||||
@ -6,15 +6,38 @@
|
|||||||
import { asLegacyGlobalForExtensionApi } from "../../../extensions/as-legacy-globals-for-extension-api/as-legacy-global-object-for-extension-api";
|
import { asLegacyGlobalForExtensionApi } from "../../../extensions/as-legacy-globals-for-extension-api/as-legacy-global-object-for-extension-api";
|
||||||
import clusterRoleBindingApiInjectable from "./cluster-role-binding.api.injectable";
|
import clusterRoleBindingApiInjectable from "./cluster-role-binding.api.injectable";
|
||||||
import clusterRoleApiInjectable from "./cluster-role.api.injectable";
|
import clusterRoleApiInjectable from "./cluster-role.api.injectable";
|
||||||
|
import clusterApiInjectable from "./cluster.api.injectable";
|
||||||
|
import componentStatusApiInjectable from "./component-status.api.injectable";
|
||||||
|
import configMapApiInjectable from "./config-map.api.injectable";
|
||||||
import cronJobApiInjectable from "./cron-job.api.injectable";
|
import cronJobApiInjectable from "./cron-job.api.injectable";
|
||||||
|
import customResourceDefinitionApiInjectable from "./custom-resource-definition.api.injectable";
|
||||||
import daemonSetApiInjectable from "./daemon-set.api.injectable";
|
import daemonSetApiInjectable from "./daemon-set.api.injectable";
|
||||||
import deploymentApiInjectable from "./deployment.api.injectable";
|
import deploymentApiInjectable from "./deployment.api.injectable";
|
||||||
|
import endpointsApiInjectable from "./endpoint.api.injectable";
|
||||||
|
import kubeEventApiInjectable from "./events.api.injectable";
|
||||||
|
import horizontalPodAutoscalerApiInjectable from "./horizontal-pod-autoscaler.api.injectable";
|
||||||
|
import ingressApiInjectable from "./ingress.api.injectable";
|
||||||
import jobApiInjectable from "./job.api.injectable";
|
import jobApiInjectable from "./job.api.injectable";
|
||||||
|
import limitRangeApiInjectable from "./limit-range.api.injectable";
|
||||||
|
import namespaceApiInjectable from "./namespace.api.injectable";
|
||||||
|
import networkPolicyApiInjectable from "./network-policy.api.injectable";
|
||||||
|
import nodeApiInjectable from "./node.api.injectable";
|
||||||
|
import persistentVolumeClaimApiInjectable from "./persistent-volume-claim.api.injectable";
|
||||||
|
import persistentVolumeApiInjectable from "./persistent-volume.api.injectable";
|
||||||
|
import podDisruptionBudgetApiInjectable from "./pod-disruption-budget.api.injectable";
|
||||||
|
import podMetricsApiInjectable from "./pod-metrics.api.injectable";
|
||||||
|
import podSecurityPolicyApiInjectable from "./pod-security-policy.api.injectable";
|
||||||
import podApiInjectable from "./pod.api.injectable";
|
import podApiInjectable from "./pod.api.injectable";
|
||||||
import replicaSetApiInjectable from "./replica-set.api.injectable";
|
import replicaSetApiInjectable from "./replica-set.api.injectable";
|
||||||
|
import resourceQuotaApiInjectable from "./resource-quota.api.injectable";
|
||||||
|
import roleBindingApiInjectable from "./role-binding.api.injectable";
|
||||||
import roleApiInjectable from "./role.api.injectable";
|
import roleApiInjectable from "./role.api.injectable";
|
||||||
|
import secretApiInjectable from "./secret.api.injectable";
|
||||||
|
import selfSubjectRulesReviewApiInjectable from "./self-subject-rules-reviews.api.injectable";
|
||||||
import serviceAccountApiInjectable from "./service-account.api.injectable";
|
import serviceAccountApiInjectable from "./service-account.api.injectable";
|
||||||
|
import serviceApiInjectable from "./service.api.injectable";
|
||||||
import statefulSetApiInjectable from "./stateful-set.api.injectable";
|
import statefulSetApiInjectable from "./stateful-set.api.injectable";
|
||||||
|
import storageClassApiInjectable from "./storage-class.api.injectable";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated use `di.inject(clusterRoleBindingApiInjectable)` instead
|
* @deprecated use `di.inject(clusterRoleBindingApiInjectable)` instead
|
||||||
@ -70,3 +93,118 @@ export const cronJobApi = asLegacyGlobalForExtensionApi(cronJobApiInjectable);
|
|||||||
* @deprecated use `di.inject(jobApiInjectable)` instead
|
* @deprecated use `di.inject(jobApiInjectable)` instead
|
||||||
*/
|
*/
|
||||||
export const jobApi = asLegacyGlobalForExtensionApi(jobApiInjectable);
|
export const jobApi = asLegacyGlobalForExtensionApi(jobApiInjectable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated use `di.inject(clusterApiInjectable)` instead
|
||||||
|
*/
|
||||||
|
export const clusterApi = asLegacyGlobalForExtensionApi(clusterApiInjectable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated use `di.inject(configMapApiInjectable)` instead
|
||||||
|
*/
|
||||||
|
export const configMapApi = asLegacyGlobalForExtensionApi(configMapApiInjectable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated use `di.inject(componentStatusApiInjectable)` instead
|
||||||
|
*/
|
||||||
|
export const componentStatusApi = asLegacyGlobalForExtensionApi(componentStatusApiInjectable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated use `di.inject(customResourceDefinitionApiInjectable)` instead
|
||||||
|
*/
|
||||||
|
export const customResourceDefinitionApi = asLegacyGlobalForExtensionApi(customResourceDefinitionApiInjectable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated use `di.inject(kubeEventApiInjectable)` instead
|
||||||
|
*/
|
||||||
|
export const kubeEventApi = asLegacyGlobalForExtensionApi(kubeEventApiInjectable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated use `di.inject(endpointsApiInjectable)` instead
|
||||||
|
*/
|
||||||
|
export const endpointsApi = asLegacyGlobalForExtensionApi(endpointsApiInjectable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated use `di.inject(horizontalPodAutoscalerApiInjectable)` instead
|
||||||
|
*/
|
||||||
|
export const horizontalPodAutoscalerApi = asLegacyGlobalForExtensionApi(horizontalPodAutoscalerApiInjectable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated use `di.inject(ingressApiInjectable)` instead
|
||||||
|
*/
|
||||||
|
export const ingressApi = asLegacyGlobalForExtensionApi(ingressApiInjectable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated use `di.inject(limitRangeApiInjectable)` instead
|
||||||
|
*/
|
||||||
|
export const limitRangeApi = asLegacyGlobalForExtensionApi(limitRangeApiInjectable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated use `di.inject(namespaceApiInjectable)` instead
|
||||||
|
*/
|
||||||
|
export const namespaceApi = asLegacyGlobalForExtensionApi(namespaceApiInjectable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated use `di.inject(networkPolicyApiInjectable)` instead
|
||||||
|
*/
|
||||||
|
export const networkPolicyApi = asLegacyGlobalForExtensionApi(networkPolicyApiInjectable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated use `di.inject(nodeApiInjectable)` instead
|
||||||
|
*/
|
||||||
|
export const nodeApi = asLegacyGlobalForExtensionApi(nodeApiInjectable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated use `di.inject(persistentVolumeClaimApiInjectable)` instead
|
||||||
|
*/
|
||||||
|
export const persistentVolumeClaimApi = asLegacyGlobalForExtensionApi(persistentVolumeClaimApiInjectable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated use `di.inject(persistentVolumeApiInjectable)` instead
|
||||||
|
*/
|
||||||
|
export const persistentVolumeApi = asLegacyGlobalForExtensionApi(persistentVolumeApiInjectable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated use `di.inject(podDisruptionBudgetApiInjectable)` instead
|
||||||
|
*/
|
||||||
|
export const podDisruptionBudgetApi = asLegacyGlobalForExtensionApi(podDisruptionBudgetApiInjectable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated use `di.inject(podMetricsApiInjectable)` instead
|
||||||
|
*/
|
||||||
|
export const podMetricsApi = asLegacyGlobalForExtensionApi(podMetricsApiInjectable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated use `di.inject(podSecurityPolicyApiInjectable)` instead
|
||||||
|
*/
|
||||||
|
export const podSecurityPolicyApi = asLegacyGlobalForExtensionApi(podSecurityPolicyApiInjectable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated use `di.inject(resourceQuotaApiInjectable)` instead
|
||||||
|
*/
|
||||||
|
export const resourceQuotaApi = asLegacyGlobalForExtensionApi(resourceQuotaApiInjectable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated use `di.inject(roleBindingApiInjectable)` instead
|
||||||
|
*/
|
||||||
|
export const roleBindingApi = asLegacyGlobalForExtensionApi(roleBindingApiInjectable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated use `di.inject(secretApiInjectable)` instead
|
||||||
|
*/
|
||||||
|
export const secretApi = asLegacyGlobalForExtensionApi(secretApiInjectable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated use `di.inject(selfSubjectRulesReviewApiInjectable)` instead
|
||||||
|
*/
|
||||||
|
export const selfSubjectRulesReviewApi = asLegacyGlobalForExtensionApi(selfSubjectRulesReviewApiInjectable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated use `di.inject(serviceApiInjectable)` instead
|
||||||
|
*/
|
||||||
|
export const serviceApi = asLegacyGlobalForExtensionApi(serviceApiInjectable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated use `di.inject(storageClassApiInjectable)` instead
|
||||||
|
*/
|
||||||
|
export const storageClassApi = asLegacyGlobalForExtensionApi(storageClassApiInjectable);
|
||||||
|
|||||||
19
src/common/k8s-api/endpoints/limit-range.api.injectable.ts
Normal file
19
src/common/k8s-api/endpoints/limit-range.api.injectable.ts
Normal 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 } from "@ogre-tools/injectable";
|
||||||
|
import assert from "assert";
|
||||||
|
import { createStoresAndApisInjectionToken } from "../create-stores-apis.token";
|
||||||
|
import { LimitRangeApi } from "./limit-range.api";
|
||||||
|
|
||||||
|
const limitRangeApiInjectable = getInjectable({
|
||||||
|
id: "limit-range-api",
|
||||||
|
instantiate: (di) => {
|
||||||
|
assert(di.inject(createStoresAndApisInjectionToken), "limitRangeApi is only available in certain environments");
|
||||||
|
|
||||||
|
return new LimitRangeApi();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default limitRangeApiInjectable;
|
||||||
@ -7,7 +7,6 @@ import type { KubeObjectScope } from "../kube-object";
|
|||||||
import { KubeObject } from "../kube-object";
|
import { KubeObject } from "../kube-object";
|
||||||
import type { DerivedKubeApiOptions } from "../kube-api";
|
import type { DerivedKubeApiOptions } from "../kube-api";
|
||||||
import { KubeApi } from "../kube-api";
|
import { KubeApi } from "../kube-api";
|
||||||
import { isClusterPageContext } from "../../utils/cluster-id-url-parsing";
|
|
||||||
|
|
||||||
export enum LimitType {
|
export enum LimitType {
|
||||||
CONTAINER = "Container",
|
CONTAINER = "Container",
|
||||||
@ -66,7 +65,3 @@ export class LimitRangeApi extends KubeApi<LimitRange> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const limitRangeApi = isClusterPageContext()
|
|
||||||
? new LimitRangeApi()
|
|
||||||
: undefined as never;
|
|
||||||
|
|||||||
19
src/common/k8s-api/endpoints/namespace.api.injectable.ts
Normal file
19
src/common/k8s-api/endpoints/namespace.api.injectable.ts
Normal 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 } from "@ogre-tools/injectable";
|
||||||
|
import assert from "assert";
|
||||||
|
import { createStoresAndApisInjectionToken } from "../create-stores-apis.token";
|
||||||
|
import { NamespaceApi } from "./namespace.api";
|
||||||
|
|
||||||
|
const namespaceApiInjectable = getInjectable({
|
||||||
|
id: "namespace-api",
|
||||||
|
instantiate: (di) => {
|
||||||
|
assert(di.inject(createStoresAndApisInjectionToken), "namespaceApi is only available in certain environments");
|
||||||
|
|
||||||
|
return new NamespaceApi();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default namespaceApiInjectable;
|
||||||
@ -9,7 +9,6 @@ import type { KubeObjectScope, KubeObjectStatus } from "../kube-object";
|
|||||||
import { KubeObject } from "../kube-object";
|
import { KubeObject } from "../kube-object";
|
||||||
import { metricsApi } from "./metrics.api";
|
import { metricsApi } from "./metrics.api";
|
||||||
import type { PodMetricData } from "./pod.api";
|
import type { PodMetricData } from "./pod.api";
|
||||||
import { isClusterPageContext } from "../../utils/cluster-id-url-parsing";
|
|
||||||
|
|
||||||
export enum NamespaceStatusKind {
|
export enum NamespaceStatusKind {
|
||||||
ACTIVE = "Active",
|
ACTIVE = "Active",
|
||||||
@ -58,7 +57,3 @@ export function getMetricsForNamespace(namespace: string, selector = ""): Promis
|
|||||||
namespace,
|
namespace,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export const namespaceApi = isClusterPageContext()
|
|
||||||
? new NamespaceApi()
|
|
||||||
: undefined as never;
|
|
||||||
@ -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 } from "@ogre-tools/injectable";
|
||||||
|
import assert from "assert";
|
||||||
|
import { createStoresAndApisInjectionToken } from "../create-stores-apis.token";
|
||||||
|
import { NetworkPolicyApi } from "./network-policy.api";
|
||||||
|
|
||||||
|
const networkPolicyApiInjectable = getInjectable({
|
||||||
|
id: "network-policy-api",
|
||||||
|
instantiate: (di) => {
|
||||||
|
assert(di.inject(createStoresAndApisInjectionToken), "networkPolicyApi is only available in certain environments");
|
||||||
|
|
||||||
|
return new NetworkPolicyApi();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default networkPolicyApiInjectable;
|
||||||
@ -7,7 +7,6 @@ import type { KubeObjectScope, LabelSelector } from "../kube-object";
|
|||||||
import { KubeObject } from "../kube-object";
|
import { KubeObject } from "../kube-object";
|
||||||
import type { DerivedKubeApiOptions } from "../kube-api";
|
import type { DerivedKubeApiOptions } from "../kube-api";
|
||||||
import { KubeApi } from "../kube-api";
|
import { KubeApi } from "../kube-api";
|
||||||
import { isClusterPageContext } from "../../utils/cluster-id-url-parsing";
|
|
||||||
|
|
||||||
export interface IPolicyIpBlock {
|
export interface IPolicyIpBlock {
|
||||||
cidr: string;
|
cidr: string;
|
||||||
@ -132,7 +131,3 @@ export class NetworkPolicyApi extends KubeApi<NetworkPolicy> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const networkPolicyApi = isClusterPageContext()
|
|
||||||
? new NetworkPolicyApi()
|
|
||||||
: undefined as never;
|
|
||||||
|
|||||||
19
src/common/k8s-api/endpoints/node.api.injectable.ts
Normal file
19
src/common/k8s-api/endpoints/node.api.injectable.ts
Normal 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 } from "@ogre-tools/injectable";
|
||||||
|
import assert from "assert";
|
||||||
|
import { createStoresAndApisInjectionToken } from "../create-stores-apis.token";
|
||||||
|
import { NodeApi } from "./node.api";
|
||||||
|
|
||||||
|
const nodeApiInjectable = getInjectable({
|
||||||
|
id: "node-api",
|
||||||
|
instantiate: (di) => {
|
||||||
|
assert(di.inject(createStoresAndApisInjectionToken), "nodeApi is only available in certain environments");
|
||||||
|
|
||||||
|
return new NodeApi();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default nodeApiInjectable;
|
||||||
@ -10,7 +10,6 @@ import type { MetricData } from "./metrics.api";
|
|||||||
import { metricsApi } from "./metrics.api";
|
import { metricsApi } from "./metrics.api";
|
||||||
import type { DerivedKubeApiOptions, IgnoredKubeApiOptions } from "../kube-api";
|
import type { DerivedKubeApiOptions, IgnoredKubeApiOptions } from "../kube-api";
|
||||||
import { KubeApi } from "../kube-api";
|
import { KubeApi } from "../kube-api";
|
||||||
import { isClusterPageContext } from "../../utils/cluster-id-url-parsing";
|
|
||||||
import { TypedRegEx } from "typed-regex";
|
import { TypedRegEx } from "typed-regex";
|
||||||
|
|
||||||
export class NodeApi extends KubeApi<Node> {
|
export class NodeApi extends KubeApi<Node> {
|
||||||
@ -267,7 +266,3 @@ export class Node extends KubeObject<NodeStatus, NodeSpec, KubeObjectScope.Clust
|
|||||||
return this.spec.unschedulable;
|
return this.spec.unschedulable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const nodeApi = isClusterPageContext()
|
|
||||||
? new NodeApi()
|
|
||||||
: undefined as never;
|
|
||||||
@ -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 } from "@ogre-tools/injectable";
|
||||||
|
import assert from "assert";
|
||||||
|
import { createStoresAndApisInjectionToken } from "../create-stores-apis.token";
|
||||||
|
import { PersistentVolumeClaimApi } from "./persistent-volume-claim.api";
|
||||||
|
|
||||||
|
const persistentVolumeClaimApiInjectable = getInjectable({
|
||||||
|
id: "persistent-volume-claim-api",
|
||||||
|
instantiate: (di) => {
|
||||||
|
assert(di.inject(createStoresAndApisInjectionToken), "persistentVolumeClaimApi is only available in certain environments");
|
||||||
|
|
||||||
|
return new PersistentVolumeClaimApi();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default persistentVolumeClaimApiInjectable;
|
||||||
@ -10,7 +10,6 @@ import { metricsApi } from "./metrics.api";
|
|||||||
import type { Pod } from "./pod.api";
|
import type { Pod } from "./pod.api";
|
||||||
import type { DerivedKubeApiOptions, IgnoredKubeApiOptions } from "../kube-api";
|
import type { DerivedKubeApiOptions, IgnoredKubeApiOptions } from "../kube-api";
|
||||||
import { KubeApi } from "../kube-api";
|
import { KubeApi } from "../kube-api";
|
||||||
import { isClusterPageContext } from "../../utils/cluster-id-url-parsing";
|
|
||||||
import { object } from "../../utils";
|
import { object } from "../../utils";
|
||||||
import type { ResourceRequirements } from "./types/resource-requirements";
|
import type { ResourceRequirements } from "./types/resource-requirements";
|
||||||
|
|
||||||
@ -86,7 +85,3 @@ export class PersistentVolumeClaim extends KubeObject<PersistentVolumeClaimStatu
|
|||||||
return this.status?.phase ?? "-";
|
return this.status?.phase ?? "-";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const persistentVolumeClaimApi = isClusterPageContext()
|
|
||||||
? new PersistentVolumeClaimApi()
|
|
||||||
: undefined as never;
|
|
||||||
@ -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 } from "@ogre-tools/injectable";
|
||||||
|
import assert from "assert";
|
||||||
|
import { createStoresAndApisInjectionToken } from "../create-stores-apis.token";
|
||||||
|
import { PersistentVolumeApi } from "./persistent-volume.api";
|
||||||
|
|
||||||
|
const persistentVolumeApiInjectable = getInjectable({
|
||||||
|
id: "persistent-volume-api",
|
||||||
|
instantiate: (di) => {
|
||||||
|
assert(di.inject(createStoresAndApisInjectionToken), "persistentVolumeApi is only available in certain environments");
|
||||||
|
|
||||||
|
return new PersistentVolumeApi();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default persistentVolumeApiInjectable;
|
||||||
@ -8,7 +8,6 @@ import { KubeObject } from "../kube-object";
|
|||||||
import { unitsToBytes } from "../../utils";
|
import { unitsToBytes } from "../../utils";
|
||||||
import type { DerivedKubeApiOptions } from "../kube-api";
|
import type { DerivedKubeApiOptions } from "../kube-api";
|
||||||
import { KubeApi } from "../kube-api";
|
import { KubeApi } from "../kube-api";
|
||||||
import { isClusterPageContext } from "../../utils/cluster-id-url-parsing";
|
|
||||||
import type { ResourceRequirements } from "./types/resource-requirements";
|
import type { ResourceRequirements } from "./types/resource-requirements";
|
||||||
|
|
||||||
export interface PersistentVolumeSpec {
|
export interface PersistentVolumeSpec {
|
||||||
@ -107,7 +106,3 @@ export class PersistentVolumeApi extends KubeApi<PersistentVolume> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const persistentVolumeApi = isClusterPageContext()
|
|
||||||
? new PersistentVolumeApi()
|
|
||||||
: undefined as never;
|
|
||||||
|
|||||||
@ -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 } from "@ogre-tools/injectable";
|
||||||
|
import assert from "assert";
|
||||||
|
import { createStoresAndApisInjectionToken } from "../create-stores-apis.token";
|
||||||
|
import { PodDisruptionBudgetApi } from "./pod-disruption-budget.api";
|
||||||
|
|
||||||
|
const podDisruptionBudgetApiInjectable = getInjectable({
|
||||||
|
id: "pod-disruption-budget-api",
|
||||||
|
instantiate: (di) => {
|
||||||
|
assert(di.inject(createStoresAndApisInjectionToken), "podDisruptionBudgetApi is only available in certain environments");
|
||||||
|
|
||||||
|
return new PodDisruptionBudgetApi();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default podDisruptionBudgetApiInjectable;
|
||||||
@ -7,7 +7,6 @@ import type { KubeObjectScope, LabelSelector } from "../kube-object";
|
|||||||
import { KubeObject } from "../kube-object";
|
import { KubeObject } from "../kube-object";
|
||||||
import type { DerivedKubeApiOptions } from "../kube-api";
|
import type { DerivedKubeApiOptions } from "../kube-api";
|
||||||
import { KubeApi } from "../kube-api";
|
import { KubeApi } from "../kube-api";
|
||||||
import { isClusterPageContext } from "../../utils/cluster-id-url-parsing";
|
|
||||||
|
|
||||||
export interface PodDisruptionBudgetSpec {
|
export interface PodDisruptionBudgetSpec {
|
||||||
minAvailable: string;
|
minAvailable: string;
|
||||||
@ -56,7 +55,3 @@ export class PodDisruptionBudgetApi extends KubeApi<PodDisruptionBudget> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const podDisruptionBudgetApi = isClusterPageContext()
|
|
||||||
? new PodDisruptionBudgetApi()
|
|
||||||
: undefined as never;
|
|
||||||
|
|||||||
19
src/common/k8s-api/endpoints/pod-metrics.api.injectable.ts
Normal file
19
src/common/k8s-api/endpoints/pod-metrics.api.injectable.ts
Normal 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 } from "@ogre-tools/injectable";
|
||||||
|
import assert from "assert";
|
||||||
|
import { createStoresAndApisInjectionToken } from "../create-stores-apis.token";
|
||||||
|
import { PodMetricsApi } from "./pod-metrics.api";
|
||||||
|
|
||||||
|
const podMetricsApiInjectable = getInjectable({
|
||||||
|
id: "pod-metrics-api",
|
||||||
|
instantiate: (di) => {
|
||||||
|
assert(di.inject(createStoresAndApisInjectionToken), "podMetricsApi is only available in certain environments");
|
||||||
|
|
||||||
|
return new PodMetricsApi();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default podMetricsApiInjectable;
|
||||||
@ -7,7 +7,6 @@ import type { KubeObjectMetadata, KubeObjectScope } from "../kube-object";
|
|||||||
import { KubeObject } from "../kube-object";
|
import { KubeObject } from "../kube-object";
|
||||||
import type { DerivedKubeApiOptions } from "../kube-api";
|
import type { DerivedKubeApiOptions } from "../kube-api";
|
||||||
import { KubeApi } from "../kube-api";
|
import { KubeApi } from "../kube-api";
|
||||||
import { isClusterPageContext } from "../../utils/cluster-id-url-parsing";
|
|
||||||
import type { KubeJsonApiData } from "../kube-json-api";
|
import type { KubeJsonApiData } from "../kube-json-api";
|
||||||
|
|
||||||
export interface PodMetricsData extends KubeJsonApiData<KubeObjectMetadata<KubeObjectScope.Namespace>, void, void> {
|
export interface PodMetricsData extends KubeJsonApiData<KubeObjectMetadata<KubeObjectScope.Namespace>, void, void> {
|
||||||
@ -56,7 +55,3 @@ export class PodMetricsApi extends KubeApi<PodMetrics, PodMetricsData> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const podMetricsApi = isClusterPageContext()
|
|
||||||
? new PodMetricsApi()
|
|
||||||
: undefined as never;
|
|
||||||
|
|||||||
@ -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 } from "@ogre-tools/injectable";
|
||||||
|
import assert from "assert";
|
||||||
|
import { createStoresAndApisInjectionToken } from "../create-stores-apis.token";
|
||||||
|
import { PodSecurityPolicyApi } from "./pod-security-policy.api";
|
||||||
|
|
||||||
|
const podSecurityPolicyApiInjectable = getInjectable({
|
||||||
|
id: "pod-security-policy-api",
|
||||||
|
instantiate: (di) => {
|
||||||
|
assert(di.inject(createStoresAndApisInjectionToken), "podSecurityPolicyApi is only available in certain environments");
|
||||||
|
|
||||||
|
return new PodSecurityPolicyApi();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default podSecurityPolicyApiInjectable;
|
||||||
@ -7,7 +7,6 @@ import type { KubeObjectScope } from "../kube-object";
|
|||||||
import { KubeObject } from "../kube-object";
|
import { KubeObject } from "../kube-object";
|
||||||
import type { DerivedKubeApiOptions } from "../kube-api";
|
import type { DerivedKubeApiOptions } from "../kube-api";
|
||||||
import { KubeApi } from "../kube-api";
|
import { KubeApi } from "../kube-api";
|
||||||
import { isClusterPageContext } from "../../utils/cluster-id-url-parsing";
|
|
||||||
|
|
||||||
export interface PodSecurityPolicySpec {
|
export interface PodSecurityPolicySpec {
|
||||||
allowPrivilegeEscalation?: boolean;
|
allowPrivilegeEscalation?: boolean;
|
||||||
@ -116,7 +115,3 @@ export class PodSecurityPolicyApi extends KubeApi<PodSecurityPolicy> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const podSecurityPolicyApi = isClusterPageContext()
|
|
||||||
? new PodSecurityPolicyApi()
|
|
||||||
: undefined as never;
|
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import { KubeApi } from "../kube-api";
|
|||||||
import type { RequireExactlyOne } from "type-fest";
|
import type { RequireExactlyOne } from "type-fest";
|
||||||
import type { KubeObjectMetadata, LocalObjectReference, Affinity, Toleration, LabelSelector, KubeObjectScope } from "../kube-object";
|
import type { KubeObjectMetadata, LocalObjectReference, Affinity, Toleration, LabelSelector, KubeObjectScope } from "../kube-object";
|
||||||
import type { SecretReference } from "./secret.api";
|
import type { SecretReference } from "./secret.api";
|
||||||
import type { PersistentVolumeClaimSpec } from "./persistent-volume-claims.api";
|
import type { PersistentVolumeClaimSpec } from "./persistent-volume-claim.api";
|
||||||
import { KubeObject } from "../kube-object";
|
import { KubeObject } from "../kube-object";
|
||||||
import { isDefined } from "../../utils";
|
import { isDefined } from "../../utils";
|
||||||
|
|
||||||
|
|||||||
@ -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 } from "@ogre-tools/injectable";
|
||||||
|
import assert from "assert";
|
||||||
|
import { createStoresAndApisInjectionToken } from "../create-stores-apis.token";
|
||||||
|
import { ResourceQuotaApi } from "./resource-quota.api";
|
||||||
|
|
||||||
|
const resourceQuotaApiInjectable = getInjectable({
|
||||||
|
id: "resource-quota-api",
|
||||||
|
instantiate: (di) => {
|
||||||
|
assert(di.inject(createStoresAndApisInjectionToken), "resourceQuotaApi is only available in certain environments");
|
||||||
|
|
||||||
|
return new ResourceQuotaApi();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default resourceQuotaApiInjectable;
|
||||||
@ -7,7 +7,6 @@ import type { KubeObjectScope } from "../kube-object";
|
|||||||
import { KubeObject } from "../kube-object";
|
import { KubeObject } from "../kube-object";
|
||||||
import type { DerivedKubeApiOptions } from "../kube-api";
|
import type { DerivedKubeApiOptions } from "../kube-api";
|
||||||
import { KubeApi } from "../kube-api";
|
import { KubeApi } from "../kube-api";
|
||||||
import { isClusterPageContext } from "../../utils/cluster-id-url-parsing";
|
|
||||||
|
|
||||||
export type IResourceQuotaValues = Partial<Record<string, string>> & {
|
export type IResourceQuotaValues = Partial<Record<string, string>> & {
|
||||||
// Compute Resource Quota
|
// Compute Resource Quota
|
||||||
@ -69,7 +68,3 @@ export class ResourceQuotaApi extends KubeApi<ResourceQuota> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const resourceQuotaApi = isClusterPageContext()
|
|
||||||
? new ResourceQuotaApi()
|
|
||||||
: undefined as never;
|
|
||||||
|
|||||||
19
src/common/k8s-api/endpoints/role-binding.api.injectable.ts
Normal file
19
src/common/k8s-api/endpoints/role-binding.api.injectable.ts
Normal 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 } from "@ogre-tools/injectable";
|
||||||
|
import assert from "assert";
|
||||||
|
import { createStoresAndApisInjectionToken } from "../create-stores-apis.token";
|
||||||
|
import { RoleBindingApi } from "./role-binding.api";
|
||||||
|
|
||||||
|
const roleBindingApiInjectable = getInjectable({
|
||||||
|
id: "role-binding-api",
|
||||||
|
instantiate: (di) => {
|
||||||
|
assert(di.inject(createStoresAndApisInjectionToken), "roleBindingApi is only available in certain environments");
|
||||||
|
|
||||||
|
return new RoleBindingApi();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default roleBindingApiInjectable;
|
||||||
@ -8,7 +8,6 @@ import { KubeObject } from "../kube-object";
|
|||||||
import type { DerivedKubeApiOptions } from "../kube-api";
|
import type { DerivedKubeApiOptions } from "../kube-api";
|
||||||
import { KubeApi } from "../kube-api";
|
import { KubeApi } from "../kube-api";
|
||||||
import type { KubeJsonApiData } from "../kube-json-api";
|
import type { KubeJsonApiData } from "../kube-json-api";
|
||||||
import { isClusterPageContext } from "../../utils/cluster-id-url-parsing";
|
|
||||||
import type { RoleRef } from "./types/role-ref";
|
import type { RoleRef } from "./types/role-ref";
|
||||||
import type { Subject } from "./types/subject";
|
import type { Subject } from "./types/subject";
|
||||||
|
|
||||||
@ -48,7 +47,3 @@ export class RoleBindingApi extends KubeApi<RoleBinding, RoleBindingData> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const roleBindingApi = isClusterPageContext()
|
|
||||||
? new RoleBindingApi()
|
|
||||||
: undefined as never;
|
|
||||||
|
|||||||
19
src/common/k8s-api/endpoints/secret.api.injectable.ts
Normal file
19
src/common/k8s-api/endpoints/secret.api.injectable.ts
Normal 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 } from "@ogre-tools/injectable";
|
||||||
|
import assert from "assert";
|
||||||
|
import { createStoresAndApisInjectionToken } from "../create-stores-apis.token";
|
||||||
|
import { SecretApi } from "./secret.api";
|
||||||
|
|
||||||
|
const secretApiInjectable = getInjectable({
|
||||||
|
id: "secret-api",
|
||||||
|
instantiate: (di) => {
|
||||||
|
assert(di.inject(createStoresAndApisInjectionToken), "secretApi is only available in certain environments");
|
||||||
|
|
||||||
|
return new SecretApi();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default secretApiInjectable;
|
||||||
@ -9,7 +9,6 @@ import type { KubeJsonApiData } from "../kube-json-api";
|
|||||||
import { autoBind } from "../../utils";
|
import { autoBind } from "../../utils";
|
||||||
import type { DerivedKubeApiOptions } from "../kube-api";
|
import type { DerivedKubeApiOptions } from "../kube-api";
|
||||||
import { KubeApi } from "../kube-api";
|
import { KubeApi } from "../kube-api";
|
||||||
import { isClusterPageContext } from "../../utils/cluster-id-url-parsing";
|
|
||||||
|
|
||||||
export enum SecretType {
|
export enum SecretType {
|
||||||
Opaque = "Opaque",
|
Opaque = "Opaque",
|
||||||
@ -65,7 +64,3 @@ export class SecretApi extends KubeApi<Secret, SecretData> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const secretApi = isClusterPageContext()
|
|
||||||
? new SecretApi()
|
|
||||||
: undefined as never;
|
|
||||||
|
|||||||
@ -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 } from "@ogre-tools/injectable";
|
||||||
|
import assert from "assert";
|
||||||
|
import { createStoresAndApisInjectionToken } from "../create-stores-apis.token";
|
||||||
|
import { SelfSubjectRulesReviewApi } from "./self-subject-rules-reviews.api";
|
||||||
|
|
||||||
|
const selfSubjectRulesReviewApiInjectable = getInjectable({
|
||||||
|
id: "self-subject-rules-review-api",
|
||||||
|
instantiate: (di) => {
|
||||||
|
assert(di.inject(createStoresAndApisInjectionToken), "selfSubjectRulesReviewApi is only available in certain environments");
|
||||||
|
|
||||||
|
return new SelfSubjectRulesReviewApi();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default selfSubjectRulesReviewApiInjectable;
|
||||||
@ -4,10 +4,17 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { KubeObject } from "../kube-object";
|
import { KubeObject } from "../kube-object";
|
||||||
|
import type { DerivedKubeApiOptions, IgnoredKubeApiOptions } from "../kube-api";
|
||||||
import { KubeApi } from "../kube-api";
|
import { KubeApi } from "../kube-api";
|
||||||
import { isClusterPageContext } from "../../utils/cluster-id-url-parsing";
|
|
||||||
|
|
||||||
export class SelfSubjectRulesReviewApi extends KubeApi<SelfSubjectRulesReview> {
|
export class SelfSubjectRulesReviewApi extends KubeApi<SelfSubjectRulesReview> {
|
||||||
|
constructor(opts: DerivedKubeApiOptions & IgnoredKubeApiOptions = {}) {
|
||||||
|
super({
|
||||||
|
...opts,
|
||||||
|
objectConstructor: SelfSubjectRulesReview,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
create({ namespace = "default" }) {
|
create({ namespace = "default" }) {
|
||||||
return super.create({}, {
|
return super.create({}, {
|
||||||
spec: {
|
spec: {
|
||||||
@ -71,15 +78,3 @@ export class SelfSubjectRulesReview extends KubeObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let selfSubjectRulesReviewApi: SelfSubjectRulesReviewApi;
|
|
||||||
|
|
||||||
if (isClusterPageContext()) {
|
|
||||||
selfSubjectRulesReviewApi = new SelfSubjectRulesReviewApi({
|
|
||||||
objectConstructor: SelfSubjectRulesReview,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export {
|
|
||||||
selfSubjectRulesReviewApi,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|||||||
19
src/common/k8s-api/endpoints/service.api.injectable.ts
Normal file
19
src/common/k8s-api/endpoints/service.api.injectable.ts
Normal 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 } from "@ogre-tools/injectable";
|
||||||
|
import assert from "assert";
|
||||||
|
import { createStoresAndApisInjectionToken } from "../create-stores-apis.token";
|
||||||
|
import { ServiceApi } from "./service.api";
|
||||||
|
|
||||||
|
const serviceApiInjectable = getInjectable({
|
||||||
|
id: "service-api",
|
||||||
|
instantiate: (di) => {
|
||||||
|
assert(di.inject(createStoresAndApisInjectionToken), "serviceApi is only available in certain environments");
|
||||||
|
|
||||||
|
return new ServiceApi();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default serviceApiInjectable;
|
||||||
@ -7,7 +7,6 @@ import type { KubeObjectScope } from "../kube-object";
|
|||||||
import { KubeObject } from "../kube-object";
|
import { KubeObject } from "../kube-object";
|
||||||
import type { DerivedKubeApiOptions } from "../kube-api";
|
import type { DerivedKubeApiOptions } from "../kube-api";
|
||||||
import { KubeApi } from "../kube-api";
|
import { KubeApi } from "../kube-api";
|
||||||
import { isClusterPageContext } from "../../utils/cluster-id-url-parsing";
|
|
||||||
|
|
||||||
export interface ServicePort {
|
export interface ServicePort {
|
||||||
name?: string;
|
name?: string;
|
||||||
@ -133,7 +132,3 @@ export class ServiceApi extends KubeApi<Service> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const serviceApi = isClusterPageContext()
|
|
||||||
? new ServiceApi()
|
|
||||||
: undefined as never;
|
|
||||||
|
|||||||
19
src/common/k8s-api/endpoints/storage-class.api.injectable.ts
Normal file
19
src/common/k8s-api/endpoints/storage-class.api.injectable.ts
Normal 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 } from "@ogre-tools/injectable";
|
||||||
|
import assert from "assert";
|
||||||
|
import { createStoresAndApisInjectionToken } from "../create-stores-apis.token";
|
||||||
|
import { StorageClassApi } from "./storage-class.api";
|
||||||
|
|
||||||
|
const storageClassApiInjectable = getInjectable({
|
||||||
|
id: "storage-class-api",
|
||||||
|
instantiate: (di) => {
|
||||||
|
assert(di.inject(createStoresAndApisInjectionToken), "storageClassApi is only available in certain environments");
|
||||||
|
|
||||||
|
return new StorageClassApi();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default storageClassApiInjectable;
|
||||||
@ -9,7 +9,6 @@ import { KubeObject } from "../kube-object";
|
|||||||
import type { DerivedKubeApiOptions } from "../kube-api";
|
import type { DerivedKubeApiOptions } from "../kube-api";
|
||||||
import { KubeApi } from "../kube-api";
|
import { KubeApi } from "../kube-api";
|
||||||
import type { KubeJsonApiData } from "../kube-json-api";
|
import type { KubeJsonApiData } from "../kube-json-api";
|
||||||
import { isClusterPageContext } from "../../utils/cluster-id-url-parsing";
|
|
||||||
|
|
||||||
export interface TopologySelectorLabelRequirement {
|
export interface TopologySelectorLabelRequirement {
|
||||||
key: string;
|
key: string;
|
||||||
@ -90,7 +89,3 @@ export class StorageClassApi extends KubeApi<StorageClass, StorageClassData> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const storageClassApi = isClusterPageContext()
|
|
||||||
? new StorageClassApi()
|
|
||||||
: undefined as never;
|
|
||||||
|
|||||||
@ -42,34 +42,34 @@ export { KubeApi, forCluster, forRemoteCluster } from "../../common/k8s-api/kube
|
|||||||
export { KubeObject, KubeStatus } from "../../common/k8s-api/kube-object";
|
export { KubeObject, KubeStatus } from "../../common/k8s-api/kube-object";
|
||||||
export { KubeObjectStore } from "../../common/k8s-api/kube-object.store";
|
export { KubeObjectStore } from "../../common/k8s-api/kube-object.store";
|
||||||
export { Pod, PodApi as PodsApi } from "../../common/k8s-api/endpoints/pod.api";
|
export { Pod, PodApi as PodsApi } from "../../common/k8s-api/endpoints/pod.api";
|
||||||
export { Node, nodeApi as nodesApi, NodeApi as NodesApi } from "../../common/k8s-api/endpoints/nodes.api";
|
export { Node, nodeApi as nodesApi, NodeApi as NodesApi } from "../../common/k8s-api/endpoints/node.api";
|
||||||
export { Deployment, DeploymentApi } from "../../common/k8s-api/endpoints/deployment.api";
|
export { Deployment, DeploymentApi } from "../../common/k8s-api/endpoints/deployment.api";
|
||||||
export { DaemonSet } from "../../common/k8s-api/endpoints/daemon-set.api";
|
export { DaemonSet } from "../../common/k8s-api/endpoints/daemon-set.api";
|
||||||
export { StatefulSet } from "../../common/k8s-api/endpoints/stateful-set.api";
|
export { StatefulSet } from "../../common/k8s-api/endpoints/stateful-set.api";
|
||||||
export { Job } from "../../common/k8s-api/endpoints/job.api";
|
export { Job } from "../../common/k8s-api/endpoints/job.api";
|
||||||
export { CronJob } from "../../common/k8s-api/endpoints/cron-job.api";
|
export { CronJob } from "../../common/k8s-api/endpoints/cron-job.api";
|
||||||
export { ConfigMap, configMapApi } from "../../common/k8s-api/endpoints/configmap.api";
|
export { ConfigMap, configMapApi } from "../../common/k8s-api/endpoints/config-map.api";
|
||||||
export { Secret, secretApi as secretsApi } from "../../common/k8s-api/endpoints/secret.api";
|
export { Secret, secretApi as secretsApi } from "../../common/k8s-api/endpoints/secret.api";
|
||||||
export { ReplicaSet } from "../../common/k8s-api/endpoints/replica-set.api";
|
export { ReplicaSet } from "../../common/k8s-api/endpoints/replica-set.api";
|
||||||
export { ResourceQuota, resourceQuotaApi } from "../../common/k8s-api/endpoints/resource-quota.api";
|
export { ResourceQuota, resourceQuotaApi } from "../../common/k8s-api/endpoints/resource-quota.api";
|
||||||
export { LimitRange, limitRangeApi } from "../../common/k8s-api/endpoints/limit-range.api";
|
export { LimitRange, limitRangeApi } from "../../common/k8s-api/endpoints/limit-range.api";
|
||||||
export { HorizontalPodAutoscaler, horizontalPodAutoscalerApi as hpaApi } from "../../common/k8s-api/endpoints/hpa.api";
|
export { HorizontalPodAutoscaler, horizontalPodAutoscalerApi as hpaApi } from "../../common/k8s-api/endpoints/horizontal-pod-autoscaler.api";
|
||||||
export { PodDisruptionBudget, podDisruptionBudgetApi as pdbApi } from "../../common/k8s-api/endpoints/pod-disruption-budget.api";
|
export { PodDisruptionBudget, podDisruptionBudgetApi as pdbApi } from "../../common/k8s-api/endpoints/pod-disruption-budget.api";
|
||||||
export { Service, serviceApi } from "../../common/k8s-api/endpoints/service.api";
|
export { Service, serviceApi } from "../../common/k8s-api/endpoints/service.api";
|
||||||
export { Endpoints as Endpoint, endpointsApi as endpointApi } from "../../common/k8s-api/endpoints/endpoint.api";
|
export { Endpoints as Endpoint, endpointsApi as endpointApi } from "../../common/k8s-api/endpoints/endpoint.api";
|
||||||
export { Ingress, ingressApi, IngressApi } from "../../common/k8s-api/endpoints/ingress.api";
|
export { Ingress, ingressApi, IngressApi } from "../../common/k8s-api/endpoints/ingress.api";
|
||||||
export { NetworkPolicy, networkPolicyApi } from "../../common/k8s-api/endpoints/network-policy.api";
|
export { NetworkPolicy, networkPolicyApi } from "../../common/k8s-api/endpoints/network-policy.api";
|
||||||
export { PersistentVolume, persistentVolumeApi } from "../../common/k8s-api/endpoints/persistent-volume.api";
|
export { PersistentVolume, persistentVolumeApi } from "../../common/k8s-api/endpoints/persistent-volume.api";
|
||||||
export { PersistentVolumeClaim, persistentVolumeClaimApi as pvcApi, PersistentVolumeClaimApi as PersistentVolumeClaimsApi } from "../../common/k8s-api/endpoints/persistent-volume-claims.api";
|
export { PersistentVolumeClaim, persistentVolumeClaimApi as pvcApi, PersistentVolumeClaimApi as PersistentVolumeClaimsApi } from "../../common/k8s-api/endpoints/persistent-volume-claim.api";
|
||||||
export { StorageClass, storageClassApi } from "../../common/k8s-api/endpoints/storage-class.api";
|
export { StorageClass, storageClassApi } from "../../common/k8s-api/endpoints/storage-class.api";
|
||||||
export { Namespace, namespaceApi as namespacesApi } from "../../common/k8s-api/endpoints/namespaces.api";
|
export { Namespace, namespaceApi as namespacesApi } from "../../common/k8s-api/endpoints/namespace.api";
|
||||||
export { KubeEvent, eventApi } from "../../common/k8s-api/endpoints/events.api";
|
export { KubeEvent, eventApi } from "../../common/k8s-api/endpoints/events.api";
|
||||||
export { ServiceAccount } from "../../common/k8s-api/endpoints/service-account.api";
|
export { ServiceAccount } from "../../common/k8s-api/endpoints/service-account.api";
|
||||||
export { Role } from "../../common/k8s-api/endpoints/role.api";
|
export { Role } from "../../common/k8s-api/endpoints/role.api";
|
||||||
export { RoleBinding, roleBindingApi } from "../../common/k8s-api/endpoints/role-binding.api";
|
export { RoleBinding, roleBindingApi } from "../../common/k8s-api/endpoints/role-binding.api";
|
||||||
export { ClusterRole } from "../../common/k8s-api/endpoints/cluster-role.api";
|
export { ClusterRole } from "../../common/k8s-api/endpoints/cluster-role.api";
|
||||||
export { ClusterRoleBinding } from "../../common/k8s-api/endpoints/cluster-role-binding.api";
|
export { ClusterRoleBinding } from "../../common/k8s-api/endpoints/cluster-role-binding.api";
|
||||||
export { CustomResourceDefinition, crdApi } from "../../common/k8s-api/endpoints/crd.api";
|
export { CustomResourceDefinition, crdApi } from "../../common/k8s-api/endpoints/custom-resource-definition.api";
|
||||||
|
|
||||||
// types
|
// types
|
||||||
export type { ILocalKubeApiConfig, IRemoteKubeApiConfig, IKubeApiCluster } from "../../common/k8s-api/kube-api";
|
export type { ILocalKubeApiConfig, IRemoteKubeApiConfig, IKubeApiCluster } from "../../common/k8s-api/kube-api";
|
||||||
|
|||||||
@ -54,34 +54,34 @@ export { KubeApi, forCluster, forRemoteCluster } from "../../common/k8s-api/kube
|
|||||||
export { KubeObject, KubeStatus } from "../../common/k8s-api/kube-object";
|
export { KubeObject, KubeStatus } from "../../common/k8s-api/kube-object";
|
||||||
export { KubeObjectStore } from "../../common/k8s-api/kube-object.store";
|
export { KubeObjectStore } from "../../common/k8s-api/kube-object.store";
|
||||||
export { Pod, PodApi as PodsApi } from "../../common/k8s-api/endpoints/pod.api";
|
export { Pod, PodApi as PodsApi } from "../../common/k8s-api/endpoints/pod.api";
|
||||||
export { Node, nodeApi as nodesApi, NodeApi as NodesApi } from "../../common/k8s-api/endpoints/nodes.api";
|
export { Node, nodeApi as nodesApi, NodeApi as NodesApi } from "../../common/k8s-api/endpoints/node.api";
|
||||||
export { Deployment, DeploymentApi } from "../../common/k8s-api/endpoints/deployment.api";
|
export { Deployment, DeploymentApi } from "../../common/k8s-api/endpoints/deployment.api";
|
||||||
export { DaemonSet } from "../../common/k8s-api/endpoints/daemon-set.api";
|
export { DaemonSet } from "../../common/k8s-api/endpoints/daemon-set.api";
|
||||||
export { StatefulSet } from "../../common/k8s-api/endpoints/stateful-set.api";
|
export { StatefulSet } from "../../common/k8s-api/endpoints/stateful-set.api";
|
||||||
export { Job } from "../../common/k8s-api/endpoints/job.api";
|
export { Job } from "../../common/k8s-api/endpoints/job.api";
|
||||||
export { CronJob } from "../../common/k8s-api/endpoints/cron-job.api";
|
export { CronJob } from "../../common/k8s-api/endpoints/cron-job.api";
|
||||||
export { ConfigMap, configMapApi } from "../../common/k8s-api/endpoints/configmap.api";
|
export { ConfigMap, configMapApi } from "../../common/k8s-api/endpoints/config-map.api";
|
||||||
export { Secret, secretApi as secretsApi } from "../../common/k8s-api/endpoints/secret.api";
|
export { Secret, secretApi as secretsApi } from "../../common/k8s-api/endpoints/secret.api";
|
||||||
export { ReplicaSet } from "../../common/k8s-api/endpoints/replica-set.api";
|
export { ReplicaSet } from "../../common/k8s-api/endpoints/replica-set.api";
|
||||||
export { ResourceQuota, resourceQuotaApi } from "../../common/k8s-api/endpoints/resource-quota.api";
|
export { ResourceQuota, resourceQuotaApi } from "../../common/k8s-api/endpoints/resource-quota.api";
|
||||||
export { LimitRange, limitRangeApi } from "../../common/k8s-api/endpoints/limit-range.api";
|
export { LimitRange, limitRangeApi } from "../../common/k8s-api/endpoints/limit-range.api";
|
||||||
export { HorizontalPodAutoscaler, horizontalPodAutoscalerApi as hpaApi } from "../../common/k8s-api/endpoints/hpa.api";
|
export { HorizontalPodAutoscaler, horizontalPodAutoscalerApi as hpaApi } from "../../common/k8s-api/endpoints/horizontal-pod-autoscaler.api";
|
||||||
export { PodDisruptionBudget, podDisruptionBudgetApi as pdbApi } from "../../common/k8s-api/endpoints/pod-disruption-budget.api";
|
export { PodDisruptionBudget, podDisruptionBudgetApi as pdbApi } from "../../common/k8s-api/endpoints/pod-disruption-budget.api";
|
||||||
export { Service, serviceApi } from "../../common/k8s-api/endpoints/service.api";
|
export { Service, serviceApi } from "../../common/k8s-api/endpoints/service.api";
|
||||||
export { Endpoints as Endpoint, endpointsApi as endpointApi } from "../../common/k8s-api/endpoints/endpoint.api";
|
export { Endpoints as Endpoint, endpointsApi as endpointApi } from "../../common/k8s-api/endpoints/endpoint.api";
|
||||||
export { Ingress, ingressApi, IngressApi } from "../../common/k8s-api/endpoints/ingress.api";
|
export { Ingress, ingressApi, IngressApi } from "../../common/k8s-api/endpoints/ingress.api";
|
||||||
export { NetworkPolicy, networkPolicyApi } from "../../common/k8s-api/endpoints/network-policy.api";
|
export { NetworkPolicy, networkPolicyApi } from "../../common/k8s-api/endpoints/network-policy.api";
|
||||||
export { PersistentVolume, persistentVolumeApi } from "../../common/k8s-api/endpoints/persistent-volume.api";
|
export { PersistentVolume, persistentVolumeApi } from "../../common/k8s-api/endpoints/persistent-volume.api";
|
||||||
export { PersistentVolumeClaim, persistentVolumeClaimApi as pvcApi, PersistentVolumeClaimApi as PersistentVolumeClaimsApi } from "../../common/k8s-api/endpoints/persistent-volume-claims.api";
|
export { PersistentVolumeClaim, persistentVolumeClaimApi as pvcApi, PersistentVolumeClaimApi as PersistentVolumeClaimsApi } from "../../common/k8s-api/endpoints/persistent-volume-claim.api";
|
||||||
export { StorageClass, storageClassApi } from "../../common/k8s-api/endpoints/storage-class.api";
|
export { StorageClass, storageClassApi } from "../../common/k8s-api/endpoints/storage-class.api";
|
||||||
export { Namespace, namespaceApi as namespacesApi } from "../../common/k8s-api/endpoints/namespaces.api";
|
export { Namespace, namespaceApi as namespacesApi } from "../../common/k8s-api/endpoints/namespace.api";
|
||||||
export { KubeEvent, eventApi } from "../../common/k8s-api/endpoints/events.api";
|
export { KubeEvent, eventApi } from "../../common/k8s-api/endpoints/events.api";
|
||||||
export { ServiceAccount } from "../../common/k8s-api/endpoints/service-account.api";
|
export { ServiceAccount } from "../../common/k8s-api/endpoints/service-account.api";
|
||||||
export { Role } from "../../common/k8s-api/endpoints/role.api";
|
export { Role } from "../../common/k8s-api/endpoints/role.api";
|
||||||
export { RoleBinding, roleBindingApi } from "../../common/k8s-api/endpoints/role-binding.api";
|
export { RoleBinding, roleBindingApi } from "../../common/k8s-api/endpoints/role-binding.api";
|
||||||
export { ClusterRole } from "../../common/k8s-api/endpoints/cluster-role.api";
|
export { ClusterRole } from "../../common/k8s-api/endpoints/cluster-role.api";
|
||||||
export { ClusterRoleBinding } from "../../common/k8s-api/endpoints/cluster-role-binding.api";
|
export { ClusterRoleBinding } from "../../common/k8s-api/endpoints/cluster-role-binding.api";
|
||||||
export { CustomResourceDefinition, crdApi } from "../../common/k8s-api/endpoints/crd.api";
|
export { CustomResourceDefinition, crdApi } from "../../common/k8s-api/endpoints/custom-resource-definition.api";
|
||||||
export { KubeObjectStatusLevel } from "./kube-object-status";
|
export { KubeObjectStatusLevel } from "./kube-object-status";
|
||||||
|
|
||||||
// types
|
// types
|
||||||
|
|||||||
@ -12,8 +12,8 @@ import { DrawerItem, DrawerTitle } from "../drawer";
|
|||||||
import { Badge } from "../badge";
|
import { Badge } from "../badge";
|
||||||
import type { KubeObjectDetailsProps } from "../kube-object-details";
|
import type { KubeObjectDetailsProps } from "../kube-object-details";
|
||||||
import { cssNames } from "../../utils";
|
import { cssNames } from "../../utils";
|
||||||
import type { HorizontalPodAutoscalerMetricSpec, HorizontalPodAutoscalerMetricTarget } from "../../../common/k8s-api/endpoints/hpa.api";
|
import type { HorizontalPodAutoscalerMetricSpec, HorizontalPodAutoscalerMetricTarget } from "../../../common/k8s-api/endpoints/horizontal-pod-autoscaler.api";
|
||||||
import { HorizontalPodAutoscaler, HpaMetricType } from "../../../common/k8s-api/endpoints/hpa.api";
|
import { HorizontalPodAutoscaler, HpaMetricType } from "../../../common/k8s-api/endpoints/horizontal-pod-autoscaler.api";
|
||||||
import { Table, TableCell, TableHead, TableRow } from "../table";
|
import { Table, TableCell, TableHead, TableRow } from "../table";
|
||||||
import { apiManager } from "../../../common/k8s-api/api-manager";
|
import { apiManager } from "../../../common/k8s-api/api-manager";
|
||||||
import { KubeObjectMeta } from "../kube-object-meta";
|
import { KubeObjectMeta } from "../kube-object-meta";
|
||||||
|
|||||||
@ -4,8 +4,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { KubeObjectStore } from "../../../common/k8s-api/kube-object.store";
|
import { KubeObjectStore } from "../../../common/k8s-api/kube-object.store";
|
||||||
import type { HorizontalPodAutoscaler, HorizontalPodAutoscalerApi } from "../../../common/k8s-api/endpoints/hpa.api";
|
import type { HorizontalPodAutoscaler, HorizontalPodAutoscalerApi } from "../../../common/k8s-api/endpoints/horizontal-pod-autoscaler.api";
|
||||||
import { horizontalPodAutoscalerApi } from "../../../common/k8s-api/endpoints/hpa.api";
|
import { horizontalPodAutoscalerApi } from "../../../common/k8s-api/endpoints/horizontal-pod-autoscaler.api";
|
||||||
import { apiManager } from "../../../common/k8s-api/api-manager";
|
import { apiManager } from "../../../common/k8s-api/api-manager";
|
||||||
import { isClusterPageContext } from "../../utils";
|
import { isClusterPageContext } from "../../utils";
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import "./hpa.scss";
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
import { KubeObjectListLayout } from "../kube-object-list-layout";
|
import { KubeObjectListLayout } from "../kube-object-list-layout";
|
||||||
import type { HorizontalPodAutoscaler } from "../../../common/k8s-api/endpoints/hpa.api";
|
import type { HorizontalPodAutoscaler } from "../../../common/k8s-api/endpoints/horizontal-pod-autoscaler.api";
|
||||||
import { hpaStore } from "./hpa.store";
|
import { hpaStore } from "./hpa.store";
|
||||||
import { Badge } from "../badge";
|
import { Badge } from "../badge";
|
||||||
import { cssNames } from "../../utils";
|
import { cssNames } from "../../utils";
|
||||||
@ -40,7 +40,7 @@ export class HorizontalPodAutoscalers extends React.Component {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<p>
|
<p>
|
||||||
{hpa.getMetricValues(metrics[0])}
|
{hpa.getMetricValues(metrics[0])}
|
||||||
{" "}
|
{" "}
|
||||||
{metricsRemain}
|
{metricsRemain}
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@ -4,8 +4,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { KubeObjectStore } from "../../../common/k8s-api/kube-object.store";
|
import { KubeObjectStore } from "../../../common/k8s-api/kube-object.store";
|
||||||
import type { ConfigMap, ConfigMapApi, ConfigMapData } from "../../../common/k8s-api/endpoints/configmap.api";
|
import type { ConfigMap, ConfigMapApi, ConfigMapData } from "../../../common/k8s-api/endpoints/config-map.api";
|
||||||
import { configMapApi } from "../../../common/k8s-api/endpoints/configmap.api";
|
import { configMapApi } from "../../../common/k8s-api/endpoints/config-map.api";
|
||||||
import { apiManager } from "../../../common/k8s-api/api-manager";
|
import { apiManager } from "../../../common/k8s-api/api-manager";
|
||||||
import { isClusterPageContext } from "../../utils";
|
import { isClusterPageContext } from "../../utils";
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import "./crd-details.scss";
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
import { CustomResourceDefinition } from "../../../common/k8s-api/endpoints/crd.api";
|
import { CustomResourceDefinition } from "../../../common/k8s-api/endpoints/custom-resource-definition.api";
|
||||||
import { Badge } from "../badge";
|
import { Badge } from "../badge";
|
||||||
import { DrawerItem, DrawerTitle } from "../drawer";
|
import { DrawerItem, DrawerTitle } from "../drawer";
|
||||||
import type { KubeObjectDetailsProps } from "../kube-object-details";
|
import type { KubeObjectDetailsProps } from "../kube-object-details";
|
||||||
|
|||||||
@ -13,8 +13,8 @@ import { DrawerItem } from "../drawer";
|
|||||||
import type { KubeObjectDetailsProps } from "../kube-object-details";
|
import type { KubeObjectDetailsProps } from "../kube-object-details";
|
||||||
import { KubeObjectMeta } from "../kube-object-meta";
|
import { KubeObjectMeta } from "../kube-object-meta";
|
||||||
import { Input } from "../input";
|
import { Input } from "../input";
|
||||||
import type { AdditionalPrinterColumnsV1 } from "../../../common/k8s-api/endpoints/crd.api";
|
import type { AdditionalPrinterColumnsV1 } from "../../../common/k8s-api/endpoints/custom-resource-definition.api";
|
||||||
import { CustomResourceDefinition } from "../../../common/k8s-api/endpoints/crd.api";
|
import { CustomResourceDefinition } from "../../../common/k8s-api/endpoints/custom-resource-definition.api";
|
||||||
import { convertKubectlJsonPathToNodeJsonPath } from "../../utils/jsonPath";
|
import { convertKubectlJsonPathToNodeJsonPath } from "../../utils/jsonPath";
|
||||||
import type { KubeObjectStatus } from "../../../common/k8s-api/kube-object";
|
import type { KubeObjectStatus } from "../../../common/k8s-api/kube-object";
|
||||||
import { KubeObject } from "../../../common/k8s-api/kube-object";
|
import { KubeObject } from "../../../common/k8s-api/kube-object";
|
||||||
|
|||||||
@ -6,8 +6,8 @@
|
|||||||
import { computed, reaction, makeObservable } from "mobx";
|
import { computed, reaction, makeObservable } from "mobx";
|
||||||
import { KubeObjectStore } from "../../../common/k8s-api/kube-object.store";
|
import { KubeObjectStore } from "../../../common/k8s-api/kube-object.store";
|
||||||
import { autoBind, isClusterPageContext } from "../../utils";
|
import { autoBind, isClusterPageContext } from "../../utils";
|
||||||
import type { CustomResourceDefinition, CustomResourceDefinitionApi } from "../../../common/k8s-api/endpoints/crd.api";
|
import type { CustomResourceDefinition, CustomResourceDefinitionApi } from "../../../common/k8s-api/endpoints/custom-resource-definition.api";
|
||||||
import { crdApi } from "../../../common/k8s-api/endpoints/crd.api";
|
import { crdApi } from "../../../common/k8s-api/endpoints/custom-resource-definition.api";
|
||||||
import { apiManager } from "../../../common/k8s-api/api-manager";
|
import { apiManager } from "../../../common/k8s-api/api-manager";
|
||||||
import { KubeApi } from "../../../common/k8s-api/kube-api";
|
import { KubeApi } from "../../../common/k8s-api/kube-api";
|
||||||
import { CRDResourceStore } from "./crd-resource.store";
|
import { CRDResourceStore } from "./crd-resource.store";
|
||||||
|
|||||||
@ -9,8 +9,8 @@ import type { StorageLayer } from "../../../utils";
|
|||||||
import { autoBind, noop, toggle } from "../../../utils";
|
import { autoBind, noop, toggle } from "../../../utils";
|
||||||
import type { KubeObjectStoreLoadingParams } from "../../../../common/k8s-api/kube-object.store";
|
import type { KubeObjectStoreLoadingParams } from "../../../../common/k8s-api/kube-object.store";
|
||||||
import { KubeObjectStore } from "../../../../common/k8s-api/kube-object.store";
|
import { KubeObjectStore } from "../../../../common/k8s-api/kube-object.store";
|
||||||
import type { NamespaceApi } from "../../../../common/k8s-api/endpoints/namespaces.api";
|
import type { NamespaceApi } from "../../../../common/k8s-api/endpoints/namespace.api";
|
||||||
import { Namespace } from "../../../../common/k8s-api/endpoints/namespaces.api";
|
import { Namespace } from "../../../../common/k8s-api/endpoints/namespace.api";
|
||||||
|
|
||||||
interface Dependencies {
|
interface Dependencies {
|
||||||
storage: StorageLayer<string[] | undefined>;
|
storage: StorageLayer<string[] | undefined>;
|
||||||
|
|||||||
@ -10,8 +10,8 @@ import { cssNames, interval } from "../../utils";
|
|||||||
import { TabLayout } from "../layout/tab-layout-2";
|
import { TabLayout } from "../layout/tab-layout-2";
|
||||||
import { nodesStore } from "./nodes.store";
|
import { nodesStore } from "./nodes.store";
|
||||||
import { KubeObjectListLayout } from "../kube-object-list-layout";
|
import { KubeObjectListLayout } from "../kube-object-list-layout";
|
||||||
import type { NodeMetricData, Node } from "../../../common/k8s-api/endpoints/nodes.api";
|
import type { NodeMetricData, Node } from "../../../common/k8s-api/endpoints/node.api";
|
||||||
import { formatNodeTaint, getMetricsForAllNodes } from "../../../common/k8s-api/endpoints/nodes.api";
|
import { formatNodeTaint, getMetricsForAllNodes } from "../../../common/k8s-api/endpoints/node.api";
|
||||||
import { LineProgress } from "../line-progress";
|
import { LineProgress } from "../line-progress";
|
||||||
import { bytesToUnits } from "../../../common/utils/convertMemory";
|
import { bytesToUnits } from "../../../common/utils/convertMemory";
|
||||||
import { Tooltip, TooltipPosition } from "../tooltip";
|
import { Tooltip, TooltipPosition } from "../tooltip";
|
||||||
@ -224,7 +224,7 @@ export class NodesRoute extends React.Component {
|
|||||||
flat
|
flat
|
||||||
key="name"
|
key="name"
|
||||||
label={node.getName()}
|
label={node.getName()}
|
||||||
tooltip={node.getName()}
|
tooltip={node.getName()}
|
||||||
/>,
|
/>,
|
||||||
<KubeObjectStatusIcon key="icon" object={node} />,
|
<KubeObjectStatusIcon key="icon" object={node} />,
|
||||||
this.renderCpuUsage(node),
|
this.renderCpuUsage(node),
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import React from "react";
|
|||||||
import { KubeObjectListLayout } from "../../kube-object-list-layout";
|
import { KubeObjectListLayout } from "../../kube-object-list-layout";
|
||||||
import { KubeObjectStatusIcon } from "../../kube-object-status-icon";
|
import { KubeObjectStatusIcon } from "../../kube-object-status-icon";
|
||||||
import { AddRoleDialog } from "./add-dialog";
|
import { AddRoleDialog } from "./add-dialog";
|
||||||
import { rolesStore } from "./store";
|
import { roleStore } from "./legacy-store";
|
||||||
import { SiblingsInTabLayout } from "../../layout/siblings-in-tab-layout";
|
import { SiblingsInTabLayout } from "../../layout/siblings-in-tab-layout";
|
||||||
import { KubeObjectAge } from "../../kube-object/age";
|
import { KubeObjectAge } from "../../kube-object/age";
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ export class Roles extends React.Component {
|
|||||||
isConfigurable
|
isConfigurable
|
||||||
tableId="access_roles"
|
tableId="access_roles"
|
||||||
className="Roles"
|
className="Roles"
|
||||||
store={rolesStore}
|
store={roleStore}
|
||||||
sortingCallbacks={{
|
sortingCallbacks={{
|
||||||
[columnId.name]: role => role.getName(),
|
[columnId.name]: role => role.getName(),
|
||||||
[columnId.namespace]: role => role.getNs(),
|
[columnId.namespace]: role => role.getNs(),
|
||||||
|
|||||||
@ -86,7 +86,7 @@ export class CreateServiceAccountDialog extends React.Component<CreateServiceAcc
|
|||||||
id="create-dialog-namespace-select-input"
|
id="create-dialog-namespace-select-input"
|
||||||
themeName="light"
|
themeName="light"
|
||||||
value={namespace}
|
value={namespace}
|
||||||
onChange={namespace => this.namespace = namespace ?? "default"}
|
onChange={option => this.namespace = option?.namespace ?? "default"}
|
||||||
/>
|
/>
|
||||||
</WizardStep>
|
</WizardStep>
|
||||||
</Wizard>
|
</Wizard>
|
||||||
|
|||||||
@ -5,13 +5,14 @@
|
|||||||
|
|
||||||
import styles from "./avatar.module.scss";
|
import styles from "./avatar.module.scss";
|
||||||
|
|
||||||
import type { HTMLAttributes, ImgHTMLAttributes } from "react";
|
import type { ImgHTMLAttributes, MouseEventHandler } from "react";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import randomColor from "randomcolor";
|
import randomColor from "randomcolor";
|
||||||
import GraphemeSplitter from "grapheme-splitter";
|
import GraphemeSplitter from "grapheme-splitter";
|
||||||
|
import type { SingleOrMany } from "../../utils";
|
||||||
import { cssNames, isDefined, iter } from "../../utils";
|
import { cssNames, isDefined, iter } from "../../utils";
|
||||||
|
|
||||||
export interface AvatarProps extends HTMLAttributes<HTMLElement> {
|
export interface AvatarProps {
|
||||||
title: string;
|
title: string;
|
||||||
colorHash?: string;
|
colorHash?: string;
|
||||||
size?: number;
|
size?: number;
|
||||||
@ -20,6 +21,10 @@ export interface AvatarProps extends HTMLAttributes<HTMLElement> {
|
|||||||
variant?: "circle" | "rounded" | "square";
|
variant?: "circle" | "rounded" | "square";
|
||||||
imgProps?: ImgHTMLAttributes<HTMLImageElement>;
|
imgProps?: ImgHTMLAttributes<HTMLImageElement>;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
|
children?: SingleOrMany<React.ReactNode>;
|
||||||
|
className?: string;
|
||||||
|
id?: string;
|
||||||
|
onClick?: MouseEventHandler<HTMLDivElement>;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNameParts(name: string): string[] {
|
function getNameParts(name: string): string[] {
|
||||||
@ -57,7 +62,7 @@ function getLabelFromTitle(title: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function Avatar(props: AvatarProps) {
|
export function Avatar(props: AvatarProps) {
|
||||||
const { title, variant = "rounded", size = 32, colorHash, children, background, imgProps, src, className, disabled, ...rest } = props;
|
const { title, variant = "rounded", size = 32, colorHash, children, background, imgProps, src, className, disabled, id, onClick } = props;
|
||||||
const colorFromHash = randomColor({ seed: colorHash, luminosity: "dark" });
|
const colorFromHash = randomColor({ seed: colorHash, luminosity: "dark" });
|
||||||
|
|
||||||
const renderContents = () => {
|
const renderContents = () => {
|
||||||
@ -86,7 +91,8 @@ export function Avatar(props: AvatarProps) {
|
|||||||
height: `${size}px`,
|
height: `${size}px`,
|
||||||
background: background || (src ? "transparent" : colorFromHash),
|
background: background || (src ? "transparent" : colorFromHash),
|
||||||
}}
|
}}
|
||||||
{...rest}
|
id={id}
|
||||||
|
onClick={onClick}
|
||||||
>
|
>
|
||||||
{renderContents()}
|
{renderContents()}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -5,9 +5,8 @@
|
|||||||
|
|
||||||
import styles from "./hotbar-entity-icon.module.scss";
|
import styles from "./hotbar-entity-icon.module.scss";
|
||||||
|
|
||||||
import type { HTMLAttributes } from "react";
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { makeObservable, observable } from "mobx";
|
import { observable } from "mobx";
|
||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
|
|
||||||
import type { CatalogCategoryRegistry, CatalogEntity, CatalogEntityContextMenu } from "../../../common/catalog";
|
import type { CatalogCategoryRegistry, CatalogEntity, CatalogEntityContextMenu } from "../../../common/catalog";
|
||||||
@ -23,13 +22,15 @@ import { withInjectables } from "@ogre-tools/injectable-react";
|
|||||||
import catalogCategoryRegistryInjectable from "../../../common/catalog/category-registry.injectable";
|
import catalogCategoryRegistryInjectable from "../../../common/catalog/category-registry.injectable";
|
||||||
import onContextMenuOpenInjectable from "../../../common/catalog/on-context-menu-open.injectable";
|
import onContextMenuOpenInjectable from "../../../common/catalog/on-context-menu-open.injectable";
|
||||||
|
|
||||||
export interface HotbarEntityIconProps extends HTMLAttributes<HTMLElement> {
|
export interface HotbarEntityIconProps {
|
||||||
entity: CatalogEntity;
|
entity: CatalogEntity;
|
||||||
index: number;
|
index: number;
|
||||||
errorClass?: IClassName;
|
errorClass?: IClassName;
|
||||||
add: (item: CatalogEntity, index: number) => void;
|
add: (item: CatalogEntity, index: number) => void;
|
||||||
remove: (uid: string) => void;
|
remove: (uid: string) => void;
|
||||||
size?: number;
|
size?: number;
|
||||||
|
onClick?: () => void;
|
||||||
|
className?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Dependencies {
|
interface Dependencies {
|
||||||
@ -41,11 +42,6 @@ interface Dependencies {
|
|||||||
class NonInjectedHotbarEntityIcon extends React.Component<HotbarEntityIconProps & Dependencies> {
|
class NonInjectedHotbarEntityIcon extends React.Component<HotbarEntityIconProps & Dependencies> {
|
||||||
private readonly menuItems = observable.array<CatalogEntityContextMenu>();
|
private readonly menuItems = observable.array<CatalogEntityContextMenu>();
|
||||||
|
|
||||||
constructor(props: HotbarEntityIconProps & Dependencies) {
|
|
||||||
super(props);
|
|
||||||
makeObservable(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
get kindIcon() {
|
get kindIcon() {
|
||||||
const className = styles.badge;
|
const className = styles.badge;
|
||||||
const category = this.props.catalogCategoryRegistry.getCategoryForEntity(this.props.entity);
|
const category = this.props.catalogCategoryRegistry.getCategoryForEntity(this.props.entity);
|
||||||
@ -56,9 +52,9 @@ class NonInjectedHotbarEntityIcon extends React.Component<HotbarEntityIconProps
|
|||||||
|
|
||||||
if (Icon.isSvg(category.metadata.icon)) {
|
if (Icon.isSvg(category.metadata.icon)) {
|
||||||
return <Icon svg={category.metadata.icon} className={className} />;
|
return <Icon svg={category.metadata.icon} className={className} />;
|
||||||
} else {
|
|
||||||
return <Icon material={category.metadata.icon} className={className} />;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return <Icon material={category.metadata.icon} className={className} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
get ledIcon() {
|
get ledIcon() {
|
||||||
@ -66,9 +62,14 @@ class NonInjectedHotbarEntityIcon extends React.Component<HotbarEntityIconProps
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const className = cssNames(styles.led, { [styles.online]: this.props.entity.status.phase === LensKubernetesClusterStatus.CONNECTED }); // TODO: make it more generic
|
return (
|
||||||
|
<div
|
||||||
return <div className={className} />;
|
className={cssNames(styles.led, {
|
||||||
|
// TODO: make it more generic
|
||||||
|
[styles.online]: this.props.entity.status.phase === LensKubernetesClusterStatus.CONNECTED,
|
||||||
|
})}
|
||||||
|
/>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
isActive(item: CatalogEntity) {
|
isActive(item: CatalogEntity) {
|
||||||
@ -88,7 +89,7 @@ class NonInjectedHotbarEntityIcon extends React.Component<HotbarEntityIconProps
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { entity, errorClass, add, remove, index, children, ...elemProps } = this.props;
|
const { entity, className, onClick } = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<HotbarIcon
|
<HotbarIcon
|
||||||
@ -98,7 +99,7 @@ class NonInjectedHotbarEntityIcon extends React.Component<HotbarEntityIconProps
|
|||||||
src={entity.spec.icon?.src}
|
src={entity.spec.icon?.src}
|
||||||
material={entity.spec.icon?.material}
|
material={entity.spec.icon?.material}
|
||||||
background={entity.spec.icon?.background}
|
background={entity.spec.icon?.background}
|
||||||
className={this.props.className}
|
className={className}
|
||||||
active={this.isActive(entity)}
|
active={this.isActive(entity)}
|
||||||
onMenuOpen={() => this.onMenuOpen()}
|
onMenuOpen={() => this.onMenuOpen()}
|
||||||
disabled={!entity}
|
disabled={!entity}
|
||||||
@ -108,7 +109,7 @@ class NonInjectedHotbarEntityIcon extends React.Component<HotbarEntityIconProps
|
|||||||
? `${entity.getName()} (${entity.metadata.source})`
|
? `${entity.getName()} (${entity.metadata.source})`
|
||||||
: entity.getName()
|
: entity.getName()
|
||||||
)}
|
)}
|
||||||
{...elemProps}
|
onClick={onClick}
|
||||||
>
|
>
|
||||||
{ this.ledIcon }
|
{ this.ledIcon }
|
||||||
{ this.kindIcon }
|
{ this.kindIcon }
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user