mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Turn on strict mode in tsconfig.json, some helpful lints, and required cleanup where strictness necessitates it (#5195)
* Turn on strict mode in tsconfig.json - Add route, clusterRoute, and payloadValidatedClusterRoute helper functions to improve types with backend routes - Turn on the following new lints: - react/jsx-first-prop-new-line - react/jsx-wrap-multilines - react/jsx-one-expression-per-line - react/jsx-max-props-per-line - react/jsx-indent - react/jsx-indent-props Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix build Signed-off-by: Sebastian Malton <sebastian@malton.name> * Replace KubeObject scope strings with enum Signed-off-by: Sebastian Malton <sebastian@malton.name> * Revert package.json version changes Signed-off-by: Sebastian Malton <sebastian@malton.name> * revert move hostedCluster(Id) Signed-off-by: Sebastian Malton <sebastian@malton.name> * change some type param names to be not single letters Signed-off-by: Sebastian Malton <sebastian@malton.name> * remove copy-extension-themes Signed-off-by: Sebastian Malton <sebastian@malton.name> * add new make clean action Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix build to not use webpack for generating types Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix kube-object-menu.test.tsx Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix select.test.tsx Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix catalog.test.tsx Signed-off-by: Sebastian Malton <sebastian@malton.name> * revert move fileNameMigration to index Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix ref logic error Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix log-resource-selector.test.tsx tests Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix dock-store.test.ts test by overriding createStorage to not touch file system Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix cluster.test.ts tests Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix kube=api.test.ts Signed-off-by: Sebastian Malton <sebastian@malton.name> * fixed hotbar-store.test.ts Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix kubeconfig-manager.test.ts Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix cluster-role-bindings/__tests__/dialog.test.tsx Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix role-bindings/__tests__/dialog.test.tsx Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix pods.test.ts Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix delete-cluster-dialog.test.tsx Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix daemonset.store.test.ts Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix replicaset.store.test.ts Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix statefulsets/dialog/dialog.test.tsx Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix replicasets/scale-dialog/dialog.test.tsx Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix deployments.store.test.ts Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix deployments/scale/dialog.test.tsx Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix cronjob.store.test.ts Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix stateful-set.api.test.ts Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix deployment.api.test.ts Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix api-manager.test.ts Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix statefulset.store.test.ts Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix job.store.test.ts Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix pods.store.test.ts Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix scroll-spy.test.tsx Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix hotbar-remove-command.test.tsx Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix catalog-entity-registry.test.ts Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix welcome.test.tsx Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix verify-that-all-routes-have-route-component.test.ts Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix pod-tolerations.test.tsx Signed-off-by: Sebastian Malton <sebastian@malton.name> * better fix for previous 3 fixes, plus also select.test.tsx Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix kube-object-menu.test.tsx Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix app-paths.test.ts Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix dock-tabs.test.tsx Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix isReactNode typing Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix sub-title.tsx Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix drawer.tsx Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix list-layout.tsx and header.tsx Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix error-boundary.tsx Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix upgrade-chart/store.ts and dock-tab.store.ts Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix install-chart/store.ts Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix edit-resource/store.ts Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix create-resource/store.ts Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix namespace-select.tsx Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix namespace-select-filter.tsx Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix crd-list.tsx Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix wrong types for extensions Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix circular dependency Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix circular dependency on catalogCategoryRegistry Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix api-kube Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix type errors, most <Select /> errors Signed-off-by: Sebastian Malton <sebastian@malton.name> * fixing more type errors Signed-off-by: Sebastian Malton <sebastian@malton.name> * some more fixing type errors Signed-off-by: Sebastian Malton <sebastian@malton.name> * convert all KubeApis to injectable with legacy global backups Signed-off-by: Sebastian Malton <sebastian@malton.name> * factor out into a common file all the exports Signed-off-by: Sebastian Malton <sebastian@malton.name> * convert all KubeObjectStores to injectable with legacy global backups Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix lint Signed-off-by: Sebastian Malton <sebastian@malton.name> * remove unused legacy KubeApi globals Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix bad previous commit Signed-off-by: Sebastian Malton <sebastian@malton.name> * more crash fixing Signed-off-by: Sebastian Malton <sebastian@malton.name> * try and fix behavioural tests Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix sidebar-and-tab-navigation-for-core.test.tsx Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix sidebar-and-tab-navigation-for-extensions.test.tsx Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix navigation-using-application-menu.test.ts Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix catalog.test.tsx Signed-off-by: Sebastian Malton <sebastian@malton.name> * Make ThemeStore non-singleton and fix navigation-to-terminal-preferences.test.ts Signed-off-by: Sebastian Malton <sebastian@malton.name> * extensions.test.tsx Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix catalog-entity-registry.test.ts Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix navigation-using-application-menu.test.ts Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix log-resource-selector.test.tsx Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix dock-tabs.test.tsx Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix delete-cluster-dialog.test.tsx Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix navigation-to-kubernetes-preferences.test.ts Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix navigation-to-editor-preferences.test.ts Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix navigation-to-proxy-preferences.test.ts Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix navigation-using-application-menu.test.ts Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix navigation-to-application-preferences.test.ts Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix dock-store.test.ts Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix select.test.tsx Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix role-bindings/__tests__/dialog.test.tsx Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix hotbar-remove-command.test.tsx Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix cluster-role-bindings/__tests__/dialog.test.tsx Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix navigation-to-extension-specific-preferences.test.tsx Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix navigation-to-telemetry-preferences.test.tsx Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix closing-preferences.test.tsx Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix navigation-to-editor-preferences.test.ts Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix navigation-to-proxy-preferences.test.ts - Fix other type errors too Signed-off-by: Sebastian Malton <sebastian@malton.name> * final tweaks Signed-off-by: Sebastian Malton <sebastian@malton.name> * Add more tsconfig files, fix bug in <Catalog> - Make all of history, navigation injectable Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix type errors Signed-off-by: Sebastian Malton <sebastian@malton.name> * Convert all of kube-details-params/ and navigate/ to injectable - This fixes a runtime error that was encountered during testing Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix runtime errors on renderer - remove all static uses of `createPageParam` (and then removed the legacy global) - Made LensRendererExtension and LensMainExtension just used dependencies and not the getLegacyDi - Fixed circular dep in extension-loader Signed-off-by: Sebastian Malton <sebastian@malton.name> * Move registerStore calls to after injectMany Signed-off-by: Sebastian Malton <sebastian@malton.name> * replace all the rest of the legacy uses of apiManager Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix stack overflow and cycles in DI Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix NamespaceSelectFilter not opening Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix WizardStep and AddNamespaceDialog Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix KubeApi's not being registered Signed-off-by: Sebastian Malton <sebastian@malton.name> * cleanup WindowManager Signed-off-by: Sebastian Malton <sebastian@malton.name> * Proper fix for Wizard, fix NamespaceStore.subscribe Signed-off-by: Sebastian Malton <sebastian@malton.name> * Rewrite withTooltip to be more type correct - Fixes mobx related "too many recursive actions" error - Change all the uses of withTooltips to be functional components Signed-off-by: Sebastian Malton <sebastian@malton.name> * Add e2e test to cover kube api registration Signed-off-by: Sebastian Malton <sebastian@malton.name> * cleanup internal-commands Signed-off-by: Sebastian Malton <sebastian@malton.name> * remove cast in <Animate> Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix command-palette e2e test Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix type error after rebase Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix test name Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix lint Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix code to help CodeQL scanner Signed-off-by: Sebastian Malton <sebastian@malton.name> * update intree extension lock files Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix build-extensions picking wrong @types/react Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix tests from rebase Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix type error Signed-off-by: Sebastian Malton <sebastian@malton.name> * Make KubeconfigSyncManager more injectable Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix crash in test mode for Dialog Signed-off-by: Sebastian Malton <sebastian@malton.name> * make Select snapshots deterministic Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix new type error Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix kube-object.store.test.ts typing Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix merge build issues Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix snapshots after merge Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix lint after merge Signed-off-by: Sebastian Malton <sebastian@malton.name> * reexport BaseKubeJsonApiObjectMetadata Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix typo in terminalSpawningPool Signed-off-by: Sebastian Malton <sebastian@malton.name> * remove duplicate license header Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix typo to waitUntilDefined Signed-off-by: Sebastian Malton <sebastian@malton.name> * remove iter use from getLegacyGlobalDiForExtensionApi Signed-off-by: Sebastian Malton <sebastian@malton.name> * remove complex createStorage override Signed-off-by: Sebastian Malton <sebastian@malton.name> * override logger with mocks only when needed for tests Signed-off-by: Sebastian Malton <sebastian@malton.name> * remove specialized overrideStore flags for getDiForUnitTesting Signed-off-by: Sebastian Malton <sebastian@malton.name> * remove unnecessary | undefined types from the exactOptionalFieldTypes experiment Signed-off-by: Sebastian Malton <sebastian@malton.name> * use more descriptive name for local test mocks Signed-off-by: Sebastian Malton <sebastian@malton.name> * remove unnecessary addition to 'make clean' target Signed-off-by: Sebastian Malton <sebastian@malton.name> * remove oddity of KubeObjectStore.getById(undefined) being allowed Signed-off-by: Sebastian Malton <sebastian@malton.name> * rename KubeObject.getDescriptor in favour of name without fundemental JS meaning Signed-off-by: Sebastian Malton <sebastian@malton.name> * Simplify legacyRegisterApi when working in behaviour unit tests - Don't emit within main environment as there should be no auto registering there Signed-off-by: Sebastian Malton <sebastian@malton.name> * change confusing variable name in ReactiveDuration Signed-off-by: Sebastian Malton <sebastian@malton.name> * make visitor pattern more explicit for Entity contextMenuOpen Signed-off-by: Sebastian Malton <sebastian@malton.name> * toggleDetails -> toggleKubeDetailsPane is more specific Signed-off-by: Sebastian Malton <sebastian@malton.name> * remove outdated comment Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix bug where LensExtension dependencies are not set Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix tests from the revert of react 18 Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix more tests from merge Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix typings with new is-compatible-extension tests Signed-off-by: Sebastian Malton <sebastian@malton.name> * more type fixing Signed-off-by: Sebastian Malton <sebastian@malton.name> * Revert in-tree extension versions Signed-off-by: Sebastian Malton <sebastian@malton.name> * Improve name of guarding injectable for stores and apis - New name better implies that it is just a guard state and does not do anything Signed-off-by: Sebastian Malton <sebastian@malton.name> * Add helper for <Select>.isMulti for storing in a Set<Value> Signed-off-by: Sebastian Malton <sebastian@malton.name> * fix is-compatible-extension.test.ts types Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
381d77c633
commit
dfcb7c3330
1062 files changed
+26512
-28689
No files matched your search
@@ -3,10 +3,9 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import assert from "assert";
|
||||
import semver from "semver";
|
||||
import {
|
||||
isCompatibleExtension,
|
||||
} from "../extension-discovery/is-compatible-extension/is-compatible-extension";
|
||||
import { isCompatibleExtension } from "../extension-discovery/is-compatible-extension/is-compatible-extension";
|
||||
import type { LensExtensionManifest } from "../lens-extension";
|
||||
|
||||
describe("Extension/App versions compatibility checks", () => {
|
||||
@@ -60,6 +59,8 @@ function isCompatible({ extLensEngineVersion = "^1.0", appVersion = "1.0" } = {}
|
||||
const appSemVer = semver.coerce(appVersion);
|
||||
const extensionManifestMock = getExtensionManifestMock(extLensEngineVersion);
|
||||
|
||||
assert(appSemVer);
|
||||
|
||||
return isCompatibleExtension({ appSemVer })(extensionManifestMock);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import { stdout, stderr } from "process";
|
||||
|
||||
console = new Console(stdout, stderr);
|
||||
|
||||
let ext: LensExtension = null;
|
||||
let ext: LensExtension;
|
||||
|
||||
describe("lens extension", () => {
|
||||
beforeEach(async () => {
|
||||
|
||||
+16
-10
@@ -7,17 +7,23 @@ import { asLegacyGlobalForExtensionApi } from "./as-legacy-global-object-for-ext
|
||||
import { getLegacyGlobalDiForExtensionApi } from "./legacy-global-di-for-extension-api";
|
||||
import loggerInjectable from "../../common/logger.injectable";
|
||||
|
||||
export const asLegacyGlobalSingletonForExtensionApi = <
|
||||
Instance,
|
||||
InstantiationParameter = void,
|
||||
>(
|
||||
injectable: Injectable<Instance, unknown, InstantiationParameter>,
|
||||
instantiationParameter?: InstantiationParameter,
|
||||
) => {
|
||||
export interface LegacySingleton<T> {
|
||||
createInstance(): T;
|
||||
getInstance(): T;
|
||||
resetInstance(): void;
|
||||
}
|
||||
|
||||
export function asLegacyGlobalSingletonForExtensionApi<Instance>(injectable: Injectable<Instance, unknown, void>): LegacySingleton<Instance>;
|
||||
export function asLegacyGlobalSingletonForExtensionApi<Instance, InstantiationParameter>(injectable: Injectable<Instance, unknown, InstantiationParameter>, param: InstantiationParameter): LegacySingleton<Instance>;
|
||||
|
||||
export function asLegacyGlobalSingletonForExtensionApi<Instance, InstantiationParameter>(
|
||||
injectable: Injectable<Instance, unknown, InstantiationParameter>,
|
||||
instantiationParameter?: InstantiationParameter,
|
||||
): LegacySingleton<Instance> {
|
||||
const instance = asLegacyGlobalForExtensionApi(
|
||||
injectable,
|
||||
injectable as never,
|
||||
instantiationParameter,
|
||||
);
|
||||
) as Instance;
|
||||
|
||||
return {
|
||||
createInstance: () => instance,
|
||||
@@ -33,4 +39,4 @@ export const asLegacyGlobalSingletonForExtensionApi = <
|
||||
);
|
||||
},
|
||||
};
|
||||
};
|
||||
}
|
||||
+11
-6
@@ -19,14 +19,19 @@ export const setLegacyGlobalDiForExtensionApi = (
|
||||
};
|
||||
|
||||
export const getLegacyGlobalDiForExtensionApi = () => {
|
||||
const globalDis = [...legacyGlobalDis.values()];
|
||||
|
||||
if (globalDis.length > 1) {
|
||||
if (legacyGlobalDis.size > 1) {
|
||||
throw new Error("Tried to get DI container using legacy globals where there is multiple containers available.");
|
||||
}
|
||||
|
||||
return globalDis[0];
|
||||
const [di] = [...legacyGlobalDis.values()];
|
||||
|
||||
if (!di) {
|
||||
throw new Error("Tried to get DI container using legacy globals where there is no containers available.");
|
||||
}
|
||||
|
||||
return di;
|
||||
};
|
||||
|
||||
export const getEnvironmentSpecificLegacyGlobalDiForExtensionApi = (environment: Environments) =>
|
||||
legacyGlobalDis.get(environment);
|
||||
export function getEnvironmentSpecificLegacyGlobalDiForExtensionApi(environment: Environments) {
|
||||
return legacyGlobalDis.get(environment);
|
||||
}
|
||||
@@ -3,13 +3,17 @@
|
||||
* 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,
|
||||
kubernetesClusterCategory,
|
||||
GeneralEntity,
|
||||
WebLink,
|
||||
} from "../../common/catalog-entities";
|
||||
|
||||
export const kubernetesClusterCategory = asLegacyGlobalForExtensionApi(kubernetesClusterCategoryInjectable);
|
||||
|
||||
export type {
|
||||
KubernetesClusterPrometheusMetrics,
|
||||
KubernetesClusterSpec,
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
/**
|
||||
* 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`
|
||||
|
||||
export { ResourceStack } from "../../common/k8s/resource-stack";
|
||||
import apiManagerInjectable from "../../common/k8s-api/api-manager/manager.injectable";
|
||||
import { asLegacyGlobalForExtensionApi } from "../as-legacy-globals-for-extension-api/as-legacy-global-object-for-extension-api";
|
||||
|
||||
export const apiManager = asLegacyGlobalForExtensionApi(apiManagerInjectable);
|
||||
|
||||
export {
|
||||
KubeApi,
|
||||
forCluster,
|
||||
forRemoteCluster,
|
||||
type ILocalKubeApiConfig,
|
||||
type IRemoteKubeApiConfig,
|
||||
type IKubeApiCluster,
|
||||
} from "../../common/k8s-api/kube-api";
|
||||
|
||||
export {
|
||||
KubeObject,
|
||||
KubeStatus,
|
||||
type KubeObjectMetadata,
|
||||
type BaseKubeJsonApiObjectMetadata,
|
||||
type KubeJsonApiObjectMetadata,
|
||||
type KubeStatusData,
|
||||
} from "../../common/k8s-api/kube-object";
|
||||
|
||||
export {
|
||||
KubeObjectStore,
|
||||
type KubeObjectStoreLoadAllParams,
|
||||
type KubeObjectStoreLoadingParams,
|
||||
type KubeObjectStoreSubscribeParams,
|
||||
} from "../../common/k8s-api/kube-object.store";
|
||||
|
||||
export {
|
||||
type PodContainer as IPodContainer,
|
||||
type PodContainerStatus as IPodContainerStatus,
|
||||
Pod,
|
||||
PodApi as PodsApi,
|
||||
Node,
|
||||
NodeApi as NodesApi,
|
||||
Deployment,
|
||||
DeploymentApi,
|
||||
DaemonSet,
|
||||
StatefulSet,
|
||||
Job,
|
||||
CronJob,
|
||||
ConfigMap,
|
||||
type SecretReference as ISecretRef,
|
||||
Secret,
|
||||
ReplicaSet,
|
||||
ResourceQuota,
|
||||
LimitRange,
|
||||
HorizontalPodAutoscaler,
|
||||
PodDisruptionBudget,
|
||||
Service,
|
||||
Endpoints as Endpoint,
|
||||
Ingress, IngressApi,
|
||||
NetworkPolicy,
|
||||
PersistentVolume,
|
||||
PersistentVolumeClaim,
|
||||
PersistentVolumeClaimApi as PersistentVolumeClaimsApi,
|
||||
StorageClass,
|
||||
Namespace,
|
||||
KubeEvent,
|
||||
ServiceAccount,
|
||||
Role,
|
||||
RoleBinding,
|
||||
ClusterRole,
|
||||
ClusterRoleBinding,
|
||||
CustomResourceDefinition,
|
||||
} from "../../common/k8s-api/endpoints";
|
||||
@@ -3,6 +3,7 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import type { FSWatcher } from "chokidar";
|
||||
import { watch } from "chokidar";
|
||||
import path from "path";
|
||||
import os from "os";
|
||||
@@ -66,7 +67,7 @@ describe("ExtensionDiscovery", () => {
|
||||
});
|
||||
|
||||
it("emits add for added extension", async (done) => {
|
||||
let addHandler: (filePath: string) => void;
|
||||
let addHandler!: (filePath: string) => void;
|
||||
|
||||
mockedFse.readJson.mockImplementation((p) => {
|
||||
expect(p).toBe(path.join(os.homedir(), ".k8slens/extensions/my-extension/package.json"));
|
||||
@@ -82,7 +83,7 @@ describe("ExtensionDiscovery", () => {
|
||||
|
||||
mockedFse.pathExists.mockImplementation(() => true);
|
||||
|
||||
const mockWatchInstance: any = {
|
||||
const mockWatchInstance = {
|
||||
on: jest.fn((event: string, handler: typeof addHandler) => {
|
||||
if (event === "add") {
|
||||
addHandler = handler;
|
||||
@@ -90,11 +91,9 @@ describe("ExtensionDiscovery", () => {
|
||||
|
||||
return mockWatchInstance;
|
||||
}),
|
||||
};
|
||||
} as unknown as FSWatcher;
|
||||
|
||||
mockedWatch.mockImplementationOnce(() =>
|
||||
(mockWatchInstance) as any,
|
||||
);
|
||||
mockedWatch.mockImplementationOnce(() => mockWatchInstance);
|
||||
|
||||
// Need to force isLoaded to be true so that the file watching is started
|
||||
extensionDiscovery.isLoaded = true;
|
||||
@@ -124,9 +123,9 @@ describe("ExtensionDiscovery", () => {
|
||||
});
|
||||
|
||||
it("doesn't emit add for added file under extension", async done => {
|
||||
let addHandler: (filePath: string) => void;
|
||||
let addHandler!: (filePath: string) => void;
|
||||
|
||||
const mockWatchInstance: any = {
|
||||
const mockWatchInstance = {
|
||||
on: jest.fn((event: string, handler: typeof addHandler) => {
|
||||
if (event === "add") {
|
||||
addHandler = handler;
|
||||
@@ -134,11 +133,9 @@ describe("ExtensionDiscovery", () => {
|
||||
|
||||
return mockWatchInstance;
|
||||
}),
|
||||
};
|
||||
} as unknown as FSWatcher;
|
||||
|
||||
mockedWatch.mockImplementationOnce(() =>
|
||||
(mockWatchInstance) as any,
|
||||
);
|
||||
mockedWatch.mockImplementationOnce(() => mockWatchInstance);
|
||||
|
||||
// Need to force isLoaded to be true so that the file watching is started
|
||||
extensionDiscovery.isLoaded = true;
|
||||
|
||||
@@ -11,7 +11,7 @@ import { makeObservable, observable, reaction, when } from "mobx";
|
||||
import os from "os";
|
||||
import path from "path";
|
||||
import { broadcastMessage, ipcMainHandle, ipcRendererOn } from "../../common/ipc";
|
||||
import { toJS } from "../../common/utils";
|
||||
import { isErrnoException, toJS } from "../../common/utils";
|
||||
import logger from "../../main/logger";
|
||||
import type { ExtensionsStore } from "../extensions-store/extensions-store";
|
||||
import type { ExtensionLoader } from "../extension-loader";
|
||||
@@ -81,7 +81,7 @@ interface LoadFromFolderOptions {
|
||||
* - "remove": When extension is removed. The event is of type LensExtensionId
|
||||
*/
|
||||
export class ExtensionDiscovery {
|
||||
protected bundledFolderPath: string;
|
||||
protected bundledFolderPath!: string;
|
||||
|
||||
private loadStarted = false;
|
||||
private extensions: Map<string, InstalledExtension> = new Map();
|
||||
@@ -271,7 +271,13 @@ export class ExtensionDiscovery {
|
||||
* @param extensionId The ID of the extension to uninstall.
|
||||
*/
|
||||
async uninstallExtension(extensionId: LensExtensionId): Promise<void> {
|
||||
const { manifest, absolutePath } = this.extensions.get(extensionId) ?? this.dependencies.extensionLoader.getExtension(extensionId);
|
||||
const extension = this.extensions.get(extensionId) ?? this.dependencies.extensionLoader.getExtension(extensionId);
|
||||
|
||||
if (!extension) {
|
||||
return void logger.warn(`${logModule} could not uninstall extension, not found`, { id: extensionId });
|
||||
}
|
||||
|
||||
const { manifest, absolutePath } = extension;
|
||||
|
||||
logger.info(`${logModule} Uninstalling ${manifest.name}`);
|
||||
|
||||
@@ -369,7 +375,7 @@ export class ExtensionDiscovery {
|
||||
isCompatible,
|
||||
};
|
||||
} catch (error) {
|
||||
if (error.code === "ENOTDIR") {
|
||||
if (isErrnoException(error) && error.code === "ENOTDIR") {
|
||||
// ignore this error, probably from .DS_Store file
|
||||
logger.debug(`${logModule}: failed to load extension manifest through a not-dir-like at ${manifestPath}`);
|
||||
} else {
|
||||
@@ -392,10 +398,12 @@ export class ExtensionDiscovery {
|
||||
try {
|
||||
await this.dependencies.installExtension(extension.absolutePath);
|
||||
} catch (error) {
|
||||
const message = error.message || error || "unknown error";
|
||||
const message = error instanceof Error
|
||||
? error.message
|
||||
: String(error || "unknown error");
|
||||
const { name, version } = extension.manifest;
|
||||
|
||||
logger.error(`${logModule}: failed to install user extension ${name}@${version}`, message);
|
||||
logger.error(`${logModule}: failed to install user extension ${name}@${version}: ${message}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -28,8 +28,8 @@ export const isCompatibleExtension = ({ appSemVer }: Dependencies): ((manifest:
|
||||
const { major: extMajor, minor: extMinor } = semver.coerce(manifestLensEngine, {
|
||||
loose: true,
|
||||
includePrerelease: false,
|
||||
});
|
||||
const supportedVersionsByExtension: string = semver.validRange(`^${extMajor}.${extMinor}`);
|
||||
}) as semver.SemVer;
|
||||
const supportedVersionsByExtension = semver.validRange(`^${extMajor}.${extMinor}`) as string;
|
||||
|
||||
return semver.satisfies(appVersion, supportedVersionsByExtension, {
|
||||
loose: true,
|
||||
|
||||
@@ -74,7 +74,7 @@ export class ExtensionInstaller {
|
||||
});
|
||||
let stderr = "";
|
||||
|
||||
child.stderr.on("data", data => {
|
||||
child.stderr?.on("data", data => {
|
||||
stderr += String(data);
|
||||
});
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import { getInjectionToken } from "@ogre-tools/injectable";
|
||||
import type { InstalledExtension } from "../extension-discovery/extension-discovery";
|
||||
import type { LensExtension, LensExtensionConstructor } from "../lens-extension";
|
||||
|
||||
export type CreateExtensionInstance = (ExtensionClass: LensExtensionConstructor, extension: InstalledExtension) => LensExtension;
|
||||
|
||||
export const createExtensionInstanceInjectionToken = getInjectionToken<CreateExtensionInstance>({
|
||||
id: "create-extension-instance-token",
|
||||
});
|
||||
-17
@@ -1,17 +0,0 @@
|
||||
/**
|
||||
* 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 { createExtensionInstance } from "./create-extension-instance";
|
||||
import fileSystemProvisionerStoreInjectable from "./file-system-provisioner-store/file-system-provisioner-store.injectable";
|
||||
|
||||
const createExtensionInstanceInjectable = getInjectable({
|
||||
id: "create-extension-instance",
|
||||
|
||||
instantiate: (di) => createExtensionInstance({
|
||||
fileSystemProvisionerStore: di.inject(fileSystemProvisionerStoreInjectable),
|
||||
}),
|
||||
});
|
||||
|
||||
export default createExtensionInstanceInjectable;
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import type { LensExtensionConstructor } from "../../lens-extension";
|
||||
import type { InstalledExtension } from "../../extension-discovery/extension-discovery";
|
||||
import type {
|
||||
LensExtensionDependencies } from "../../lens-extension-set-dependencies";
|
||||
import {
|
||||
setLensExtensionDependencies,
|
||||
} from "../../lens-extension-set-dependencies";
|
||||
|
||||
export const createExtensionInstance =
|
||||
(dependencies: LensExtensionDependencies) =>
|
||||
(ExtensionClass: LensExtensionConstructor, extension: InstalledExtension) => {
|
||||
const instance = new ExtensionClass(extension);
|
||||
|
||||
instance[setLensExtensionDependencies](dependencies);
|
||||
|
||||
return instance;
|
||||
};
|
||||
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* 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 { observable } from "mobx";
|
||||
import type { LensExtensionId, LensExtension } from "../lens-extension";
|
||||
|
||||
const extensionInstancesInjectable = getInjectable({
|
||||
id: "extension-instances",
|
||||
instantiate: () => observable.map<LensExtensionId, LensExtension>(),
|
||||
});
|
||||
|
||||
export default extensionInstancesInjectable;
|
||||
@@ -5,20 +5,21 @@
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { ExtensionLoader } from "./extension-loader";
|
||||
import updateExtensionsStateInjectable from "./update-extensions-state/update-extensions-state.injectable";
|
||||
import createExtensionInstanceInjectable from "./create-extension-instance/create-extension-instance.injectable";
|
||||
import { extensionRegistratorInjectionToken } from "./extension-registrator-injection-token";
|
||||
import extensionInstallationCounterInjectable from "./extension-installation-counter.injectable";
|
||||
import { createExtensionInstanceInjectionToken } from "./create-extension-instance.token";
|
||||
import extensionInstancesInjectable from "./extension-instances.injectable";
|
||||
|
||||
const extensionLoaderInjectable = getInjectable({
|
||||
id: "extension-loader",
|
||||
|
||||
instantiate: (di) =>
|
||||
new ExtensionLoader({
|
||||
updateExtensionsState: di.inject(updateExtensionsStateInjectable),
|
||||
createExtensionInstance: di.inject(createExtensionInstanceInjectable),
|
||||
extensionRegistrators: di.injectMany(extensionRegistratorInjectionToken),
|
||||
extensionInstallationCounter: di.inject(extensionInstallationCounterInjectable),
|
||||
}),
|
||||
instantiate: (di) => new ExtensionLoader({
|
||||
updateExtensionsState: di.inject(updateExtensionsStateInjectable),
|
||||
createExtensionInstance: di.inject(createExtensionInstanceInjectionToken),
|
||||
extensionRegistrators: di.injectMany(extensionRegistratorInjectionToken),
|
||||
extensionInstallationCounter: di.inject(extensionInstallationCounterInjectable),
|
||||
extensionInstances: di.inject(extensionInstancesInjectable),
|
||||
}),
|
||||
});
|
||||
|
||||
export default extensionLoaderInjectable;
|
||||
@@ -4,15 +4,15 @@
|
||||
*/
|
||||
|
||||
import { ipcRenderer } from "electron";
|
||||
import { EventEmitter } from "events";
|
||||
import { isEqual } from "lodash";
|
||||
import type { ObservableMap } from "mobx";
|
||||
import { action, computed, makeObservable, observable, observe, reaction, when } from "mobx";
|
||||
import path from "path";
|
||||
import { broadcastMessage, ipcMainOn, ipcRendererOn, ipcMainHandle } from "../../common/ipc";
|
||||
import type { Disposer } from "../../common/utils";
|
||||
import { toJS } from "../../common/utils";
|
||||
import { isDefined, toJS } from "../../common/utils";
|
||||
import logger from "../../main/logger";
|
||||
import type { KubernetesCluster } from "../common-api/catalog";
|
||||
import type { CatalogEntity, KubernetesCluster } from "../common-api/catalog";
|
||||
import type { InstalledExtension } from "../extension-discovery/extension-discovery";
|
||||
import type { LensExtension, LensExtensionConstructor, LensExtensionId } from "../lens-extension";
|
||||
import type { LensRendererExtension } from "../lens-renderer-extension";
|
||||
@@ -20,14 +20,18 @@ import * as registries from "../registries";
|
||||
import type { LensExtensionState } from "../extensions-store/extensions-store";
|
||||
import { extensionLoaderFromMainChannel, extensionLoaderFromRendererChannel } from "../../common/ipc/extension-handling";
|
||||
import { requestExtensionLoaderInitialState } from "../../renderer/ipc";
|
||||
import assert from "assert";
|
||||
import { EventEmitter } from "../../common/event-emitter";
|
||||
import type { CreateExtensionInstance } from "./create-extension-instance.token";
|
||||
|
||||
const logModule = "[EXTENSIONS-LOADER]";
|
||||
|
||||
interface Dependencies {
|
||||
updateExtensionsState: (extensionsState: Record<LensExtensionId, LensExtensionState>) => void;
|
||||
createExtensionInstance: (ExtensionClass: LensExtensionConstructor, extension: InstalledExtension) => LensExtension;
|
||||
extensionRegistrators: ((extension: LensExtension, extensionInstallationCount: number) => void)[];
|
||||
extensionInstallationCounter: Map<string, number>;
|
||||
createExtensionInstance: CreateExtensionInstance;
|
||||
readonly extensionRegistrators: ((extension: LensExtension, extensionInstallationCount: number) => void)[];
|
||||
readonly extensionInstallationCounter: Map<string, number>;
|
||||
readonly extensionInstances: ObservableMap<LensExtensionId, LensExtension>;
|
||||
}
|
||||
|
||||
export interface ExtensionLoading {
|
||||
@@ -39,23 +43,21 @@ export interface ExtensionLoading {
|
||||
* Loads installed extensions to the Lens application
|
||||
*/
|
||||
export class ExtensionLoader {
|
||||
protected extensions = observable.map<LensExtensionId, InstalledExtension>();
|
||||
protected instances = observable.map<LensExtensionId, LensExtension>();
|
||||
protected readonly extensions = observable.map<LensExtensionId, InstalledExtension>();
|
||||
|
||||
/**
|
||||
* This is the set of extensions that don't come with either
|
||||
* - Main.LensExtension when running in the main process
|
||||
* - Renderer.LensExtension when running in the renderer process
|
||||
*/
|
||||
protected nonInstancesByName = observable.set<string>();
|
||||
protected readonly nonInstancesByName = observable.set<string>();
|
||||
|
||||
/**
|
||||
* This is updated by the `observe` in the constructor. DO NOT write directly to it
|
||||
*/
|
||||
protected instancesByName = observable.map<string, LensExtension>();
|
||||
protected readonly instancesByName = observable.map<string, LensExtension>();
|
||||
|
||||
// emits event "remove" of type LensExtension when the extension is removed
|
||||
private events = new EventEmitter();
|
||||
private readonly onRemoveExtensionId = new EventEmitter<[string]>();
|
||||
|
||||
@observable isLoaded = false;
|
||||
|
||||
@@ -63,10 +65,10 @@ export class ExtensionLoader {
|
||||
return when(() => this.isLoaded);
|
||||
}
|
||||
|
||||
constructor(protected dependencies : Dependencies) {
|
||||
constructor(protected readonly dependencies: Dependencies) {
|
||||
makeObservable(this);
|
||||
|
||||
observe(this.instances, change => {
|
||||
observe(this.dependencies.extensionInstances, change => {
|
||||
switch (change.type) {
|
||||
case "add":
|
||||
if (this.instancesByName.has(change.newValue.name)) {
|
||||
@@ -84,10 +86,6 @@ export class ExtensionLoader {
|
||||
});
|
||||
}
|
||||
|
||||
@computed get enabledExtensionInstances() : LensExtension[] {
|
||||
return [...this.instances.values()].filter(extension => extension.isEnabled);
|
||||
}
|
||||
|
||||
@computed get userExtensions(): Map<LensExtensionId, InstalledExtension> {
|
||||
const extensions = this.toJSON();
|
||||
|
||||
@@ -152,7 +150,7 @@ export class ExtensionLoader {
|
||||
);
|
||||
}
|
||||
|
||||
initExtensions(extensions?: Map<LensExtensionId, InstalledExtension>) {
|
||||
initExtensions(extensions: Map<LensExtensionId, InstalledExtension>) {
|
||||
this.extensions.replace(extensions);
|
||||
}
|
||||
|
||||
@@ -163,7 +161,7 @@ export class ExtensionLoader {
|
||||
@action
|
||||
removeInstance(lensExtensionId: LensExtensionId) {
|
||||
logger.info(`${logModule} deleting extension instance ${lensExtensionId}`);
|
||||
const instance = this.instances.get(lensExtensionId);
|
||||
const instance = this.dependencies.extensionInstances.get(lensExtensionId);
|
||||
|
||||
if (!instance) {
|
||||
return;
|
||||
@@ -171,8 +169,8 @@ export class ExtensionLoader {
|
||||
|
||||
try {
|
||||
instance.disable();
|
||||
this.events.emit("remove", instance);
|
||||
this.instances.delete(lensExtensionId);
|
||||
this.onRemoveExtensionId.emit(instance.id);
|
||||
this.dependencies.extensionInstances.delete(lensExtensionId);
|
||||
this.nonInstancesByName.delete(instance.name);
|
||||
} catch (error) {
|
||||
logger.error(`${logModule}: deactivation extension error`, { lensExtensionId, error });
|
||||
@@ -188,7 +186,11 @@ export class ExtensionLoader {
|
||||
}
|
||||
|
||||
setIsEnabled(lensExtensionId: LensExtensionId, isEnabled: boolean) {
|
||||
this.extensions.get(lensExtensionId).isEnabled = isEnabled;
|
||||
const extension = this.extensions.get(lensExtensionId);
|
||||
|
||||
assert(extension, `Must register extension ${lensExtensionId} with before enabling it`);
|
||||
|
||||
extension.isEnabled = isEnabled;
|
||||
}
|
||||
|
||||
protected async initMain() {
|
||||
@@ -248,14 +250,15 @@ export class ExtensionLoader {
|
||||
loadOnClusterManagerRenderer = () => {
|
||||
logger.debug(`${logModule}: load on main renderer (cluster manager)`);
|
||||
|
||||
return this.autoInitExtensions(async (extension: LensRendererExtension) => {
|
||||
return this.autoInitExtensions(async (ext) => {
|
||||
const extension = ext as LensRendererExtension;
|
||||
const removeItems = [
|
||||
registries.EntitySettingRegistry.getInstance().add(extension.entitySettings),
|
||||
registries.CatalogEntityDetailRegistry.getInstance().add(extension.catalogEntityDetailItems),
|
||||
];
|
||||
|
||||
this.events.on("remove", (removedExtension: LensRendererExtension) => {
|
||||
if (removedExtension.id === extension.id) {
|
||||
this.onRemoveExtensionId.addListener((removedExtensionId) => {
|
||||
if (removedExtensionId === extension.id) {
|
||||
removeItems.forEach(remove => {
|
||||
remove();
|
||||
});
|
||||
@@ -266,12 +269,15 @@ export class ExtensionLoader {
|
||||
});
|
||||
};
|
||||
|
||||
loadOnClusterRenderer = (getCluster: () => KubernetesCluster) => {
|
||||
loadOnClusterRenderer = (getCluster: () => CatalogEntity) => {
|
||||
logger.debug(`${logModule}: load on cluster renderer (dashboard)`);
|
||||
|
||||
this.autoInitExtensions(async (extension: LensRendererExtension) => {
|
||||
this.autoInitExtensions(async (ext) => {
|
||||
const entity = getCluster() as KubernetesCluster;
|
||||
const extension = ext as LensRendererExtension;
|
||||
|
||||
// getCluster must be a callback, as the entity might be available only after an extension has been loaded
|
||||
if ((await extension.isEnabledForCluster(getCluster())) === false) {
|
||||
if ((await extension.isEnabledForCluster(entity)) === false) {
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -279,8 +285,8 @@ export class ExtensionLoader {
|
||||
registries.KubeObjectDetailRegistry.getInstance().add(extension.kubeObjectDetailItems),
|
||||
];
|
||||
|
||||
this.events.on("remove", (removedExtension: LensRendererExtension) => {
|
||||
if (removedExtension.id === extension.id) {
|
||||
this.onRemoveExtensionId.addListener((removedExtensionId) => {
|
||||
if (removedExtensionId === extension.id) {
|
||||
removeItems.forEach(remove => {
|
||||
remove();
|
||||
});
|
||||
@@ -300,7 +306,7 @@ export class ExtensionLoader {
|
||||
|
||||
const extensions = [...installedExtensions.entries()]
|
||||
.map(([extId, extension]) => {
|
||||
const alreadyInit = this.instances.has(extId) || this.nonInstancesByName.has(extension.manifest.name);
|
||||
const alreadyInit = this.dependencies.extensionInstances.has(extId) || this.nonInstancesByName.has(extension.manifest.name);
|
||||
|
||||
if (extension.isCompatible && extension.isEnabled && !alreadyInit) {
|
||||
try {
|
||||
@@ -317,7 +323,7 @@ export class ExtensionLoader {
|
||||
extension,
|
||||
);
|
||||
|
||||
this.instances.set(extId, instance);
|
||||
this.dependencies.extensionInstances.set(extId, instance);
|
||||
|
||||
return {
|
||||
instance,
|
||||
@@ -332,7 +338,9 @@ export class ExtensionLoader {
|
||||
}
|
||||
|
||||
return null;
|
||||
}).filter(extension => Boolean(extension));
|
||||
})
|
||||
// Remove null values
|
||||
.filter(isDefined);
|
||||
|
||||
// We first need to wait until each extension's `onActivate` is resolved or rejected,
|
||||
// as this might register new catalog categories. Afterwards we can safely .enable the extension.
|
||||
@@ -346,7 +354,7 @@ export class ExtensionLoader {
|
||||
);
|
||||
|
||||
extensions.forEach(({ instance }) => {
|
||||
const installationCount = (this.dependencies.extensionInstallationCounter.get(instance.sanitizedExtensionId) | 0) + 1;
|
||||
const installationCount = (this.dependencies.extensionInstallationCounter.get(instance.sanitizedExtensionId) ?? 0) + 1;
|
||||
|
||||
this.dependencies.extensionInstallationCounter.set(instance.sanitizedExtensionId, installationCount);
|
||||
|
||||
@@ -389,7 +397,7 @@ export class ExtensionLoader {
|
||||
try {
|
||||
return __non_webpack_require__(extAbsolutePath).default;
|
||||
} catch (error) {
|
||||
if (ipcRenderer) {
|
||||
if (window && error instanceof window.Error) {
|
||||
console.error(`${logModule}: can't load ${entryPointName} for "${extension.manifest.name}": ${error.stack || error}`, extension);
|
||||
} else {
|
||||
logger.error(`${logModule}: can't load ${entryPointName} for "${extension.manifest.name}": ${error}`, { extension });
|
||||
@@ -399,12 +407,12 @@ export class ExtensionLoader {
|
||||
return null;
|
||||
}
|
||||
|
||||
getExtension(extId: LensExtensionId): InstalledExtension {
|
||||
getExtension(extId: LensExtensionId) {
|
||||
return this.extensions.get(extId);
|
||||
}
|
||||
|
||||
getInstanceById<E extends LensExtension>(extId: LensExtensionId): E {
|
||||
return this.instances.get(extId) as E;
|
||||
getInstanceById(extId: LensExtensionId) {
|
||||
return this.dependencies.extensionInstances.get(extId);
|
||||
}
|
||||
|
||||
toJSON(): Map<LensExtensionId, InstalledExtension> {
|
||||
|
||||
+2
-2
@@ -3,8 +3,8 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import directoryForUserDataInjectable from "../../../../../common/app-paths/directory-for-user-data/directory-for-user-data.injectable";
|
||||
import getAbsolutePathInjectable from "../../../../../common/path/get-absolute-path.injectable";
|
||||
import directoryForUserDataInjectable from "../../../common/app-paths/directory-for-user-data/directory-for-user-data.injectable";
|
||||
import getAbsolutePathInjectable from "../../../common/path/get-absolute-path.injectable";
|
||||
|
||||
const directoryForExtensionDataInjectable = getInjectable({
|
||||
id: "directory-for-extension-data",
|
||||
+8
-7
@@ -4,17 +4,18 @@
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { FileSystemProvisionerStore } from "./file-system-provisioner-store";
|
||||
import directoryForExtensionDataInjectable from "./directory-for-extension-data/directory-for-extension-data.injectable";
|
||||
import directoryForExtensionDataInjectable from "./directory-for-extension-data.injectable";
|
||||
|
||||
const fileSystemProvisionerStoreInjectable = getInjectable({
|
||||
id: "file-system-provisioner-store",
|
||||
|
||||
instantiate: (di) =>
|
||||
FileSystemProvisionerStore.createInstance({
|
||||
directoryForExtensionData: di.inject(
|
||||
directoryForExtensionDataInjectable,
|
||||
),
|
||||
}),
|
||||
instantiate: (di) => {
|
||||
FileSystemProvisionerStore.resetInstance();
|
||||
|
||||
return FileSystemProvisionerStore.createInstance({
|
||||
directoryForExtensionData: di.inject(directoryForExtensionDataInjectable),
|
||||
});
|
||||
},
|
||||
|
||||
causesSideEffects: true,
|
||||
});
|
||||
+6
-10
@@ -8,9 +8,9 @@ import { SHA256 } from "crypto-js";
|
||||
import fse from "fs-extra";
|
||||
import { action, makeObservable, observable } from "mobx";
|
||||
import path from "path";
|
||||
import { BaseStore } from "../../../../common/base-store";
|
||||
import type { LensExtensionId } from "../../../lens-extension";
|
||||
import { toJS } from "../../../../common/utils";
|
||||
import { BaseStore } from "../../../common/base-store";
|
||||
import type { LensExtensionId } from "../../lens-extension";
|
||||
import { getOrInsertWith, toJS } from "../../../common/utils";
|
||||
|
||||
interface FSProvisionModel {
|
||||
extensions: Record<string, string>; // extension names to paths
|
||||
@@ -41,16 +41,12 @@ export class FileSystemProvisionerStore extends BaseStore<FSProvisionModel> {
|
||||
* @returns path to the folder that the extension can safely write files to.
|
||||
*/
|
||||
async requestDirectory(extensionName: string): Promise<string> {
|
||||
if (!this.registeredExtensions.has(extensionName)) {
|
||||
const dirPath = getOrInsertWith(this.registeredExtensions, extensionName, () => {
|
||||
const salt = randomBytes(32).toString("hex");
|
||||
const hashedName = SHA256(`${extensionName}/${salt}`).toString();
|
||||
|
||||
const dirPath = path.resolve(this.dependencies.directoryForExtensionData, hashedName);
|
||||
|
||||
this.registeredExtensions.set(extensionName, dirPath);
|
||||
}
|
||||
|
||||
const dirPath = this.registeredExtensions.get(extensionName);
|
||||
return path.resolve(this.dependencies.directoryForExtensionData, hashedName);
|
||||
});
|
||||
|
||||
await fse.ensureDir(dirPath);
|
||||
|
||||
@@ -6,10 +6,11 @@
|
||||
import { BaseStore } from "../common/base-store";
|
||||
import * as path from "path";
|
||||
import type { LensExtension } from "./lens-extension";
|
||||
import assert from "assert";
|
||||
|
||||
export abstract class ExtensionStore<T> extends BaseStore<T> {
|
||||
readonly displayName = "ExtensionStore<T>";
|
||||
protected extension: LensExtension;
|
||||
protected extension?: LensExtension;
|
||||
|
||||
loadExtension(extension: LensExtension) {
|
||||
this.extension = extension;
|
||||
@@ -24,6 +25,8 @@ export abstract class ExtensionStore<T> extends BaseStore<T> {
|
||||
}
|
||||
|
||||
protected cwd() {
|
||||
assert(this.extension, "must call this.load() first");
|
||||
|
||||
return path.join(super.cwd(), "extension-store", this.extension.name);
|
||||
}
|
||||
}
|
||||
@@ -42,7 +42,7 @@ export class ExtensionsStore extends BaseStore<LensExtensionsStoreModel> {
|
||||
return isBundled || Boolean(this.state.get(id)?.enabled);
|
||||
}
|
||||
|
||||
mergeState = action((extensionsState: Record<LensExtensionId, LensExtensionState>) => {
|
||||
mergeState = action((extensionsState: Record<LensExtensionId, LensExtensionState> | [LensExtensionId, LensExtensionState][]) => {
|
||||
this.state.merge(extensionsState);
|
||||
});
|
||||
|
||||
|
||||
@@ -4,15 +4,14 @@
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { computed } from "mobx";
|
||||
import extensionLoaderInjectable from "./extension-loader/extension-loader.injectable";
|
||||
import extensionInstancesInjectable from "./extension-loader/extension-instances.injectable";
|
||||
|
||||
const extensionsInjectable = getInjectable({
|
||||
id: "extensions",
|
||||
|
||||
instantiate: (di) => {
|
||||
const extensionLoader = di.inject(extensionLoaderInjectable);
|
||||
const extensionInstances = di.inject(extensionInstancesInjectable);
|
||||
|
||||
return computed(() => extensionLoader.enabledExtensionInstances);
|
||||
return computed(() => [...extensionInstances.values()].filter(extension => extension.isEnabled));
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -3,12 +3,27 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import type { FileSystemProvisionerStore } from "./extension-loader/create-extension-instance/file-system-provisioner-store/file-system-provisioner-store";
|
||||
|
||||
// This symbol encapsulates setting of dependencies to only happen locally in Lens Core
|
||||
// and not by e.g. authors of extensions
|
||||
export const setLensExtensionDependencies = Symbol("set-lens-extension-dependencies");
|
||||
import type { IComputedValue } from "mobx";
|
||||
import type { CatalogCategoryRegistry } from "../common/catalog";
|
||||
import type { NavigateToRoute } from "../common/front-end-routing/navigate-to-route-injection-token";
|
||||
import type { Route } from "../common/front-end-routing/route-injection-token";
|
||||
import type { CatalogEntityRegistry as MainCatalogEntityRegistry } from "../main/catalog";
|
||||
import type { CatalogEntityRegistry as RendererCatalogEntityRegistry } from "../renderer/api/catalog/entity/registry";
|
||||
import type { GetExtensionPageParameters } from "../renderer/routes/get-extension-page-parameters.injectable";
|
||||
import type { FileSystemProvisionerStore } from "./extension-loader/file-system-provisioner-store/file-system-provisioner-store";
|
||||
|
||||
export interface LensExtensionDependencies {
|
||||
fileSystemProvisionerStore: FileSystemProvisionerStore;
|
||||
readonly fileSystemProvisionerStore: FileSystemProvisionerStore;
|
||||
}
|
||||
|
||||
export interface LensMainExtensionDependencies extends LensExtensionDependencies {
|
||||
readonly entityRegistry: MainCatalogEntityRegistry;
|
||||
}
|
||||
|
||||
export interface LensRendererExtensionDependencies extends LensExtensionDependencies {
|
||||
navigateToRoute: NavigateToRoute;
|
||||
getExtensionPageParameters: GetExtensionPageParameters;
|
||||
readonly routes: IComputedValue<Route<unknown>[]>;
|
||||
readonly entityRegistry: RendererCatalogEntityRegistry;
|
||||
readonly categoryRegistry: CatalogCategoryRegistry;
|
||||
}
|
||||
@@ -11,7 +11,6 @@ import type { PackageJson } from "type-fest";
|
||||
import type { Disposer } from "../common/utils";
|
||||
import { disposer } from "../common/utils";
|
||||
import type { LensExtensionDependencies } from "./lens-extension-set-dependencies";
|
||||
import { setLensExtensionDependencies } from "./lens-extension-set-dependencies";
|
||||
|
||||
export type LensExtensionId = string; // path to manifest (package.json)
|
||||
export type LensExtensionConstructor = new (...args: ConstructorParameters<typeof LensExtension>) => LensExtension;
|
||||
@@ -32,9 +31,10 @@ export interface LensExtensionManifest extends PackageJson {
|
||||
};
|
||||
}
|
||||
|
||||
export const Disposers = Symbol();
|
||||
export const lensExtensionDependencies = Symbol("lens-extension-dependencies");
|
||||
export const Disposers = Symbol("disposers");
|
||||
|
||||
export class LensExtension {
|
||||
export class LensExtension<Dependencies extends LensExtensionDependencies = LensExtensionDependencies> {
|
||||
readonly id: LensExtensionId;
|
||||
readonly manifest: LensExtensionManifest;
|
||||
readonly manifestPath: string;
|
||||
@@ -74,11 +74,7 @@ export class LensExtension {
|
||||
return this.manifest.description;
|
||||
}
|
||||
|
||||
private dependencies: LensExtensionDependencies;
|
||||
|
||||
[setLensExtensionDependencies] = (dependencies: LensExtensionDependencies) => {
|
||||
this.dependencies = dependencies;
|
||||
};
|
||||
readonly [lensExtensionDependencies]!: Dependencies;
|
||||
|
||||
/**
|
||||
* getExtensionFileFolder returns the path to an already created folder. This
|
||||
@@ -88,11 +84,11 @@ export class LensExtension {
|
||||
* folder name.
|
||||
*/
|
||||
async getExtensionFileFolder(): Promise<string> {
|
||||
return this.dependencies.fileSystemProvisionerStore.requestDirectory(this.id);
|
||||
return this[lensExtensionDependencies].fileSystemProvisionerStore.requestDirectory(this.id);
|
||||
}
|
||||
|
||||
@action
|
||||
async enable(register: (ext: LensExtension) => Promise<Disposer[]>) {
|
||||
async enable(register: (ext: this) => Promise<Disposer[]>) {
|
||||
if (this._isEnabled) {
|
||||
return;
|
||||
}
|
||||
@@ -142,11 +138,13 @@ export function sanitizeExtensionName(name: string) {
|
||||
return name.replace("@", "").replace("/", "--");
|
||||
}
|
||||
|
||||
export const getSanitizedPath = (...parts: string[]) => parts
|
||||
.filter(Boolean)
|
||||
.join("/")
|
||||
.replace(/\/+/g, "/")
|
||||
.replace(/\/$/, ""); // normalize multi-slashes (e.g. coming from page.id)
|
||||
export function getSanitizedPath(...parts: string[]) {
|
||||
return parts
|
||||
.filter(Boolean)
|
||||
.join("/")
|
||||
.replace(/\/+/g, "/")
|
||||
.replace(/\/$/, "");
|
||||
} // normalize multi-slashes (e.g. coming from page.id)
|
||||
|
||||
export function extensionDisplayName(name: string, version: string) {
|
||||
return `${name}@${version}`;
|
||||
|
||||
@@ -3,29 +3,29 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import { LensExtension } from "./lens-extension";
|
||||
import { LensExtension, lensExtensionDependencies } from "./lens-extension";
|
||||
import { WindowManager } from "../main/window-manager";
|
||||
import { catalogEntityRegistry } from "../main/catalog";
|
||||
import type { CatalogEntity } from "../common/catalog";
|
||||
import type { IObservableArray } from "mobx";
|
||||
import type { MenuRegistration } from "../main/menu/menu-registration";
|
||||
import type { TrayMenuRegistration } from "../main/tray/tray-menu-registration";
|
||||
import type { ShellEnvModifier } from "../main/shell-session/shell-env-modifier/shell-env-modifier-registration";
|
||||
import type { LensMainExtensionDependencies } from "./lens-extension-set-dependencies";
|
||||
|
||||
export class LensMainExtension extends LensExtension {
|
||||
export class LensMainExtension extends LensExtension<LensMainExtensionDependencies> {
|
||||
appMenus: MenuRegistration[] = [];
|
||||
trayMenus: TrayMenuRegistration[] = [];
|
||||
|
||||
/**
|
||||
* implement this to modify the shell environment that Lens terminals are opened with. The ShellEnvModifier type has the signature
|
||||
*
|
||||
*
|
||||
* (ctx: ShellEnvContext, env: Record<string, string | undefined>) => Record<string, string | undefined>
|
||||
*
|
||||
*
|
||||
* @param ctx the shell environment context, specifically the relevant catalog entity for the terminal. This can be used, for example, to get
|
||||
* cluster-specific information that can be made available in the shell environment by the implementation of terminalShellEnvModifier
|
||||
*
|
||||
*
|
||||
* @param env the current shell environment that the terminal will be opened with. The implementation should modify this as desired.
|
||||
*
|
||||
*
|
||||
* @returns the modified shell environment that the terminal will be opened with. The implementation must return env as passed in, if it
|
||||
* does not modify the shell environment
|
||||
*/
|
||||
@@ -36,10 +36,10 @@ export class LensMainExtension extends LensExtension {
|
||||
}
|
||||
|
||||
addCatalogSource(id: string, source: IObservableArray<CatalogEntity>) {
|
||||
catalogEntityRegistry.addObservableSource(`${this.name}:${id}`, source);
|
||||
this[lensExtensionDependencies].entityRegistry.addObservableSource(`${this.name}:${id}`, source);
|
||||
}
|
||||
|
||||
removeCatalogSource(id: string) {
|
||||
catalogEntityRegistry.removeSource(`${this.name}:${id}`);
|
||||
this[lensExtensionDependencies].entityRegistry.removeSource(`${this.name}:${id}`);
|
||||
}
|
||||
}
|
||||
@@ -4,13 +4,11 @@
|
||||
*/
|
||||
|
||||
import type * as registries from "./registries";
|
||||
import { Disposers, LensExtension } from "./lens-extension";
|
||||
import { Disposers, LensExtension, lensExtensionDependencies } from "./lens-extension";
|
||||
import type { CatalogEntity } from "../common/catalog";
|
||||
import type { Disposer } from "../common/utils";
|
||||
import type { EntityFilter } from "../renderer/api/catalog-entity-registry";
|
||||
import { catalogEntityRegistry } from "../renderer/api/catalog-entity-registry";
|
||||
import type { EntityFilter } from "../renderer/api/catalog/entity/registry";
|
||||
import type { CategoryFilter } from "../renderer/api/catalog-category-registry";
|
||||
import { catalogCategoryRegistry } from "../renderer/api/catalog-category-registry";
|
||||
import type { TopBarRegistration } from "../renderer/components/layout/top-bar/top-bar-registration";
|
||||
import type { KubernetesCluster } from "../common/catalog-entities";
|
||||
import type { WelcomeMenuRegistration } from "../renderer/components/+welcome/welcome-menu-items/welcome-menu-registration";
|
||||
@@ -23,16 +21,13 @@ import type { StatusBarRegistration } from "../renderer/components/status-bar/st
|
||||
import type { KubeObjectMenuRegistration } from "../renderer/components/kube-object-menu/kube-object-menu-registration";
|
||||
import type { WorkloadsOverviewDetailRegistration } from "../renderer/components/+workloads-overview/workloads-overview-detail-registration";
|
||||
import type { KubeObjectStatusRegistration } from "../renderer/components/kube-object-status-icon/kube-object-status-registration";
|
||||
import { Environments, getEnvironmentSpecificLegacyGlobalDiForExtensionApi } from "./as-legacy-globals-for-extension-api/legacy-global-di-for-extension-api";
|
||||
import routesInjectable from "../renderer/routes/routes.injectable";
|
||||
import { fromPairs, map, matches, toPairs } from "lodash/fp";
|
||||
import extensionPageParametersInjectable from "../renderer/routes/extension-page-parameters.injectable";
|
||||
import { pipeline } from "@ogre-tools/fp";
|
||||
import { getExtensionRoutePath } from "../renderer/routes/get-extension-route-path";
|
||||
import { navigateToRouteInjectionToken } from "../common/front-end-routing/navigate-to-route-injection-token";
|
||||
import { getExtensionRoutePath } from "../renderer/routes/for-extension";
|
||||
import type { LensRendererExtensionDependencies } from "./lens-extension-set-dependencies";
|
||||
import type { KubeObjectHandlerRegistration } from "../renderer/kube-object/handler";
|
||||
|
||||
export class LensRendererExtension extends LensExtension {
|
||||
export class LensRendererExtension extends LensExtension<LensRendererExtensionDependencies> {
|
||||
globalPages: registries.PageRegistration[] = [];
|
||||
clusterPages: registries.PageRegistration[] = [];
|
||||
clusterPageMenus: registries.ClusterPageMenuRegistration[] = [];
|
||||
@@ -52,49 +47,39 @@ export class LensRendererExtension extends LensExtension {
|
||||
customCategoryViews: CustomCategoryViewRegistration[] = [];
|
||||
kubeObjectHandlers: KubeObjectHandlerRegistration[] = [];
|
||||
|
||||
async navigate<P extends object>(pageId?: string, params?: P) {
|
||||
const di = getEnvironmentSpecificLegacyGlobalDiForExtensionApi(
|
||||
Environments.renderer,
|
||||
);
|
||||
async navigate(pageId?: string, params: object = {}) {
|
||||
const routes = this[lensExtensionDependencies].routes.get();
|
||||
const targetRegistration = [...this.globalPages, ...this.clusterPages]
|
||||
.find(registration => registration.id === (pageId || undefined));
|
||||
|
||||
const navigateToRoute = di.inject(navigateToRouteInjectionToken);
|
||||
const routes = di.inject(routesInjectable).get();
|
||||
|
||||
const targetRegistration = [...this.globalPages, ...this.clusterPages].find(
|
||||
registration => registration.id === (pageId || undefined),
|
||||
);
|
||||
if (!targetRegistration) {
|
||||
return;
|
||||
}
|
||||
|
||||
const targetRoutePath = getExtensionRoutePath(this, targetRegistration.id);
|
||||
|
||||
const targetRoute = routes.find(matches({ path: targetRoutePath }));
|
||||
|
||||
if (targetRoute) {
|
||||
const normalizedParams = di.inject(extensionPageParametersInjectable, {
|
||||
extension: this,
|
||||
registration: targetRegistration,
|
||||
});
|
||||
|
||||
const query = pipeline(
|
||||
params,
|
||||
|
||||
toPairs,
|
||||
|
||||
map(([key, value]) => {
|
||||
const normalizedParam = normalizedParams[key];
|
||||
|
||||
return [
|
||||
key,
|
||||
normalizedParam.stringify(value),
|
||||
];
|
||||
}),
|
||||
|
||||
fromPairs,
|
||||
);
|
||||
|
||||
navigateToRoute(targetRoute, {
|
||||
query,
|
||||
});
|
||||
if (!targetRoute) {
|
||||
return;
|
||||
}
|
||||
|
||||
const normalizedParams = this[lensExtensionDependencies].getExtensionPageParameters({
|
||||
extension: this,
|
||||
registration: targetRegistration,
|
||||
});
|
||||
const query = pipeline(
|
||||
params,
|
||||
toPairs,
|
||||
map(([key, value]) => [
|
||||
key,
|
||||
normalizedParams[key].stringify(value),
|
||||
]),
|
||||
fromPairs,
|
||||
);
|
||||
|
||||
this[lensExtensionDependencies].navigateToRoute(targetRoute, {
|
||||
query,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -113,7 +98,7 @@ export class LensRendererExtension extends LensExtension {
|
||||
* @returns A function to clean up the filter
|
||||
*/
|
||||
addCatalogFilter(fn: EntityFilter): Disposer {
|
||||
const dispose = catalogEntityRegistry.addCatalogFilter(fn);
|
||||
const dispose = this[lensExtensionDependencies].entityRegistry.addCatalogFilter(fn);
|
||||
|
||||
this[Disposers].push(dispose);
|
||||
|
||||
@@ -126,7 +111,7 @@ export class LensRendererExtension extends LensExtension {
|
||||
* @returns A function to clean up the filter
|
||||
*/
|
||||
addCatalogCategoryFilter(fn: CategoryFilter): Disposer {
|
||||
const dispose = catalogCategoryRegistry.addCatalogCategoryFilter(fn);
|
||||
const dispose = this[lensExtensionDependencies].categoryRegistry.addCatalogCategoryFilter(fn);
|
||||
|
||||
this[Disposers].push(dispose);
|
||||
|
||||
|
||||
@@ -4,14 +4,23 @@
|
||||
*/
|
||||
|
||||
import type { CatalogEntity } from "../../common/catalog";
|
||||
import { catalogEntityRegistry as registry } from "../../main/catalog";
|
||||
import { asLegacyGlobalForExtensionApi } from "../as-legacy-globals-for-extension-api/as-legacy-global-object-for-extension-api";
|
||||
import catalogCategoryRegistryInjectable from "../../common/catalog/category-registry.injectable";
|
||||
import catalogEntityRegistryInjectable from "../../main/catalog/entity-registry.injectable";
|
||||
|
||||
export { catalogCategoryRegistry as catalogCategories } from "../../common/catalog/catalog-category-registry";
|
||||
export const catalogCategories = asLegacyGlobalForExtensionApi(catalogCategoryRegistryInjectable);
|
||||
const catalogEntityRegistry = asLegacyGlobalForExtensionApi(catalogEntityRegistryInjectable);
|
||||
|
||||
export class CatalogEntityRegistry {
|
||||
getItemsForApiKind<T extends CatalogEntity>(apiVersion: string, kind: string): T[] {
|
||||
return registry.getItemsForApiKind<T>(apiVersion, kind);
|
||||
}
|
||||
export interface CatalogEntityRegistry {
|
||||
getItemsForApiKind(apiVersion: string, kind: string): CatalogEntity[];
|
||||
/**
|
||||
* @deprecated use a cast instead of a unbounded type parameter
|
||||
*/
|
||||
getItemsForApiKind<T extends CatalogEntity>(apiVersion: string, kind: string): T[];
|
||||
}
|
||||
|
||||
export const catalogEntities = new CatalogEntityRegistry();
|
||||
export const catalogEntities: CatalogEntityRegistry = {
|
||||
getItemsForApiKind(apiVersion: string, kind: string) {
|
||||
return catalogEntityRegistry.filterItemsForApiKind(apiVersion, kind);
|
||||
},
|
||||
};
|
||||
@@ -11,44 +11,4 @@ export function isAllowedResource(...args: any[]) {
|
||||
return Boolean(void args);
|
||||
}
|
||||
|
||||
export { ResourceStack } from "../../common/k8s/resource-stack";
|
||||
export { apiManager } from "../../common/k8s-api/api-manager";
|
||||
export { KubeApi, forCluster, forRemoteCluster } from "../../common/k8s-api/kube-api";
|
||||
export { KubeObject, KubeStatus } from "../../common/k8s-api/kube-object";
|
||||
export { KubeObjectStore } from "../../common/k8s-api/kube-object.store";
|
||||
export { Pod, podsApi, PodsApi } from "../../common/k8s-api/endpoints/pods.api";
|
||||
export { Node, nodesApi, NodesApi } from "../../common/k8s-api/endpoints/nodes.api";
|
||||
export { Deployment, deploymentApi, DeploymentApi } from "../../common/k8s-api/endpoints/deployment.api";
|
||||
export { DaemonSet, daemonSetApi } from "../../common/k8s-api/endpoints/daemon-set.api";
|
||||
export { StatefulSet, statefulSetApi } from "../../common/k8s-api/endpoints/stateful-set.api";
|
||||
export { Job, jobApi } from "../../common/k8s-api/endpoints/job.api";
|
||||
export { CronJob, cronJobApi } from "../../common/k8s-api/endpoints/cron-job.api";
|
||||
export { ConfigMap, configMapApi } from "../../common/k8s-api/endpoints/configmap.api";
|
||||
export { Secret, secretsApi } from "../../common/k8s-api/endpoints/secret.api";
|
||||
export { ReplicaSet, replicaSetApi } from "../../common/k8s-api/endpoints/replica-set.api";
|
||||
export { ResourceQuota, resourceQuotaApi } from "../../common/k8s-api/endpoints/resource-quota.api";
|
||||
export { LimitRange, limitRangeApi } from "../../common/k8s-api/endpoints/limit-range.api";
|
||||
export { HorizontalPodAutoscaler, hpaApi } from "../../common/k8s-api/endpoints/hpa.api";
|
||||
export { PodDisruptionBudget, pdbApi } from "../../common/k8s-api/endpoints/poddisruptionbudget.api";
|
||||
export { Service, serviceApi } from "../../common/k8s-api/endpoints/service.api";
|
||||
export { Endpoint, endpointApi } from "../../common/k8s-api/endpoints/endpoint.api";
|
||||
export { Ingress, ingressApi, IngressApi } from "../../common/k8s-api/endpoints/ingress.api";
|
||||
export { NetworkPolicy, networkPolicyApi } from "../../common/k8s-api/endpoints/network-policy.api";
|
||||
export { PersistentVolume, persistentVolumeApi } from "../../common/k8s-api/endpoints/persistent-volume.api";
|
||||
export { PersistentVolumeClaim, pvcApi, PersistentVolumeClaimsApi } from "../../common/k8s-api/endpoints/persistent-volume-claims.api";
|
||||
export { StorageClass, storageClassApi } from "../../common/k8s-api/endpoints/storage-class.api";
|
||||
export { Namespace, namespacesApi } from "../../common/k8s-api/endpoints/namespaces.api";
|
||||
export { KubeEvent, eventApi } from "../../common/k8s-api/endpoints/events.api";
|
||||
export { ServiceAccount, serviceAccountsApi } from "../../common/k8s-api/endpoints/service-accounts.api";
|
||||
export { Role, roleApi } from "../../common/k8s-api/endpoints/role.api";
|
||||
export { RoleBinding, roleBindingApi } from "../../common/k8s-api/endpoints/role-binding.api";
|
||||
export { ClusterRole, clusterRoleApi } from "../../common/k8s-api/endpoints/cluster-role.api";
|
||||
export { ClusterRoleBinding, clusterRoleBindingApi } from "../../common/k8s-api/endpoints/cluster-role-binding.api";
|
||||
export { CustomResourceDefinition, crdApi } from "../../common/k8s-api/endpoints/crd.api";
|
||||
|
||||
// types
|
||||
export type { ILocalKubeApiConfig, IRemoteKubeApiConfig, IKubeApiCluster } from "../../common/k8s-api/kube-api";
|
||||
export type { IPodContainer, IPodContainerStatus } from "../../common/k8s-api/endpoints/pods.api";
|
||||
export type { ISecretRef } from "../../common/k8s-api/endpoints/secret.api";
|
||||
export type { KubeObjectMetadata, KubeStatusData } from "../../common/k8s-api/kube-object";
|
||||
export type { KubeObjectStoreLoadAllParams, KubeObjectStoreLoadingParams, KubeObjectStoreSubscribeParams } from "../../common/k8s-api/kube-object.store";
|
||||
export * from "../common-api/k8s-api";
|
||||
@@ -1,3 +1,2 @@
|
||||
dist/
|
||||
yarn.lock
|
||||
__mocks__/
|
||||
+594
@@ -0,0 +1,594 @@
|
||||
{
|
||||
"name": "@k8slens/extensions",
|
||||
"version": "0.0.1",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@babel/runtime": {
|
||||
"version": "7.17.9",
|
||||
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.17.9.tgz",
|
||||
"integrity": "sha512-lSiBBvodq29uShpWGNbgFdKYNiFDo5/HIYsaCEY9ff4sb10x9jizo2+pRrSyF4jKZCXqgzuqBOQKbUm90gQwJg==",
|
||||
"requires": {
|
||||
"regenerator-runtime": "^0.13.4"
|
||||
}
|
||||
},
|
||||
"@emotion/hash": {
|
||||
"version": "0.8.0",
|
||||
"resolved": "https://registry.npmjs.org/@emotion/hash/-/hash-0.8.0.tgz",
|
||||
"integrity": "sha512-kBJtf7PH6aWwZ6fka3zQ0p6SBYzx4fl1LoZXE2RrnYST9Xljm7WfKJrU4g/Xr3Beg72MLrp1AWNUmuYJTL7Cow=="
|
||||
},
|
||||
"@material-ui/core": {
|
||||
"version": "4.12.3",
|
||||
"resolved": "https://registry.npmjs.org/@material-ui/core/-/core-4.12.3.tgz",
|
||||
"integrity": "sha512-sdpgI/PL56QVsEJldwEe4FFaFTLUqN+rd7sSZiRCdx2E/C7z5yK0y/khAWVBH24tXwto7I1hCzNWfJGZIYJKnw==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.4.4",
|
||||
"@material-ui/styles": "^4.11.4",
|
||||
"@material-ui/system": "^4.12.1",
|
||||
"@material-ui/types": "5.1.0",
|
||||
"@material-ui/utils": "^4.11.2",
|
||||
"@types/react-transition-group": "^4.2.0",
|
||||
"clsx": "^1.0.4",
|
||||
"hoist-non-react-statics": "^3.3.2",
|
||||
"popper.js": "1.16.1-lts",
|
||||
"prop-types": "^15.7.2",
|
||||
"react-is": "^16.8.0 || ^17.0.0",
|
||||
"react-transition-group": "^4.4.0"
|
||||
}
|
||||
},
|
||||
"@material-ui/styles": {
|
||||
"version": "4.11.5",
|
||||
"resolved": "https://registry.npmjs.org/@material-ui/styles/-/styles-4.11.5.tgz",
|
||||
"integrity": "sha512-o/41ot5JJiUsIETME9wVLAJrmIWL3j0R0Bj2kCOLbSfqEkKf0fmaPt+5vtblUh5eXr2S+J/8J3DaCb10+CzPGA==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.4.4",
|
||||
"@emotion/hash": "^0.8.0",
|
||||
"@material-ui/types": "5.1.0",
|
||||
"@material-ui/utils": "^4.11.3",
|
||||
"clsx": "^1.0.4",
|
||||
"csstype": "^2.5.2",
|
||||
"hoist-non-react-statics": "^3.3.2",
|
||||
"jss": "^10.5.1",
|
||||
"jss-plugin-camel-case": "^10.5.1",
|
||||
"jss-plugin-default-unit": "^10.5.1",
|
||||
"jss-plugin-global": "^10.5.1",
|
||||
"jss-plugin-nested": "^10.5.1",
|
||||
"jss-plugin-props-sort": "^10.5.1",
|
||||
"jss-plugin-rule-value-function": "^10.5.1",
|
||||
"jss-plugin-vendor-prefixer": "^10.5.1",
|
||||
"prop-types": "^15.7.2"
|
||||
}
|
||||
},
|
||||
"@material-ui/system": {
|
||||
"version": "4.12.2",
|
||||
"resolved": "https://registry.npmjs.org/@material-ui/system/-/system-4.12.2.tgz",
|
||||
"integrity": "sha512-6CSKu2MtmiJgcCGf6nBQpM8fLkuB9F55EKfbdTC80NND5wpTmKzwdhLYLH3zL4cLlK0gVaaltW7/wMuyTnN0Lw==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.4.4",
|
||||
"@material-ui/utils": "^4.11.3",
|
||||
"csstype": "^2.5.2",
|
||||
"prop-types": "^15.7.2"
|
||||
}
|
||||
},
|
||||
"@material-ui/types": {
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@material-ui/types/-/types-5.1.0.tgz",
|
||||
"integrity": "sha512-7cqRjrY50b8QzRSYyhSpx4WRw2YuO0KKIGQEVk5J8uoz2BanawykgZGoWEqKm7pVIbzFDN0SpPcVV4IhOFkl8A=="
|
||||
},
|
||||
"@material-ui/utils": {
|
||||
"version": "4.11.3",
|
||||
"resolved": "https://registry.npmjs.org/@material-ui/utils/-/utils-4.11.3.tgz",
|
||||
"integrity": "sha512-ZuQPV4rBK/V1j2dIkSSEcH5uT6AaHuKWFfotADHsC0wVL1NLd2WkFCm4ZZbX33iO4ydl6V0GPngKm8HZQ2oujg==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.4.4",
|
||||
"prop-types": "^15.7.2",
|
||||
"react-is": "^16.8.0 || ^17.0.0"
|
||||
}
|
||||
},
|
||||
"@types/history": {
|
||||
"version": "4.7.11",
|
||||
"resolved": "https://registry.npmjs.org/@types/history/-/history-4.7.11.tgz",
|
||||
"integrity": "sha512-qjDJRrmvBMiTx+jyLxvLfJU7UznFuokDv4f3WRuriHKERccVpFU+8XMQUAbDzoiJCsmexxRExQeMwwCdamSKDA=="
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "14.17.14",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.17.14.tgz",
|
||||
"integrity": "sha512-rsAj2u8Xkqfc332iXV12SqIsjVi07H479bOP4q94NAcjzmAvapumEhuVIt53koEf7JFrpjgNKjBga5Pnn/GL8A=="
|
||||
},
|
||||
"@types/prop-types": {
|
||||
"version": "15.7.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.5.tgz",
|
||||
"integrity": "sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w=="
|
||||
},
|
||||
"@types/react": {
|
||||
"version": "17.0.45",
|
||||
"resolved": "https://registry.npmjs.org/@types/react/-/react-17.0.45.tgz",
|
||||
"integrity": "sha512-YfhQ22Lah2e3CHPsb93tRwIGNiSwkuz1/blk4e6QrWS0jQzCSNbGLtOEYhPg02W0yGTTmpajp7dCTbBAMN3qsg==",
|
||||
"requires": {
|
||||
"@types/prop-types": "*",
|
||||
"@types/scheduler": "*",
|
||||
"csstype": "^3.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"csstype": {
|
||||
"version": "3.0.11",
|
||||
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.11.tgz",
|
||||
"integrity": "sha512-sa6P2wJ+CAbgyy4KFssIb/JNMLxFvKF1pCYCSXS8ZMuqZnMsrxqI2E5sPyoTpxoPU/gVZMzr2zjOfg8GIZOMsw=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"@types/react-dom": {
|
||||
"version": "17.0.16",
|
||||
"resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-17.0.16.tgz",
|
||||
"integrity": "sha512-DWcXf8EbMrO/gWnQU7Z88Ws/p16qxGpPyjTKTpmBSFKeE+HveVubqGO1CVK7FrwlWD5MuOcvh8gtd0/XO38NdQ==",
|
||||
"requires": {
|
||||
"@types/react": "^17"
|
||||
}
|
||||
},
|
||||
"@types/react-router": {
|
||||
"version": "5.1.18",
|
||||
"resolved": "https://registry.npmjs.org/@types/react-router/-/react-router-5.1.18.tgz",
|
||||
"integrity": "sha512-YYknwy0D0iOwKQgz9v8nOzt2J6l4gouBmDnWqUUznltOTaon+r8US8ky8HvN0tXvc38U9m6z/t2RsVsnd1zM0g==",
|
||||
"requires": {
|
||||
"@types/history": "^4.7.11",
|
||||
"@types/react": "*"
|
||||
}
|
||||
},
|
||||
"@types/react-router-dom": {
|
||||
"version": "5.3.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/react-router-dom/-/react-router-dom-5.3.3.tgz",
|
||||
"integrity": "sha512-kpqnYK4wcdm5UaWI3fLcELopqLrHgLqNsdpHauzlQktfkHL3npOSwtj1Uz9oKBAzs7lFtVkV8j83voAz2D8fhw==",
|
||||
"requires": {
|
||||
"@types/history": "^4.7.11",
|
||||
"@types/react": "*",
|
||||
"@types/react-router": "*"
|
||||
}
|
||||
},
|
||||
"@types/react-transition-group": {
|
||||
"version": "4.4.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/react-transition-group/-/react-transition-group-4.4.4.tgz",
|
||||
"integrity": "sha512-7gAPz7anVK5xzbeQW9wFBDg7G++aPLAFY0QaSMOou9rJZpbuI58WAuJrgu+qR92l61grlnCUe7AFX8KGahAgug==",
|
||||
"requires": {
|
||||
"@types/react": "*"
|
||||
}
|
||||
},
|
||||
"@types/scheduler": {
|
||||
"version": "0.16.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.2.tgz",
|
||||
"integrity": "sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew=="
|
||||
},
|
||||
"ajv": {
|
||||
"version": "6.12.6",
|
||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
|
||||
"integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
|
||||
"requires": {
|
||||
"fast-deep-equal": "^3.1.1",
|
||||
"fast-json-stable-stringify": "^2.0.0",
|
||||
"json-schema-traverse": "^0.4.1",
|
||||
"uri-js": "^4.2.2"
|
||||
}
|
||||
},
|
||||
"atomically": {
|
||||
"version": "1.7.0",
|
||||
"resolved": "https://registry.npmjs.org/atomically/-/atomically-1.7.0.tgz",
|
||||
"integrity": "sha512-Xcz9l0z7y9yQ9rdDaxlmaI4uJHf/T8g9hOEzJcsEqX2SjCj4J20uK7+ldkDHMbpJDK76wF7xEIgxc/vSlsfw5w=="
|
||||
},
|
||||
"clsx": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/clsx/-/clsx-1.1.1.tgz",
|
||||
"integrity": "sha512-6/bPho624p3S2pMyvP5kKBPXnI3ufHLObBFCfgx+LkeR5lg2XYy2hqZqUf45ypD8COn2bhgGJSUE+l5dhNBieA=="
|
||||
},
|
||||
"conf": {
|
||||
"version": "7.1.2",
|
||||
"resolved": "https://registry.npmjs.org/conf/-/conf-7.1.2.tgz",
|
||||
"integrity": "sha512-r8/HEoWPFn4CztjhMJaWNAe5n+gPUCSaJ0oufbqDLFKsA1V8JjAG7G+p0pgoDFAws9Bpk2VtVLLXqOBA7WxLeg==",
|
||||
"requires": {
|
||||
"ajv": "^6.12.2",
|
||||
"atomically": "^1.3.1",
|
||||
"debounce-fn": "^4.0.0",
|
||||
"dot-prop": "^5.2.0",
|
||||
"env-paths": "^2.2.0",
|
||||
"json-schema-typed": "^7.0.3",
|
||||
"make-dir": "^3.1.0",
|
||||
"onetime": "^5.1.0",
|
||||
"pkg-up": "^3.1.0",
|
||||
"semver": "^7.3.2"
|
||||
}
|
||||
},
|
||||
"css-vendor": {
|
||||
"version": "2.0.8",
|
||||
"resolved": "https://registry.npmjs.org/css-vendor/-/css-vendor-2.0.8.tgz",
|
||||
"integrity": "sha512-x9Aq0XTInxrkuFeHKbYC7zWY8ai7qJ04Kxd9MnvbC1uO5DagxoHQjm4JvG+vCdXOoFtCjbL2XSZfxmoYa9uQVQ==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.8.3",
|
||||
"is-in-browser": "^1.0.2"
|
||||
}
|
||||
},
|
||||
"csstype": {
|
||||
"version": "2.6.20",
|
||||
"resolved": "https://registry.npmjs.org/csstype/-/csstype-2.6.20.tgz",
|
||||
"integrity": "sha512-/WwNkdXfckNgw6S5R125rrW8ez139lBHWouiBvX8dfMFtcn6V81REDqnH7+CRpRipfYlyU1CmOnOxrmGcFOjeA=="
|
||||
},
|
||||
"debounce-fn": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/debounce-fn/-/debounce-fn-4.0.0.tgz",
|
||||
"integrity": "sha512-8pYCQiL9Xdcg0UPSD3d+0KMlOjp+KGU5EPwYddgzQ7DATsg4fuUDjQtsYLmWjnk2obnNHgV3vE2Y4jejSOJVBQ==",
|
||||
"requires": {
|
||||
"mimic-fn": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"dom-helpers": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/dom-helpers/-/dom-helpers-5.2.1.tgz",
|
||||
"integrity": "sha512-nRCa7CK3VTrM2NmGkIy4cbK7IZlgBE/PYMn55rrXefr5xXDP0LdtfPnblFDoVdcAfslJ7or6iqAUnx0CCGIWQA==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.8.7",
|
||||
"csstype": "^3.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"csstype": {
|
||||
"version": "3.0.11",
|
||||
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.11.tgz",
|
||||
"integrity": "sha512-sa6P2wJ+CAbgyy4KFssIb/JNMLxFvKF1pCYCSXS8ZMuqZnMsrxqI2E5sPyoTpxoPU/gVZMzr2zjOfg8GIZOMsw=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"dot-prop": {
|
||||
"version": "5.3.0",
|
||||
"resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz",
|
||||
"integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==",
|
||||
"requires": {
|
||||
"is-obj": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"env-paths": {
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz",
|
||||
"integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A=="
|
||||
},
|
||||
"fast-deep-equal": {
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
||||
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="
|
||||
},
|
||||
"fast-json-stable-stringify": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
|
||||
"integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw=="
|
||||
},
|
||||
"find-up": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz",
|
||||
"integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==",
|
||||
"requires": {
|
||||
"locate-path": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"hoist-non-react-statics": {
|
||||
"version": "3.3.2",
|
||||
"resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz",
|
||||
"integrity": "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==",
|
||||
"requires": {
|
||||
"react-is": "^16.7.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"react-is": {
|
||||
"version": "16.13.1",
|
||||
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
|
||||
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"hyphenate-style-name": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/hyphenate-style-name/-/hyphenate-style-name-1.0.4.tgz",
|
||||
"integrity": "sha512-ygGZLjmXfPHj+ZWh6LwbC37l43MhfztxetbFCoYTM2VjkIUpeHgSNn7QIyVFj7YQ1Wl9Cbw5sholVJPzWvC2MQ=="
|
||||
},
|
||||
"is-in-browser": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/is-in-browser/-/is-in-browser-1.1.3.tgz",
|
||||
"integrity": "sha1-Vv9NtoOgeMYILrldrX3GLh0E+DU="
|
||||
},
|
||||
"is-obj": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz",
|
||||
"integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w=="
|
||||
},
|
||||
"js-tokens": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
|
||||
"integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="
|
||||
},
|
||||
"json-schema-traverse": {
|
||||
"version": "0.4.1",
|
||||
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
|
||||
"integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="
|
||||
},
|
||||
"json-schema-typed": {
|
||||
"version": "7.0.3",
|
||||
"resolved": "https://registry.npmjs.org/json-schema-typed/-/json-schema-typed-7.0.3.tgz",
|
||||
"integrity": "sha512-7DE8mpG+/fVw+dTpjbxnx47TaMnDfOI1jwft9g1VybltZCduyRQPJPvc+zzKY9WPHxhPWczyFuYa6I8Mw4iU5A=="
|
||||
},
|
||||
"jss": {
|
||||
"version": "10.9.0",
|
||||
"resolved": "https://registry.npmjs.org/jss/-/jss-10.9.0.tgz",
|
||||
"integrity": "sha512-YpzpreB6kUunQBbrlArlsMpXYyndt9JATbt95tajx0t4MTJJcCJdd4hdNpHmOIDiUJrF/oX5wtVFrS3uofWfGw==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.3.1",
|
||||
"csstype": "^3.0.2",
|
||||
"is-in-browser": "^1.1.3",
|
||||
"tiny-warning": "^1.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"csstype": {
|
||||
"version": "3.0.11",
|
||||
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.11.tgz",
|
||||
"integrity": "sha512-sa6P2wJ+CAbgyy4KFssIb/JNMLxFvKF1pCYCSXS8ZMuqZnMsrxqI2E5sPyoTpxoPU/gVZMzr2zjOfg8GIZOMsw=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"jss-plugin-camel-case": {
|
||||
"version": "10.9.0",
|
||||
"resolved": "https://registry.npmjs.org/jss-plugin-camel-case/-/jss-plugin-camel-case-10.9.0.tgz",
|
||||
"integrity": "sha512-UH6uPpnDk413/r/2Olmw4+y54yEF2lRIV8XIZyuYpgPYTITLlPOsq6XB9qeqv+75SQSg3KLocq5jUBXW8qWWww==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.3.1",
|
||||
"hyphenate-style-name": "^1.0.3",
|
||||
"jss": "10.9.0"
|
||||
}
|
||||
},
|
||||
"jss-plugin-default-unit": {
|
||||
"version": "10.9.0",
|
||||
"resolved": "https://registry.npmjs.org/jss-plugin-default-unit/-/jss-plugin-default-unit-10.9.0.tgz",
|
||||
"integrity": "sha512-7Ju4Q9wJ/MZPsxfu4T84mzdn7pLHWeqoGd/D8O3eDNNJ93Xc8PxnLmV8s8ZPNRYkLdxZqKtm1nPQ0BM4JRlq2w==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.3.1",
|
||||
"jss": "10.9.0"
|
||||
}
|
||||
},
|
||||
"jss-plugin-global": {
|
||||
"version": "10.9.0",
|
||||
"resolved": "https://registry.npmjs.org/jss-plugin-global/-/jss-plugin-global-10.9.0.tgz",
|
||||
"integrity": "sha512-4G8PHNJ0x6nwAFsEzcuVDiBlyMsj2y3VjmFAx/uHk/R/gzJV+yRHICjT4MKGGu1cJq2hfowFWCyrr/Gg37FbgQ==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.3.1",
|
||||
"jss": "10.9.0"
|
||||
}
|
||||
},
|
||||
"jss-plugin-nested": {
|
||||
"version": "10.9.0",
|
||||
"resolved": "https://registry.npmjs.org/jss-plugin-nested/-/jss-plugin-nested-10.9.0.tgz",
|
||||
"integrity": "sha512-2UJnDrfCZpMYcpPYR16oZB7VAC6b/1QLsRiAutOt7wJaaqwCBvNsosLEu/fUyKNQNGdvg2PPJFDO5AX7dwxtoA==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.3.1",
|
||||
"jss": "10.9.0",
|
||||
"tiny-warning": "^1.0.2"
|
||||
}
|
||||
},
|
||||
"jss-plugin-props-sort": {
|
||||
"version": "10.9.0",
|
||||
"resolved": "https://registry.npmjs.org/jss-plugin-props-sort/-/jss-plugin-props-sort-10.9.0.tgz",
|
||||
"integrity": "sha512-7A76HI8bzwqrsMOJTWKx/uD5v+U8piLnp5bvru7g/3ZEQOu1+PjHvv7bFdNO3DwNPC9oM0a//KwIJsIcDCjDzw==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.3.1",
|
||||
"jss": "10.9.0"
|
||||
}
|
||||
},
|
||||
"jss-plugin-rule-value-function": {
|
||||
"version": "10.9.0",
|
||||
"resolved": "https://registry.npmjs.org/jss-plugin-rule-value-function/-/jss-plugin-rule-value-function-10.9.0.tgz",
|
||||
"integrity": "sha512-IHJv6YrEf8pRzkY207cPmdbBstBaE+z8pazhPShfz0tZSDtRdQua5jjg6NMz3IbTasVx9FdnmptxPqSWL5tyJg==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.3.1",
|
||||
"jss": "10.9.0",
|
||||
"tiny-warning": "^1.0.2"
|
||||
}
|
||||
},
|
||||
"jss-plugin-vendor-prefixer": {
|
||||
"version": "10.9.0",
|
||||
"resolved": "https://registry.npmjs.org/jss-plugin-vendor-prefixer/-/jss-plugin-vendor-prefixer-10.9.0.tgz",
|
||||
"integrity": "sha512-MbvsaXP7iiVdYVSEoi+blrW+AYnTDvHTW6I6zqi7JcwXdc6I9Kbm234nEblayhF38EftoenbM+5218pidmC5gA==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.3.1",
|
||||
"css-vendor": "^2.0.8",
|
||||
"jss": "10.9.0"
|
||||
}
|
||||
},
|
||||
"locate-path": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz",
|
||||
"integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==",
|
||||
"requires": {
|
||||
"p-locate": "^3.0.0",
|
||||
"path-exists": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"loose-envify": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
|
||||
"integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==",
|
||||
"requires": {
|
||||
"js-tokens": "^3.0.0 || ^4.0.0"
|
||||
}
|
||||
},
|
||||
"lru-cache": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
|
||||
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
|
||||
"requires": {
|
||||
"yallist": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"make-dir": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz",
|
||||
"integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==",
|
||||
"requires": {
|
||||
"semver": "^6.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"semver": {
|
||||
"version": "6.3.0",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
|
||||
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"mimic-fn": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-3.1.0.tgz",
|
||||
"integrity": "sha512-Ysbi9uYW9hFyfrThdDEQuykN4Ey6BuwPD2kpI5ES/nFTDn/98yxYNLZJcgUAKPT/mcrLLKaGzJR9YVxJrIdASQ=="
|
||||
},
|
||||
"mobx": {
|
||||
"version": "6.5.0",
|
||||
"resolved": "https://registry.npmjs.org/mobx/-/mobx-6.5.0.tgz",
|
||||
"integrity": "sha512-pHZ/cySF00FVENDWIDzJyoObFahK6Eg4d0papqm6d7yMkxWTZ/S/csqJX1A3PsYy4t5k3z2QnlwuCfMW5lSEwA=="
|
||||
},
|
||||
"mobx-react": {
|
||||
"version": "7.4.0",
|
||||
"resolved": "https://registry.npmjs.org/mobx-react/-/mobx-react-7.4.0.tgz",
|
||||
"integrity": "sha512-gbUwaKZK09SiAleTMxNMKs1MYKTpoIEWJLTLRIR/xnALuuHET8wkL8j1nbc1/6cDkOWVyKz/ReftILx0Pdh2PQ==",
|
||||
"requires": {
|
||||
"mobx-react-lite": "^3.4.0"
|
||||
}
|
||||
},
|
||||
"mobx-react-lite": {
|
||||
"version": "3.4.0",
|
||||
"resolved": "https://registry.npmjs.org/mobx-react-lite/-/mobx-react-lite-3.4.0.tgz",
|
||||
"integrity": "sha512-bRuZp3C0itgLKHu/VNxi66DN/XVkQG7xtoBVWxpvC5FhAqbOCP21+nPhULjnzEqd7xBMybp6KwytdUpZKEgpIQ=="
|
||||
},
|
||||
"object-assign": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
|
||||
"integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM="
|
||||
},
|
||||
"onetime": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz",
|
||||
"integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==",
|
||||
"requires": {
|
||||
"mimic-fn": "^2.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"mimic-fn": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz",
|
||||
"integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"p-limit": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
|
||||
"integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",
|
||||
"requires": {
|
||||
"p-try": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"p-locate": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz",
|
||||
"integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==",
|
||||
"requires": {
|
||||
"p-limit": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"p-try": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
|
||||
"integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ=="
|
||||
},
|
||||
"path-exists": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
|
||||
"integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU="
|
||||
},
|
||||
"pkg-up": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/pkg-up/-/pkg-up-3.1.0.tgz",
|
||||
"integrity": "sha512-nDywThFk1i4BQK4twPQ6TA4RT8bDY96yeuCVBWL3ePARCiEKDRSrNGbFIgUJpLp+XeIR65v8ra7WuJOFUBtkMA==",
|
||||
"requires": {
|
||||
"find-up": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"popper.js": {
|
||||
"version": "1.16.1-lts",
|
||||
"resolved": "https://registry.npmjs.org/popper.js/-/popper.js-1.16.1-lts.tgz",
|
||||
"integrity": "sha512-Kjw8nKRl1m+VrSFCoVGPph93W/qrSO7ZkqPpTf7F4bk/sqcfWK019dWBUpE/fBOsOQY1dks/Bmcbfn1heM/IsA=="
|
||||
},
|
||||
"prop-types": {
|
||||
"version": "15.8.1",
|
||||
"resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz",
|
||||
"integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==",
|
||||
"requires": {
|
||||
"loose-envify": "^1.4.0",
|
||||
"object-assign": "^4.1.1",
|
||||
"react-is": "^16.13.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"react-is": {
|
||||
"version": "16.13.1",
|
||||
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
|
||||
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"punycode": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
|
||||
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A=="
|
||||
},
|
||||
"react-is": {
|
||||
"version": "17.0.2",
|
||||
"resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz",
|
||||
"integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w=="
|
||||
},
|
||||
"react-transition-group": {
|
||||
"version": "4.4.2",
|
||||
"resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.2.tgz",
|
||||
"integrity": "sha512-/RNYfRAMlZwDSr6z4zNKV6xu53/e2BuaBbGhbyYIXTrmgu/bGHzmqOs7mJSJBHy9Ud+ApHx3QjrkKSp1pxvlFg==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.5.5",
|
||||
"dom-helpers": "^5.0.1",
|
||||
"loose-envify": "^1.4.0",
|
||||
"prop-types": "^15.6.2"
|
||||
}
|
||||
},
|
||||
"regenerator-runtime": {
|
||||
"version": "0.13.9",
|
||||
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz",
|
||||
"integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA=="
|
||||
},
|
||||
"semver": {
|
||||
"version": "7.3.7",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz",
|
||||
"integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==",
|
||||
"requires": {
|
||||
"lru-cache": "^6.0.0"
|
||||
}
|
||||
},
|
||||
"tiny-warning": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/tiny-warning/-/tiny-warning-1.0.3.tgz",
|
||||
"integrity": "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA=="
|
||||
},
|
||||
"typed-emitter": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/typed-emitter/-/typed-emitter-1.4.0.tgz",
|
||||
"integrity": "sha512-weBmoo3HhpKGgLBOYwe8EB31CzDFuaK7CCL+axXhUYhn4jo6DSkHnbefboCF5i4DQ2aMFe0C/FdTWcPdObgHyg=="
|
||||
},
|
||||
"uri-js": {
|
||||
"version": "4.4.1",
|
||||
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
|
||||
"integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==",
|
||||
"requires": {
|
||||
"punycode": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"yallist": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
|
||||
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "@k8slens/extensions",
|
||||
"productName": "OpenLens extensions",
|
||||
"description": "OpenLens - Open Source Kubernetes IDE: extensions",
|
||||
"version": "0.0.0",
|
||||
"version": "0.0.1",
|
||||
"copyright": "© 2021 OpenLens Authors",
|
||||
"license": "MIT",
|
||||
"main": "dist/src/extensions/extension-api.js",
|
||||
@@ -16,9 +16,15 @@
|
||||
"name": "OpenLens Authors"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/node": "14.17.14",
|
||||
"@material-ui/core": "4.12.3",
|
||||
"@types/node": "14.17.14",
|
||||
"@types/react": "^17.0.45",
|
||||
"@types/react-dom": "^17.0.16",
|
||||
"@types/react-router": "^5.1.18",
|
||||
"@types/react-router-dom": "^5.3.3",
|
||||
"conf": "^7.0.1",
|
||||
"mobx": "^6.5.0",
|
||||
"mobx-react": "^7.3.0",
|
||||
"typed-emitter": "^1.3.1"
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
// Base class for extensions-api registries
|
||||
import { action, observable, makeObservable } from "mobx";
|
||||
import type { Disposer } from "../../common/utils";
|
||||
import { Singleton } from "../../common/utils";
|
||||
import type { LensExtension } from "../lens-extension";
|
||||
|
||||
@@ -21,7 +22,7 @@ export class BaseRegistry<T, I = T> extends Singleton {
|
||||
}
|
||||
|
||||
@action
|
||||
add(items: T | T[], extension?: LensExtension) {
|
||||
add(items: T | T[], extension?: LensExtension): Disposer {
|
||||
const itemArray = [items].flat() as T[];
|
||||
|
||||
itemArray.forEach(item => {
|
||||
@@ -33,7 +34,7 @@ export class BaseRegistry<T, I = T> extends Singleton {
|
||||
|
||||
// eslint-disable-next-line unused-imports/no-unused-vars-ts
|
||||
protected getRegisteredItem(item: T, extension?: LensExtension): I {
|
||||
return item as any;
|
||||
return item as never;
|
||||
}
|
||||
|
||||
@action
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*/
|
||||
|
||||
import type React from "react";
|
||||
import type { Disposer } from "../../common/utils";
|
||||
import type { CatalogEntity } from "../common-api/catalog";
|
||||
import { BaseRegistry } from "./base-registry";
|
||||
|
||||
@@ -23,6 +24,10 @@ export interface CatalogEntityDetailRegistration<T extends CatalogEntity> {
|
||||
}
|
||||
|
||||
export class CatalogEntityDetailRegistry extends BaseRegistry<CatalogEntityDetailRegistration<CatalogEntity>> {
|
||||
add<T extends CatalogEntity>(items: CatalogEntityDetailRegistration<T> | CatalogEntityDetailRegistration<T>[]): Disposer {
|
||||
return super.add(items as never);
|
||||
}
|
||||
|
||||
getItemsForKind(kind: string, apiVersion: string) {
|
||||
const items = this.getItems().filter((item) => {
|
||||
return item.kind === kind && item.apiVersions.includes(apiVersion);
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*/
|
||||
|
||||
import type React from "react";
|
||||
import type { Disposer } from "../../common/utils";
|
||||
import type { KubeObjectDetailsProps } from "../renderer-api/components";
|
||||
import type { KubeObject } from "../renderer-api/k8s-api";
|
||||
import { BaseRegistry } from "./base-registry";
|
||||
@@ -12,14 +13,20 @@ export interface KubeObjectDetailComponents<T extends KubeObject = KubeObject> {
|
||||
Details: React.ComponentType<KubeObjectDetailsProps<T>>;
|
||||
}
|
||||
|
||||
export interface KubeObjectDetailRegistration {
|
||||
export interface KubeObjectDetailRegistration<T extends KubeObject = KubeObject> {
|
||||
kind: string;
|
||||
apiVersions: string[];
|
||||
components: KubeObjectDetailComponents<KubeObject>;
|
||||
components: KubeObjectDetailComponents<T>;
|
||||
priority?: number;
|
||||
}
|
||||
|
||||
export class KubeObjectDetailRegistry extends BaseRegistry<KubeObjectDetailRegistration> {
|
||||
add(items: KubeObjectDetailRegistration[]): Disposer;
|
||||
add<T extends KubeObject>(item: KubeObjectDetailRegistration<T>): Disposer;
|
||||
add(items: KubeObjectDetailRegistration | KubeObjectDetailRegistration[]): Disposer {
|
||||
return super.add(items);
|
||||
}
|
||||
|
||||
getItemsForKind(kind: string, apiVersion: string) {
|
||||
const items = this.getItems().filter((item) => {
|
||||
return item.kind === kind && item.apiVersions.includes(apiVersion);
|
||||
|
||||
@@ -40,6 +40,6 @@ export interface RegisteredPage {
|
||||
id: string;
|
||||
extensionId: string;
|
||||
url: string; // registered extension's page URL (without page params)
|
||||
params: PageParams<PageParam>; // normalized params
|
||||
params: PageParams<PageParam<any>>; // normalized params
|
||||
components: PageComponents; // normalized components
|
||||
}
|
||||
@@ -20,12 +20,12 @@ export interface RouteParams {
|
||||
/**
|
||||
* the parts of the URI query string
|
||||
*/
|
||||
search: Record<string, string>;
|
||||
search: Record<string, string | undefined>;
|
||||
|
||||
/**
|
||||
* the matching parts of the path. The dynamic parts of the URI path.
|
||||
*/
|
||||
pathname: Record<string, string>;
|
||||
pathname: Record<string, string | undefined>;
|
||||
|
||||
/**
|
||||
* if the most specific path schema that is matched does not cover the whole
|
||||
|
||||
@@ -5,21 +5,26 @@
|
||||
|
||||
|
||||
import type { CatalogCategory, CatalogEntity } from "../../common/catalog";
|
||||
import { catalogEntityRegistry as registry } from "../../renderer/api/catalog-entity-registry";
|
||||
import type { CatalogEntityOnBeforeRun } from "../../renderer/api/catalog-entity-registry";
|
||||
import type { CatalogEntityOnBeforeRun } from "../../renderer/api/catalog/entity/registry";
|
||||
import type { Disposer } from "../../common/utils";
|
||||
export { catalogCategoryRegistry as catalogCategories } from "../../common/catalog/catalog-category-registry";
|
||||
import catalogCategoryRegistryInjectable from "../../common/catalog/category-registry.injectable";
|
||||
import { asLegacyGlobalForExtensionApi } from "../as-legacy-globals-for-extension-api/as-legacy-global-object-for-extension-api";
|
||||
import catalogEntityRegistryInjectable from "../../renderer/api/catalog/entity/registry.injectable";
|
||||
|
||||
export const catalogCategories = asLegacyGlobalForExtensionApi(catalogCategoryRegistryInjectable);
|
||||
|
||||
const internalEntityRegistry = asLegacyGlobalForExtensionApi(catalogEntityRegistryInjectable);
|
||||
|
||||
export class CatalogEntityRegistry {
|
||||
/**
|
||||
* Currently active/visible entity
|
||||
*/
|
||||
get activeEntity() {
|
||||
return registry.activeEntity;
|
||||
return internalEntityRegistry.activeEntity;
|
||||
}
|
||||
|
||||
get entities(): Map<string, CatalogEntity> {
|
||||
return registry.entities;
|
||||
return internalEntityRegistry.entities;
|
||||
}
|
||||
|
||||
getById(id: string) {
|
||||
@@ -27,11 +32,11 @@ export class CatalogEntityRegistry {
|
||||
}
|
||||
|
||||
getItemsForApiKind<T extends CatalogEntity>(apiVersion: string, kind: string): T[] {
|
||||
return registry.getItemsForApiKind<T>(apiVersion, kind);
|
||||
return internalEntityRegistry.getItemsForApiKind<T>(apiVersion, kind);
|
||||
}
|
||||
|
||||
getItemsForCategory<T extends CatalogEntity>(category: CatalogCategory): T[] {
|
||||
return registry.getItemsForCategory(category);
|
||||
return internalEntityRegistry.getItemsForCategory(category);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -43,7 +48,7 @@ export class CatalogEntityRegistry {
|
||||
* @returns A function to remove that hook
|
||||
*/
|
||||
addOnBeforeRun(onBeforeRun: CatalogEntityOnBeforeRun): Disposer {
|
||||
return registry.addOnBeforeRun(onBeforeRun);
|
||||
return internalEntityRegistry.addOnBeforeRun(onBeforeRun);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,9 +12,9 @@ import commandOverlayInjectable from "../../renderer/components/command-palette/
|
||||
import createPodLogsTabInjectable from "../../renderer/components/dock/logs/create-pod-logs-tab.injectable";
|
||||
import createWorkloadLogsTabInjectable from "../../renderer/components/dock/logs/create-workload-logs-tab.injectable";
|
||||
import sendCommandInjectable from "../../renderer/components/dock/terminal/send-command.injectable";
|
||||
import { podsStore } from "../../renderer/components/+workloads-pods/pods.store";
|
||||
import renameTabInjectable from "../../renderer/components/dock/dock/rename-tab.injectable";
|
||||
import { asLegacyGlobalObjectForExtensionApiWithModifications } from "../as-legacy-globals-for-extension-api/as-legacy-global-object-for-extension-api-with-modifications";
|
||||
import { podStore } from "../../renderer/components/+workloads-pods/legacy-store";
|
||||
import { ConfirmDialog as _ConfirmDialog } from "../../renderer/components/confirm-dialog";
|
||||
import type { ConfirmDialogBooleanParams, ConfirmDialogParams, ConfirmDialogProps } from "../../renderer/components/confirm-dialog";
|
||||
import openConfirmDialogInjectable from "../../renderer/components/confirm-dialog/open.injectable";
|
||||
@@ -37,9 +37,7 @@ export * from "../../renderer/components/switch";
|
||||
export * from "../../renderer/components/input/input";
|
||||
|
||||
// command-overlay
|
||||
export const CommandOverlay = asLegacyGlobalForExtensionApi(
|
||||
commandOverlayInjectable,
|
||||
);
|
||||
export const CommandOverlay = asLegacyGlobalForExtensionApi(commandOverlayInjectable);
|
||||
|
||||
export type {
|
||||
CategoryColumnRegistration,
|
||||
@@ -94,39 +92,30 @@ export * from "../../renderer/components/+events/kube-event-details";
|
||||
// specific exports
|
||||
export * from "../../renderer/components/status-brick";
|
||||
|
||||
export const createTerminalTab = asLegacyGlobalFunctionForExtensionApi(
|
||||
createTerminalTabInjectable,
|
||||
export const createTerminalTab = asLegacyGlobalFunctionForExtensionApi(createTerminalTabInjectable);
|
||||
|
||||
export const terminalStore = asLegacyGlobalObjectForExtensionApiWithModifications(
|
||||
terminalStoreInjectable,
|
||||
{
|
||||
sendCommand: asLegacyGlobalFunctionForExtensionApi(sendCommandInjectable),
|
||||
},
|
||||
);
|
||||
|
||||
export const terminalStore =
|
||||
asLegacyGlobalObjectForExtensionApiWithModifications(
|
||||
terminalStoreInjectable,
|
||||
{
|
||||
sendCommand: asLegacyGlobalFunctionForExtensionApi(sendCommandInjectable),
|
||||
},
|
||||
);
|
||||
const renameTab = asLegacyGlobalFunctionForExtensionApi(renameTabInjectable);
|
||||
|
||||
export const logTabStore = asLegacyGlobalObjectForExtensionApiWithModifications(
|
||||
logTabStoreInjectable,
|
||||
{
|
||||
createPodTab: asLegacyGlobalFunctionForExtensionApi(
|
||||
createPodLogsTabInjectable,
|
||||
),
|
||||
|
||||
createWorkloadTab: asLegacyGlobalFunctionForExtensionApi(
|
||||
createWorkloadLogsTabInjectable,
|
||||
),
|
||||
|
||||
createPodTab: asLegacyGlobalFunctionForExtensionApi(createPodLogsTabInjectable),
|
||||
createWorkloadTab: asLegacyGlobalFunctionForExtensionApi(createWorkloadLogsTabInjectable),
|
||||
renameTab: (tabId: string): void => {
|
||||
const renameTab =
|
||||
asLegacyGlobalFunctionForExtensionApi(renameTabInjectable);
|
||||
const { selectedPodId } = logTabStore.getData(tabId) ?? {};
|
||||
const pod = selectedPodId && podStore.getById(selectedPodId);
|
||||
|
||||
const tabData = logTabStore.getData(tabId);
|
||||
const pod = podsStore.getById(tabData.selectedPodId);
|
||||
|
||||
renameTab(tabId, `Pod ${pod.getName()}`);
|
||||
if (pod) {
|
||||
renameTab(tabId, `Pod ${pod.getName()}`);
|
||||
}
|
||||
},
|
||||
|
||||
tabs: undefined,
|
||||
},
|
||||
);
|
||||
|
||||
@@ -6,10 +6,39 @@ import type { KubeResource } from "../../common/rbac";
|
||||
import isAllowedResourceInjectable from "../../common/utils/is-allowed-resource.injectable";
|
||||
import { castArray } from "lodash/fp";
|
||||
import { getLegacyGlobalDiForExtensionApi } from "../as-legacy-globals-for-extension-api/legacy-global-di-for-extension-api";
|
||||
import clusterRoleBindingApiInjectable from "../../common/k8s-api/endpoints/cluster-role-binding.api.injectable";
|
||||
import clusterRoleApiInjectable from "../../common/k8s-api/endpoints/cluster-role.api.injectable";
|
||||
import serviceAccountApiInjectable from "../../common/k8s-api/endpoints/service-account.api.injectable";
|
||||
import { asLegacyGlobalForExtensionApi } from "../as-legacy-globals-for-extension-api/as-legacy-global-object-for-extension-api";
|
||||
import roleApiInjectable from "../../common/k8s-api/endpoints/role.api.injectable";
|
||||
import podApiInjectable from "../../common/k8s-api/endpoints/pod.api.injectable";
|
||||
import daemonSetApiInjectable from "../../common/k8s-api/endpoints/daemon-set.api.injectable";
|
||||
import replicaSetApiInjectable from "../../common/k8s-api/endpoints/replica-set.api.injectable";
|
||||
import statefulSetApiInjectable from "../../common/k8s-api/endpoints/stateful-set.api.injectable";
|
||||
import deploymentApiInjectable from "../../common/k8s-api/endpoints/deployment.api.injectable";
|
||||
import jobApiInjectable from "../../common/k8s-api/endpoints/job.api.injectable";
|
||||
import cronJobApiInjectable from "../../common/k8s-api/endpoints/cron-job.api.injectable";
|
||||
import nodeApiInjectable from "../../common/k8s-api/endpoints/node.api.injectable";
|
||||
import configMapApiInjectable from "../../common/k8s-api/endpoints/config-map.api.injectable";
|
||||
import secretApiInjectable from "../../common/k8s-api/endpoints/secret.api.injectable";
|
||||
import resourceQuotaApiInjectable from "../../common/k8s-api/endpoints/resource-quota.api.injectable";
|
||||
import limitRangeApiInjectable from "../../common/k8s-api/endpoints/limit-range.api.injectable";
|
||||
import horizontalPodAutoscalerApiInjectable from "../../common/k8s-api/endpoints/horizontal-pod-autoscaler.api.injectable";
|
||||
import podDisruptionBudgetApiInjectable from "../../common/k8s-api/endpoints/pod-disruption-budget.api.injectable";
|
||||
import serviceApiInjectable from "../../common/k8s-api/endpoints/service.api.injectable";
|
||||
import endpointsApiInjectable from "../../common/k8s-api/endpoints/endpoint.api.injectable";
|
||||
import ingressApiInjectable from "../../common/k8s-api/endpoints/ingress.api.injectable";
|
||||
import networkPolicyApiInjectable from "../../common/k8s-api/endpoints/network-policy.api.injectable";
|
||||
import persistentVolumeApiInjectable from "../../common/k8s-api/endpoints/persistent-volume.api.injectable";
|
||||
import persistentVolumeClaimApiInjectable from "../../common/k8s-api/endpoints/persistent-volume-claim.api.injectable";
|
||||
import storageClassApiInjectable from "../../common/k8s-api/endpoints/storage-class.api.injectable";
|
||||
import namespaceApiInjectable from "../../common/k8s-api/endpoints/namespace.api.injectable";
|
||||
import kubeEventApiInjectable from "../../common/k8s-api/endpoints/events.api.injectable";
|
||||
import roleBindingApiInjectable from "../../common/k8s-api/endpoints/role-binding.api.injectable";
|
||||
import customResourceDefinitionApiInjectable from "../../common/k8s-api/endpoints/custom-resource-definition.api.injectable";
|
||||
|
||||
export function isAllowedResource(resource: KubeResource | KubeResource[]) {
|
||||
const resources = castArray(resource);
|
||||
|
||||
const di = getLegacyGlobalDiForExtensionApi();
|
||||
|
||||
return resources.every((resourceName: any) => {
|
||||
@@ -20,77 +49,69 @@ export function isAllowedResource(resource: KubeResource | KubeResource[]) {
|
||||
});
|
||||
}
|
||||
|
||||
export { ResourceStack } from "../../common/k8s/resource-stack";
|
||||
export { apiManager } from "../../common/k8s-api/api-manager";
|
||||
export { KubeObjectStore } from "../../common/k8s-api/kube-object.store";
|
||||
export { KubeApi, forCluster, forRemoteCluster } from "../../common/k8s-api/kube-api";
|
||||
export { KubeObject, KubeStatus } from "../../common/k8s-api/kube-object";
|
||||
export { Pod, podsApi, PodsApi } from "../../common/k8s-api/endpoints";
|
||||
export { Node, nodesApi, NodesApi } from "../../common/k8s-api/endpoints";
|
||||
export { Deployment, deploymentApi, DeploymentApi } from "../../common/k8s-api/endpoints";
|
||||
export { DaemonSet, daemonSetApi } from "../../common/k8s-api/endpoints";
|
||||
export { StatefulSet, statefulSetApi } from "../../common/k8s-api/endpoints";
|
||||
export { Job, jobApi } from "../../common/k8s-api/endpoints";
|
||||
export { CronJob, cronJobApi } from "../../common/k8s-api/endpoints";
|
||||
export { ConfigMap, configMapApi } from "../../common/k8s-api/endpoints";
|
||||
export { Secret, secretsApi } from "../../common/k8s-api/endpoints";
|
||||
export { ReplicaSet, replicaSetApi } from "../../common/k8s-api/endpoints";
|
||||
export { ResourceQuota, resourceQuotaApi } from "../../common/k8s-api/endpoints";
|
||||
export { LimitRange, limitRangeApi } from "../../common/k8s-api/endpoints";
|
||||
export { HorizontalPodAutoscaler, hpaApi } from "../../common/k8s-api/endpoints";
|
||||
export { PodDisruptionBudget, pdbApi } from "../../common/k8s-api/endpoints";
|
||||
export { Service, serviceApi } from "../../common/k8s-api/endpoints";
|
||||
export { Endpoint, endpointApi } from "../../common/k8s-api/endpoints";
|
||||
export { Ingress, ingressApi, IngressApi } from "../../common/k8s-api/endpoints";
|
||||
export { NetworkPolicy, networkPolicyApi } from "../../common/k8s-api/endpoints";
|
||||
export { PersistentVolume, persistentVolumeApi } from "../../common/k8s-api/endpoints";
|
||||
export { PersistentVolumeClaim, pvcApi, PersistentVolumeClaimsApi } from "../../common/k8s-api/endpoints";
|
||||
export { StorageClass, storageClassApi } from "../../common/k8s-api/endpoints";
|
||||
export { Namespace, namespacesApi } from "../../common/k8s-api/endpoints";
|
||||
export { KubeEvent, eventApi } from "../../common/k8s-api/endpoints";
|
||||
export { ServiceAccount, serviceAccountsApi } from "../../common/k8s-api/endpoints";
|
||||
export { Role, roleApi } from "../../common/k8s-api/endpoints";
|
||||
export { RoleBinding, roleBindingApi } from "../../common/k8s-api/endpoints";
|
||||
export { ClusterRole, clusterRoleApi } from "../../common/k8s-api/endpoints";
|
||||
export { ClusterRoleBinding, clusterRoleBindingApi } from "../../common/k8s-api/endpoints";
|
||||
export { CustomResourceDefinition, crdApi } from "../../common/k8s-api/endpoints";
|
||||
export { KubeObjectStatusLevel } from "./kube-object-status";
|
||||
export { KubeJsonApi } from "../../common/k8s-api/kube-json-api";
|
||||
export const serviceAccountsApi = asLegacyGlobalForExtensionApi(serviceAccountApiInjectable);
|
||||
export const clusterRoleApi = asLegacyGlobalForExtensionApi(clusterRoleApiInjectable);
|
||||
export const clusterRoleBindingApi = asLegacyGlobalForExtensionApi(clusterRoleBindingApiInjectable);
|
||||
export const roleApi = asLegacyGlobalForExtensionApi(roleApiInjectable);
|
||||
export const podsApi = asLegacyGlobalForExtensionApi(podApiInjectable);
|
||||
export const daemonSetApi = asLegacyGlobalForExtensionApi(daemonSetApiInjectable);
|
||||
export const replicaSetApi = asLegacyGlobalForExtensionApi(replicaSetApiInjectable);
|
||||
export const statefulSetApi = asLegacyGlobalForExtensionApi(statefulSetApiInjectable);
|
||||
export const deploymentApi = asLegacyGlobalForExtensionApi(deploymentApiInjectable);
|
||||
export const jobApi = asLegacyGlobalForExtensionApi(jobApiInjectable);
|
||||
export const cronJobApi = asLegacyGlobalForExtensionApi(cronJobApiInjectable);
|
||||
export const nodesApi = asLegacyGlobalForExtensionApi(nodeApiInjectable);
|
||||
export const secretsApi = asLegacyGlobalForExtensionApi(secretApiInjectable);
|
||||
export const configMapApi = asLegacyGlobalForExtensionApi(configMapApiInjectable);
|
||||
export const resourceQuotaApi = asLegacyGlobalForExtensionApi(resourceQuotaApiInjectable);
|
||||
export const limitRangeApi = asLegacyGlobalForExtensionApi(limitRangeApiInjectable);
|
||||
export const serviceApi = asLegacyGlobalForExtensionApi(serviceApiInjectable);
|
||||
export const hpaApi = asLegacyGlobalForExtensionApi(horizontalPodAutoscalerApiInjectable);
|
||||
export const pdbApi = asLegacyGlobalForExtensionApi(podDisruptionBudgetApiInjectable);
|
||||
export const endpointApi = asLegacyGlobalForExtensionApi(endpointsApiInjectable);
|
||||
export const ingressApi = asLegacyGlobalForExtensionApi(ingressApiInjectable);
|
||||
export const networkPolicyApi = asLegacyGlobalForExtensionApi(networkPolicyApiInjectable);
|
||||
export const persistentVolumeApi = asLegacyGlobalForExtensionApi(persistentVolumeApiInjectable);
|
||||
export const pvcApi = asLegacyGlobalForExtensionApi(persistentVolumeClaimApiInjectable);
|
||||
export const storageClassApi = asLegacyGlobalForExtensionApi(storageClassApiInjectable);
|
||||
export const namespacesApi = asLegacyGlobalForExtensionApi(namespaceApiInjectable);
|
||||
export const eventApi = asLegacyGlobalForExtensionApi(kubeEventApiInjectable);
|
||||
export const roleBindingApi = asLegacyGlobalForExtensionApi(roleBindingApiInjectable);
|
||||
export const crdApi = asLegacyGlobalForExtensionApi(customResourceDefinitionApiInjectable);
|
||||
|
||||
// types
|
||||
export type { ILocalKubeApiConfig, IRemoteKubeApiConfig, IKubeApiCluster } from "../../common/k8s-api/kube-api";
|
||||
export type { IPodContainer, IPodContainerStatus } from "../../common/k8s-api/endpoints";
|
||||
export type { ISecretRef } from "../../common/k8s-api/endpoints";
|
||||
export type { KubeObjectStatus } from "./kube-object-status";
|
||||
export type { KubeObjectMetadata, KubeStatusData } from "../../common/k8s-api/kube-object";
|
||||
export type { KubeObjectStoreLoadAllParams, KubeObjectStoreLoadingParams, KubeObjectStoreSubscribeParams } from "../../common/k8s-api/kube-object.store";
|
||||
export * from "../common-api/k8s-api";
|
||||
|
||||
export {
|
||||
KubeObjectStatusLevel,
|
||||
type KubeObjectStatus,
|
||||
} from "../../common/k8s-api/kube-object-status";
|
||||
|
||||
// stores
|
||||
export type { EventStore } from "../../renderer/components/+events/event.store";
|
||||
export type { PodsStore } from "../../renderer/components/+workloads-pods/pods.store";
|
||||
export type { NodesStore } from "../../renderer/components/+nodes/nodes.store";
|
||||
export type { DeploymentStore } from "../../renderer/components/+workloads-deployments/deployments.store";
|
||||
export type { DaemonSetStore } from "../../renderer/components/+workloads-daemonsets/daemonsets.store";
|
||||
export type { StatefulSetStore } from "../../renderer/components/+workloads-statefulsets/statefulset.store";
|
||||
export type { JobStore } from "../../renderer/components/+workloads-jobs/job.store";
|
||||
export type { CronJobStore } from "../../renderer/components/+workloads-cronjobs/cronjob.store";
|
||||
export type { ConfigMapsStore } from "../../renderer/components/+config-maps/config-maps.store";
|
||||
export type { SecretsStore } from "../../renderer/components/+config-secrets/secrets.store";
|
||||
export type { ReplicaSetStore } from "../../renderer/components/+workloads-replicasets/replicasets.store";
|
||||
export type { ResourceQuotasStore } from "../../renderer/components/+config-resource-quotas/resource-quotas.store";
|
||||
export type { LimitRangesStore } from "../../renderer/components/+config-limit-ranges/limit-ranges.store";
|
||||
export type { HPAStore } from "../../renderer/components/+config-autoscalers/hpa.store";
|
||||
export type { PodDisruptionBudgetsStore } from "../../renderer/components/+config-pod-disruption-budgets/pod-disruption-budgets.store";
|
||||
export type { ServiceStore } from "../../renderer/components/+network-services/services.store";
|
||||
export type { EndpointStore } from "../../renderer/components/+network-endpoints/endpoints.store";
|
||||
export type { IngressStore } from "../../renderer/components/+network-ingresses/ingress.store";
|
||||
export type { NetworkPolicyStore } from "../../renderer/components/+network-policies/network-policy.store";
|
||||
export type { PersistentVolumesStore } from "../../renderer/components/+storage-volumes/volumes.store";
|
||||
export type { VolumeClaimStore } from "../../renderer/components/+storage-volume-claims/volume-claim.store";
|
||||
export type { StorageClassStore } from "../../renderer/components/+storage-classes/storage-class.store";
|
||||
export type { NamespaceStore } from "../../renderer/components/+namespaces/namespace-store/namespace.store";
|
||||
export type { ServiceAccountsStore } from "../../renderer/components/+user-management/+service-accounts/store";
|
||||
export type { RolesStore } from "../../renderer/components/+user-management/+roles/store";
|
||||
export type { RoleBindingsStore } from "../../renderer/components/+user-management/+role-bindings/store";
|
||||
export type { CRDStore } from "../../renderer/components/+custom-resources/crd.store";
|
||||
export type { CRDResourceStore } from "../../renderer/components/+custom-resources/crd-resource.store";
|
||||
export type { EventStore } from "../../renderer/components/+events/store";
|
||||
export type { PodStore as PodsStore } from "../../renderer/components/+workloads-pods/store";
|
||||
export type { NodeStore as NodesStore } from "../../renderer/components/+nodes/store";
|
||||
export type { DeploymentStore } from "../../renderer/components/+workloads-deployments/store";
|
||||
export type { DaemonSetStore } from "../../renderer/components/+workloads-daemonsets/store";
|
||||
export type { StatefulSetStore } from "../../renderer/components/+workloads-statefulsets/store";
|
||||
export type { JobStore } from "../../renderer/components/+workloads-jobs/store";
|
||||
export type { CronJobStore } from "../../renderer/components/+workloads-cronjobs/store";
|
||||
export type { ConfigMapStore as ConfigMapsStore } from "../../renderer/components/+config-maps/store";
|
||||
export type { SecretStore as SecretsStore } from "../../renderer/components/+config-secrets/store";
|
||||
export type { ReplicaSetStore } from "../../renderer/components/+workloads-replicasets/store";
|
||||
export type { ResourceQuotaStore as ResourceQuotasStore } from "../../renderer/components/+config-resource-quotas/store";
|
||||
export type { LimitRangeStore as LimitRangesStore } from "../../renderer/components/+config-limit-ranges/store";
|
||||
export type { HorizontalPodAutoscalerStore as HPAStore } from "../../renderer/components/+config-autoscalers/store";
|
||||
export type { PodDisruptionBudgetStore as PodDisruptionBudgetsStore } from "../../renderer/components/+config-pod-disruption-budgets/store";
|
||||
export type { ServiceStore } from "../../renderer/components/+network-services/store";
|
||||
export type { EndpointsStore as EndpointStore } from "../../renderer/components/+network-endpoints/store";
|
||||
export type { IngressStore } from "../../renderer/components/+network-ingresses/store";
|
||||
export type { NetworkPolicyStore } from "../../renderer/components/+network-policies/store";
|
||||
export type { PersistentVolumeStore as PersistentVolumesStore } from "../../renderer/components/+storage-volumes/store";
|
||||
export type { PersistentVolumeClaimStore as VolumeClaimStore } from "../../renderer/components/+storage-volume-claims/store";
|
||||
export type { StorageClassStore } from "../../renderer/components/+storage-classes/store";
|
||||
export type { NamespaceStore } from "../../renderer/components/+namespaces/store";
|
||||
export type { ServiceAccountStore as ServiceAccountsStore } from "../../renderer/components/+user-management/+service-accounts/store";
|
||||
export type { RoleStore as RolesStore } from "../../renderer/components/+user-management/+roles/store";
|
||||
export type { RoleBindingStore as RoleBindingsStore } from "../../renderer/components/+user-management/+role-bindings/store";
|
||||
export type { CustomResourceDefinitionStore as CRDStore } from "../../renderer/components/+custom-resources/definition.store";
|
||||
export type { CustomResourceStore as CRDResourceStore } from "../../common/k8s-api/api-manager/resource.store";
|
||||
@@ -1,16 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
export interface KubeObjectStatus {
|
||||
level: KubeObjectStatusLevel;
|
||||
text: string;
|
||||
timestamp?: string;
|
||||
}
|
||||
|
||||
export enum KubeObjectStatusLevel {
|
||||
INFO = 1,
|
||||
WARNING = 2,
|
||||
CRITICAL = 3,
|
||||
}
|
||||
@@ -3,14 +3,20 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import type { PageParamInit } from "../../renderer/navigation";
|
||||
import { navigation, PageParam } from "../../renderer/navigation";
|
||||
import getDetailsUrlInjectable from "../../renderer/components/kube-detail-params/get-details-url.injectable";
|
||||
import hideDetailsInjectable from "../../renderer/components/kube-detail-params/hide-details.injectable";
|
||||
import showDetailsInjectable from "../../renderer/components/kube-detail-params/show-details.injectable";
|
||||
import createPageParamInjectable from "../../renderer/navigation/create-page-param.injectable";
|
||||
import isActiveRouteInjectable from "../../renderer/navigation/is-route-active.injectable";
|
||||
import navigateInjectable from "../../renderer/navigation/navigate.injectable";
|
||||
import { asLegacyGlobalFunctionForExtensionApi } from "../as-legacy-globals-for-extension-api/as-legacy-global-function-for-extension-api";
|
||||
|
||||
export type { PageParamInit, PageParam } from "../../renderer/navigation/page-param";
|
||||
export { navigate, isActiveRoute } from "../../renderer/navigation/helpers";
|
||||
export { hideDetails, showDetails, getDetailsUrl } from "../../renderer/components/kube-detail-params";
|
||||
export type { PageParamInit, PageParam } from "../../renderer/navigation";
|
||||
export type { URLParams } from "../../common/utils/buildUrl";
|
||||
|
||||
export function createPageParam<V>(init: PageParamInit<V>) {
|
||||
return new PageParam<V>(init, navigation);
|
||||
}
|
||||
export const getDetailsUrl = asLegacyGlobalFunctionForExtensionApi(getDetailsUrlInjectable);
|
||||
export const showDetails = asLegacyGlobalFunctionForExtensionApi(showDetailsInjectable);
|
||||
export const hideDetails = asLegacyGlobalFunctionForExtensionApi(hideDetailsInjectable);
|
||||
export const createPageParam = asLegacyGlobalFunctionForExtensionApi(createPageParamInjectable);
|
||||
export const isActiveRoute = asLegacyGlobalFunctionForExtensionApi(isActiveRouteInjectable);
|
||||
export const navigate = asLegacyGlobalFunctionForExtensionApi(navigateInjectable);
|
||||
@@ -3,8 +3,11 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import { ThemeStore } from "../../renderer/theme.store";
|
||||
import themeStoreInjectable from "../../renderer/themes/store.injectable";
|
||||
import { asLegacyGlobalForExtensionApi } from "../as-legacy-globals-for-extension-api/as-legacy-global-object-for-extension-api";
|
||||
|
||||
const themeStore = asLegacyGlobalForExtensionApi(themeStoreInjectable);
|
||||
|
||||
export function getActiveTheme() {
|
||||
return ThemeStore.getInstance().activeTheme;
|
||||
return themeStore.activeTheme;
|
||||
}
|
||||
Reference in new issue
Block a user