mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Prevent duplicate app windows (#5533)
Co-authored-by: Janne Savolainen <janne.savolainen@live.fi> Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com> Co-authored-by: Iku-turso <mikko.aspiala@gmail.com>
This commit is contained in:
1 parent
5c1f0daf50
commit
6451df1f17
19 files changed
+528
-109
No files matched your search
@@ -39,7 +39,6 @@ import { KubeObjectStore } from "../../../common/k8s-api/kube-object.store";
|
||||
import clusterFrameContextInjectable from "../../cluster-frame-context/cluster-frame-context.injectable";
|
||||
import startMainApplicationInjectable from "../../../main/start-main-application/start-main-application.injectable";
|
||||
import startFrameInjectable from "../../start-frame/start-frame.injectable";
|
||||
import { flushPromises } from "../../../common/test-utils/flush-promises";
|
||||
import type { NamespaceStore } from "../+namespaces/store";
|
||||
import namespaceStoreInjectable from "../+namespaces/store.injectable";
|
||||
import historyInjectable from "../../navigation/history.injectable";
|
||||
@@ -56,6 +55,7 @@ import assert from "assert";
|
||||
import { openMenu } from "react-select-event";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import { StatusBar } from "../status-bar/status-bar";
|
||||
import lensProxyPortInjectable from "../../../main/lens-proxy/lens-proxy-port.injectable";
|
||||
|
||||
type Callback = (dis: DiContainers) => void | Promise<void>;
|
||||
|
||||
@@ -75,7 +75,7 @@ export interface ApplicationBuilder {
|
||||
};
|
||||
|
||||
applicationMenu: {
|
||||
click: (path: string) => Promise<void>;
|
||||
click: (path: string) => void;
|
||||
};
|
||||
|
||||
preferences: {
|
||||
@@ -181,13 +181,13 @@ export const getApplicationBuilder = () => {
|
||||
computed(() => []),
|
||||
);
|
||||
|
||||
const iconPaths = mainDi.inject(trayIconPathsInjectable);
|
||||
|
||||
let trayMenuItemsStateFake: TrayMenuItem[];
|
||||
let trayMenuIconPath: string;
|
||||
|
||||
mainDi.override(electronTrayInjectable, () => ({
|
||||
start: () => {
|
||||
const iconPaths = mainDi.inject(trayIconPathsInjectable);
|
||||
|
||||
trayMenuIconPath = iconPaths.normal;
|
||||
},
|
||||
stop: () => {},
|
||||
@@ -206,7 +206,7 @@ export const getApplicationBuilder = () => {
|
||||
dis,
|
||||
|
||||
applicationMenu: {
|
||||
click: async (path: string) => {
|
||||
click: (path: string) => {
|
||||
const applicationMenuItems = mainDi.inject(
|
||||
applicationMenuItemsInjectable,
|
||||
);
|
||||
@@ -237,8 +237,6 @@ export const getApplicationBuilder = () => {
|
||||
undefined,
|
||||
{},
|
||||
);
|
||||
|
||||
await flushPromises();
|
||||
},
|
||||
},
|
||||
|
||||
@@ -398,6 +396,8 @@ export const getApplicationBuilder = () => {
|
||||
},
|
||||
|
||||
async render() {
|
||||
mainDi.inject(lensProxyPortInjectable).set(42);
|
||||
|
||||
for (const callback of beforeApplicationStartCallbacks) {
|
||||
await callback(dis);
|
||||
}
|
||||
@@ -408,7 +408,7 @@ export const getApplicationBuilder = () => {
|
||||
|
||||
const applicationWindow = mainDi.inject(applicationWindowInjectable);
|
||||
|
||||
await applicationWindow.show();
|
||||
await applicationWindow.start();
|
||||
|
||||
const startFrame = rendererDi.inject(startFrameInjectable);
|
||||
|
||||
|
||||
Reference in new issue
Block a user