mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Cleaning up
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
aa4b993491
commit
569a512835
@ -51,23 +51,6 @@ describe("<Welcome/>", () => {
|
||||
WelcomeBannerRegistry.resetInstance();
|
||||
});
|
||||
|
||||
it("renders items in the top bar", async () => {
|
||||
const testId = "testId";
|
||||
const text = "topBarItem";
|
||||
|
||||
TopBarRegistry.getInstance().getItems = jest.fn().mockImplementationOnce(() => [
|
||||
{
|
||||
components: {
|
||||
Item: () => <span data-testid={testId}>{text}</span>
|
||||
}
|
||||
}
|
||||
]);
|
||||
|
||||
render(<Welcome />);
|
||||
|
||||
expect(screen.getByTestId(testId)).toHaveTextContent(text);
|
||||
});
|
||||
|
||||
it("renders <Banner /> registered in WelcomeBannerRegistry and hide logo", async () => {
|
||||
const testId = "testId";
|
||||
|
||||
|
||||
@ -178,6 +178,29 @@ export class Sidebar extends React.Component<Props> {
|
||||
});
|
||||
}
|
||||
|
||||
renderCluster() {
|
||||
if (!this.clusterEntity) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const { metadata, spec } = this.clusterEntity;
|
||||
|
||||
return (
|
||||
<div className={styles.cluster}>
|
||||
<HotbarIcon
|
||||
uid={metadata.uid}
|
||||
title={metadata.name}
|
||||
source={metadata.source}
|
||||
src={spec.icon?.src}
|
||||
className="mr-5"
|
||||
/>
|
||||
<div className={styles.clusterName}>
|
||||
{metadata.name}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
get clusterEntity() {
|
||||
return catalogEntityRegistry.activeEntity;
|
||||
}
|
||||
@ -187,20 +210,7 @@ export class Sidebar extends React.Component<Props> {
|
||||
|
||||
return (
|
||||
<div className={cssNames("flex flex-col", className)}>
|
||||
{this.clusterEntity && (
|
||||
<div className={styles.cluster}>
|
||||
<HotbarIcon
|
||||
uid={this.clusterEntity.metadata.uid}
|
||||
title={this.clusterEntity.metadata.name}
|
||||
source={this.clusterEntity.metadata.source}
|
||||
src={this.clusterEntity.spec.icon?.src}
|
||||
className="mr-5"
|
||||
/>
|
||||
<div className={styles.clusterName}>
|
||||
{this.clusterEntity.metadata.name}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{this.renderCluster()}
|
||||
<div className={styles.sidebarNav}>
|
||||
<SidebarItem
|
||||
id="cluster"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user