Expose reactive ways to hide items in cluster frame using Extension API - PART 7 (#5824)

* Kludge "isEnabledForCluster" work again for cluster pages

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Kludge "isEnabledForCluster" work again for kube object details

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Expose reactive way to hide kube object detail items in Extension API

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Expose reactive way to hide kube object menu items in Extension API

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Expose reactive way to hide kube object status items in Extension API

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Expose reactive way to hide workload overview detail items in Extension API

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Expose reactive way to disable pages in Extension API

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Expose a way to access active cluster from Extension API

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Deprecate "isEnabledForCluster" in favor of individual enabled or visible properties for each registration

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
Janne Savolainen authored and GitHub committed 2022-07-13 13:47:03 -04:00
1 parent ca40c51117
commit d66e6c23c5
19 files changed
+679 -33

No files matched your search

@@ -90,6 +90,8 @@ export class LensRendererExtension extends LensExtension<LensRendererExtensionDe
* called when the extension is created within a cluster frame.
*
* The default implementation is to return `true`
*
* @deprecated Switch to using "enabled" or "visible" properties in each registration together with `activeCluster`
*/
async isEnabledForCluster(cluster: KubernetesCluster): Promise<Boolean> {
return (void cluster) || true;
@@ -2,6 +2,7 @@
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import type { IComputedValue } from "mobx";
import type { PageParamInit, PageParam } from "../../renderer/navigation";
// Extensions-api -> Custom page registration
@@ -14,6 +15,7 @@ export interface PageRegistration {
id?: string;
params?: PageParams<string | Omit<PageParamInit<any>, "name" | "prefix">>;
components: PageComponents;
enabled?: IComputedValue<boolean>;
}
export interface PageComponents {
+5
View File
@@ -10,6 +10,7 @@ import type { Disposer } from "../../common/utils";
import catalogCategoryRegistryInjectable from "../../common/catalog/category-registry.injectable";
import { asLegacyGlobalForExtensionApi } from "../as-legacy-globals-for-extension-api/as-legacy-global-object-for-extension-api";
import catalogEntityRegistryInjectable from "../../renderer/api/catalog/entity/registry.injectable";
import activeKubernetesClusterInjectable from "../../renderer/cluster-frame-context/active-kubernetes-cluster.injectable";
export const catalogCategories = asLegacyGlobalForExtensionApi(catalogCategoryRegistryInjectable);
@@ -53,3 +54,7 @@ export class CatalogEntityRegistry {
}
export const catalogEntities = new CatalogEntityRegistry();
export const activeCluster = asLegacyGlobalForExtensionApi(
activeKubernetesClusterInjectable,
);