From b692bc3603bdea8055dddc60f11b480b4ca08fcc Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Thu, 30 Sep 2021 09:46:33 -0400 Subject: [PATCH] Make default catalog action to open entity (#3915) --- integration/helpers/utils.ts | 3 --- src/renderer/components/+catalog/catalog.tsx | 10 +++++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/integration/helpers/utils.ts b/integration/helpers/utils.ts index f9a10e1d4d..e52ae1d87f 100644 --- a/integration/helpers/utils.ts +++ b/integration/helpers/utils.ts @@ -104,10 +104,7 @@ function minikubeEntityId() { * From the catalog, click the minikube entity and wait for it to connect, returning its frame */ export async function lauchMinikubeClusterFromCatalog(window: Page): Promise { - await window.waitForSelector("div.TableCell"); 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()}`); diff --git a/src/renderer/components/+catalog/catalog.tsx b/src/renderer/components/+catalog/catalog.tsx index 454a825fd2..49a57c44b0 100644 --- a/src/renderer/components/+catalog/catalog.tsx +++ b/src/renderer/components/+catalog/catalog.tsx @@ -28,7 +28,7 @@ import { action, makeObservable, observable, reaction, runInAction, when } from import { CatalogEntityItem, CatalogEntityStore } from "./catalog-entity.store"; import { navigate } from "../../navigation"; 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 { ConfirmDialog } from "../confirm-dialog"; import { catalogCategoryRegistry, CatalogEntity } from "../../../common/catalog"; @@ -117,15 +117,16 @@ export class Catalog extends React.Component { } })); } + addToHotbar(item: CatalogEntityItem): void { HotbarStore.getInstance().addToHotbar(item.entity); } onDetails = (item: CatalogEntityItem) => { - if (this.catalogEntityStore.selectedItemId === item.getId()) { + if (this.catalogEntityStore.selectedItemId) { this.catalogEntityStore.selectedItemId = null; } else { - this.catalogEntityStore.selectedItemId = item.getId(); + item.onRun(catalogEntityRunContext); } }; @@ -176,6 +177,9 @@ export class Catalog extends React.Component { return ( + this.catalogEntityStore.selectedItemId = item.getId()}> + View Details + { this.contextMenu.menuItems.map((menuItem, index) => ( this.onMenuItemClick(menuItem)}>