mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Allow computed tray menu for extensions (#6598)
* Add computed tray menu for extensions. Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com> * Use disposer. Fix style. Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com> * Register/reregister injectables by id. Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com> Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>
This commit is contained in:
1 parent
a91e3a7f8e
commit
1861fe2049
6 files changed
+143
-18
No files matched your search
@@ -15,8 +15,8 @@ const startReactiveTrayMenuItemsInjectable = getInjectable({
|
||||
|
||||
return {
|
||||
id: "start-reactive-tray-menu-items",
|
||||
run: async () => {
|
||||
await reactiveTrayMenuItems.start();
|
||||
run: () => {
|
||||
reactiveTrayMenuItems.start();
|
||||
},
|
||||
|
||||
runAfter: di.inject(startTrayInjectable),
|
||||
|
||||
@@ -25,9 +25,13 @@ const trayMenuItemRegistratorInjectable = getInjectable({
|
||||
const withErrorLoggingFor = di.inject(withErrorLoggingInjectable);
|
||||
const getRandomId = di.inject(getRandomIdInjectable);
|
||||
|
||||
return mainExtension.trayMenus.flatMap(
|
||||
toItemInjectablesFor(mainExtension, withErrorLoggingFor, getRandomId),
|
||||
);
|
||||
return computed(() => {
|
||||
const trayMenus = Array.isArray(mainExtension.trayMenus) ? mainExtension.trayMenus : mainExtension.trayMenus.get();
|
||||
|
||||
return trayMenus.flatMap(
|
||||
toItemInjectablesFor(mainExtension, withErrorLoggingFor, getRandomId),
|
||||
);
|
||||
});
|
||||
},
|
||||
|
||||
injectionToken: extensionRegistratorInjectionToken,
|
||||
@@ -117,5 +121,3 @@ const toItemInjectablesFor = (extension: LensMainExtension, withErrorLoggingFor:
|
||||
|
||||
return _toItemInjectables(null);
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user