1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/src/renderer/frames/cluster-frame/init-cluster-frame/init-cluster-frame.injectable.ts
Sebastian Malton 0150edc8fd Simplify loading extensions
Signed-off-by: Sebastian Malton <sebastian@malton.name>
2022-12-02 09:02:42 -05:00

35 lines
1.5 KiB
TypeScript

/**
* 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 { initClusterFrame } from "./init-cluster-frame";
import extensionLoaderInjectable from "../../../../extensions/extension-loader/extension-loader.injectable";
import catalogEntityRegistryInjectable from "../../../api/catalog/entity/registry.injectable";
import frameRoutingIdInjectable from "./frame-routing-id/frame-routing-id.injectable";
import hostedClusterInjectable from "../../../cluster-frame-context/hosted-cluster.injectable";
import clusterFrameContextInjectable from "../../../cluster-frame-context/cluster-frame-context.injectable";
import assert from "assert";
import emitAppEventInjectable from "../../../../common/app-event-bus/emit-event.injectable";
const initClusterFrameInjectable = getInjectable({
id: "init-cluster-frame",
instantiate: (di) => {
const hostedCluster = di.inject(hostedClusterInjectable);
assert(hostedCluster, "This can only be injected within a cluster frame");
return initClusterFrame({
hostedCluster,
loadExtensions: di.inject(extensionLoaderInjectable).autoInitExtensions,
catalogEntityRegistry: di.inject(catalogEntityRegistryInjectable),
frameRoutingId: di.inject(frameRoutingIdInjectable),
emitAppEvent: di.inject(emitAppEventInjectable),
clusterFrameContext: di.inject(clusterFrameContextInjectable),
});
},
});
export default initClusterFrameInjectable;