Add context menu into sidebar (#4044)

This commit is contained in:
Sebastian Malton authored and GitHub committed 2021-10-19 09:19:25 -04:00
1 parent e21888c62c
commit 125a073007
8 files changed
+243 -197

No files matched your search

@@ -23,10 +23,11 @@ import { catalogCategoryRegistry } from "../catalog/catalog-category-registry";
import { CatalogEntity, CatalogEntityActionContext, CatalogEntityContextMenuContext, CatalogEntityMetadata, CatalogEntityStatus } from "../catalog";
import { clusterActivateHandler, clusterDisconnectHandler } from "../cluster-ipc";
import { ClusterStore } from "../cluster-store";
import { requestMain } from "../ipc";
import { broadcastMessage, requestMain } from "../ipc";
import { CatalogCategory, CatalogCategorySpec } from "../catalog";
import { app } from "electron";
import type { CatalogEntitySpec } from "../catalog/catalog-entity";
import { IpcRendererNavigationEvents } from "../../renderer/navigation/events";
export interface KubernetesClusterPrometheusMetrics {
address?: {
@@ -114,7 +115,10 @@ export class KubernetesCluster extends CatalogEntity<KubernetesClusterMetadata,
context.menuItems.push({
title: "Settings",
icon: "edit",
onClick: () => context.navigate(`/entity/${this.metadata.uid}/settings`)
onClick: () => broadcastMessage(
IpcRendererNavigationEvents.NAVIGATE_IN_APP,
`/entity/${this.metadata.uid}/settings`,
),
});
}
+4 -1
View File
@@ -172,7 +172,10 @@ export interface CatalogEntitySettingsMenu {
}
export interface CatalogEntityContextMenuContext {
navigate: (url: string) => void;
/**
* Navigate to the specified pathname
*/
navigate: (pathname: string) => void;
menuItems: CatalogEntityContextMenu[];
}
+1 -1
View File
@@ -23,7 +23,7 @@ import type { RouteProps } from "react-router";
import { buildURL } from "../utils/buildUrl";
export const clusterRoute: RouteProps = {
path: "/cluster"
path: "/overview"
};
export const clusterURL = buildURL(clusterRoute.path);