@k8slens/extensions 5.2.4 → 5.3.0-git.58f7bcb38d.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 (51) hide show
  1. package/dist/src/common/catalog/catalog-category-registry.d.ts +9 -0
  2. package/dist/src/common/catalog/catalog-entity.d.ts +18 -0
  3. package/dist/src/common/catalog-entities/__tests__/kubernetes-cluster.test.d.ts +1 -0
  4. package/dist/src/common/k8s-api/endpoints/resource-applier.api.d.ts +4 -4
  5. package/dist/src/common/k8s-api/kube-api.d.ts +20 -2
  6. package/dist/src/common/k8s-api/kube-object.d.ts +18 -1
  7. package/dist/src/common/k8s-api/kube-object.store.d.ts +3 -0
  8. package/dist/src/common/routes/catalog.d.ts +2 -0
  9. package/dist/src/common/user-store/preferences-helpers.d.ts +1 -0
  10. package/dist/src/common/user-store/user-store.d.ts +1 -0
  11. package/dist/src/extensions/extension-api.js +3286 -351
  12. package/dist/src/extensions/lens-renderer-extension.d.ts +9 -2
  13. package/dist/src/extensions/main-api/k8s-api.d.ts +2 -2
  14. package/dist/src/extensions/registries/command-registry.d.ts +2 -2
  15. package/dist/src/extensions/renderer-api/catalog.d.ts +9 -0
  16. package/dist/src/extensions/renderer-api/k8s-api.d.ts +2 -2
  17. package/dist/src/main/{routes/utils/index.d.ts → __test__/lens-proxy.test.d.ts} +1 -1
  18. package/dist/src/main/context-handler.d.ts +1 -1
  19. package/dist/src/main/lens-proxy.d.ts +1 -0
  20. package/dist/src/main/resource-applier.d.ts +9 -0
  21. package/dist/src/main/routes/resource-applier-route.d.ts +1 -0
  22. package/dist/src/main/utils/__test__/update-channel.test.d.ts +21 -0
  23. package/dist/src/main/utils/http-responses.d.ts +20 -1
  24. package/dist/src/main/{routes/utils → utils}/parse-query.d.ts +0 -0
  25. package/dist/src/main/utils/update-channel.d.ts +21 -0
  26. package/dist/src/renderer/api/catalog-category-registry.d.ts +1 -0
  27. package/dist/src/renderer/api/catalog-entity-registry.d.ts +24 -1
  28. package/dist/src/renderer/bootstrap.d.ts +1 -1
  29. package/dist/src/renderer/components/+add-cluster/add-cluster.d.ts +1 -1
  30. package/dist/src/renderer/components/+catalog/__tests__/catalog-add-button.test.d.ts +1 -0
  31. package/dist/src/renderer/components/+catalog/catalog-entity-details.d.ts +1 -1
  32. package/dist/src/renderer/components/+catalog/catalog-entity-drawer-menu.d.ts +1 -1
  33. package/dist/src/renderer/components/+catalog/catalog-entity-item.d.ts +23 -0
  34. package/dist/src/renderer/components/+catalog/catalog-entity.store.d.ts +7 -23
  35. package/dist/src/renderer/components/+catalog/catalog-menu.d.ts +1 -1
  36. package/dist/src/renderer/components/+catalog/catalog.d.ts +6 -1
  37. package/dist/src/renderer/components/+catalog/catalog.test.d.ts +21 -0
  38. package/dist/src/renderer/components/activate-entity-command/activate-entity-command.d.ts +30 -0
  39. package/dist/src/renderer/components/activate-entity-command/index.d.ts +21 -0
  40. package/dist/src/renderer/components/app.d.ts +1 -1
  41. package/dist/src/renderer/components/dock/create-resource.d.ts +1 -1
  42. package/dist/src/renderer/components/dock/dock.store.d.ts +1 -1
  43. package/dist/src/renderer/components/dock/edit-resource.store.d.ts +2 -0
  44. package/dist/src/renderer/components/dock/log-tab.store.d.ts +1 -1
  45. package/dist/src/renderer/components/dock/terminal.d.ts +2 -0
  46. package/dist/src/renderer/components/hotbar/hotbar-menu.d.ts +1 -1
  47. package/dist/src/renderer/components/menu/menu.d.ts +6 -0
  48. package/dist/src/renderer/components/switch/switcher.d.ts +1 -1
  49. package/dist/src/renderer/lens-app.d.ts +1 -1
  50. package/dist/src/renderer/navigation/history.d.ts +2 -2
  51. package/package.json +4 -4
@@ -24,6 +24,7 @@ import { LensExtension } from "./lens-extension";
24
24
  import type { CatalogEntity } from "../common/catalog";
25
25
  import type { Disposer } from "../common/utils";
26
26
  import { EntityFilter } from "../renderer/api/catalog-entity-registry";
27
+ import { CategoryFilter } from "../renderer/api/catalog-category-registry";
27
28
  export declare class LensRendererExtension extends LensExtension {
28
29
  globalPages: registries.PageRegistration[];
29
30
  clusterPages: registries.PageRegistration[];
@@ -46,9 +47,15 @@ export declare class LensRendererExtension extends LensExtension {
46
47
  */
47
48
  isEnabledForCluster(cluster: Cluster): Promise<Boolean>;
48
49
  /**
49
- * Add a filtering function for the catalog. This will be removed if the extension is disabled.
50
- * @param fn The function which should return a truthy value for those entities which should be kepted
50
+ * Add a filtering function for the catalog entities. This will be removed if the extension is disabled.
51
+ * @param fn The function which should return a truthy value for those entities which should be kept.
51
52
  * @returns A function to clean up the filter
52
53
  */
53
54
  addCatalogFilter(fn: EntityFilter): Disposer;
55
+ /**
56
+ * Add a filtering function for the catalog categories. This will be removed if the extension is disabled.
57
+ * @param fn The function which should return a truthy value for those categories which should be kept.
58
+ * @returns A function to clean up the filter
59
+ */
60
+ addCatalogCategoryFilter(fn: CategoryFilter): Disposer;
54
61
  }
@@ -21,7 +21,7 @@
21
21
  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
- export { KubeApi, forCluster } from "../../common/k8s-api/kube-api";
24
+ export { KubeApi, forCluster, forRemoteCluster } from "../../common/k8s-api/kube-api";
25
25
  export { KubeObject } 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";
@@ -53,6 +53,6 @@ export { RoleBinding, roleBindingApi } from "../../common/k8s-api/endpoints/role
53
53
  export { ClusterRole, clusterRoleApi } from "../../common/k8s-api/endpoints/cluster-role.api";
54
54
  export { ClusterRoleBinding, clusterRoleBindingApi } from "../../common/k8s-api/endpoints/cluster-role-binding.api";
55
55
  export { CustomResourceDefinition, crdApi } from "../../common/k8s-api/endpoints/crd.api";
56
- export type { IKubeApiCluster } from "../../common/k8s-api/kube-api";
56
+ export type { ILocalKubeApiConfig, IRemoteKubeApiConfig, IKubeApiCluster } from "../../common/k8s-api/kube-api";
57
57
  export type { IPodContainer, IPodContainerStatus } from "../../common/k8s-api/endpoints/pods.api";
58
58
  export type { ISecretRef } from "../../common/k8s-api/endpoints/secret.api";
@@ -21,9 +21,9 @@
21
21
  import { BaseRegistry } from "./base-registry";
22
22
  import type { LensExtension } from "../lens-extension";
23
23
  import type { CatalogEntity } from "../../common/catalog";
24
- export declare type CommandContext = {
24
+ export interface CommandContext {
25
25
  entity?: CatalogEntity;
26
- };
26
+ }
27
27
  export interface CommandRegistration {
28
28
  id: string;
29
29
  title: string;
@@ -19,6 +19,8 @@
19
19
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
20
  */
21
21
  import type { CatalogCategory, CatalogEntity } from "../../common/catalog";
22
+ import type { CatalogEntityOnBeforeRun } from "../../renderer/api/catalog-entity-registry";
23
+ import type { Disposer } from "../../common/utils";
22
24
  export { catalogCategoryRegistry as catalogCategories } from "../../common/catalog/catalog-category-registry";
23
25
  export declare class CatalogEntityRegistry {
24
26
  /**
@@ -29,5 +31,12 @@ export declare class CatalogEntityRegistry {
29
31
  getById(id: string): CatalogEntity<import("../../common/catalog").CatalogEntityMetadata, import("../../common/catalog").CatalogEntityStatus, import("../../common/catalog").CatalogEntitySpec>;
30
32
  getItemsForApiKind<T extends CatalogEntity>(apiVersion: string, kind: string): T[];
31
33
  getItemsForCategory<T extends CatalogEntity>(category: CatalogCategory): T[];
34
+ /**
35
+ * Add a onBeforeRun hook to a catalog entity. If `onBeforeRun` was previously added then it will not be added again
36
+ * @param catalogEntityUid The uid of the catalog entity
37
+ * @param onBeforeRun The function that should return a boolean if the onRun of catalog entity should be triggered.
38
+ * @returns A function to remove that hook
39
+ */
40
+ addOnBeforeRun(entity: CatalogEntity, onBeforeRun: CatalogEntityOnBeforeRun): Disposer;
32
41
  }
33
42
  export declare const catalogEntities: CatalogEntityRegistry;
@@ -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 { KubeObjectStore } from "../../common/k8s-api/kube-object.store";
25
- export { KubeApi, forCluster } from "../../common/k8s-api/kube-api";
25
+ export { KubeApi, forCluster, forRemoteCluster } from "../../common/k8s-api/kube-api";
26
26
  export { KubeObject } 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";
@@ -54,7 +54,7 @@ export { ClusterRole, clusterRoleApi } from "../../common/k8s-api/endpoints";
54
54
  export { ClusterRoleBinding, clusterRoleBindingApi } from "../../common/k8s-api/endpoints";
55
55
  export { CustomResourceDefinition, crdApi } from "../../common/k8s-api/endpoints";
56
56
  export { KubeObjectStatusLevel } from "./kube-object-status";
57
- export type { IKubeApiCluster } from "../../common/k8s-api/kube-api";
57
+ export type { ILocalKubeApiConfig, IRemoteKubeApiConfig, IKubeApiCluster } from "../../common/k8s-api/kube-api";
58
58
  export type { IPodContainer, IPodContainerStatus } from "../../common/k8s-api/endpoints";
59
59
  export type { ISecretRef } from "../../common/k8s-api/endpoints";
60
60
  export type { KubeObjectStatus } from "./kube-object-status";
@@ -18,4 +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
- export * from "./parse-query";
21
+ export {};
@@ -40,7 +40,7 @@ export declare class ContextHandler {
40
40
  getPrometheusService(): Promise<PrometheusService | undefined>;
41
41
  getPrometheusPath(): Promise<string>;
42
42
  resolveAuthProxyUrl(): Promise<string>;
43
- getApiTarget(isWatchRequest?: boolean): Promise<httpProxy.ServerOptions>;
43
+ getApiTarget(isLongRunningRequest?: boolean): Promise<httpProxy.ServerOptions>;
44
44
  protected newApiTarget(timeout: number): Promise<httpProxy.ServerOptions>;
45
45
  ensureServer(): Promise<void>;
46
46
  stopServer(): void;
@@ -32,6 +32,7 @@ export interface LensProxyFunctions {
32
32
  shellApiRequest: (args: ProxyApiRequestArgs) => void | Promise<void>;
33
33
  kubeApiRequest: (args: ProxyApiRequestArgs) => void | Promise<void>;
34
34
  }
35
+ export declare function isLongRunningRequest(reqUrl: string): boolean;
35
36
  export declare class LensProxy extends Singleton {
36
37
  protected router: Router;
37
38
  protected origin: string;
@@ -20,9 +20,18 @@
20
20
  */
21
21
  import type { Cluster } from "./cluster";
22
22
  import type { KubernetesObject } from "@kubernetes/client-node";
23
+ import type { Patch } from "rfc6902";
23
24
  export declare class ResourceApplier {
24
25
  protected cluster: Cluster;
25
26
  constructor(cluster: Cluster);
27
+ /**
28
+ * Patch a kube resource's manifest, throwing any error that occurs.
29
+ * @param name The name of the kube resource
30
+ * @param kind The kind of the kube resource
31
+ * @param patch The list of JSON operations
32
+ * @param ns The optional namespace of the kube resource
33
+ */
34
+ patch(name: string, kind: string, patch: Patch, ns?: string): Promise<string>;
26
35
  apply(resource: KubernetesObject | any): Promise<string>;
27
36
  protected kubectlApply(content: string): Promise<string>;
28
37
  kubectlApplyAll(resources: string[], extraArgs?: string[]): Promise<string>;
@@ -21,4 +21,5 @@
21
21
  import type { LensApiRequest } from "../router";
22
22
  export declare class ResourceApplierApiRoute {
23
23
  static applyResource(request: LensApiRequest): Promise<void>;
24
+ static patchResource(request: LensApiRequest): Promise<void>;
24
25
  }
@@ -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 {};
@@ -20,6 +20,25 @@
20
20
  */
21
21
  /// <reference types="node" />
22
22
  import type http from "http";
23
- export declare function respondJson(res: http.ServerResponse, content: any, status?: number): void;
23
+ /**
24
+ * Respond to a HTTP request with a body of JSON data
25
+ * @param res The HTTP response to write data to
26
+ * @param content The data or its JSON stringified version of it
27
+ * @param status [200] The status code to respond with
28
+ */
29
+ export declare function respondJson(res: http.ServerResponse, content: Object | string, status?: number): void;
30
+ /**
31
+ * Respond to a HTTP request with a body of plain text data
32
+ * @param res The HTTP response to write data to
33
+ * @param content The string data to respond with
34
+ * @param status [200] The status code to respond with
35
+ */
24
36
  export declare function respondText(res: http.ServerResponse, content: string, status?: number): void;
37
+ /**
38
+ * Respond to a HTTP request with a body of plain text data
39
+ * @param res The HTTP response to write data to
40
+ * @param content The string data to respond with
41
+ * @param contentType The HTTP Content-Type header value
42
+ * @param status [200] The status code to respond with
43
+ */
25
44
  export declare function respond(res: http.ServerResponse, content: string, contentType: string, status?: number): 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 declare function nextUpdateChannel(defaultChannel: string, channel: string): string;
@@ -19,3 +19,4 @@
19
19
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
20
  */
21
21
  export { catalogCategoryRegistry } from "../../common/catalog";
22
+ export type { CategoryFilter } from "../../common/catalog";
@@ -18,16 +18,20 @@
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 { ObservableSet } from "mobx";
21
22
  import { CatalogCategory, CatalogEntity, CatalogEntityData, CatalogCategoryRegistry, CatalogEntityKindData } from "../../common/catalog";
22
23
  import "../../common/catalog-entities";
23
24
  import type { Cluster } from "../../main/cluster";
24
25
  import { Disposer } from "../utils";
25
26
  export declare type EntityFilter = (entity: CatalogEntity) => any;
27
+ export declare type CatalogEntityOnBeforeRun = (entity: CatalogEntity) => boolean | Promise<boolean>;
28
+ declare type CatalogEntityUid = CatalogEntity["metadata"]["uid"];
26
29
  export declare class CatalogEntityRegistry {
27
30
  private categoryRegistry;
28
31
  protected activeEntityId: string | undefined;
29
32
  protected _entities: import("mobx").ObservableMap<string, CatalogEntity<import("../../common/catalog").CatalogEntityMetadata, import("../../common/catalog").CatalogEntityStatus, import("../../common/catalog").CatalogEntitySpec>>;
30
- protected filters: import("mobx").ObservableSet<EntityFilter>;
33
+ protected filters: ObservableSet<EntityFilter>;
34
+ protected onBeforeRunHooks: import("mobx").ObservableMap<string, ObservableSet<CatalogEntityOnBeforeRun>>;
31
35
  /**
32
36
  * Buffer for keeping entities that don't yet have CatalogCategory synced
33
37
  */
@@ -56,6 +60,25 @@ export declare class CatalogEntityRegistry {
56
60
  * @returns A function to remove that filter
57
61
  */
58
62
  addCatalogFilter(fn: EntityFilter): Disposer;
63
+ /**
64
+ * Add a onBeforeRun hook to a catalog entity. If `onBeforeRun` was previously added then it will not be added again
65
+ * @param catalogEntityUid The uid of the catalog entity
66
+ * @param onBeforeRun The function that should return a boolean if the onRun of catalog entity should be triggered.
67
+ * @returns A function to remove that hook
68
+ */
69
+ addOnBeforeRun(entityOrId: CatalogEntity | CatalogEntityUid, onBeforeRun: CatalogEntityOnBeforeRun): Disposer;
70
+ /**
71
+ * Runs all the registered `onBeforeRun` hooks, short circuiting on the first falsy returned/resolved valued
72
+ * @param entity The entity to run the hooks on
73
+ * @returns Whether the entities `onRun` method should be executed
74
+ */
75
+ onBeforeRun(entity: CatalogEntity): Promise<boolean>;
76
+ /**
77
+ * Perform the onBeforeRun check and, if successful, then proceed to call `entity`'s onRun method
78
+ * @param entity The instance to invoke the hooks and then execute the onRun
79
+ */
80
+ onRun(entity: CatalogEntity): void;
59
81
  }
60
82
  export declare const catalogEntityRegistry: CatalogEntityRegistry;
61
83
  export declare function getActiveClusterEntity(): Cluster | undefined;
84
+ export {};
@@ -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?(): Promise<void>;
30
+ init?(rootElem: HTMLElement): Promise<void>;
31
31
  };
32
32
  export declare function bootstrap(App: AppComponent): Promise<void>;
33
33
  /**
@@ -30,7 +30,7 @@ export declare class AddCluster extends React.Component {
30
30
  kubeContexts: import("mobx").ObservableMap<string, Option>;
31
31
  customConfig: string;
32
32
  isWaiting: boolean;
33
- errorText: string;
33
+ errors: string[];
34
34
  constructor(props: {});
35
35
  componentDidMount(): void;
36
36
  get allErrors(): string[];
@@ -21,7 +21,7 @@
21
21
  import "./catalog-entity-details.scss";
22
22
  import { Component } from "react";
23
23
  import type { CatalogCategory, CatalogEntity } from "../../../common/catalog";
24
- import type { CatalogEntityItem } from "./catalog-entity.store";
24
+ import type { CatalogEntityItem } from "./catalog-entity-item";
25
25
  interface Props<T extends CatalogEntity> {
26
26
  item: CatalogEntityItem<T> | null | undefined;
27
27
  hideDetails(): void;
@@ -21,7 +21,7 @@
21
21
  import React from "react";
22
22
  import { MenuActionsProps } from "../menu/menu-actions";
23
23
  import type { CatalogEntity, CatalogEntityContextMenu } from "../../api/catalog-entity";
24
- import type { CatalogEntityItem } from "./catalog-entity.store";
24
+ import type { CatalogEntityItem } from "./catalog-entity-item";
25
25
  export interface CatalogEntityDrawerMenuProps<T extends CatalogEntity> extends MenuActionsProps {
26
26
  item: CatalogEntityItem<T> | null | undefined;
27
27
  }
@@ -0,0 +1,23 @@
1
+ import React from "react";
2
+ import type { CatalogEntity } from "../../api/catalog-entity";
3
+ import type { ItemObject } from "../../../common/item.store";
4
+ import type { CatalogEntityRegistry } from "../../api/catalog-entity-registry";
5
+ export declare class CatalogEntityItem<T extends CatalogEntity> implements ItemObject {
6
+ entity: T;
7
+ private registry;
8
+ constructor(entity: T, registry: CatalogEntityRegistry);
9
+ get kind(): string;
10
+ get apiVersion(): string;
11
+ get name(): string;
12
+ getName(): string;
13
+ get id(): string;
14
+ getId(): string;
15
+ get phase(): string;
16
+ get enabled(): boolean;
17
+ get labels(): string[];
18
+ getLabelBadges(onClick?: React.MouseEventHandler<any>): JSX.Element[];
19
+ get source(): string;
20
+ get searchFields(): string[];
21
+ onRun(): void;
22
+ onContextMenuOpen(ctx: any): Promise<void>;
23
+ }
@@ -18,34 +18,18 @@
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 React from "react";
22
- import type { CatalogEntity, CatalogEntityActionContext } from "../../api/catalog-entity";
23
- import { ItemObject, ItemStore } from "../../../common/item.store";
21
+ import { CatalogEntityRegistry } from "../../api/catalog-entity-registry";
22
+ import type { CatalogEntity } from "../../api/catalog-entity";
23
+ import { ItemStore } from "../../../common/item.store";
24
24
  import { CatalogCategory } from "../../../common/catalog";
25
- export declare class CatalogEntityItem<T extends CatalogEntity> implements ItemObject {
26
- entity: T;
27
- constructor(entity: T);
28
- get kind(): string;
29
- get apiVersion(): string;
30
- get name(): string;
31
- getName(): string;
32
- get id(): string;
33
- getId(): string;
34
- get phase(): string;
35
- get enabled(): boolean;
36
- get labels(): string[];
37
- getLabelBadges(onClick?: React.MouseEventHandler<any>): JSX.Element[];
38
- get source(): string;
39
- get searchFields(): string[];
40
- onRun(ctx: CatalogEntityActionContext): void;
41
- onContextMenuOpen(ctx: any): Promise<void>;
42
- }
25
+ import { CatalogEntityItem } from "./catalog-entity-item";
43
26
  export declare class CatalogEntityStore extends ItemStore<CatalogEntityItem<CatalogEntity>> {
44
- constructor();
27
+ private registry;
28
+ constructor(registry?: CatalogEntityRegistry);
45
29
  activeCategory?: CatalogCategory;
46
30
  selectedItemId?: string;
47
31
  get entities(): CatalogEntityItem<CatalogEntity<import("../../../common/catalog").CatalogEntityMetadata, import("../../../common/catalog").CatalogEntityStatus, import("../../../common/catalog").CatalogEntitySpec>>[];
48
32
  get selectedItem(): CatalogEntityItem<CatalogEntity<import("../../../common/catalog").CatalogEntityMetadata, import("../../../common/catalog").CatalogEntityStatus, import("../../../common/catalog").CatalogEntitySpec>>;
49
- watch(): () => void;
33
+ watch(): import("../../../common/utils").ExtendableDisposer;
50
34
  loadAll(): Promise<any>;
51
35
  }
@@ -22,5 +22,5 @@ declare type Props = {
22
22
  activeItem: string;
23
23
  onItemClick: (id: string) => void;
24
24
  };
25
- export declare function CatalogMenu(props: Props): JSX.Element;
25
+ export declare const CatalogMenu: (props: Props) => JSX.Element;
26
26
  export {};
@@ -19,19 +19,24 @@
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 { CatalogEntityItem } from "./catalog-entity.store";
22
+ import { CatalogEntityStore } from "./catalog-entity.store";
23
+ import type { CatalogEntityItem } from "./catalog-entity-item";
23
24
  import type { CatalogEntityContextMenu } from "../../api/catalog-entity";
24
25
  import { CatalogEntity } from "../../../common/catalog";
25
26
  import type { RouteComponentProps } from "react-router";
26
27
  import { CatalogViewRouteParam } from "../../../common/routes";
27
28
  export declare const previousActiveTab: import("../../utils").StorageHelper<string>;
28
29
  interface Props extends RouteComponentProps<CatalogViewRouteParam> {
30
+ catalogEntityStore?: CatalogEntityStore;
29
31
  }
30
32
  export declare class Catalog extends React.Component<Props> {
31
33
  private catalogEntityStore?;
32
34
  private contextMenu;
33
35
  activeTab?: string;
34
36
  constructor(props: Props);
37
+ static defaultProps: {
38
+ catalogEntityStore: CatalogEntityStore;
39
+ };
35
40
  get routeActiveTab(): string;
36
41
  componentDidMount(): Promise<void>;
37
42
  addToHotbar(item: CatalogEntityItem<CatalogEntity>): 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 {};
@@ -0,0 +1,30 @@
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
+ import React from "react";
22
+ import type { CatalogEntity } from "../../api/catalog-entity";
23
+ export declare class ActivateEntityCommand extends React.Component {
24
+ get options(): {
25
+ label: string;
26
+ value: CatalogEntity<import("../../../common/catalog").CatalogEntityMetadata, import("../../../common/catalog").CatalogEntityStatus, import("../../../common/catalog").CatalogEntitySpec>;
27
+ }[];
28
+ onSelect(entity: CatalogEntity): void;
29
+ render(): JSX.Element;
30
+ }
@@ -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 * from "./activate-entity-command";
@@ -25,7 +25,7 @@ import type { ClusterId } from "../../common/cluster-types";
25
25
  export declare class App extends React.Component {
26
26
  static clusterId: ClusterId;
27
27
  constructor(props: {});
28
- static init(): Promise<void>;
28
+ static init(rootElem: HTMLElement): Promise<void>;
29
29
  componentDidMount(): void;
30
30
  startUrl: string;
31
31
  getTabLayoutRoutes(menuItem: ClusterPageMenuRegistration): TabLayoutRoute[];
@@ -39,7 +39,7 @@ export declare class CreateResource extends React.Component<Props> {
39
39
  get currentTemplate(): SelectOption<any>;
40
40
  onChange: (value: string, error?: string) => void;
41
41
  onSelectTemplate: (item: SelectOption) => void;
42
- create: () => Promise<JSX.Element>;
42
+ create: () => Promise<undefined>;
43
43
  renderControls(): JSX.Element;
44
44
  render(): JSX.Element;
45
45
  }
@@ -105,7 +105,7 @@ export declare class DockStore implements DockStorageState {
105
105
  getTabIndex(tabId: TabId): number;
106
106
  protected getNewTabNumber(kind: TabKind): number;
107
107
  createTab(rawTabDesc: DockTabCreate, addNumber?: boolean): DockTab;
108
- closeTab(tabId: TabId): Promise<void>;
108
+ closeTab(tabId: TabId): void;
109
109
  closeTabs(tabs: DockTab[]): void;
110
110
  closeAllTabs(): void;
111
111
  closeOtherTabs(tabId: TabId): void;
@@ -25,6 +25,7 @@ import type { KubeObjectStore } from "../../../common/k8s-api/kube-object.store"
25
25
  export interface EditingResource {
26
26
  resource: string;
27
27
  draft?: string;
28
+ firstDraft?: string;
28
29
  }
29
30
  export declare class EditResourceStore extends DockTabStore<EditingResource> {
30
31
  private watchers;
@@ -36,6 +37,7 @@ export declare class EditResourceStore extends DockTabStore<EditingResource> {
36
37
  getResource(tabId: TabId): KubeObject | undefined;
37
38
  getResourcePath(tabId: TabId): string | undefined;
38
39
  getTabByResource(object: KubeObject): DockTab;
40
+ clearInitialDraft(tabId: TabId): void;
39
41
  reset(): void;
40
42
  }
41
43
  export declare const editResourceStore: EditResourceStore;
@@ -37,7 +37,7 @@ interface WorkloadLogsTabData {
37
37
  }
38
38
  export declare class LogTabStore extends DockTabStore<LogTabData> {
39
39
  constructor();
40
- createPodTab({ selectedPod, selectedContainer }: PodLogsTabData): void;
40
+ createPodTab({ selectedPod, selectedContainer }: PodLogsTabData): string;
41
41
  createWorkloadTab({ workload }: WorkloadLogsTabData): void;
42
42
  renameTab(tabId: string): void;
43
43
  private createDockTab;
@@ -52,5 +52,7 @@ export declare class Terminal {
52
52
  onResize: () => void;
53
53
  onActivate: () => void;
54
54
  onClickLink: (evt: MouseEvent, link: string) => void;
55
+ onContextMenu: () => void;
56
+ onSelectionChange: () => void;
55
57
  keyHandler: (evt: KeyboardEvent) => boolean;
56
58
  }
@@ -21,7 +21,7 @@
21
21
  import "./hotbar-menu.scss";
22
22
  import React from "react";
23
23
  import { IClassName } from "../../utils";
24
- import { CatalogEntity } from "../../api/catalog-entity";
24
+ import type { CatalogEntity } from "../../api/catalog-entity";
25
25
  import { DropResult } from "react-beautiful-dnd";
26
26
  import { HotbarItem } from "../../../common/hotbar-types";
27
27
  interface Props {
@@ -29,6 +29,10 @@ export interface MenuPosition {
29
29
  right?: boolean;
30
30
  bottom?: boolean;
31
31
  }
32
+ export interface MenuStyle {
33
+ top: string;
34
+ left: string;
35
+ }
32
36
  export interface MenuProps {
33
37
  isOpen?: boolean;
34
38
  open(): void;
@@ -47,6 +51,7 @@ export interface MenuProps {
47
51
  }
48
52
  interface State {
49
53
  position?: MenuPosition;
54
+ menuStyle?: MenuStyle;
50
55
  }
51
56
  export declare class Menu extends React.Component<MenuProps, State> {
52
57
  static defaultProps: object;
@@ -60,6 +65,7 @@ export declare class Menu extends React.Component<MenuProps, State> {
60
65
  get isOpen(): boolean;
61
66
  componentDidMount(): void;
62
67
  componentWillUnmount(): void;
68
+ componentDidUpdate(prevProps: MenuProps): void;
63
69
  protected get focusableItems(): MenuItem[];
64
70
  protected get focusedItem(): MenuItem;
65
71
  protected focusNextItem(reverse?: boolean): void;