Upgrade to Electron 14.2.4 (#4625)

Co-authored-by: Sebastian Malton <sebastian@malton.name>
Co-authored-by: Jim Ehrismann <jehrismann@mirantis.com>
This commit is contained in:
authored and GitHub committed 2022-01-27 10:23:36 -05:00
1 parent 205225f6a4
commit 1cac3ca74c
58 files changed
+545 -418

No files matched your search

+83
View File
@@ -0,0 +1,83 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { ipcRenderer, OpenDialogOptions } from "electron";
import { clusterActivateHandler, clusterClearDeletingHandler, clusterDeleteHandler, clusterDisconnectHandler, clusterKubectlApplyAllHandler, clusterKubectlDeleteAllHandler, clusterSetDeletingHandler, 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 { openFilePickingDialogChannel } from "../../common/ipc/dialog";
import { extensionDiscoveryStateChannel, extensionLoaderFromMainChannel } from "../../common/ipc/extension-handling";
import type { InstalledExtension } from "../../extensions/extension-discovery/extension-discovery";
import type { LensExtensionId } from "../../extensions/lens-extension";
import { toJS } from "../utils";
import type { Location } from "history";
function requestMain(channel: string, ...args: any[]) {
return ipcRenderer.invoke(channel, ...args.map(toJS));
}
function emitToMain(channel: string, ...args: any[]) {
return ipcRenderer.send(channel, ...args.map(toJS));
}
export function emitOpenAppMenuAsContextMenu(): void {
emitToMain(windowOpenAppMenuAsContextMenuChannel);
}
export function emitWindowLocationChanged(location: Location): void {
emitToMain(windowLocationChangedChannel, location);
}
export function requestWindowAction(type: WindowAction): Promise<void> {
return requestMain(windowActionHandleChannel, type);
}
export function requestOpenFilePickingDialog(opts: OpenDialogOptions): Promise<{ canceled: boolean; filePaths: string[]; }> {
return requestMain(openFilePickingDialogChannel, opts);
}
export function requestSetClusterFrameId(clusterId: ClusterId): Promise<void> {
return requestMain(clusterSetFrameIdHandler, clusterId);
}
export function requestClusterActivation(clusterId: ClusterId, force?: boolean): Promise<void> {
return requestMain(clusterActivateHandler, clusterId, force);
}
export function requestClusterDisconnection(clusterId: ClusterId, force?: boolean): Promise<void> {
return requestMain(clusterDisconnectHandler, clusterId, force);
}
export function requestSetClusterAsDeleting(clusterId: ClusterId): Promise<void> {
return requestMain(clusterSetDeletingHandler, clusterId);
}
export function requestClearClusterAsDeleting(clusterId: ClusterId): Promise<void> {
return requestMain(clusterClearDeletingHandler, clusterId);
}
export function requestDeleteCluster(clusterId: ClusterId): Promise<void> {
return requestMain(clusterDeleteHandler, clusterId);
}
export function requestInitialClusterStates(): Promise<{ id: string, state: ClusterState }[]> {
return requestMain(clusterStates);
}
export function requestKubectlApplyAll(clusterId: ClusterId, resources: string[], kubectlArgs: string[]): Promise<{ stderr?: string; stdout?: string }> {
return requestMain(clusterKubectlApplyAllHandler, clusterId, resources, kubectlArgs);
}
export function requestKubectlDeleteAll(clusterId: ClusterId, resources: string[], kubectlArgs: string[]): Promise<{ stderr?: string; stdout?: string }> {
return requestMain(clusterKubectlDeleteAllHandler, clusterId, resources, kubectlArgs);
}
export function requestInitialExtensionDiscovery(): Promise<{ isLoaded: boolean }> {
return requestMain(extensionDiscoveryStateChannel);
}
export function requestExtensionLoaderInitialState(): Promise<[LensExtensionId, InstalledExtension][]> {
return requestMain(extensionLoaderFromMainChannel);
}
@@ -5,7 +5,7 @@
import React from "react";
import { ipcRenderer, IpcRendererEvent } from "electron";
import { areArgsUpdateAvailableFromMain, UpdateAvailableChannel, onCorrect, UpdateAvailableFromMain, BackchannelArg, ClusterListNamespaceForbiddenChannel, isListNamespaceForbiddenArgs, ListNamespaceForbiddenArgs, HotbarTooManyItems, ipcRendererOn, AutoUpdateChecking, AutoUpdateNoUpdateAvailable } from "../../common/ipc";
import { areArgsUpdateAvailableFromMain, UpdateAvailableChannel, onCorrect, UpdateAvailableFromMain, BackchannelArg, ipcRendererOn, AutoUpdateChecking, AutoUpdateNoUpdateAvailable } from "../../common/ipc";
import { Notifications, notificationsStore } from "../components/notifications";
import { Button } from "../components/button";
import { isMac } from "../../common/vars";
@@ -13,6 +13,8 @@ import { ClusterStore } from "../../common/cluster-store/cluster-store";
import { navigate } from "../navigation";
import { entitySettingsURL } from "../../common/routes";
import { defaultHotbarCells } from "../../common/hotbar-types";
import { type ListNamespaceForbiddenArgs, clusterListNamespaceForbiddenChannel, isListNamespaceForbiddenArgs } from "../../common/ipc/cluster";
import { hotbarTooManyItemsChannel } from "../../common/ipc/hotbar";
function sendToBackchannel(backchannel: string, notificationId: string, data: BackchannelArg): void {
notificationsStore.remove(notificationId);
@@ -127,13 +129,13 @@ export function registerIpcListeners() {
});
onCorrect({
source: ipcRenderer,
channel: ClusterListNamespaceForbiddenChannel,
channel: clusterListNamespaceForbiddenChannel,
listener: ListNamespacesForbiddenHandler,
verifier: isListNamespaceForbiddenArgs,
});
onCorrect({
source: ipcRenderer,
channel: HotbarTooManyItems,
channel: hotbarTooManyItemsChannel,
listener: HotbarTooManyItemsHandler,
verifier: (args: unknown[]): args is [] => args.length === 0,
});