1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Adding get userExtensions filter

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2020-10-30 10:22:30 +03:00
parent 5849c36447
commit 2b4e85397c

View File

@ -3,10 +3,11 @@ import type { LensMainExtension } from "./lens-main-extension"
import type { LensRendererExtension } from "./lens-renderer-extension"
import path from "path"
import { broadcastIpc } from "../common/ipc"
import { observable, reaction, toJS, } from "mobx"
import { computed, observable, reaction, toJS, } from "mobx"
import logger from "../main/logger"
import { app, ipcRenderer, remote } from "electron"
import { appPreferenceRegistry, clusterFeatureRegistry, clusterPageRegistry, globalPageRegistry, kubeObjectMenuRegistry, menuRegistry, statusBarRegistry } from "./registries";
import { getBundledExtensions } from "../common/utils"
export interface InstalledExtension extends ExtensionModel {
manifestPath: string;
@ -34,6 +35,16 @@ export class ExtensionLoader {
}
}
@computed get userExtensions() {
const builtIn = getBundledExtensions().map(ext => `lens-${ext}`)
const extensions: LensExtension[] = []
this.instances.forEach(instance => {
if (builtIn.includes(instance.name)) return
extensions.push(instance)
})
return extensions
}
loadOnMain() {
logger.info('[EXTENSIONS-LOADER]: load on main')
this.autoloadExtensions((extension: LensMainExtension) => {