mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Restructure to monorepo (#6907)
* wip: restructure to monorepo Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * refactor create-release-pr to a package Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * build fixes Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * github workflow fixes Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * fix typo Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * add webpack-env types to core Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * fix github workflows Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * refactor/fix integration tests Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * lint fix Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * yarn run dev Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * eslint settings for vscode Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * move templates to right package Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * open-lens build fixes Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * integration test fix Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * fix nx task dependencies Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * use bash shell for unit tests in test workflow Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * fix test:unit for windows Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * fix win-ca webpack error in open-lens Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * fix win-ca webpack error in open-lens Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * fix build:app on windows Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * remove ELECTRON_BUILDER_EXTRA_ARGS Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * sync src/ from master Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> * remove Makefile from core Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com> Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
1 parent
0066ca4ea2
commit
2657df2293
3321 files changed
+28699
-11447
No files matched your search
@@ -0,0 +1,67 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import appNameInjectable from "../../common/vars/app-name.injectable";
|
||||
import isLinuxInjectable from "../../common/vars/is-linux.injectable";
|
||||
import isMacInjectable from "../../common/vars/is-mac.injectable";
|
||||
import isSnapPackageInjectable from "../../common/vars/is-snap-package.injectable";
|
||||
import isWindowsInjectable from "../../common/vars/is-windows.injectable";
|
||||
import { asLegacyGlobalFunctionForExtensionApi } from "../as-legacy-globals-for-extension-api/as-legacy-global-function-for-extension-api";
|
||||
import { getLegacyGlobalDiForExtensionApi } from "../as-legacy-globals-for-extension-api/legacy-global-di-for-extension-api";
|
||||
import getEnabledExtensionsInjectable from "./get-enabled-extensions/get-enabled-extensions.injectable";
|
||||
import type { UserPreferenceExtensionItems } from "./user-preferences";
|
||||
import { Preferences } from "./user-preferences";
|
||||
import { slackUrl, issuesTrackerUrl } from "../../common/vars";
|
||||
import { buildVersionInjectionToken } from "../../common/vars/build-semantic-version.injectable";
|
||||
|
||||
export interface AppExtensionItems {
|
||||
readonly Preferences: UserPreferenceExtensionItems;
|
||||
readonly version: string;
|
||||
readonly appName: string;
|
||||
readonly slackUrl: string;
|
||||
readonly issuesTrackerUrl: string;
|
||||
readonly isSnap: boolean;
|
||||
readonly isWindows: boolean;
|
||||
readonly isMac: boolean;
|
||||
readonly isLinux: boolean;
|
||||
getEnabledExtensions: () => string[];
|
||||
}
|
||||
|
||||
export const App: AppExtensionItems = {
|
||||
Preferences,
|
||||
getEnabledExtensions: asLegacyGlobalFunctionForExtensionApi(getEnabledExtensionsInjectable),
|
||||
get version() {
|
||||
const di = getLegacyGlobalDiForExtensionApi();
|
||||
|
||||
return di.inject(buildVersionInjectionToken).get();
|
||||
},
|
||||
get appName() {
|
||||
const di = getLegacyGlobalDiForExtensionApi();
|
||||
|
||||
return di.inject(appNameInjectable);
|
||||
},
|
||||
get isSnap() {
|
||||
const di = getLegacyGlobalDiForExtensionApi();
|
||||
|
||||
return di.inject(isSnapPackageInjectable);
|
||||
},
|
||||
get isWindows() {
|
||||
const di = getLegacyGlobalDiForExtensionApi();
|
||||
|
||||
return di.inject(isWindowsInjectable);
|
||||
},
|
||||
get isMac() {
|
||||
const di = getLegacyGlobalDiForExtensionApi();
|
||||
|
||||
return di.inject(isMacInjectable);
|
||||
},
|
||||
get isLinux() {
|
||||
const di = getLegacyGlobalDiForExtensionApi();
|
||||
|
||||
return di.inject(isLinuxInjectable);
|
||||
},
|
||||
slackUrl,
|
||||
issuesTrackerUrl,
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import kubernetesClusterCategoryInjectable from "../../common/catalog/categories/kubernetes-cluster.injectable";
|
||||
import { asLegacyGlobalForExtensionApi } from "../as-legacy-globals-for-extension-api/as-legacy-global-object-for-extension-api";
|
||||
|
||||
export {
|
||||
KubernetesCluster,
|
||||
GeneralEntity,
|
||||
WebLink,
|
||||
} from "../../common/catalog-entities";
|
||||
|
||||
export const kubernetesClusterCategory = asLegacyGlobalForExtensionApi(kubernetesClusterCategoryInjectable);
|
||||
|
||||
export type {
|
||||
KubernetesClusterPrometheusMetrics,
|
||||
KubernetesClusterSpec,
|
||||
KubernetesClusterMetadata,
|
||||
WebLinkSpec,
|
||||
WebLinkStatus,
|
||||
WebLinkStatusPhase,
|
||||
KubernetesClusterStatusPhase,
|
||||
KubernetesClusterStatus,
|
||||
} from "../../common/catalog-entities";
|
||||
|
||||
export * from "../../common/catalog/catalog-entity";
|
||||
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import appEventBusInjectable from "../../common/app-event-bus/app-event-bus.injectable";
|
||||
import { asLegacyGlobalForExtensionApi } from "../as-legacy-globals-for-extension-api/as-legacy-global-object-for-extension-api";
|
||||
|
||||
export type { AppEvent } from "../../common/app-event-bus/event-bus";
|
||||
|
||||
export const appEventBus = asLegacyGlobalForExtensionApi(appEventBusInjectable);
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* 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 extensionsStoreInjectable from "../../extensions-store/extensions-store.injectable";
|
||||
|
||||
const getEnabledExtensionsInjectable = getInjectable({
|
||||
id: "get-enabled-extensions",
|
||||
|
||||
instantiate: (di) => () =>
|
||||
di.inject(extensionsStoreInjectable).enabledExtensions,
|
||||
});
|
||||
|
||||
export default getEnabledExtensionsInjectable;
|
||||
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
// APIs
|
||||
import { App } from "./app";
|
||||
import * as EventBus from "./event-bus";
|
||||
import * as Store from "./stores";
|
||||
import { Util } from "./utils";
|
||||
import * as Catalog from "./catalog";
|
||||
import * as Types from "./types";
|
||||
import * as Proxy from "./proxy";
|
||||
import loggerInjectable from "../../common/logger.injectable";
|
||||
import { asLegacyGlobalForExtensionApi } from "../as-legacy-globals-for-extension-api/as-legacy-global-object-for-extension-api";
|
||||
|
||||
const logger = asLegacyGlobalForExtensionApi(loggerInjectable);
|
||||
|
||||
export {
|
||||
App,
|
||||
EventBus,
|
||||
Catalog,
|
||||
Store,
|
||||
Types,
|
||||
Util,
|
||||
logger,
|
||||
Proxy,
|
||||
};
|
||||
@@ -0,0 +1,279 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
// NOTE: this file is not currently exported as part of `Common`, but should be.
|
||||
// It is here to consolidate the common parts which are exported to `Main`
|
||||
// and to `Renderer`
|
||||
|
||||
import apiManagerInjectable from "../../common/k8s-api/api-manager/manager.injectable";
|
||||
import createKubeApiForClusterInjectable from "../../common/k8s-api/create-kube-api-for-cluster.injectable";
|
||||
import createKubeApiForRemoteClusterInjectable from "../../common/k8s-api/create-kube-api-for-remote-cluster.injectable";
|
||||
import createResourceStackInjectable from "../../common/k8s/create-resource-stack.injectable";
|
||||
import type { ResourceApplyingStack } from "../../common/k8s/resource-stack";
|
||||
import { asLegacyGlobalFunctionForExtensionApi } from "../as-legacy-globals-for-extension-api/as-legacy-global-function-for-extension-api";
|
||||
import { asLegacyGlobalForExtensionApi } from "../as-legacy-globals-for-extension-api/as-legacy-global-object-for-extension-api";
|
||||
import type { KubernetesCluster } from "./catalog";
|
||||
import type { KubeApiDataFrom, KubeObjectStoreOptions } from "../../common/k8s-api/kube-object.store";
|
||||
import { KubeObjectStore as InternalKubeObjectStore } from "../../common/k8s-api/kube-object.store";
|
||||
import type { KubeJsonApiDataFor, KubeObject } from "../../common/k8s-api/kube-object";
|
||||
import type { DerivedKubeApiOptions, KubeApiDependencies, KubeApiOptions } from "../../common/k8s-api/kube-api";
|
||||
import { KubeApi as InternalKubeApi } from "../../common/k8s-api/kube-api";
|
||||
import clusterFrameContextForNamespacedResourcesInjectable from "../../renderer/cluster-frame-context/for-namespaced-resources.injectable";
|
||||
import type { ClusterContext } from "../../renderer/cluster-frame-context/cluster-frame-context";
|
||||
import loggerInjectable from "../../common/logger.injectable";
|
||||
import { getLegacyGlobalDiForExtensionApi } from "../as-legacy-globals-for-extension-api/legacy-global-di-for-extension-api";
|
||||
import maybeKubeApiInjectable from "../../common/k8s-api/maybe-kube-api.injectable";
|
||||
import { DeploymentApi as InternalDeploymentApi, IngressApi as InternalIngressApi, NodeApi, PersistentVolumeClaimApi, PodApi } from "../../common/k8s-api/endpoints";
|
||||
import { storesAndApisCanBeCreatedInjectionToken } from "../../common/k8s-api/stores-apis-can-be-created.token";
|
||||
import type { JsonApiConfig } from "../../common/k8s-api/json-api";
|
||||
import type { KubeJsonApi as InternalKubeJsonApi } from "../../common/k8s-api/kube-json-api";
|
||||
import createKubeJsonApiInjectable from "../../common/k8s-api/create-kube-json-api.injectable";
|
||||
import type { RequestInit } from "node-fetch";
|
||||
import createKubeJsonApiForClusterInjectable from "../../common/k8s-api/create-kube-json-api-for-cluster.injectable";
|
||||
|
||||
export const apiManager = asLegacyGlobalForExtensionApi(apiManagerInjectable);
|
||||
export const forCluster = asLegacyGlobalFunctionForExtensionApi(createKubeApiForClusterInjectable);
|
||||
export const forRemoteCluster = asLegacyGlobalFunctionForExtensionApi(createKubeApiForRemoteClusterInjectable);
|
||||
export const createResourceStack = asLegacyGlobalFunctionForExtensionApi(createResourceStackInjectable);
|
||||
|
||||
const getKubeApiDeps = (): KubeApiDependencies => {
|
||||
const di = getLegacyGlobalDiForExtensionApi();
|
||||
|
||||
return {
|
||||
logger: di.inject(loggerInjectable),
|
||||
maybeKubeApi: di.inject(maybeKubeApiInjectable),
|
||||
};
|
||||
};
|
||||
|
||||
// NOTE: this is done to preserve `instanceOf` behaviour
|
||||
function KubeApiCstr<
|
||||
Object extends KubeObject = KubeObject,
|
||||
Data extends KubeJsonApiDataFor<Object> = KubeJsonApiDataFor<Object>,
|
||||
>(opts: KubeApiOptions<Object, Data>) {
|
||||
const api = new InternalKubeApi(getKubeApiDeps(), opts);
|
||||
|
||||
const di = getLegacyGlobalDiForExtensionApi();
|
||||
const storesAndApisCanBeCreated = di.inject(storesAndApisCanBeCreatedInjectionToken);
|
||||
|
||||
if (storesAndApisCanBeCreated) {
|
||||
apiManager.registerApi(api);
|
||||
}
|
||||
|
||||
return api;
|
||||
}
|
||||
|
||||
export type KubeApi<
|
||||
Object extends KubeObject = KubeObject,
|
||||
Data extends KubeJsonApiDataFor<Object> = KubeJsonApiDataFor<Object>,
|
||||
> = InternalKubeApi<Object, Data>;
|
||||
|
||||
export const KubeApi = KubeApiCstr as unknown as new<
|
||||
Object extends KubeObject = KubeObject,
|
||||
Data extends KubeJsonApiDataFor<Object> = KubeJsonApiDataFor<Object>,
|
||||
>(opts: KubeApiOptions<Object, Data>) => InternalKubeApi<Object, Data>;
|
||||
|
||||
/**
|
||||
* @deprecated Switch to using `Common.createResourceStack` instead
|
||||
*/
|
||||
export class ResourceStack implements ResourceApplyingStack {
|
||||
private readonly impl: ResourceApplyingStack;
|
||||
|
||||
constructor(cluster: KubernetesCluster, name: string) {
|
||||
this.impl = createResourceStack(cluster, name);
|
||||
}
|
||||
|
||||
kubectlApplyFolder(folderPath: string, templateContext?: any, extraArgs?: string[] | undefined): Promise<string> {
|
||||
return this.impl.kubectlApplyFolder(folderPath, templateContext, extraArgs);
|
||||
}
|
||||
|
||||
kubectlDeleteFolder(folderPath: string, templateContext?: any, extraArgs?: string[] | undefined): Promise<string> {
|
||||
return this.impl.kubectlDeleteFolder(folderPath, templateContext, extraArgs);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated This type is unused
|
||||
*/
|
||||
export interface IKubeApiCluster {
|
||||
metadata: {
|
||||
uid: string;
|
||||
};
|
||||
}
|
||||
|
||||
export type { CreateKubeApiForRemoteClusterConfig as IRemoteKubeApiConfig } from "../../common/k8s-api/create-kube-api-for-remote-cluster.injectable";
|
||||
export type { CreateKubeApiForLocalClusterConfig as ILocalKubeApiConfig } from "../../common/k8s-api/create-kube-api-for-cluster.injectable";
|
||||
|
||||
export {
|
||||
KubeObject,
|
||||
KubeStatus,
|
||||
type OwnerReference,
|
||||
type KubeObjectMetadata,
|
||||
type NamespaceScopedMetadata,
|
||||
type ClusterScopedMetadata,
|
||||
type BaseKubeJsonApiObjectMetadata,
|
||||
type KubeJsonApiObjectMetadata,
|
||||
type KubeStatusData,
|
||||
} from "../../common/k8s-api/kube-object";
|
||||
|
||||
export type {
|
||||
KubeJsonApiData,
|
||||
} from "../../common/k8s-api/kube-json-api";
|
||||
|
||||
function KubeJsonApiCstr(config: JsonApiConfig, reqInit?: RequestInit) {
|
||||
const di = getLegacyGlobalDiForExtensionApi();
|
||||
const createKubeJsonApi = di.inject(createKubeJsonApiInjectable);
|
||||
|
||||
return createKubeJsonApi(config, reqInit);
|
||||
}
|
||||
|
||||
export type KubeJsonApi = InternalKubeJsonApi;
|
||||
|
||||
export const KubeJsonApi = Object.assign(
|
||||
KubeJsonApiCstr as unknown as new (config: JsonApiConfig, reqInit?: RequestInit) => InternalKubeJsonApi,
|
||||
{
|
||||
forCluster: asLegacyGlobalForExtensionApi(createKubeJsonApiForClusterInjectable),
|
||||
},
|
||||
);
|
||||
|
||||
export abstract class KubeObjectStore<
|
||||
K extends KubeObject = KubeObject,
|
||||
A extends InternalKubeApi<K, D> = InternalKubeApi<K, KubeJsonApiDataFor<K>>,
|
||||
D extends KubeJsonApiDataFor<K> = KubeApiDataFrom<K, A>,
|
||||
> extends InternalKubeObjectStore<K, A, D> {
|
||||
/**
|
||||
* @deprecated This is no longer used and shouldn't have been every really used
|
||||
*/
|
||||
static readonly context = {
|
||||
set: (ctx: ClusterContext) => {
|
||||
console.warn("Setting KubeObjectStore.context is no longer supported");
|
||||
void ctx;
|
||||
},
|
||||
get: () => asLegacyGlobalForExtensionApi(clusterFrameContextForNamespacedResourcesInjectable),
|
||||
};
|
||||
|
||||
get context() {
|
||||
return this.dependencies.context;
|
||||
}
|
||||
|
||||
constructor(api: A, opts?: KubeObjectStoreOptions);
|
||||
/**
|
||||
* @deprecated Supply API instance through constructor
|
||||
*/
|
||||
constructor();
|
||||
constructor(api?: A, opts?: KubeObjectStoreOptions) {
|
||||
const di = getLegacyGlobalDiForExtensionApi();
|
||||
|
||||
super(
|
||||
{
|
||||
context: di.inject(clusterFrameContextForNamespacedResourcesInjectable),
|
||||
logger: di.inject(loggerInjectable),
|
||||
},
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
api!,
|
||||
opts,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export {
|
||||
type JsonPatch,
|
||||
type KubeObjectStoreLoadAllParams,
|
||||
type KubeObjectStoreLoadingParams,
|
||||
type KubeObjectStoreSubscribeParams,
|
||||
} from "../../common/k8s-api/kube-object.store";
|
||||
|
||||
/**
|
||||
* @deprecated This type is only present for backwards compatable typescript support
|
||||
*/
|
||||
export interface IgnoredKubeApiOptions {
|
||||
/**
|
||||
* @deprecated this option is overridden and should not be used
|
||||
*/
|
||||
objectConstructor?: any;
|
||||
/**
|
||||
* @deprecated this option is overridden and should not be used
|
||||
*/
|
||||
kind?: any;
|
||||
/**
|
||||
* @deprecated this option is overridden and should not be used
|
||||
*/
|
||||
isNamespaces?: any;
|
||||
/**
|
||||
* @deprecated this option is overridden and should not be used
|
||||
*/
|
||||
apiBase?: any;
|
||||
}
|
||||
|
||||
// NOTE: these *Constructor functions MUST be `function` to work with `new X()`
|
||||
function PodsApiConstructor(opts?: DerivedKubeApiOptions & IgnoredKubeApiOptions) {
|
||||
return new PodApi(getKubeApiDeps(), opts);
|
||||
}
|
||||
|
||||
export type PodsApi = PodApi;
|
||||
export const PodsApi = PodsApiConstructor as unknown as new (opts?: DerivedKubeApiOptions & IgnoredKubeApiOptions) => PodApi;
|
||||
|
||||
function NodesApiConstructor(opts?: DerivedKubeApiOptions & IgnoredKubeApiOptions) {
|
||||
return new NodeApi(getKubeApiDeps(), opts);
|
||||
}
|
||||
|
||||
export type NodesApi = NodeApi;
|
||||
export const NodesApi = NodesApiConstructor as unknown as new (opts?: DerivedKubeApiOptions & IgnoredKubeApiOptions) => NodeApi;
|
||||
|
||||
function DeploymentApiConstructor(opts?: DerivedKubeApiOptions) {
|
||||
return new InternalDeploymentApi(getKubeApiDeps(), opts);
|
||||
}
|
||||
|
||||
export type DeploymentApi = InternalDeploymentApi;
|
||||
export const DeploymentApi = DeploymentApiConstructor as unknown as new (opts?: DerivedKubeApiOptions) => InternalDeploymentApi;
|
||||
|
||||
function IngressApiConstructor(opts?: DerivedKubeApiOptions & IgnoredKubeApiOptions) {
|
||||
return new InternalIngressApi(getKubeApiDeps(), opts);
|
||||
}
|
||||
|
||||
export type IngressApi = InternalIngressApi;
|
||||
export const IngressApi = IngressApiConstructor as unknown as new (opts?: DerivedKubeApiOptions & IgnoredKubeApiOptions) => InternalIngressApi;
|
||||
|
||||
function PersistentVolumeClaimsApiConstructor(opts?: DerivedKubeApiOptions & IgnoredKubeApiOptions) {
|
||||
return new PersistentVolumeClaimApi(getKubeApiDeps(), opts);
|
||||
}
|
||||
|
||||
export type PersistentVolumeClaimsApi = PersistentVolumeClaimApi;
|
||||
export const PersistentVolumeClaimsApi = PersistentVolumeClaimsApiConstructor as unknown as new (opts?: DerivedKubeApiOptions & IgnoredKubeApiOptions) => PersistentVolumeClaimApi;
|
||||
|
||||
export {
|
||||
type Container as IPodContainer,
|
||||
type PodContainerStatus as IPodContainerStatus,
|
||||
Pod,
|
||||
Node,
|
||||
Deployment,
|
||||
DaemonSet,
|
||||
StatefulSet,
|
||||
Job,
|
||||
CronJob,
|
||||
ConfigMap,
|
||||
type SecretReference as ISecretRef,
|
||||
Secret,
|
||||
ReplicaSet,
|
||||
ResourceQuota,
|
||||
LimitRange,
|
||||
HorizontalPodAutoscaler,
|
||||
PodDisruptionBudget,
|
||||
PriorityClass,
|
||||
Service,
|
||||
Endpoints as Endpoint,
|
||||
Ingress,
|
||||
NetworkPolicy,
|
||||
PersistentVolume,
|
||||
PersistentVolumeClaim,
|
||||
StorageClass,
|
||||
Namespace,
|
||||
KubeEvent,
|
||||
ServiceAccount,
|
||||
Role,
|
||||
RoleBinding,
|
||||
ClusterRole,
|
||||
ClusterRoleBinding,
|
||||
CustomResourceDefinition,
|
||||
} from "../../common/k8s-api/endpoints";
|
||||
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import { asLegacyGlobalFunctionForExtensionApi } from "../as-legacy-globals-for-extension-api/as-legacy-global-function-for-extension-api";
|
||||
import { resolveSystemProxyInjectionToken } from "../../common/utils/resolve-system-proxy/resolve-system-proxy-injection-token";
|
||||
|
||||
/**
|
||||
* Resolves URL-specific proxy information from system. See more here: https://www.electronjs.org/docs/latest/api/session#sesresolveproxyurl
|
||||
* @param url - The URL for proxy information
|
||||
* @returns Promise for proxy information as string
|
||||
*/
|
||||
export const resolveSystemProxy = asLegacyGlobalFunctionForExtensionApi(resolveSystemProxyInjectionToken);
|
||||
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
export type { StatusBarRegistration } from "../../renderer/components/status-bar/status-bar-registration";
|
||||
export type { KubeObjectMenuRegistration, KubeObjectMenuComponents } from "../../renderer/components/kube-object-menu/kube-object-menu-registration";
|
||||
export type { AppPreferenceRegistration, AppPreferenceComponents } from "../../features/preferences/renderer/compliance-for-legacy-extension-api/app-preference-registration";
|
||||
export type { KubeObjectDetailRegistration, KubeObjectDetailComponents } from "../../renderer/components/kube-object-details/kube-object-detail-registration";
|
||||
export type { KubeObjectStatusRegistration } from "../../renderer/components/kube-object-status-icon/kube-object-status-registration";
|
||||
export type { PageRegistration, RegisteredPage, PageParams, PageComponentProps, PageComponents, PageTarget } from "../../renderer/routes/page-registration";
|
||||
export type { ClusterPageMenuRegistration, ClusterPageMenuComponents } from "../../renderer/components/layout/cluster-page-menu";
|
||||
export type { ProtocolHandlerRegistration, RouteParams as ProtocolRouteParams, RouteHandler as ProtocolRouteHandler } from "../../common/protocol-handler/registration";
|
||||
export type { CustomCategoryViewProps, CustomCategoryViewComponents, CustomCategoryViewRegistration } from "../../renderer/components/+catalog/custom-views";
|
||||
export type { ShellEnvModifier, ShellEnvContext } from "../../main/shell-session/shell-env-modifier/shell-env-modifier-registration";
|
||||
export type { KubeObjectContextMenuItem, KubeObjectOnContextMenuOpenContext, KubeObjectOnContextMenuOpen, KubeObjectHandlers, KubeObjectHandlerRegistration } from "../../renderer/kube-object/handler";
|
||||
export type { TrayMenuRegistration } from "../../main/tray/tray-menu-registration";
|
||||
export type { MenuRegistration } from "../../features/application-menu/main/menu-registration";
|
||||
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
export { ExtensionStore } from "../extension-store";
|
||||
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
export type IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
|
||||
export type IpcRendererEvent = Electron.IpcRendererEvent;
|
||||
export type IpcMainEvent = Electron.IpcMainEvent;
|
||||
|
||||
export * from "./registrations";
|
||||
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import userStoreInjectable from "../../common/user-store/user-store.injectable";
|
||||
import { asLegacyGlobalForExtensionApi } from "../as-legacy-globals-for-extension-api/as-legacy-global-object-for-extension-api";
|
||||
export interface UserPreferenceExtensionItems {
|
||||
/**
|
||||
* Get the configured kubectl binaries path.
|
||||
*/
|
||||
getKubectlPath: () => string | undefined;
|
||||
}
|
||||
|
||||
const userStore = asLegacyGlobalForExtensionApi(userStoreInjectable);
|
||||
|
||||
export const Preferences: UserPreferenceExtensionItems = {
|
||||
getKubectlPath: () => userStore.kubectlBinariesPath,
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import openLinkInBrowserInjectable from "../../common/utils/open-link-in-browser.injectable";
|
||||
import buildVersionInjectable from "../../main/vars/build-version/build-version.injectable";
|
||||
import { asLegacyGlobalFunctionForExtensionApi } from "../as-legacy-globals-for-extension-api/as-legacy-global-function-for-extension-api";
|
||||
import { getLegacyGlobalDiForExtensionApi } from "../as-legacy-globals-for-extension-api/legacy-global-di-for-extension-api";
|
||||
import { Singleton } from "../../common/utils";
|
||||
import { prevDefault, stopPropagation } from "../../renderer/utils/prevDefault";
|
||||
import type { IClassName } from "../../renderer/utils/cssNames";
|
||||
import { cssNames } from "../../renderer/utils/cssNames";
|
||||
|
||||
export interface UtilsExtensionItems {
|
||||
Singleton: typeof Singleton;
|
||||
prevDefault: <E extends React.SyntheticEvent | Event, R>(callback: (evt: E) => R) => (evt: E) => R;
|
||||
stopPropagation: (evt: Event | React.SyntheticEvent) => void;
|
||||
cssNames: (...classNames: IClassName[]) => string;
|
||||
openExternal: (url: string) => Promise<void>;
|
||||
openBrowser: (url: string) => Promise<void>;
|
||||
getAppVersion: () => string;
|
||||
}
|
||||
|
||||
export const Util: UtilsExtensionItems = {
|
||||
Singleton,
|
||||
prevDefault,
|
||||
stopPropagation,
|
||||
cssNames,
|
||||
openExternal: asLegacyGlobalFunctionForExtensionApi(openLinkInBrowserInjectable),
|
||||
openBrowser: asLegacyGlobalFunctionForExtensionApi(openLinkInBrowserInjectable),
|
||||
getAppVersion: () => {
|
||||
const di = getLegacyGlobalDiForExtensionApi();
|
||||
|
||||
return di.inject(buildVersionInjectable).get();
|
||||
},
|
||||
};
|
||||
Reference in new issue
Block a user