mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Rename id -> origin because it is not unique
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
6a789380de
commit
cba15f6015
@ -7,7 +7,7 @@ import type { IComputedValue } from "mobx";
|
|||||||
import type React from "react";
|
import type React from "react";
|
||||||
|
|
||||||
export interface StatusBarItem {
|
export interface StatusBarItem {
|
||||||
id?: string;
|
origin?: string;
|
||||||
component: React.ComponentType<any>;
|
component: React.ComponentType<any>;
|
||||||
position: "left" | "right";
|
position: "left" | "right";
|
||||||
visible: IComputedValue<boolean>;
|
visible: IComputedValue<boolean>;
|
||||||
|
|||||||
@ -74,7 +74,7 @@ const toItemInjectableFor = (extension: LensRendererExtension, getRandomId: () =
|
|||||||
id,
|
id,
|
||||||
|
|
||||||
instantiate: () => ({
|
instantiate: () => ({
|
||||||
id: extension.sanitizedExtensionId,
|
origin: extension.sanitizedExtensionId,
|
||||||
component,
|
component,
|
||||||
position,
|
position,
|
||||||
visible: visible ?? computed(() => true),
|
visible: visible ?? computed(() => true),
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import { statusBarItemInjectionToken } from "./status-bar-item-injection-token";
|
|||||||
import { computedInjectManyInjectable } from "@ogre-tools/injectable-extension-for-mobx";
|
import { computedInjectManyInjectable } from "@ogre-tools/injectable-extension-for-mobx";
|
||||||
|
|
||||||
interface StatusItem {
|
interface StatusItem {
|
||||||
id?: string;
|
origin?: string;
|
||||||
component: React.ComponentType<StatusBarItemProps>;
|
component: React.ComponentType<StatusBarItemProps>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,14 +32,14 @@ function getStatusBarItems({ registrations }: Dependencies): IComputedValue<Stat
|
|||||||
};
|
};
|
||||||
|
|
||||||
for (const registration of registrations.get()) {
|
for (const registration of registrations.get()) {
|
||||||
const { position = "right", component, visible, id } = registration;
|
const { position = "right", component, visible, origin } = registration;
|
||||||
|
|
||||||
if (!visible.get()) {
|
if (!visible.get()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
res[position].push({
|
res[position].push({
|
||||||
id,
|
origin,
|
||||||
component,
|
component,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -65,7 +65,7 @@ describe("<StatusBar />", () => {
|
|||||||
|
|
||||||
builder.beforeWindowStart((windowDi) => {
|
builder.beforeWindowStart((windowDi) => {
|
||||||
windowDi.override(statusBarItemsInjectable, () => computed(() => ({
|
windowDi.override(statusBarItemsInjectable, () => computed(() => ({
|
||||||
right: [ { id: testId, component: () => <span data-testid={testId} >{text}</span> }],
|
right: [ { origin: testId, component: () => <span data-testid={testId} >{text}</span> }],
|
||||||
left: [],
|
left: [],
|
||||||
}) as StatusBarItems));
|
}) as StatusBarItems));
|
||||||
});
|
});
|
||||||
|
|||||||
@ -28,7 +28,7 @@ const NonInjectedStatusBar = observer(({ items }: Dependencies & StatusBarProps)
|
|||||||
<div
|
<div
|
||||||
className={styles.item}
|
className={styles.item}
|
||||||
key={index}
|
key={index}
|
||||||
data-origin={Item.id}>
|
data-origin={Item.origin}>
|
||||||
{<Item.component/>}
|
{<Item.component/>}
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
@ -38,7 +38,7 @@ const NonInjectedStatusBar = observer(({ items }: Dependencies & StatusBarProps)
|
|||||||
<div
|
<div
|
||||||
className={styles.item}
|
className={styles.item}
|
||||||
key={index}
|
key={index}
|
||||||
data-origin={Item.id}>
|
data-origin={Item.origin}>
|
||||||
{<Item.component/>}
|
{<Item.component/>}
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user