mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Move visible to StatusBarRegistration
Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>
This commit is contained in:
parent
9eebb9f9fb
commit
b469ab5425
@ -100,8 +100,8 @@ describe("status-bar-items-originating-from-extensions", () => {
|
||||
components: {
|
||||
Item: () => <div data-testid="some-testId">right4</div>,
|
||||
position: "right" as const,
|
||||
visible: computed(() => false),
|
||||
},
|
||||
visible: computed(() => false),
|
||||
},
|
||||
{
|
||||
components: {
|
||||
|
||||
@ -39,7 +39,7 @@ const toItemInjectableFor = (extension: LensRendererExtension, getRandomId: () =
|
||||
const id = `${getRandomId()}-status-bar-item-for-extension-${extension.sanitizedExtensionId}`;
|
||||
let component: React.ComponentType;
|
||||
let position: "left" | "right";
|
||||
let visible: IComputedValue<boolean> | undefined;
|
||||
const visible: IComputedValue<boolean> | undefined = registration?.visible;
|
||||
|
||||
if (registration?.item) {
|
||||
const { item } = registration;
|
||||
@ -56,7 +56,7 @@ const toItemInjectableFor = (extension: LensRendererExtension, getRandomId: () =
|
||||
</>
|
||||
);
|
||||
} else if (registration?.components) {
|
||||
const { position: pos = "right", Item, visible: componentVisible } = registration.components;
|
||||
const { position: pos = "right", Item } = registration.components;
|
||||
|
||||
if (pos !== "left" && pos !== "right") {
|
||||
throw new TypeError("StatusBarRegistration.components.position must be either 'right' or 'left'");
|
||||
@ -64,7 +64,6 @@ const toItemInjectableFor = (extension: LensRendererExtension, getRandomId: () =
|
||||
|
||||
position = pos;
|
||||
component = Item;
|
||||
visible = componentVisible;
|
||||
} else {
|
||||
logger.warn("StatusBarRegistration must have valid item or components field");
|
||||
|
||||
|
||||
@ -25,11 +25,6 @@ export interface StatusBarComponents {
|
||||
* @default "right"
|
||||
*/
|
||||
position?: "left" | "right";
|
||||
|
||||
/**
|
||||
* If specified, controls item visibility
|
||||
*/
|
||||
visible?: IComputedValue<boolean>;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -45,4 +40,9 @@ export interface StatusBarRegistration {
|
||||
* The newer API, allows for registering a component instead of a ReactNode
|
||||
*/
|
||||
components?: StatusBarComponents;
|
||||
|
||||
/**
|
||||
* If specified, controls item visibility
|
||||
*/
|
||||
visible?: IComputedValue<boolean>;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user