diff --git a/src/main/catalog-sources/weblinks.ts b/src/main/catalog-sources/weblinks.ts index c8e983f3be..90c9c72433 100644 --- a/src/main/catalog-sources/weblinks.ts +++ b/src/main/catalog-sources/weblinks.ts @@ -75,7 +75,9 @@ export function syncWeblinks() { uid: weblinkData.id, name: weblinkData.name, source: "local", - labels: {} + labels: { + triggerOnRunAfterOnClickDetailIcon: "true", + } }, spec: { url: weblinkData.url diff --git a/src/main/cluster-manager.ts b/src/main/cluster-manager.ts index 307b4592f1..b58084d62f 100644 --- a/src/main/cluster-manager.ts +++ b/src/main/cluster-manager.ts @@ -261,6 +261,7 @@ export function catalogEntityFromCluster(cluster: Cluster) { name: cluster.name, source: "local", labels: { + triggerOnRunAfterOnClickDetailIcon: "true", ...cluster.labels, }, distro: cluster.distribution, diff --git a/src/renderer/components/+catalog/catalog-entity-details.test.tsx b/src/renderer/components/+catalog/catalog-entity-details.test.tsx index a20bde69fc..3735083404 100644 --- a/src/renderer/components/+catalog/catalog-entity-details.test.tsx +++ b/src/renderer/components/+catalog/catalog-entity-details.test.tsx @@ -108,5 +108,46 @@ describe("", () => { expect(onRun).toHaveBeenCalledTimes(0); expect(onClickDetailIcon).toHaveBeenCalledTimes(1); }); + + + it("prioritize onClickDetailIcon over onRun, but always trigger onRun if triggerOnRunAfterOnClickDetailIcon='true'", () => { + const onRun = jest.fn(); + const onClickDetailIcon = jest.fn(); + + const item = new CatalogEntityItem({ + enabled: true, + apiVersion: "", + kind: "", + metadata: { + uid: "", + name: "", + labels: { + triggerOnRunAfterOnClickDetailIcon: "true", + }, + }, + status: { + phase: "", + }, + spec: { }, + getId: () => "", + getName: () => "", + onContextMenuOpen: () => {}, + onSettingsOpen: () => {}, + onRun, + onClickDetailIcon, + }); + + render( + {}} + /> + ); + + userEvent.click(screen.getByTestId("detail-panel-hot-bar-icon")); + + expect(onClickDetailIcon).toHaveBeenCalledTimes(1); + expect(onRun).toHaveBeenCalledTimes(1); + }); }); diff --git a/src/renderer/components/+catalog/catalog-entity-details.tsx b/src/renderer/components/+catalog/catalog-entity-details.tsx index 3799b6721a..1aa7e41a97 100644 --- a/src/renderer/components/+catalog/catalog-entity-details.tsx +++ b/src/renderer/components/+catalog/catalog-entity-details.tsx @@ -74,6 +74,10 @@ export class CatalogEntityDetails extends Component extends MenuActionsProps { item: CatalogEntityItem | null | undefined;