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";
|
||||
|
||||
export interface StatusBarItem {
|
||||
id?: string;
|
||||
origin?: string;
|
||||
component: React.ComponentType<any>;
|
||||
position: "left" | "right";
|
||||
visible: IComputedValue<boolean>;
|
||||
|
||||
@ -74,7 +74,7 @@ const toItemInjectableFor = (extension: LensRendererExtension, getRandomId: () =
|
||||
id,
|
||||
|
||||
instantiate: () => ({
|
||||
id: extension.sanitizedExtensionId,
|
||||
origin: extension.sanitizedExtensionId,
|
||||
component,
|
||||
position,
|
||||
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";
|
||||
|
||||
interface StatusItem {
|
||||
id?: string;
|
||||
origin?: string;
|
||||
component: React.ComponentType<StatusBarItemProps>;
|
||||
}
|
||||
|
||||
@ -32,14 +32,14 @@ function getStatusBarItems({ registrations }: Dependencies): IComputedValue<Stat
|
||||
};
|
||||
|
||||
for (const registration of registrations.get()) {
|
||||
const { position = "right", component, visible, id } = registration;
|
||||
const { position = "right", component, visible, origin } = registration;
|
||||
|
||||
if (!visible.get()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
res[position].push({
|
||||
id,
|
||||
origin,
|
||||
component,
|
||||
});
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@ describe("<StatusBar />", () => {
|
||||
|
||||
builder.beforeWindowStart((windowDi) => {
|
||||
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: [],
|
||||
}) as StatusBarItems));
|
||||
});
|
||||
|
||||
@ -28,7 +28,7 @@ const NonInjectedStatusBar = observer(({ items }: Dependencies & StatusBarProps)
|
||||
<div
|
||||
className={styles.item}
|
||||
key={index}
|
||||
data-origin={Item.id}>
|
||||
data-origin={Item.origin}>
|
||||
{<Item.component/>}
|
||||
</div>
|
||||
))}
|
||||
@ -38,7 +38,7 @@ const NonInjectedStatusBar = observer(({ items }: Dependencies & StatusBarProps)
|
||||
<div
|
||||
className={styles.item}
|
||||
key={index}
|
||||
data-origin={Item.id}>
|
||||
data-origin={Item.origin}>
|
||||
{<Item.component/>}
|
||||
</div>
|
||||
))}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user