Make loadOnClusterRenderer arrow function again, revert autoInitExtensions change as unnecessary

Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>
This commit is contained in:
Panu Horsmalahti committed 2022-01-19 11:00:33 +02:00
1 parent 747f91ae36
commit 683515b7d7
1 file changed
+4 -4
@@ -270,7 +270,7 @@ export class ExtensionLoader {
}); });
}; };
loadOnClusterRenderer(getCluster: () => KubernetesCluster) { loadOnClusterRenderer = (getCluster: () => KubernetesCluster) => {
logger.debug(`${logModule}: load on cluster renderer (dashboard)`); logger.debug(`${logModule}: load on cluster renderer (dashboard)`);
this.autoInitExtensions(async (extension: LensRendererExtension) => { this.autoInitExtensions(async (extension: LensRendererExtension) => {
@@ -298,7 +298,7 @@ export class ExtensionLoader {
return removeItems; return removeItems;
}); });
} };
protected async loadExtensions(installedExtensions: Map<string, InstalledExtension>, register: (ext: LensExtension) => Promise<Disposer[]>) { protected async loadExtensions(installedExtensions: Map<string, InstalledExtension>, register: (ext: LensExtension) => Promise<Disposer[]>) {
// Steps of the function: // Steps of the function:
@@ -364,13 +364,13 @@ export class ExtensionLoader {
}); });
} }
protected autoInitExtensions = (register: (ext: LensExtension) => Promise<Disposer[]>) => { protected autoInitExtensions(register: (ext: LensExtension) => Promise<Disposer[]>) {
// Setup reaction to load extensions on JSON changes // Setup reaction to load extensions on JSON changes
reaction(() => this.toJSON(), installedExtensions => this.loadExtensions(installedExtensions, register)); reaction(() => this.toJSON(), installedExtensions => this.loadExtensions(installedExtensions, register));
// Load initial extensions // Load initial extensions
return this.loadExtensions(this.toJSON(), register); return this.loadExtensions(this.toJSON(), register);
}; }
protected requireExtension(extension: InstalledExtension): LensExtensionConstructor | null { protected requireExtension(extension: InstalledExtension): LensExtensionConstructor | null {
const entryPointName = ipcRenderer ? "renderer" : "main"; const entryPointName = ipcRenderer ? "renderer" : "main";