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

Merge branch 'fix/remove-window-manager-from-extension-api' of github.com:lensapp/lens into fix/remove-window-manager-from-extension-api

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen 2020-11-11 19:33:09 +02:00
commit 4afb6d9b80
6 changed files with 31 additions and 8 deletions

View File

@ -8,11 +8,13 @@ import * as EventBus from "./event-bus"
import * as Store from "./stores" import * as Store from "./stores"
import * as Util from "./utils" import * as Util from "./utils"
import * as ClusterFeature from "./cluster-feature" import * as ClusterFeature from "./cluster-feature"
import * as Interface from "../interfaces"
export { export {
App, App,
EventBus, EventBus,
ClusterFeature, ClusterFeature,
Interface,
Store, Store,
Util, Util,
} }

View File

@ -0,0 +1 @@
export * from "./registrations"

View File

@ -0,0 +1,7 @@
export type { AppPreferenceRegistration, AppPreferenceComponents } from "../registries/app-preference-registry"
export type { ClusterFeatureRegistration, ClusterFeatureComponents } from "../registries/cluster-feature-registry"
export type { KubeObjectDetailRegistration, KubeObjectDetailComponents } from "../registries/kube-object-detail-registry"
export type { KubeObjectMenuRegistration, KubeObjectMenuComponents } from "../registries/kube-object-menu-registry"
export type { KubeObjectStatusRegistration } from "../registries/kube-object-status-registry"
export type { PageRegistration, PageComponents } from "../registries/page-registry"
export type { StatusBarRegistration } from "../registries/status-bar-registry"

View File

@ -3,10 +3,11 @@ export { apiManager } from "../../renderer/api/api-manager";
export { KubeObjectStore } from "../../renderer/kube-object.store" export { KubeObjectStore } from "../../renderer/kube-object.store"
export { KubeApi, forCluster, IKubeApiCluster } from "../../renderer/api/kube-api"; export { KubeApi, forCluster, IKubeApiCluster } from "../../renderer/api/kube-api";
export type { EventStore } from "../../renderer/components/+events/event.store" export type { EventStore } from "../../renderer/components/+events/event.store"
export { VersionedKubeApi } from "../../renderer/api/kube-api-versioned";
export { KubeObject } from "../../renderer/api/kube-object"; export { KubeObject } from "../../renderer/api/kube-object";
export { Pod, podsApi, IPodContainer, IPodContainerStatus } from "../../renderer/api/endpoints"; export { Pod, podsApi, PodsApi, IPodContainer, IPodContainerStatus } from "../../renderer/api/endpoints";
export { Node, nodesApi } from "../../renderer/api/endpoints"; export { Node, nodesApi, NodesApi } from "../../renderer/api/endpoints";
export { Deployment, deploymentApi } from "../../renderer/api/endpoints"; export { Deployment, deploymentApi, DeploymentApi } from "../../renderer/api/endpoints";
export { DaemonSet, daemonSetApi } from "../../renderer/api/endpoints"; export { DaemonSet, daemonSetApi } from "../../renderer/api/endpoints";
export { StatefulSet, statefulSetApi } from "../../renderer/api/endpoints"; export { StatefulSet, statefulSetApi } from "../../renderer/api/endpoints";
export { Job, jobApi } from "../../renderer/api/endpoints"; export { Job, jobApi } from "../../renderer/api/endpoints";
@ -19,10 +20,10 @@ export { HorizontalPodAutoscaler, hpaApi } from "../../renderer/api/endpoints";
export { PodDisruptionBudget, pdbApi } from "../../renderer/api/endpoints"; export { PodDisruptionBudget, pdbApi } from "../../renderer/api/endpoints";
export { Service, serviceApi } from "../../renderer/api/endpoints"; export { Service, serviceApi } from "../../renderer/api/endpoints";
export { Endpoint, endpointApi } from "../../renderer/api/endpoints"; export { Endpoint, endpointApi } from "../../renderer/api/endpoints";
export { Ingress, ingressApi } from "../../renderer/api/endpoints"; export { Ingress, ingressApi, IngressApi } from "../../renderer/api/endpoints";
export { NetworkPolicy, networkPolicyApi } from "../../renderer/api/endpoints"; export { NetworkPolicy, networkPolicyApi } from "../../renderer/api/endpoints";
export { PersistentVolume, persistentVolumeApi } from "../../renderer/api/endpoints"; export { PersistentVolume, persistentVolumeApi } from "../../renderer/api/endpoints";
export { PersistentVolumeClaim, PersistentVolumeClaimsApi } from "../../renderer/api/endpoints"; export { PersistentVolumeClaim, pvcApi, PersistentVolumeClaimsApi } from "../../renderer/api/endpoints";
export { StorageClass, storageClassApi } from "../../renderer/api/endpoints"; export { StorageClass, storageClassApi } from "../../renderer/api/endpoints";
export { Namespace, namespacesApi } from "../../renderer/api/endpoints"; export { Namespace, namespacesApi } from "../../renderer/api/endpoints";
export { KubeEvent, eventApi } from "../../renderer/api/endpoints"; export { KubeEvent, eventApi } from "../../renderer/api/endpoints";
@ -32,4 +33,4 @@ export { RoleBinding, roleBindingApi } from "../../renderer/api/endpoints";
export { ClusterRole, clusterRoleApi } from "../../renderer/api/endpoints"; export { ClusterRole, clusterRoleApi } from "../../renderer/api/endpoints";
export { ClusterRoleBinding, clusterRoleBindingApi } from "../../renderer/api/endpoints"; export { ClusterRoleBinding, clusterRoleBindingApi } from "../../renderer/api/endpoints";
export { CustomResourceDefinition, crdApi } from "../../renderer/api/endpoints"; export { CustomResourceDefinition, crdApi } from "../../renderer/api/endpoints";
export { KubeObjectStatus, KubeObjectStatusLevel} from "./kube-object-status" export { KubeObjectStatus, KubeObjectStatusLevel} from "./kube-object-status"

View File

@ -51,6 +51,6 @@ export class VersionedKubeApi<T extends KubeObject = any> extends KubeApi<T> {
namespace: isNamespaced ? namespace : undefined, namespace: isNamespaced ? namespace : undefined,
name: name, name: name,
}); });
return resourcePath + (query ? `?` + stringify(query) : ""); return resourcePath + (query ? `?` + stringify(this.normalizeQuery(query)) : "");
} }
} }

View File

@ -24,6 +24,8 @@ export interface IKubeApiQueryParams {
timeoutSeconds?: number; timeoutSeconds?: number;
limit?: number; // doesn't work with ?watch limit?: number; // doesn't work with ?watch
continue?: string; // might be used with ?limit from second request continue?: string; // might be used with ?limit from second request
labelSelector?: string | string[]; // restrict list of objects by their labels, e.g. labelSelector: ["label=value"]
fieldSelector?: string | string[]; // restrict list of objects by their fields, e.g. fieldSelector: "field=name"
} }
export interface IKubeApiCluster { export interface IKubeApiCluster {
@ -114,7 +116,17 @@ export class KubeApi<T extends KubeObject = any> {
namespace: this.isNamespaced ? namespace : undefined, namespace: this.isNamespaced ? namespace : undefined,
name: name, name: name,
}); });
return resourcePath + (query ? `?` + stringify(query) : ""); return resourcePath + (query ? `?` + stringify(this.normalizeQuery(query)) : "");
}
protected normalizeQuery(query: Partial<IKubeApiQueryParams> = {}) {
if (query.labelSelector) {
query.labelSelector = [query.labelSelector].flat().join(",")
}
if (query.fieldSelector) {
query.fieldSelector = [query.fieldSelector].flat().join(",")
}
return query;
} }
protected parseResponse(data: KubeJsonApiData | KubeJsonApiData[] | KubeJsonApiDataList, namespace?: string): any { protected parseResponse(data: KubeJsonApiData | KubeJsonApiData[] | KubeJsonApiDataList, namespace?: string): any {