@k8slens/extensions 5.3.0-git.81b972a2d0.0 → 5.3.0-git.820b2d1b7a.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/src/common/{utils/makeCss.d.ts → __tests__/base-store.test.d.ts} +1 -9
  2. package/dist/src/common/base-store.d.ts +3 -2
  3. package/dist/src/common/cluster-store.d.ts +2 -3
  4. package/dist/src/common/cluster-types.d.ts +7 -1
  5. package/dist/src/common/hotbar-store.d.ts +1 -0
  6. package/dist/src/common/k8s-api/endpoints/ingress.api.d.ts +10 -7
  7. package/dist/src/common/k8s-api/endpoints/job.api.d.ts +0 -1
  8. package/dist/src/common/k8s-api/kube-api.d.ts +12 -3
  9. package/dist/src/common/k8s-api/kube-object.d.ts +9 -1
  10. package/dist/src/common/k8s-api/kube-object.store.d.ts +25 -7
  11. package/dist/src/common/k8s-api/kube-watch-api.d.ts +29 -8
  12. package/dist/src/common/user-store/user-store.d.ts +1 -0
  13. package/dist/src/common/utils/paths.d.ts +1 -0
  14. package/dist/src/common/weblink-store.d.ts +1 -0
  15. package/dist/src/extensions/extension-api.js +219 -184
  16. package/dist/src/extensions/extension-store.d.ts +1 -0
  17. package/dist/src/extensions/extensions-store.d.ts +1 -0
  18. package/dist/src/extensions/main-api/k8s-api.d.ts +1 -1
  19. package/dist/src/extensions/registries/workloads-overview-detail-registry.d.ts +6 -3
  20. package/dist/src/extensions/renderer-api/k8s-api.d.ts +1 -1
  21. package/dist/src/main/catalog/catalog-entity-registry.d.ts +2 -2
  22. package/dist/src/main/cluster-manager.d.ts +2 -0
  23. package/dist/src/main/cluster.d.ts +5 -10
  24. package/dist/src/main/context-handler.d.ts +8 -5
  25. package/dist/src/main/extension-filesystem.d.ts +1 -0
  26. package/dist/src/main/kube-auth-proxy.d.ts +1 -8
  27. package/dist/src/main/lens-proxy.d.ts +1 -1
  28. package/dist/src/main/prometheus/helm.d.ts +1 -1
  29. package/dist/src/main/prometheus/lens.d.ts +1 -1
  30. package/dist/src/main/prometheus/operator.d.ts +1 -1
  31. package/dist/src/main/prometheus/provider-registry.d.ts +2 -1
  32. package/dist/src/main/prometheus/stacklight.d.ts +1 -1
  33. package/dist/src/main/proxy-functions/kube-api-request.d.ts +1 -1
  34. package/dist/src/main/proxy-functions/types.d.ts +2 -0
  35. package/dist/src/main/shell-session/node-shell-session.d.ts +2 -2
  36. package/dist/src/main/shell-session/shell-session.d.ts +8 -3
  37. package/dist/src/main/utils/shell-env.d.ts +1 -3
  38. package/dist/src/renderer/api/terminal-api.d.ts +29 -15
  39. package/dist/src/renderer/api/websocket-api.d.ts +55 -32
  40. package/dist/src/renderer/bootstrap.d.ts +1 -1
  41. package/dist/src/renderer/{components/app.d.ts → cluster-frame.d.ts} +6 -4
  42. package/dist/src/renderer/components/+catalog/catalog.d.ts +0 -1
  43. package/dist/src/renderer/components/+user-management/{select-options.d.ts → +cluster-role-bindings/__tests__/dialog.test.d.ts} +1 -7
  44. package/dist/src/renderer/components/+user-management/+cluster-role-bindings/dialog.d.ts +2 -3
  45. package/dist/src/renderer/components/+user-management/+role-bindings/__tests__/dialog.test.d.ts +21 -0
  46. package/dist/src/renderer/components/+user-management/+role-bindings/dialog.d.ts +2 -3
  47. package/dist/src/renderer/components/+workloads-daemonsets/daemonsets.d.ts +0 -1
  48. package/dist/src/renderer/components/+workloads-overview/overview.d.ts +3 -0
  49. package/dist/src/renderer/components/badge/badge.d.ts +1 -0
  50. package/dist/src/renderer/components/cluster-manager/cluster-status.d.ts +6 -7
  51. package/dist/src/renderer/components/cluster-manager/lens-views.d.ts +12 -8
  52. package/dist/src/renderer/components/cluster-settings/components/__tests__/cluster-local-terminal-settings.test.d.ts +21 -0
  53. package/dist/src/renderer/components/cluster-settings/components/{cluster-home-dir-setting.d.ts → cluster-local-terminal-settings.d.ts} +1 -12
  54. package/dist/src/renderer/components/cluster-settings/components/index.d.ts +1 -1
  55. package/dist/src/renderer/components/dialog/dialog.d.ts +1 -0
  56. package/dist/src/renderer/components/dock/edit-resource.d.ts +1 -1
  57. package/dist/src/renderer/components/dock/terminal.d.ts +7 -11
  58. package/dist/src/renderer/components/item-object-list/item-list-layout.d.ts +6 -0
  59. package/dist/src/renderer/components/kube-object-list-layout/kube-object-list-layout.d.ts +4 -0
  60. package/dist/src/renderer/components/layout/sidebar.d.ts +1 -1
  61. package/dist/src/renderer/components/switch/switcher.d.ts +1 -1
  62. package/dist/src/renderer/components/table/table-cell.d.ts +1 -0
  63. package/dist/src/renderer/initializers/kube-object-detail-registry.d.ts +1 -1
  64. package/dist/src/renderer/{lens-app.d.ts → root-frame.d.ts} +4 -1
  65. package/package.json +1 -1
@@ -21,6 +21,7 @@
21
21
  import { BaseStore } from "../common/base-store";
22
22
  import type { LensExtension } from "./lens-extension";
23
23
  export declare abstract class ExtensionStore<T> extends BaseStore<T> {
24
+ readonly displayName = "ExtensionStore<T>";
24
25
  protected extension: LensExtension;
25
26
  loadExtension(extension: LensExtension): void;
26
27
  load(): void;
@@ -28,6 +28,7 @@ export interface LensExtensionState {
28
28
  name: string;
29
29
  }
30
30
  export declare class ExtensionsStore extends BaseStore<LensExtensionsStoreModel> {
31
+ readonly displayName = "ExtensionsStore";
31
32
  constructor();
32
33
  get enabledExtensions(): string[];
33
34
  protected state: import("mobx").ObservableMap<string, LensExtensionState>;
@@ -22,7 +22,7 @@ export { isAllowedResource } from "../../common/utils/allowed-resource";
22
22
  export { ResourceStack } from "../../common/k8s/resource-stack";
23
23
  export { apiManager } from "../../common/k8s-api/api-manager";
24
24
  export { KubeApi, forCluster, forRemoteCluster } from "../../common/k8s-api/kube-api";
25
- export { KubeObject } from "../../common/k8s-api/kube-object";
25
+ export { KubeObject, KubeStatus } from "../../common/k8s-api/kube-object";
26
26
  export { KubeObjectStore } from "../../common/k8s-api/kube-object.store";
27
27
  export { Pod, podsApi, PodsApi } from "../../common/k8s-api/endpoints/pods.api";
28
28
  export { Node, nodesApi, NodesApi } from "../../common/k8s-api/endpoints/nodes.api";
@@ -21,12 +21,15 @@
21
21
  import type React from "react";
22
22
  import { BaseRegistry } from "./base-registry";
23
23
  export interface WorkloadsOverviewDetailComponents {
24
- Details: React.ComponentType<any>;
24
+ Details: React.ComponentType<{}>;
25
25
  }
26
26
  export interface WorkloadsOverviewDetailRegistration {
27
27
  components: WorkloadsOverviewDetailComponents;
28
28
  priority?: number;
29
29
  }
30
- export declare class WorkloadsOverviewDetailRegistry extends BaseRegistry<WorkloadsOverviewDetailRegistration> {
31
- getItems(): WorkloadsOverviewDetailRegistration[];
30
+ declare type RegisteredWorkloadsOverviewDetail = Required<WorkloadsOverviewDetailRegistration>;
31
+ export declare class WorkloadsOverviewDetailRegistry extends BaseRegistry<WorkloadsOverviewDetailRegistration, RegisteredWorkloadsOverviewDetail> {
32
+ getItems(): Required<WorkloadsOverviewDetailRegistration>[];
33
+ protected getRegisteredItem(item: WorkloadsOverviewDetailRegistration): RegisteredWorkloadsOverviewDetail;
32
34
  }
35
+ export {};
@@ -23,7 +23,7 @@ export { ResourceStack } from "../../common/k8s/resource-stack";
23
23
  export { apiManager } from "../../common/k8s-api/api-manager";
24
24
  export { KubeObjectStore } from "../../common/k8s-api/kube-object.store";
25
25
  export { KubeApi, forCluster, forRemoteCluster } from "../../common/k8s-api/kube-api";
26
- export { KubeObject } from "../../common/k8s-api/kube-object";
26
+ export { KubeObject, KubeStatus } from "../../common/k8s-api/kube-object";
27
27
  export { Pod, podsApi, PodsApi } from "../../common/k8s-api/endpoints";
28
28
  export { Node, nodesApi, NodesApi } from "../../common/k8s-api/endpoints";
29
29
  export { Deployment, deploymentApi, DeploymentApi } from "../../common/k8s-api/endpoints";
@@ -19,7 +19,7 @@
19
19
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
20
  */
21
21
  import { IComputedValue, IObservableArray } from "mobx";
22
- import { CatalogCategoryRegistry, CatalogEntity, CatalogEntityKindData } from "../../common/catalog";
22
+ import { CatalogCategoryRegistry, CatalogEntity, CatalogEntityConstructor, CatalogEntityKindData } from "../../common/catalog";
23
23
  export declare class CatalogEntityRegistry {
24
24
  private categoryRegistry;
25
25
  protected sources: import("mobx").ObservableMap<string, IComputedValue<CatalogEntity<import("../../common/catalog").CatalogEntityMetadata, import("../../common/catalog").CatalogEntityStatus, import("../../common/catalog").CatalogEntitySpec>[]>>;
@@ -30,6 +30,6 @@ export declare class CatalogEntityRegistry {
30
30
  get items(): CatalogEntity[];
31
31
  getById<T extends CatalogEntity>(id: string): T | undefined;
32
32
  getItemsForApiKind<T extends CatalogEntity>(apiVersion: string, kind: string): T[];
33
- getItemsByEntityClass<T extends CatalogEntity>({ apiVersion, kind }: CatalogEntityKindData): T[];
33
+ getItemsByEntityClass<T extends CatalogEntity>({ apiVersion, kind }: CatalogEntityKindData & CatalogEntityConstructor<T>): T[];
34
34
  }
35
35
  export declare const catalogEntityRegistry: CatalogEntityRegistry;
@@ -24,9 +24,11 @@ import type http from "http";
24
24
  import { Cluster } from "./cluster";
25
25
  import { Singleton } from "../common/utils";
26
26
  import { KubernetesCluster } from "../common/catalog-entities/kubernetes-cluster";
27
+ import type { ClusterId } from "../common/cluster-types";
27
28
  export declare class ClusterManager extends Singleton {
28
29
  private store;
29
30
  deleting: import("mobx").ObservableSet<string>;
31
+ visibleCluster: ClusterId | undefined;
30
32
  constructor();
31
33
  init: () => void;
32
34
  protected updateCatalog(clusters: Cluster[]): void;
@@ -103,12 +103,6 @@ export declare class Cluster implements ClusterModel, ClusterState {
103
103
  * @observable
104
104
  */
105
105
  disconnected: boolean;
106
- /**
107
- * Connection failure reason
108
- *
109
- * @observable
110
- */
111
- failureReason: string;
112
106
  /**
113
107
  * Does user have admin like access
114
108
  *
@@ -243,10 +237,6 @@ export declare class Cluster implements ClusterModel, ClusterState {
243
237
  * @internal
244
238
  */
245
239
  refreshConnectionStatus(): Promise<void>;
246
- /**
247
- * @internal
248
- */
249
- refreshAllowedResources(): Promise<void>;
250
240
  getKubeconfig(): Promise<KubeConfig>;
251
241
  /**
252
242
  * @internal
@@ -293,6 +283,11 @@ export declare class Cluster implements ClusterModel, ClusterState {
293
283
  accessible: boolean;
294
284
  disconnected: boolean;
295
285
  };
286
+ /**
287
+ * broadcast an authentication update concerning this cluster
288
+ * @internal
289
+ */
290
+ broadcastConnectUpdate(message: string, isError?: boolean): void;
296
291
  protected getAllowedNamespaces(): Promise<string[]>;
297
292
  protected getAllowedResources(): Promise<KubeResource[]>;
298
293
  isAllowedResource(kind: string): boolean;
@@ -25,6 +25,10 @@ import type { Cluster } from "./cluster";
25
25
  import type httpProxy from "http-proxy";
26
26
  import { UrlWithStringQuery } from "url";
27
27
  import { KubeAuthProxy } from "./kube-auth-proxy";
28
+ export interface PrometheusDetails {
29
+ prometheusPath: string;
30
+ provider: PrometheusProvider;
31
+ }
28
32
  export declare class ContextHandler {
29
33
  protected cluster: Cluster;
30
34
  clusterUrl: UrlWithStringQuery;
@@ -34,15 +38,14 @@ export declare class ContextHandler {
34
38
  protected prometheusPath: string | null;
35
39
  constructor(cluster: Cluster);
36
40
  setupPrometheus(preferences?: ClusterPrometheusPreferences): void;
37
- protected resolvePrometheusPath(): Promise<string>;
38
- getPrometheusProvider(): Promise<PrometheusProvider>;
41
+ getPrometheusDetails(): Promise<PrometheusDetails>;
42
+ protected ensurePrometheusPath({ service, namespace, port }: PrometheusService): string;
43
+ protected ensurePrometheusProvider(service: PrometheusService): PrometheusProvider;
39
44
  protected listPotentialProviders(): PrometheusProvider[];
40
- getPrometheusService(): Promise<PrometheusService | undefined>;
41
- getPrometheusPath(): Promise<string>;
45
+ protected getPrometheusService(): Promise<PrometheusService>;
42
46
  resolveAuthProxyUrl(): Promise<string>;
43
47
  getApiTarget(isLongRunningRequest?: boolean): Promise<httpProxy.ServerOptions>;
44
48
  protected newApiTarget(timeout: number): Promise<httpProxy.ServerOptions>;
45
49
  ensureServer(): Promise<void>;
46
50
  stopServer(): void;
47
- get proxyLastError(): string;
48
51
  }
@@ -23,6 +23,7 @@ interface FSProvisionModel {
23
23
  extensions: Record<string, string>;
24
24
  }
25
25
  export declare class FilesystemProvisionerStore extends BaseStore<FSProvisionModel> {
26
+ readonly displayName = "FilesystemProvisionerStore";
26
27
  registeredExtensions: import("mobx").ObservableMap<string, string>;
27
28
  constructor();
28
29
  /**
@@ -22,15 +22,10 @@
22
22
  import { ChildProcess } from "child_process";
23
23
  import type { Cluster } from "./cluster";
24
24
  import { Kubectl } from "./kubectl";
25
- export interface KubeAuthProxyLog {
26
- data: string;
27
- error?: boolean;
28
- }
29
25
  export declare class KubeAuthProxy {
30
- lastError: string;
31
26
  readonly apiPrefix: string;
32
27
  get port(): number;
33
- protected _port: number;
28
+ protected _port?: number;
34
29
  protected cluster: Cluster;
35
30
  protected env: NodeJS.ProcessEnv;
36
31
  protected proxyProcess: ChildProcess;
@@ -42,7 +37,5 @@ export declare class KubeAuthProxy {
42
37
  cancel(): void;
43
38
  };
44
39
  run(): Promise<void>;
45
- protected parseError(data: string): string;
46
- protected sendIpcLogMessage(res: KubeAuthProxyLog): void;
47
40
  exit(): void;
48
41
  }
@@ -42,7 +42,7 @@ export declare class LensProxy extends Singleton {
42
42
  protected proxy: httpProxy;
43
43
  protected getClusterForRequest: GetClusterForRequest;
44
44
  port: number;
45
- constructor(router: Router, functions: LensProxyFunctions);
45
+ constructor(router: Router, { shellApiRequest, kubeApiRequest, getClusterForRequest }: LensProxyFunctions);
46
46
  /**
47
47
  * Starts the lens proxy.
48
48
  * @resolves After the server is listening
@@ -26,5 +26,5 @@ export declare class PrometheusHelm extends PrometheusLens {
26
26
  readonly name: string;
27
27
  readonly rateAccuracy: string;
28
28
  readonly isConfigurable: boolean;
29
- getPrometheusService(client: CoreV1Api): Promise<PrometheusService | undefined>;
29
+ getPrometheusService(client: CoreV1Api): Promise<PrometheusService>;
30
30
  }
@@ -25,6 +25,6 @@ export declare class PrometheusLens extends PrometheusProvider {
25
25
  readonly name: string;
26
26
  readonly rateAccuracy: string;
27
27
  readonly isConfigurable: boolean;
28
- getPrometheusService(client: CoreV1Api): Promise<PrometheusService | undefined>;
28
+ getPrometheusService(client: CoreV1Api): Promise<PrometheusService>;
29
29
  getQuery(opts: Record<string, string>, queryName: string): string;
30
30
  }
@@ -25,6 +25,6 @@ export declare class PrometheusOperator extends PrometheusProvider {
25
25
  readonly id: string;
26
26
  readonly name: string;
27
27
  readonly isConfigurable: boolean;
28
- getPrometheusService(client: CoreV1Api): Promise<PrometheusService | undefined>;
28
+ getPrometheusService(client: CoreV1Api): Promise<PrometheusService>;
29
29
  getQuery(opts: Record<string, string>, queryName: string): string;
30
30
  }
@@ -34,7 +34,8 @@ export declare abstract class PrometheusProvider {
34
34
  abstract getQuery(opts: Record<string, string>, queryName: string): string;
35
35
  abstract getPrometheusService(client: CoreV1Api): Promise<PrometheusService | undefined>;
36
36
  protected bytesSent(ingress: string, namespace: string, statuses: string): string;
37
- protected getFirstNamespacedServer(client: CoreV1Api, ...selectors: string[]): Promise<PrometheusService | undefined>;
37
+ protected getFirstNamespacedService(client: CoreV1Api, ...selectors: string[]): Promise<PrometheusService>;
38
+ protected getNamespacedService(client: CoreV1Api, name: string, namespace: string): Promise<PrometheusService>;
38
39
  }
39
40
  export declare class PrometheusProviderRegistry extends Singleton {
40
41
  providers: Map<string, PrometheusProvider>;
@@ -25,6 +25,6 @@ export declare class PrometheusStacklight extends PrometheusProvider {
25
25
  readonly name: string;
26
26
  readonly rateAccuracy: string;
27
27
  readonly isConfigurable: boolean;
28
- getPrometheusService(client: CoreV1Api): Promise<PrometheusService | undefined>;
28
+ getPrometheusService(client: CoreV1Api): Promise<PrometheusService>;
29
29
  getQuery(opts: Record<string, string>, queryName: string): string;
30
30
  }
@@ -19,4 +19,4 @@
19
19
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
20
  */
21
21
  import type { ProxyApiRequestArgs } from "./types";
22
- export declare function kubeApiRequest({ req, socket, head }: ProxyApiRequestArgs): Promise<void>;
22
+ export declare function kubeApiRequest({ req, socket, head, cluster }: ProxyApiRequestArgs): Promise<void>;
@@ -21,8 +21,10 @@
21
21
  /// <reference types="node" />
22
22
  import type http from "http";
23
23
  import type net from "net";
24
+ import type { Cluster } from "../cluster";
24
25
  export interface ProxyApiRequestArgs {
25
26
  req: http.IncomingMessage;
26
27
  socket: net.Socket;
27
28
  head: Buffer;
29
+ cluster: Cluster;
28
30
  }
@@ -29,9 +29,9 @@ import { ShellSession } from "./shell-session";
29
29
  export declare class NodeShellSession extends ShellSession {
30
30
  protected nodeName: string;
31
31
  ShellType: string;
32
- protected podId: string;
32
+ protected readonly podName: string;
33
33
  protected kc: KubeConfig;
34
- protected get cwd(): string | undefined;
34
+ protected readonly cwd: string | undefined;
35
35
  constructor(socket: WebSocket, cluster: Cluster, nodeName: string, terminalId: string);
36
36
  open(): Promise<void>;
37
37
  protected createNodeShellPod(): Promise<{
@@ -22,6 +22,7 @@ import type { Cluster } from "../cluster";
22
22
  import { Kubectl } from "../kubectl";
23
23
  import type WebSocket from "ws";
24
24
  import * as pty from "node-pty";
25
+ import { TerminalMessage } from "../../renderer/api/terminal-api";
25
26
  export declare class ShellOpenError extends Error {
26
27
  cause: Error;
27
28
  constructor(message: string, cause: Error);
@@ -118,12 +119,16 @@ export declare abstract class ShellSession {
118
119
  protected kubeconfigPathP: Promise<string>;
119
120
  protected readonly terminalId: string;
120
121
  protected abstract get cwd(): string | undefined;
121
- protected ensureShellProcess(shell: string, args: string[], env: Record<string, string>, cwd: string): pty.IPty;
122
+ protected ensureShellProcess(shell: string, args: string[], env: Record<string, string>, cwd: string): {
123
+ shellProcess: pty.IPty;
124
+ resume: boolean;
125
+ };
122
126
  constructor(websocket: WebSocket, cluster: Cluster, terminalId: string);
123
- protected openShellProcess(shell: string, args: string[], env: Record<string, any>): Promise<void>;
127
+ protected send(message: TerminalMessage): void;
128
+ protected getCwd(env: Record<string, string>): Promise<string>;
129
+ protected openShellProcess(shell: string, args: string[], env: Record<string, string>): Promise<void>;
124
130
  protected getPathEntries(): string[];
125
131
  protected getCachedShellEnv(): Promise<Record<string, string>>;
126
132
  protected getShellEnv(): Promise<Record<string, any>>;
127
133
  protected exit(code?: WebSocketCloseEvent): void;
128
- protected sendResponse(msg: string): void;
129
134
  }
@@ -18,9 +18,7 @@
18
18
  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19
19
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
20
  */
21
- export interface EnvironmentVariables {
22
- readonly [key: string]: string;
23
- }
21
+ export declare type EnvironmentVariables = Record<string, string>;
24
22
  /**
25
23
  * Attempts to get the shell environment per the user's existing startup scripts.
26
24
  * If the environment can't be retrieved after 5 seconds an error message is logged.
@@ -18,15 +18,28 @@
18
18
  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19
19
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
20
  */
21
- import { EventEmitter } from "../utils";
22
- import { WebSocketApi } from "./websocket-api";
21
+ import { WebSocketApi, WebSocketEvents } from "./websocket-api";
23
22
  export declare enum TerminalChannels {
24
- STDIN = 0,
25
- STDOUT = 1,
26
- STDERR = 2,
27
- TERMINAL_SIZE = 4,
28
- TOKEN = 9
23
+ STDIN = "stdin",
24
+ STDOUT = "stdout",
25
+ CONNECTED = "connected",
26
+ RESIZE = "resize"
29
27
  }
28
+ export declare type TerminalMessage = {
29
+ type: TerminalChannels.STDIN;
30
+ data: string;
31
+ } | {
32
+ type: TerminalChannels.STDOUT;
33
+ data: string;
34
+ } | {
35
+ type: TerminalChannels.CONNECTED;
36
+ } | {
37
+ type: TerminalChannels.RESIZE;
38
+ data: {
39
+ width: number;
40
+ height: number;
41
+ };
42
+ };
30
43
  declare enum TerminalColor {
31
44
  RED = "\u001B[31m",
32
45
  GREEN = "\u001B[32m",
@@ -43,23 +56,24 @@ export declare type TerminalApiQuery = Record<string, string> & {
43
56
  node?: string;
44
57
  type?: string;
45
58
  };
46
- export declare class TerminalApi extends WebSocketApi {
59
+ export interface TerminalEvents extends WebSocketEvents {
60
+ ready: () => void;
61
+ connected: () => void;
62
+ }
63
+ export declare class TerminalApi extends WebSocketApi<TerminalEvents> {
47
64
  protected query: TerminalApiQuery;
48
65
  protected size: {
49
- Width: number;
50
- Height: number;
66
+ width: number;
67
+ height: number;
51
68
  };
52
- onReady: EventEmitter<[]>;
53
69
  isReady: boolean;
54
70
  constructor(query: TerminalApiQuery);
55
71
  connect(): Promise<void>;
56
72
  destroy(): void;
57
- removeAllListeners(): void;
58
- protected _onReady(data: string): boolean;
59
73
  reconnect(): void;
60
- sendCommand(key: string, channel?: TerminalChannels): void;
74
+ sendMessage(message: TerminalMessage): void;
61
75
  sendTerminalSize(cols: number, rows: number): void;
62
- protected parseMessage(data: string): string;
76
+ protected _onMessage({ data, ...evt }: MessageEvent<ArrayBuffer>): void;
63
77
  protected _onOpen(evt: Event): void;
64
78
  protected _onClose(evt: CloseEvent): void;
65
79
  protected emitStatus(data: string, options?: {
@@ -18,52 +18,75 @@
18
18
  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19
19
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
20
  */
21
- import { EventEmitter } from "../../common/event-emitter";
22
- interface IParams {
23
- url?: string;
24
- autoConnect?: boolean;
21
+ import type TypedEventEmitter from "typed-emitter";
22
+ interface WebsocketApiParams {
23
+ /**
24
+ * Flush pending commands on open socket
25
+ *
26
+ * @default true
27
+ */
25
28
  flushOnOpen?: boolean;
26
- reconnectDelaySeconds?: number;
27
- pingIntervalSeconds?: number;
29
+ /**
30
+ * In case of an error, wait this many seconds before reconnecting.
31
+ *
32
+ * If falsy, don't reconnect
33
+ *
34
+ * @default 10
35
+ */
36
+ reconnectDelay?: number;
37
+ /**
38
+ * The message for pinging the websocket
39
+ *
40
+ * @default "PING"
41
+ */
42
+ pingMessage?: string | ArrayBufferLike | Blob | ArrayBufferView;
43
+ /**
44
+ * If set to a number > 0, then the API will ping the socket on that interval.
45
+ *
46
+ * @unit seconds
47
+ */
48
+ pingInterval?: number;
49
+ /**
50
+ * Whether to show logs in the console
51
+ *
52
+ * @default isDevelopment
53
+ */
28
54
  logging?: boolean;
29
55
  }
30
- interface IMessage {
31
- id: string;
32
- data: string;
33
- }
34
56
  export declare enum WebSocketApiState {
35
- PENDING = -1,
36
- OPEN = 0,
37
- CONNECTING = 1,
38
- RECONNECTING = 2,
39
- CLOSED = 3
57
+ PENDING = "pending",
58
+ OPEN = "open",
59
+ CONNECTING = "connecting",
60
+ RECONNECTING = "reconnecting",
61
+ CLOSED = "closed"
62
+ }
63
+ export interface WebSocketEvents {
64
+ open: () => void;
65
+ data: (message: string) => void;
66
+ close: () => void;
40
67
  }
41
- export declare class WebSocketApi {
42
- protected params: IParams;
68
+ declare type Defaulted<Params, DefaultParams extends keyof Params> = Required<Pick<Params, DefaultParams>> & Omit<Params, DefaultParams>;
69
+ declare const WebSocketApi_base: new <T>() => TypedEventEmitter<T>;
70
+ export declare class WebSocketApi<Events extends WebSocketEvents> extends WebSocketApi_base<Events> {
43
71
  protected socket: WebSocket;
44
- protected pendingCommands: IMessage[];
45
- protected reconnectTimer: any;
46
- protected pingTimer: any;
47
- protected pingMessage: string;
72
+ protected pendingCommands: (string | ArrayBufferLike | Blob | ArrayBufferView)[];
73
+ protected reconnectTimer?: any;
74
+ protected pingTimer?: any;
75
+ protected params: Defaulted<WebsocketApiParams, keyof typeof WebSocketApi["defaultParams"]>;
48
76
  readyState: WebSocketApiState;
49
- onOpen: EventEmitter<[]>;
50
- onData: EventEmitter<[string]>;
51
- onClose: EventEmitter<[]>;
52
- static defaultParams: Partial<IParams>;
53
- constructor(params: IParams);
77
+ private static defaultParams;
78
+ constructor(params: WebsocketApiParams);
54
79
  get isConnected(): boolean;
55
80
  get isOnline(): boolean;
56
- setParams(params: Partial<IParams>): void;
57
- connect(url?: string): void;
81
+ connect(url: string): void;
58
82
  ping(): void;
59
83
  reconnect(): void;
60
84
  destroy(): void;
61
- removeAllListeners(): void;
62
- send(command: string): void;
85
+ clearAllListeners(): void;
86
+ send(command: string | ArrayBufferLike | Blob | ArrayBufferView): void;
63
87
  protected flush(): void;
64
- protected parseMessage(data: string): string;
65
88
  protected _onOpen(evt: Event): void;
66
- protected _onMessage(evt: MessageEvent): void;
89
+ protected _onMessage({ data }: MessageEvent): void;
67
90
  protected _onError(evt: Event): void;
68
91
  protected _onClose(evt: CloseEvent): void;
69
92
  protected writeLog(...data: any[]): void;
@@ -27,7 +27,7 @@ import * as ReactRouterDom from "react-router-dom";
27
27
  import * as LensExtensionsCommonApi from "../extensions/common-api";
28
28
  import * as LensExtensionsRendererApi from "../extensions/renderer-api";
29
29
  declare type AppComponent = React.ComponentType & {
30
- init?(rootElem: HTMLElement): Promise<void>;
30
+ init(rootElem: HTMLElement): Promise<void>;
31
31
  };
32
32
  export declare function bootstrap(comp: () => Promise<AppComponent>): Promise<void>;
33
33
  /**
@@ -19,11 +19,13 @@
19
19
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
20
  */
21
21
  import React from "react";
22
- import { ClusterPageMenuRegistration } from "../../extensions/registries";
23
- import { TabLayoutRoute } from "./layout/tab-layout";
24
- import type { ClusterId } from "../../common/cluster-types";
25
- export declare class App extends React.Component {
22
+ import { ClusterPageMenuRegistration } from "../extensions/registries";
23
+ import { TabLayoutRoute } from "./components/layout/tab-layout";
24
+ import type { ClusterId } from "../common/cluster-types";
25
+ export declare class ClusterFrame extends React.Component {
26
26
  static clusterId: ClusterId;
27
+ static readonly logPrefix = "[CLUSTER-FRAME]:";
28
+ static displayName: string;
27
29
  constructor(props: {});
28
30
  static init(rootElem: HTMLElement): Promise<void>;
29
31
  componentDidMount(): void;
@@ -48,7 +48,6 @@ export declare class Catalog extends React.Component<Props> {
48
48
  renderNavigation(): JSX.Element;
49
49
  renderItemMenu: (item: CatalogEntityItem<CatalogEntity>) => JSX.Element;
50
50
  renderName(item: CatalogEntityItem<CatalogEntity>): JSX.Element;
51
- renderIcon(item: CatalogEntityItem<CatalogEntity>): JSX.Element;
52
51
  renderList(): JSX.Element;
53
52
  render(): JSX.Element;
54
53
  }
@@ -18,10 +18,4 @@
18
18
  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19
19
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
20
  */
21
- import type { ServiceAccount } from "../../../common/k8s-api/endpoints";
22
- import type { KubeObject } from "../../../common/k8s-api/kube-object";
23
- import type { SelectOption } from "../select";
24
- export declare type ServiceAccountOption = SelectOption<string> & {
25
- account: ServiceAccount;
26
- };
27
- export declare function getRoleRefSelectOption<T extends KubeObject>(item: T): SelectOption<T>;
21
+ export {};
@@ -23,7 +23,6 @@ import React from "react";
23
23
  import { ClusterRole, ClusterRoleBinding, ClusterRoleBindingSubject, ServiceAccount } from "../../../../common/k8s-api/endpoints";
24
24
  import { DialogProps } from "../../dialog";
25
25
  import { SelectOption } from "../../select";
26
- import { ServiceAccountOption } from "../select-options";
27
26
  import { ObservableHashSet } from "../../../utils";
28
27
  interface Props extends Partial<DialogProps> {
29
28
  }
@@ -46,8 +45,8 @@ export declare class ClusterRoleBindingDialog extends React.Component<Props> {
46
45
  selectedGroups: import("mobx").ObservableSet<string>;
47
46
  get selectedBindings(): ClusterRoleBindingSubject[];
48
47
  get clusterRoleRefoptions(): SelectOption<ClusterRole>[];
49
- get serviceAccountOptions(): ServiceAccountOption[];
50
- get selectedServiceAccountOptions(): ServiceAccountOption[];
48
+ get serviceAccountOptions(): SelectOption<ServiceAccount>[];
49
+ get selectedServiceAccountOptions(): SelectOption<ServiceAccount>[];
51
50
  onOpen: () => void;
52
51
  reset: () => void;
53
52
  createBindings: () => Promise<void>;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Copyright (c) 2021 OpenLens Authors
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
5
+ * this software and associated documentation files (the "Software"), to deal in
6
+ * the Software without restriction, including without limitation the rights to
7
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8
+ * the Software, and to permit persons to whom the Software is furnished to do so,
9
+ * subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in all
12
+ * copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
17
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
+ */
21
+ export {};
@@ -23,7 +23,6 @@ import React from "react";
23
23
  import { ClusterRole, Role, RoleBinding, RoleBindingSubject, ServiceAccount } from "../../../../common/k8s-api/endpoints";
24
24
  import { DialogProps } from "../../dialog";
25
25
  import { SelectOption } from "../../select";
26
- import { ServiceAccountOption } from "../select-options";
27
26
  import { ObservableHashSet } from "../../../utils";
28
27
  interface Props extends Partial<DialogProps> {
29
28
  }
@@ -46,8 +45,8 @@ export declare class RoleBindingDialog extends React.Component<Props> {
46
45
  selectedGroups: import("mobx").ObservableSet<string>;
47
46
  get selectedBindings(): RoleBindingSubject[];
48
47
  get roleRefOptions(): SelectOption<Role | ClusterRole>[];
49
- get serviceAccountOptions(): ServiceAccountOption[];
50
- get selectedServiceAccountOptions(): ServiceAccountOption[];
48
+ get serviceAccountOptions(): SelectOption<ServiceAccount>[];
49
+ get selectedServiceAccountOptions(): SelectOption<ServiceAccount>[];
51
50
  onOpen: () => void;
52
51
  reset: () => void;
53
52
  createBindings: () => Promise<void>;
@@ -27,7 +27,6 @@ interface Props extends RouteComponentProps<DaemonSetsRouteParams> {
27
27
  }
28
28
  export declare class DaemonSets extends React.Component<Props> {
29
29
  getPodsLength(daemonSet: DaemonSet): number;
30
- renderNodeSelector(daemonSet: DaemonSet): JSX.Element[];
31
30
  render(): JSX.Element;
32
31
  }
33
32
  export {};
@@ -25,7 +25,10 @@ import type { WorkloadsOverviewRouteParams } from "../../../common/routes";
25
25
  interface Props extends RouteComponentProps<WorkloadsOverviewRouteParams> {
26
26
  }
27
27
  export declare class WorkloadsOverview extends React.Component<Props> {
28
+ loadErrors: string[];
29
+ constructor(props: Props);
28
30
  componentDidMount(): void;
31
+ renderLoadErrors(): JSX.Element;
29
32
  render(): JSX.Element;
30
33
  }
31
34
  export {};