1
0
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:
Sebastian Malton 2021-09-30 09:46:33 -04:00 committed by GitHub
parent 8bbaf8c59e
commit b692bc3603
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View File

@ -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<Frame> {
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()}`);

View File

@ -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<Props> {
}
}));
}
addToHotbar(item: CatalogEntityItem<CatalogEntity>): void {
HotbarStore.getInstance().addToHotbar(item.entity);
}
onDetails = (item: CatalogEntityItem<CatalogEntity>) => {
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<Props> {
return (
<MenuActions onOpen={onOpen}>
<MenuItem key="open-details" onClick={() => this.catalogEntityStore.selectedItemId = item.getId()}>
View Details
</MenuItem>
{
this.contextMenu.menuItems.map((menuItem, index) => (
<MenuItem key={index} onClick={() => this.onMenuItemClick(menuItem)}>