-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for controlling entity settings visibility during runtime #7816
base: master
Are you sure you want to change the base?
Changes from 2 commits
e81824e
0b70957
9911449
de3db05
053a5d7
f91e360
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,8 @@ import { extensionRegistratorInjectionToken } from "../../../extensions/extensio | |
import type { LensRendererExtension } from "../../../extensions/lens-renderer-extension"; | ||
import type { CatalogEntity } from "../../api/catalog-entity"; | ||
import { entitySettingInjectionToken } from "./token"; | ||
import type { IComputedValue } from "mobx"; | ||
import { computed } from "mobx"; | ||
|
||
export interface EntitySettingViewProps { | ||
entity: CatalogEntity; | ||
|
@@ -25,6 +27,7 @@ export interface EntitySettingRegistration { | |
id?: string; | ||
priority?: number; | ||
group?: string; | ||
visible?: IComputedValue<boolean>; | ||
} | ||
|
||
export interface RegisteredEntitySetting { | ||
|
@@ -36,6 +39,7 @@ export interface RegisteredEntitySetting { | |
components: EntitySettingComponents; | ||
source?: string; | ||
group: string; | ||
isShown: IComputedValue<boolean>; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if this should be optional to not break something.. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
} | ||
|
||
const entitySettingExtensionRegistratorInjectable = getInjectable({ | ||
|
@@ -59,6 +63,7 @@ const getInjectableForEntitySettingRegistrationFor = (extension: LensRendererExt | |
id = btoa(title), | ||
priority, | ||
source, | ||
visible, | ||
}: EntitySettingRegistration) => getInjectable({ | ||
id: `${extension.manifest.name}:${group}/${kind}:${id}`, | ||
instantiate: () => ({ | ||
|
@@ -70,6 +75,7 @@ const getInjectableForEntitySettingRegistrationFor = (extension: LensRendererExt | |
title, | ||
group, | ||
source, | ||
isShown: computed(() => visible?.get() ?? true), | ||
}), | ||
injectionToken: entitySettingInjectionToken, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not call this also
visible
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to replicate the existing behavior that was implemented with
AppPreferenceTabRegistration
. I think it's a convention in this code base forShowable
and such