From ae9a8c3c41535c49f1f91aa1ef7429541a901cdc Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Wed, 15 Mar 2023 08:31:38 -0400 Subject: [PATCH] Move deactivating a cluster into injectable IPC (#7356) * Move activating cluster into injectable IPC Signed-off-by: Sebastian Malton * Move deactivating a cluster into injectable IPC Signed-off-by: Sebastian Malton * Fix type error Signed-off-by: Sebastian Malton --------- Signed-off-by: Sebastian Malton --- .../catalog-entities/kubernetes-cluster.ts | 25 +++---------- .../src/common/cluster-frames.injectable.ts | 10 +++-- packages/core/src/common/cluster-frames.ts | 13 ------- packages/core/src/common/ipc/cluster.ts | 1 - packages/core/src/common/ipc/ipc.ts | 11 ++---- .../cluster/activation/common/channels.ts | 2 + .../activation/common/request-token.ts | 8 +++- .../main/deactivate-listener.injectable.ts | 14 +++++++ .../main/request-deactivation.injectable.ts | 37 +++++++++++++++++++ .../request-deactivation.injectable.ts | 20 ++++++++++ .../setup-ipc-main-handlers.injectable.ts | 19 +++------- .../setup-ipc-main-handlers.ts | 31 +++------------- packages/core/src/main/getDiForUnitTesting.ts | 6 +-- .../create-lens-window.injectable.ts | 2 +- .../utils/channel/message-to-channel.test.ts | 2 +- packages/core/src/renderer/ipc/index.ts | 6 +-- 16 files changed, 111 insertions(+), 96 deletions(-) delete mode 100644 packages/core/src/common/cluster-frames.ts create mode 100644 packages/core/src/features/cluster/activation/main/deactivate-listener.injectable.ts create mode 100644 packages/core/src/features/cluster/activation/main/request-deactivation.injectable.ts create mode 100644 packages/core/src/features/cluster/activation/renderer/request-deactivation.injectable.ts diff --git a/packages/core/src/common/catalog-entities/kubernetes-cluster.ts b/packages/core/src/common/catalog-entities/kubernetes-cluster.ts index aa3dd68af2..583e90ab50 100644 --- a/packages/core/src/common/catalog-entities/kubernetes-cluster.ts +++ b/packages/core/src/common/catalog-entities/kubernetes-cluster.ts @@ -6,15 +6,11 @@ import type { CatalogEntityActionContext, CatalogEntityContextMenuContext, CatalogEntityMetadata, CatalogEntityStatus, CatalogCategorySpec } from "../catalog"; import { CatalogEntity, CatalogCategory, categoryVersion } from "../catalog/catalog-entity"; import { broadcastMessage } from "../ipc"; -import { app } from "electron"; import type { CatalogEntityConstructor, CatalogEntitySpec } from "../catalog/catalog-entity"; import { IpcRendererNavigationEvents } from "../ipc/navigation-events"; -import { requestClusterDisconnection } from "../../renderer/ipc"; import KubeClusterCategoryIcon from "./icons/kubernetes.svg"; -import getClusterByIdInjectable from "../cluster-store/get-by-id.injectable"; import { getLegacyGlobalDiForExtensionApi } from "../../extensions/as-legacy-globals-for-extension-api/legacy-global-di-for-extension-api"; -import clusterConnectionInjectable from "../../main/cluster/cluster-connection.injectable"; -import { requestClusterActivationInjectionToken } from "../../features/cluster/activation/common/request-token"; +import { requestClusterActivationInjectionToken, requestClusterDeactivationInjectionToken } from "../../features/cluster/activation/common/request-token"; export interface KubernetesClusterPrometheusMetrics { address?: { @@ -87,21 +83,10 @@ export class KubernetesCluster< } async disconnect(): Promise { - if (app) { - const di = getLegacyGlobalDiForExtensionApi(); - const getClusterById = di.inject(getClusterByIdInjectable); - const cluster = getClusterById(this.getId()); + const di = getLegacyGlobalDiForExtensionApi(); + const requestClusterDeactivation = di.inject(requestClusterDeactivationInjectionToken); - if (!cluster) { - return; - } - - const connectionCluster = di.inject(clusterConnectionInjectable, cluster); - - connectionCluster.disconnect(); - } else { - await requestClusterDisconnection(this.getId(), false); - } + await requestClusterDeactivation(this.getId()); } async onRun(context: CatalogEntityActionContext) { @@ -135,7 +120,7 @@ export class KubernetesCluster< title: "Disconnect", icon: "link_off", onClick: () => { - requestClusterDisconnection(this.getId()); + this.disconnect(); broadcastMessage( IpcRendererNavigationEvents.NAVIGATE_IN_APP, "/catalog", diff --git a/packages/core/src/common/cluster-frames.injectable.ts b/packages/core/src/common/cluster-frames.injectable.ts index 23897012a0..dc8bf5dee7 100644 --- a/packages/core/src/common/cluster-frames.injectable.ts +++ b/packages/core/src/common/cluster-frames.injectable.ts @@ -3,12 +3,16 @@ * Licensed under MIT License. See LICENSE in root directory for more information. */ import { getInjectable } from "@ogre-tools/injectable"; -import { clusterFrameMap } from "./cluster-frames"; +import { observable } from "mobx"; + +export interface ClusterFrameInfo { + frameId: number; + processId: number; +} const clusterFramesInjectable = getInjectable({ id: "cluster-frames", - instantiate: () => clusterFrameMap, - causesSideEffects: true, + instantiate: () => observable.map(), }); export default clusterFramesInjectable; diff --git a/packages/core/src/common/cluster-frames.ts b/packages/core/src/common/cluster-frames.ts deleted file mode 100644 index 6a4757e68a..0000000000 --- a/packages/core/src/common/cluster-frames.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Copyright (c) OpenLens Authors. All rights reserved. - * Licensed under MIT License. See LICENSE in root directory for more information. - */ - -import { observable } from "mobx"; - -export interface ClusterFrameInfo { - frameId: number; - processId: number; -} - -export const clusterFrameMap = observable.map(); diff --git a/packages/core/src/common/ipc/cluster.ts b/packages/core/src/common/ipc/cluster.ts index 3b22e4ee57..fa637a190a 100644 --- a/packages/core/src/common/ipc/cluster.ts +++ b/packages/core/src/common/ipc/cluster.ts @@ -5,7 +5,6 @@ export const clusterSetFrameIdHandler = "cluster:set-frame-id"; export const clusterVisibilityHandler = "cluster:visibility"; -export const clusterDisconnectHandler = "cluster:disconnect"; export const clusterStates = "cluster:states"; /** diff --git a/packages/core/src/common/ipc/ipc.ts b/packages/core/src/common/ipc/ipc.ts index 4815fbfbf1..afc451761e 100644 --- a/packages/core/src/common/ipc/ipc.ts +++ b/packages/core/src/common/ipc/ipc.ts @@ -9,13 +9,12 @@ import { ipcMain, ipcRenderer, webContents } from "electron"; import { toJS } from "../utils/toJS"; -import type { ClusterFrameInfo } from "../cluster-frames"; -import { clusterFrameMap } from "../cluster-frames"; import type { Disposer } from "@k8slens/utilities"; import { getLegacyGlobalDiForExtensionApi } from "../../extensions/as-legacy-globals-for-extension-api/legacy-global-di-for-extension-api"; import ipcRendererInjectable from "../../renderer/utils/channel/ipc-renderer.injectable"; import loggerInjectable from "../logger.injectable"; import ipcMainInjectionToken from "./ipc-main-injection-token"; +import clusterFramesInjectable from "../cluster-frames.injectable"; export const broadcastMainChannel = "ipc:broadcast-main"; @@ -29,10 +28,6 @@ export function ipcMainHandle(channel: string, listener: (event: Electron.IpcMai }); } -function getSubFrames(): ClusterFrameInfo[] { - return Array.from(clusterFrameMap.values()); -} - export async function broadcastMessage(channel: string, ...args: any[]): Promise { if (ipcRenderer) { return ipcRenderer.invoke(broadcastMainChannel, channel, ...args.map(sanitizePayload)); @@ -44,12 +39,12 @@ export async function broadcastMessage(channel: string, ...args: any[]): Promise const di = getLegacyGlobalDiForExtensionApi(); const logger = di.inject(loggerInjectable); + const clusterFrames = di.inject(clusterFramesInjectable); ipcMain.listeners(channel).forEach((func) => func({ processId: undefined, frameId: undefined, sender: undefined, senderFrame: undefined, }, ...args)); - const subFrames = getSubFrames(); const views = webContents.getAllWebContents(); if (!views || !Array.isArray(views) || views.length === 0) return; @@ -75,7 +70,7 @@ export async function broadcastMessage(channel: string, ...args: any[]): Promise } // Send message to subFrames of views. - for (const frameInfo of subFrames) { + for (const frameInfo of clusterFrames.values()) { logger.silly(`[IPC]: broadcasting "${channel}" to subframe "frameInfo.processId"=${frameInfo.processId} "frameInfo.frameId"=${frameInfo.frameId}`, { args }); try { diff --git a/packages/core/src/features/cluster/activation/common/channels.ts b/packages/core/src/features/cluster/activation/common/channels.ts index 8ab63e7645..3631c4d9b8 100644 --- a/packages/core/src/features/cluster/activation/common/channels.ts +++ b/packages/core/src/features/cluster/activation/common/channels.ts @@ -16,3 +16,5 @@ export interface ActivateCluster { } export const activateClusterChannel = getRequestChannel("activate-cluster"); + +export const deactivateClusterChannel = getRequestChannel("deactivate-cluster"); diff --git a/packages/core/src/features/cluster/activation/common/request-token.ts b/packages/core/src/features/cluster/activation/common/request-token.ts index 0838c3f1ba..5bee44208f 100644 --- a/packages/core/src/features/cluster/activation/common/request-token.ts +++ b/packages/core/src/features/cluster/activation/common/request-token.ts @@ -5,10 +5,16 @@ import { getInjectionToken } from "@ogre-tools/injectable"; import type { ChannelRequester } from "../../../../common/utils/channel/request-from-channel-injection-token"; -import type { activateClusterChannel } from "./channels"; +import type { activateClusterChannel, deactivateClusterChannel } from "./channels"; export type RequestClusterActivation = ChannelRequester; export const requestClusterActivationInjectionToken = getInjectionToken({ id: "request-cluster-activation-token", }); + +export type RequestClusterDeactivation = ChannelRequester; + +export const requestClusterDeactivationInjectionToken = getInjectionToken({ + id: "request-cluster-deactivation-token", +}); diff --git a/packages/core/src/features/cluster/activation/main/deactivate-listener.injectable.ts b/packages/core/src/features/cluster/activation/main/deactivate-listener.injectable.ts new file mode 100644 index 0000000000..e24ce48ba6 --- /dev/null +++ b/packages/core/src/features/cluster/activation/main/deactivate-listener.injectable.ts @@ -0,0 +1,14 @@ +/** + * Copyright (c) OpenLens Authors. All rights reserved. + * Licensed under MIT License. See LICENSE in root directory for more information. + */ +import { getRequestChannelListenerInjectable } from "../../../../main/utils/channel/channel-listeners/listener-tokens"; +import { deactivateClusterChannel } from "../common/channels"; +import requestClusterDeactivationInjectable from "./request-deactivation.injectable"; + +const clusterDeactivationRequestChannelListenerInjectable = getRequestChannelListenerInjectable({ + channel: deactivateClusterChannel, + handler: (di) => di.inject(requestClusterDeactivationInjectable), +}); + +export default clusterDeactivationRequestChannelListenerInjectable; diff --git a/packages/core/src/features/cluster/activation/main/request-deactivation.injectable.ts b/packages/core/src/features/cluster/activation/main/request-deactivation.injectable.ts new file mode 100644 index 0000000000..05fc00911c --- /dev/null +++ b/packages/core/src/features/cluster/activation/main/request-deactivation.injectable.ts @@ -0,0 +1,37 @@ +/** + * Copyright (c) OpenLens Authors. All rights reserved. + * Licensed under MIT License. See LICENSE in root directory for more information. + */ +import { getInjectable } from "@ogre-tools/injectable"; +import emitAppEventInjectable from "../../../../common/app-event-bus/emit-event.injectable"; +import clusterFramesInjectable from "../../../../common/cluster-frames.injectable"; +import getClusterByIdInjectable from "../../../../common/cluster-store/get-by-id.injectable"; +import clusterConnectionInjectable from "../../../../main/cluster/cluster-connection.injectable"; +import { requestClusterDeactivationInjectionToken } from "../common/request-token"; + +const requestClusterDeactivationInjectable = getInjectable({ + id: "request-cluster-deactivation", + instantiate: (di) => { + const getClusterById = di.inject(getClusterByIdInjectable); + const clusterFrames = di.inject(clusterFramesInjectable); + const emitAppEvent = di.inject(emitAppEventInjectable); + + return async (clusterId) => { + emitAppEvent({ name: "cluster", action: "stop" }); + + const cluster = getClusterById(clusterId); + + if (!cluster) { + return; + } + + const connection = di.inject(clusterConnectionInjectable, cluster); + + connection.disconnect(); + clusterFrames.delete(clusterId); + }; + }, + injectionToken: requestClusterDeactivationInjectionToken, +}); + +export default requestClusterDeactivationInjectable; diff --git a/packages/core/src/features/cluster/activation/renderer/request-deactivation.injectable.ts b/packages/core/src/features/cluster/activation/renderer/request-deactivation.injectable.ts new file mode 100644 index 0000000000..362784e91b --- /dev/null +++ b/packages/core/src/features/cluster/activation/renderer/request-deactivation.injectable.ts @@ -0,0 +1,20 @@ +/** + * Copyright (c) OpenLens Authors. All rights reserved. + * Licensed under MIT License. See LICENSE in root directory for more information. + */ +import { getInjectable } from "@ogre-tools/injectable"; +import requestFromChannelInjectable from "../../../../renderer/utils/channel/request-from-channel.injectable"; +import { deactivateClusterChannel } from "../common/channels"; +import { requestClusterDeactivationInjectionToken } from "../common/request-token"; + +const requestClusterDeactivationInjectable = getInjectable({ + id: "request-cluster-deactivation", + instantiate: (di) => { + const requestFromChannel = di.inject(requestFromChannelInjectable); + + return (clusterId) => requestFromChannel(deactivateClusterChannel, clusterId); + }, + injectionToken: requestClusterDeactivationInjectionToken, +}); + +export default requestClusterDeactivationInjectable; diff --git a/packages/core/src/main/electron-app/runnables/setup-ipc-main-handlers/setup-ipc-main-handlers.injectable.ts b/packages/core/src/main/electron-app/runnables/setup-ipc-main-handlers/setup-ipc-main-handlers.injectable.ts index 932e80c61f..cdf120dad7 100644 --- a/packages/core/src/main/electron-app/runnables/setup-ipc-main-handlers/setup-ipc-main-handlers.injectable.ts +++ b/packages/core/src/main/electron-app/runnables/setup-ipc-main-handlers/setup-ipc-main-handlers.injectable.ts @@ -8,10 +8,9 @@ import loggerInjectable from "../../../../common/logger.injectable"; import clusterStoreInjectable from "../../../../common/cluster-store/cluster-store.injectable"; import { onLoadOfApplicationInjectionToken } from "@k8slens/application"; import applicationMenuItemCompositeInjectable from "../../../../features/application-menu/main/application-menu-item-composite.injectable"; -import emitAppEventInjectable from "../../../../common/app-event-bus/emit-event.injectable"; import getClusterByIdInjectable from "../../../../common/cluster-store/get-by-id.injectable"; import pushCatalogToRendererInjectable from "../../../catalog-sync-to-renderer/push-catalog-to-renderer.injectable"; -import clusterConnectionInjectable from "../../../cluster/cluster-connection.injectable"; +import clusterFramesInjectable from "../../../../common/cluster-frames.injectable"; const setupIpcMainHandlersInjectable = getInjectable({ id: "setup-ipc-main-handlers", @@ -19,21 +18,15 @@ const setupIpcMainHandlersInjectable = getInjectable({ instantiate: (di) => ({ run: () => { const logger = di.inject(loggerInjectable); - const applicationMenuItemComposite = di.inject(applicationMenuItemCompositeInjectable); - const pushCatalogToRenderer = di.inject(pushCatalogToRendererInjectable); - const clusterStore = di.inject(clusterStoreInjectable); - const emitAppEvent = di.inject(emitAppEventInjectable); - const getClusterById = di.inject(getClusterByIdInjectable); logger.debug("[APP-MAIN] initializing ipc main handlers"); setupIpcMainHandlers({ - applicationMenuItemComposite, - pushCatalogToRenderer, - clusterStore, - emitAppEvent, - getClusterById, - getClusterConnection: (cluster) => di.inject(clusterConnectionInjectable, cluster), + applicationMenuItemComposite: di.inject(applicationMenuItemCompositeInjectable), + pushCatalogToRenderer: di.inject(pushCatalogToRendererInjectable), + clusterStore: di.inject(clusterStoreInjectable), + getClusterById: di.inject(getClusterByIdInjectable), + clusterFrames: di.inject(clusterFramesInjectable), }); }, }), diff --git a/packages/core/src/main/electron-app/runnables/setup-ipc-main-handlers/setup-ipc-main-handlers.ts b/packages/core/src/main/electron-app/runnables/setup-ipc-main-handlers/setup-ipc-main-handlers.ts index 987903fc3f..d5b85c440a 100644 --- a/packages/core/src/main/electron-app/runnables/setup-ipc-main-handlers/setup-ipc-main-handlers.ts +++ b/packages/core/src/main/electron-app/runnables/setup-ipc-main-handlers/setup-ipc-main-handlers.ts @@ -4,62 +4,43 @@ */ import type { IpcMainInvokeEvent } from "electron"; import { BrowserWindow, Menu } from "electron"; -import { clusterFrameMap } from "../../../../common/cluster-frames"; -import { clusterSetFrameIdHandler, clusterDisconnectHandler, clusterStates } from "../../../../common/ipc/cluster"; +import type { ClusterFrameInfo } from "../../../../common/cluster-frames.injectable"; +import { clusterSetFrameIdHandler, clusterStates } from "../../../../common/ipc/cluster"; import type { ClusterId } from "../../../../common/cluster-types"; import type { ClusterStore } from "../../../../common/cluster-store/cluster-store"; import { broadcastMainChannel, broadcastMessage, ipcMainHandle, ipcMainOn } from "../../../../common/ipc"; -import type { IComputedValue } from "mobx"; +import type { IComputedValue, ObservableMap } from "mobx"; import { windowActionHandleChannel, windowLocationChangedChannel, windowOpenAppMenuAsContextMenuChannel } from "../../../../common/ipc/window"; import { handleWindowAction, onLocationChange } from "../../../ipc/window"; import type { ApplicationMenuItemTypes } from "../../../../features/application-menu/main/menu-items/application-menu-item-injection-token"; import type { Composite } from "../../../../common/utils/composite/get-composite/get-composite"; import { getApplicationMenuTemplate } from "../../../../features/application-menu/main/populate-application-menu.injectable"; import type { MenuItemRoot } from "../../../../features/application-menu/main/application-menu-item-composite.injectable"; -import type { EmitAppEvent } from "../../../../common/app-event-bus/emit-event.injectable"; import type { GetClusterById } from "../../../../common/cluster-store/get-by-id.injectable"; -import type { Cluster } from "../../../../common/cluster/cluster"; -import type { ClusterConnection } from "../../../cluster/cluster-connection.injectable"; interface Dependencies { applicationMenuItemComposite: IComputedValue>; clusterStore: ClusterStore; - emitAppEvent: EmitAppEvent; getClusterById: GetClusterById; pushCatalogToRenderer: () => void; - getClusterConnection: (cluster: Cluster) => ClusterConnection; + clusterFrames: ObservableMap; } export const setupIpcMainHandlers = ({ applicationMenuItemComposite, clusterStore, - emitAppEvent, getClusterById, pushCatalogToRenderer, - getClusterConnection, + clusterFrames, }: Dependencies) => { ipcMainHandle(clusterSetFrameIdHandler, (event: IpcMainInvokeEvent, clusterId: ClusterId) => { const cluster = getClusterById(clusterId); if (cluster) { - clusterFrameMap.set(cluster.id, { frameId: event.frameId, processId: event.processId }); + clusterFrames.set(cluster.id, { frameId: event.frameId, processId: event.processId }); pushCatalogToRenderer(); } }); - ipcMainHandle(clusterDisconnectHandler, (event, clusterId: ClusterId) => { - emitAppEvent({ name: "cluster", action: "stop" }); - const cluster = getClusterById(clusterId); - - if (!cluster) { - return; - } - - const clusterConnection = getClusterConnection(cluster); - - clusterConnection.disconnect(); - clusterFrameMap.delete(cluster.id); - }); - ipcMainHandle(windowActionHandleChannel, (event, action) => handleWindowAction(action)); ipcMainOn(windowLocationChangedChannel, () => onLocationChange()); diff --git a/packages/core/src/main/getDiForUnitTesting.ts b/packages/core/src/main/getDiForUnitTesting.ts index c4dd2a0d52..b71ab53239 100644 --- a/packages/core/src/main/getDiForUnitTesting.ts +++ b/packages/core/src/main/getDiForUnitTesting.ts @@ -16,9 +16,7 @@ import setupMainWindowVisibilityAfterActivationInjectable from "./electron-app/r import setupDeviceShutdownInjectable from "./electron-app/runnables/setup-device-shutdown.injectable"; import setupApplicationNameInjectable from "./electron-app/runnables/setup-application-name.injectable"; import setupRunnablesBeforeClosingOfApplicationInjectable from "./electron-app/runnables/setup-runnables-before-closing-of-application.injectable"; -import clusterFramesInjectable from "../common/cluster-frames.injectable"; -import type { ClusterFrameInfo } from "../common/cluster-frames"; -import { observable, runInAction } from "mobx"; +import { runInAction } from "mobx"; import broadcastMessageInjectable from "../common/ipc/broadcast-message.injectable"; import electronQuitAndInstallUpdateInjectable from "./electron-app/features/electron-quit-and-install-update.injectable"; import electronUpdaterIsActiveInjectable from "./electron-app/features/electron-updater-is-active.injectable"; @@ -65,8 +63,6 @@ export function getDiForUnitTesting() { overrideElectronFeatures(di); getOverrideFsWithFakes()(di); - di.override(clusterFramesInjectable, () => observable.map()); - di.override(broadcastMessageInjectable, () => (channel) => { throw new Error(`Tried to broadcast message to channel "${channel}" over IPC without explicit override.`); }); diff --git a/packages/core/src/main/start-main-application/lens-window/application-window/create-lens-window.injectable.ts b/packages/core/src/main/start-main-application/lens-window/application-window/create-lens-window.injectable.ts index d2d8f344eb..e3854f6df6 100644 --- a/packages/core/src/main/start-main-application/lens-window/application-window/create-lens-window.injectable.ts +++ b/packages/core/src/main/start-main-application/lens-window/application-window/create-lens-window.injectable.ts @@ -5,7 +5,7 @@ import { getInjectable } from "@ogre-tools/injectable"; import type { ContentSource, ElectronWindowTitleBarStyle } from "./create-electron-window.injectable"; import createElectronWindowForInjectable from "./create-electron-window.injectable"; -import type { ClusterFrameInfo } from "../../../../common/cluster-frames"; +import type { ClusterFrameInfo } from "../../../../common/cluster-frames.injectable"; export interface ElectronWindow { show: () => void; diff --git a/packages/core/src/main/utils/channel/message-to-channel.test.ts b/packages/core/src/main/utils/channel/message-to-channel.test.ts index 59e749b64b..8e544c47dd 100644 --- a/packages/core/src/main/utils/channel/message-to-channel.test.ts +++ b/packages/core/src/main/utils/channel/message-to-channel.test.ts @@ -8,7 +8,7 @@ import clusterFramesInjectable from "../../../common/cluster-frames.injectable"; import type { MessageChannel } from "../../../common/utils/channel/message-channel-listener-injection-token"; import { sendMessageToChannelInjectionToken } from "../../../common/utils/channel/message-to-channel-injection-token"; import type { DiContainer } from "@ogre-tools/injectable"; -import type { ClusterFrameInfo } from "../../../common/cluster-frames"; +import type { ClusterFrameInfo } from "../../../common/cluster-frames.injectable"; describe("message-to-channel", () => { let di: DiContainer; diff --git a/packages/core/src/renderer/ipc/index.ts b/packages/core/src/renderer/ipc/index.ts index c4d126a648..744e6d785e 100644 --- a/packages/core/src/renderer/ipc/index.ts +++ b/packages/core/src/renderer/ipc/index.ts @@ -3,7 +3,7 @@ * Licensed under MIT License. See LICENSE in root directory for more information. */ -import { clusterDisconnectHandler, clusterSetFrameIdHandler, clusterStates } from "../../common/ipc/cluster"; +import { clusterSetFrameIdHandler, clusterStates } from "../../common/ipc/cluster"; import type { ClusterId, ClusterState } from "../../common/cluster-types"; import { windowActionHandleChannel, windowLocationChangedChannel, windowOpenAppMenuAsContextMenuChannel, type WindowAction } from "../../common/ipc/window"; import { extensionDiscoveryStateChannel, extensionLoaderFromMainChannel } from "../../common/ipc/extension-handling"; @@ -46,10 +46,6 @@ export function requestSetClusterFrameId(clusterId: ClusterId): Promise { return requestMain(clusterSetFrameIdHandler, clusterId); } -export function requestClusterDisconnection(clusterId: ClusterId, force?: boolean): Promise { - return requestMain(clusterDisconnectHandler, clusterId, force); -} - export function requestInitialClusterStates(): Promise<{ id: string; state: ClusterState }[]> { return requestMain(clusterStates); }