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)`);
this.autoInitExtensions(async (extension: LensRendererExtension) => {
@@ -298,7 +298,7 @@ export class ExtensionLoader {
return removeItems;
});
}
};
protected async loadExtensions(installedExtensions: Map<string, InstalledExtension>, register: (ext: LensExtension) => Promise<Disposer[]>) {
// 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
reaction(() => this.toJSON(), installedExtensions => this.loadExtensions(installedExtensions, register));
// Load initial extensions
return this.loadExtensions(this.toJSON(), register);
};
}
protected requireExtension(extension: InstalledExtension): LensExtensionConstructor | null {
const entryPointName = ipcRenderer ? "renderer" : "main";