mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Make default catalog action to open entity (#3915)
This commit is contained in:
parent
8bbaf8c59e
commit
b692bc3603
@ -104,10 +104,7 @@ function minikubeEntityId() {
|
|||||||
* From the catalog, click the minikube entity and wait for it to connect, returning its frame
|
* From the catalog, click the minikube entity and wait for it to connect, returning its frame
|
||||||
*/
|
*/
|
||||||
export async function lauchMinikubeClusterFromCatalog(window: Page): Promise<Frame> {
|
export async function lauchMinikubeClusterFromCatalog(window: Page): Promise<Frame> {
|
||||||
await window.waitForSelector("div.TableCell");
|
|
||||||
await window.click("div.TableCell >> text='minikube'");
|
await window.click("div.TableCell >> text='minikube'");
|
||||||
await window.waitForSelector("div.drawer-title-text >> text='KubernetesCluster: minikube'");
|
|
||||||
await window.click("div.EntityIcon div.HotbarIcon div div.MuiAvatar-root");
|
|
||||||
|
|
||||||
const minikubeFrame = await window.waitForSelector(`#cluster-frame-${minikubeEntityId()}`);
|
const minikubeFrame = await window.waitForSelector(`#cluster-frame-${minikubeEntityId()}`);
|
||||||
|
|
||||||
|
|||||||
@ -28,7 +28,7 @@ import { action, makeObservable, observable, reaction, runInAction, when } from
|
|||||||
import { CatalogEntityItem, CatalogEntityStore } from "./catalog-entity.store";
|
import { CatalogEntityItem, CatalogEntityStore } from "./catalog-entity.store";
|
||||||
import { navigate } from "../../navigation";
|
import { navigate } from "../../navigation";
|
||||||
import { MenuItem, MenuActions } from "../menu";
|
import { MenuItem, MenuActions } from "../menu";
|
||||||
import type { CatalogEntityContextMenu, CatalogEntityContextMenuContext } from "../../api/catalog-entity";
|
import { CatalogEntityContextMenu, CatalogEntityContextMenuContext, catalogEntityRunContext } from "../../api/catalog-entity";
|
||||||
import { HotbarStore } from "../../../common/hotbar-store";
|
import { HotbarStore } from "../../../common/hotbar-store";
|
||||||
import { ConfirmDialog } from "../confirm-dialog";
|
import { ConfirmDialog } from "../confirm-dialog";
|
||||||
import { catalogCategoryRegistry, CatalogEntity } from "../../../common/catalog";
|
import { catalogCategoryRegistry, CatalogEntity } from "../../../common/catalog";
|
||||||
@ -117,15 +117,16 @@ export class Catalog extends React.Component<Props> {
|
|||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
addToHotbar(item: CatalogEntityItem<CatalogEntity>): void {
|
addToHotbar(item: CatalogEntityItem<CatalogEntity>): void {
|
||||||
HotbarStore.getInstance().addToHotbar(item.entity);
|
HotbarStore.getInstance().addToHotbar(item.entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
onDetails = (item: CatalogEntityItem<CatalogEntity>) => {
|
onDetails = (item: CatalogEntityItem<CatalogEntity>) => {
|
||||||
if (this.catalogEntityStore.selectedItemId === item.getId()) {
|
if (this.catalogEntityStore.selectedItemId) {
|
||||||
this.catalogEntityStore.selectedItemId = null;
|
this.catalogEntityStore.selectedItemId = null;
|
||||||
} else {
|
} else {
|
||||||
this.catalogEntityStore.selectedItemId = item.getId();
|
item.onRun(catalogEntityRunContext);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -176,6 +177,9 @@ export class Catalog extends React.Component<Props> {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<MenuActions onOpen={onOpen}>
|
<MenuActions onOpen={onOpen}>
|
||||||
|
<MenuItem key="open-details" onClick={() => this.catalogEntityStore.selectedItemId = item.getId()}>
|
||||||
|
View Details
|
||||||
|
</MenuItem>
|
||||||
{
|
{
|
||||||
this.contextMenu.menuItems.map((menuItem, index) => (
|
this.contextMenu.menuItems.map((menuItem, index) => (
|
||||||
<MenuItem key={index} onClick={() => this.onMenuItemClick(menuItem)}>
|
<MenuItem key={index} onClick={() => this.onMenuItemClick(menuItem)}>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user