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

@@ -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 { KubeObject } from "../../../common/k8s-api/kube-object";
import type { KubeObjectStatus } from "../../../common/k8s-api/kube-object-status";
@@ -9,4 +10,5 @@ export interface KubeObjectStatusRegistration {
kind: string;
apiVersions: string[];
resolve: (object: KubeObject) => KubeObjectStatus;
visible?: IComputedValue<boolean>;
}
@@ -38,9 +38,13 @@ const kubeObjectStatusTextRegistratorInjectable = getInjectable({
instantiate: () => ({
...registration,
enabled: computed(() =>
extensionShouldBeEnabledForClusterFrame.value.get(),
),
enabled: computed(() => {
if (!extensionShouldBeEnabledForClusterFrame.value.get()) {
return false;
}
return registration.visible ? registration.visible.get() : true;
}),
}),
injectionToken: kubeObjectStatusTextInjectionToken,