Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
ed6f522
Fix failing to start shell being hidden from user
Nokel81 Jun 14, 2022
87dc14c
Cleanup
Nokel81 Oct 13, 2022
dba4f59
Add enough code to get first couple terminal tests to pass
Nokel81 Oct 14, 2022
8136e23
Fix type errors from testing in dev mode
Nokel81 Oct 14, 2022
f111450
Introduce and use ApplicationBuilder.quit in afterEach() hooks
Nokel81 Oct 14, 2022
c9f1594
Upgrade XTermJs to v5 to get snapshot testing working
Nokel81 Oct 17, 2022
2de3068
Use webgl when available, add search and better weblinks
Nokel81 Oct 17, 2022
d293554
Get tests passing
Nokel81 Oct 18, 2022
988307e
Add script to download the correct version of canvas
Nokel81 Oct 18, 2022
071ba8a
Fix installing canvas on all platforms
Nokel81 Oct 18, 2022
ea603c7
Fix the script
Nokel81 Oct 18, 2022
78b05ba
Remove console logs
Nokel81 Oct 18, 2022
aa41117
Fix lint
Nokel81 Oct 18, 2022
19466f1
Temporarily upgrade to beta version of xterm to verify fix
Nokel81 Oct 26, 2022
d1acca4
Fix post install script because of temp version of xterm
Nokel81 Oct 26, 2022
f2d19e7
Fix some more lint
Nokel81 Oct 26, 2022
2a96eb8
Fix usage of new asyncComputed type
Nokel81 Oct 28, 2022
862cd2a
Update (mostly just) snapshots and a few other tests
Nokel81 Oct 31, 2022
3c9791e
Fix type error
Nokel81 Nov 1, 2022
c340256
Replace last use of customRequestPromise with di
Nokel81 Nov 3, 2022
f522d23
Replace usage of request in setupLensProxy
Nokel81 Nov 3, 2022
37955f0
Replace usage of request in k8sRequest and cluster detectors
Nokel81 Nov 3, 2022
b86bc6d
Remove direct dependency on request et al
Nokel81 Nov 3, 2022
4c1d076
Add process of cleaning up lens proxy startup if down quickly
Nokel81 Nov 3, 2022
c6a9d56
Fix bad vscode rename
Nokel81 Nov 3, 2022
e49b0f6
Remove calls to show error popup on stopping
Nokel81 Nov 3, 2022
d173e45
Fix starting of lens proxy
Nokel81 Nov 3, 2022
b96e115
Fix type errors
Nokel81 Nov 7, 2022
6ce833c
Make ApplicationBuilder.quit more realistic
Nokel81 Nov 8, 2022
0dabbb6
Replace override of catalogSyncToRenderer with a global override
Nokel81 Nov 8, 2022
a82a120
Fix many tests by changing injectables
Nokel81 Nov 8, 2022
e90a181
Fix listing-active-helm-repositories-in-preferences.test.ts
Nokel81 Nov 8, 2022
9c75199
Update snapshot
Nokel81 Nov 8, 2022
97dfe4d
Fix new tests
Nokel81 Nov 8, 2022
e8bc887
Fix postinstall script
Nokel81 Nov 14, 2022
58cbf5f
Fix bad imports of node-fetch
Nokel81 Nov 14, 2022
8761aa1
Fix type errors
Nokel81 Nov 14, 2022
8fd732b
Fix unit tests
Nokel81 Nov 15, 2022
e9e248e
Fix tests not stopping by forcing cleanup
Nokel81 Nov 18, 2022
71ad8e1
Generate tray icons before installing canvas
Nokel81 Nov 18, 2022
3a7ac10
Add updated icons
Nokel81 Nov 18, 2022
c11d8c6
Fix lint
Nokel81 Nov 18, 2022
0088add
Fix code after rebase
Nokel81 Nov 24, 2022
6321b10
Fix test failures
Nokel81 Nov 24, 2022
9683a7c
Fix tests and lint
Nokel81 Nov 29, 2022
a271c83
Update snapshots
Nokel81 Nov 29, 2022
3b72137
Remove unused (but newly added) dep
Nokel81 Dec 1, 2022
19a8691
Update snapshots
Nokel81 Dec 1, 2022
f6b5214
Fixup new test file after rebase
Nokel81 Dec 6, 2022
78614af
Update snapshots
Nokel81 Dec 6, 2022
56703cd
Update snapshots
Nokel81 Dec 6, 2022
a1d2fa0
Fix lint
Nokel81 Dec 15, 2022
3fbbf02
Fix errors blocking compilation
Nokel81 Dec 16, 2022
8b18e58
Update snapshots
Nokel81 Dec 20, 2022
d9a7a48
Fix lint
Nokel81 Dec 20, 2022
ea49929
Fix types
Nokel81 Dec 21, 2022
0e1b2c0
Fix test failures
Nokel81 Dec 21, 2022
12bd506
Fix lint
Nokel81 Jan 5, 2023
2f43d24
Fix build
Nokel81 Jan 9, 2023
14f50a3
Fix unit tests
Nokel81 Jan 9, 2023
6d0e527
Fix build type errors
Nokel81 Jan 9, 2023
d22af76
Fix most tests
Nokel81 Jan 9, 2023
3492741
Fix kubeconfig-manager tests
Nokel81 Jan 9, 2023
6dd926a
Fix tests not using ApplicationBuilder
Nokel81 Jan 9, 2023
cfad2c0
Fix expected URL
Nokel81 Jan 9, 2023
186d7f9
Fix tests not using ApplicationBuilder
Nokel81 Jan 9, 2023
9adddaf
Fix top bar tests
Nokel81 Jan 9, 2023
e88743d
Add suspend plugin
Nokel81 Jan 9, 2023
4885461
More work to get tests to pass in a more realistic way
Nokel81 Jan 9, 2023
120a5f7
Fix tests by faking the version detector
Nokel81 Jan 10, 2023
91cd2c8
Remove debug logging
Nokel81 Jan 10, 2023
7971755
Cleanup uses and overrides of requestAnimationFrame
Nokel81 Jan 10, 2023
c658a0b
Get terminal tests to pass again
Nokel81 Jan 10, 2023
9b7e77d
Remove unneccessary causesSideEffects
Nokel81 Jan 10, 2023
4815510
Update cluster-frame test snapshots
Nokel81 Jan 10, 2023
3471397
Fix edit-namespace-from-new-tab tests
Nokel81 Jan 10, 2023
e77411a
Fix tests failing due to allow resources not updateing
Nokel81 Jan 10, 2023
d1eb149
Fix tooltip tests
Nokel81 Jan 10, 2023
6880d52
Update install-helm-chart-from-new-tab snapshots
Nokel81 Jan 10, 2023
d2ee54f
Update showing-details-for-helm-release snapshots
Nokel81 Jan 10, 2023
8704067
Update sidebar-and-tab-navigation-for-extensions snapshots
Nokel81 Jan 10, 2023
9539c1c
Fix cluster-store tests
Nokel81 Jan 10, 2023
5f30b81
Fix kube-auth-proxy tests
Nokel81 Jan 10, 2023
4edfa40
Update more snapshots
Nokel81 Jan 10, 2023
29a7e2a
Fix kube-api-version-detection tests
Nokel81 Jan 10, 2023
51b8c91
Fix build
Nokel81 Jan 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@
"<rootDir>/packages"
],
"setupFiles": [
"<rootDir>/src/jest.setup.ts",
"jest-canvas-mock"
"<rootDir>/src/jest.setup.ts"
],
"globalSetup": "<rootDir>/src/jest.timezone.ts",
"setupFilesAfterEnv": [
Expand Down Expand Up @@ -265,7 +264,7 @@
"immer": "^9.0.17",
"joi": "^17.7.0",
"js-yaml": "^4.1.0",
"jsdom": "^16.7.0",
"jsdom": "^20.0.1",
"lodash": "^4.17.15",
"marked": "^4.2.5",
"md5-file": "^5.0.0",
Expand Down Expand Up @@ -335,6 +334,7 @@
"@types/html-webpack-plugin": "^3.2.6",
"@types/http-proxy": "^1.17.9",
"@types/jest": "^28.1.6",
"@types/jest-image-snapshot": "^5.1.0",
"@types/js-yaml": "^4.0.5",
"@types/jsdom": "^16.2.14",
"@types/lodash": "^4.14.191",
Expand Down Expand Up @@ -375,6 +375,7 @@
"adr": "^1.4.3",
"ansi_up": "^5.1.0",
"chalk": "^4.1.2",
"canvas": "^2.10.1",
"chart.js": "^2.9.4",
"circular-dependency-plugin": "^5.2.2",
"cli-progress": "^3.11.2",
Expand Down Expand Up @@ -403,8 +404,8 @@
"ignore-loader": "^0.1.2",
"include-media": "^1.4.9",
"jest": "^28.1.3",
"jest-canvas-mock": "^2.3.1",
"jest-environment-jsdom": "^28.1.3",
"jest-image-snapshot": "^5.2.0",
"jest-mock-extended": "^2.0.9",
"make-plural": "^6.2.2",
"memfs": "^3.4.12",
Expand Down
2 changes: 1 addition & 1 deletion src/common/app-paths/app-paths-channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import type { AppPaths } from "./app-path-injection-token";
import type { RequestChannel } from "../utils/channel/request-channel-listener-injection-token";
import type { RequestChannel } from "../utils/channel/request-channel";

export type AppPathsChannel = RequestChannel<void, AppPaths>;

Expand Down
2 changes: 1 addition & 1 deletion src/common/helm/add-helm-repository-channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/
import type { HelmRepo } from "./helm-repo";
import type { AsyncResult } from "../utils/async-result";
import type { RequestChannel } from "../utils/channel/request-channel-listener-injection-token";
import type { RequestChannel } from "../utils/channel/request-channel";

export type AddHelmRepositoryChannel = RequestChannel<HelmRepo, AsyncResult<void, string>>;

Expand Down
2 changes: 1 addition & 1 deletion src/common/helm/get-active-helm-repositories-channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/
import type { HelmRepo } from "./helm-repo";
import type { AsyncResult } from "../utils/async-result";
import type { RequestChannel } from "../utils/channel/request-channel-listener-injection-token";
import type { RequestChannel } from "../utils/channel/request-channel";

export type GetActiveHelmRepositoriesChannel = RequestChannel<void, AsyncResult<HelmRepo[]>>;

Expand Down
2 changes: 1 addition & 1 deletion src/common/helm/remove-helm-repository-channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import type { AsyncResult } from "../utils/async-result";
import type { RequestChannel } from "../utils/channel/request-channel-listener-injection-token";
import type { RequestChannel } from "../utils/channel/request-channel";
import type { HelmRepo } from "./helm-repo";

export type RemoveHelmRepositoryChannel = RequestChannel<HelmRepo, AsyncResult<void, string>>;
Expand Down
10 changes: 5 additions & 5 deletions src/common/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@


export interface Logger {
info: (message: string, ...args: any) => void;
error: (message: string, ...args: any) => void;
debug: (message: string, ...args: any) => void;
warn: (message: string, ...args: any) => void;
silly: (message: string, ...args: any) => void;
info: (message: string, ...args: any[]) => void;
error: (message: string, ...args: any[]) => void;
debug: (message: string, ...args: any[]) => void;
warn: (message: string, ...args: any[]) => void;
silly: (message: string, ...args: any[]) => void;
}
4 changes: 4 additions & 0 deletions src/common/terminal/channels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export enum TerminalChannels {
CONNECTED = "connected",
RESIZE = "resize",
PING = "ping",
ERROR = "error",
}

export type TerminalMessage = {
Expand All @@ -28,4 +29,7 @@ export type TerminalMessage = {
};
} | {
type: TerminalChannels.PING;
} | {
type: TerminalChannels.ERROR;
data: string;
};
10 changes: 4 additions & 6 deletions src/common/utils/channel/channel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ import { getApplicationBuilder } from "../../../renderer/components/test-utils/g
import type { LensWindow } from "../../../main/start-main-application/lens-window/application-window/create-lens-window.injectable";
import type { MessageChannel } from "./message-channel-listener-injection-token";
import { messageChannelListenerInjectionToken } from "./message-channel-listener-injection-token";
import type { RequestFromChannel } from "./request-from-channel-injection-token";
import { requestFromChannelInjectionToken } from "./request-from-channel-injection-token";
import type { RequestChannel } from "./request-channel-listener-injection-token";
import type { RequestChannel } from "./request-channel";
import type { AsyncFnMock } from "@async-fn/jest";
import asyncFn from "@async-fn/jest";
import { getPromiseStatus } from "../../test-utils/get-promise-status";
import { runInAction } from "mobx";
import type { RequestChannelHandler } from "../../../main/utils/channel/channel-listeners/listener-tokens";
import { getRequestChannelListenerInjectable } from "../../../main/utils/channel/channel-listeners/listener-tokens";
import type { RequestFromChannel } from "../../../renderer/utils/channel/request-from-channel.injectable";
import requestFromChannelInjectable from "../../../renderer/utils/channel/request-from-channel.injectable";
Comment on lines +21 to +22
Copy link
Contributor

@jansav jansav Jan 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't be removing the injection token. requestFromChannel is contract which is implemented separately in renderer and main but the contract is same.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important thing is that channel is something that can be called from anywhere and it doesn't know who answers. That being said, the "request" or "message" doesn't even have to go over IPC, the listener and caller can be located in same environment. (It doesn't work like this yet due YAGNI but conceptually that's what Channel is.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The contract isn't the same. A request channel being requested on has no meaning on main and thus main shouldn't even know about it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

main can request stuff from channel. It just doesn't know who answers it, might be main or renderer.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No it cannot, where is that possible?


type TestMessageChannel = MessageChannel<string>;
type TestRequestChannel = RequestChannel<string, string>;
Expand Down Expand Up @@ -164,9 +164,7 @@ describe("channel", () => {

const windowDi = applicationBuilder.applicationWindow.only.di;

requestFromChannel = windowDi.inject(
requestFromChannelInjectionToken,
);
requestFromChannel = windowDi.inject(requestFromChannelInjectable);
});

describe("when requesting from channel", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,11 @@ export interface RequestChannel<Request, Response> {
_requestSignature?: Request; // used only to mark `Request` as "used"
_responseSignature?: Response; // used only to mark `Response` as "used"
}

export type ChannelRequest<Channel> = Channel extends RequestChannel<infer Request, any>
? Request
: never;

export type ChannelResponse<Channel> = Channel extends RequestChannel<any, infer Response>
? Response
: never;

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import type { RequestChannel } from "../channel/request-channel-listener-injection-token";
import type { RequestChannel } from "../channel/request-channel";

export type ResolveSystemProxyChannel = RequestChannel<string, string>;

Expand Down
2 changes: 1 addition & 1 deletion src/common/utils/sync-box/channels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import type { MessageChannel } from "../channel/message-channel-listener-injection-token";
import type { RequestChannel } from "../channel/request-channel-listener-injection-token";
import type { RequestChannel } from "../channel/request-channel";

export type SyncBoxChannel = MessageChannel<{ id: string; value: any }>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import type { ClusterId } from "../../../../common/cluster-types";
import type { RequestChannel } from "../../../../common/utils/channel/request-channel-listener-injection-token";
import type { RequestChannel } from "../../../../common/utils/channel/request-channel";

export type ClearClusterAsDeletingChannel = RequestChannel<ClusterId, void>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import type { ClusterId } from "../../../../common/cluster-types";
import type { RequestChannel } from "../../../../common/utils/channel/request-channel-listener-injection-token";
import type { RequestChannel } from "../../../../common/utils/channel/request-channel";

export type DeleteClusterChannel = RequestChannel<ClusterId, void>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import type { ClusterId } from "../../../../common/cluster-types";
import type { RequestChannel } from "../../../../common/utils/channel/request-channel-listener-injection-token";
import type { RequestChannel } from "../../../../common/utils/channel/request-channel";

export type SetClusterAsDeletingChannel = RequestChannel<ClusterId, void>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
import { getInjectable } from "@ogre-tools/injectable";
import { asyncComputed } from "@ogre-tools/injectable-react";
import { getActiveHelmRepositoriesChannel } from "../../../../../common/helm/get-active-helm-repositories-channel";
import { requestFromChannelInjectionToken } from "../../../../../common/utils/channel/request-from-channel-injection-token";
import showErrorNotificationInjectable from "../../../../../renderer/components/notifications/show-error-notification.injectable";
import helmRepositoriesErrorStateInjectable from "./helm-repositories-error-state.injectable";
import { runInAction } from "mobx";
import requestFromChannelInjectable from "../../../../../renderer/utils/channel/request-from-channel.injectable";

const activeHelmRepositoriesInjectable = getInjectable({
id: "active-helm-repositories",

instantiate: (di) => {
const requestFromChannel = di.inject(requestFromChannelInjectionToken);
const requestFromChannel = di.inject(requestFromChannelInjectable);
const showErrorNotification = di.inject(showErrorNotificationInjectable);
const helmRepositoriesErrorState = di.inject(
helmRepositoriesErrorStateInjectable,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
*/
import { getInjectable } from "@ogre-tools/injectable";
import type { HelmRepo } from "../../../../../../../common/helm/helm-repo";
import { requestFromChannelInjectionToken } from "../../../../../../../common/utils/channel/request-from-channel-injection-token";
import activeHelmRepositoriesInjectable from "../../active-helm-repositories.injectable";
import showErrorNotificationInjectable from "../../../../../../../renderer/components/notifications/show-error-notification.injectable";
import showSuccessNotificationInjectable from "../../../../../../../renderer/components/notifications/show-success-notification.injectable";
import { addHelmRepositoryChannel } from "../../../../../../../common/helm/add-helm-repository-channel";
import requestFromChannelInjectable from "../../../../../../utils/channel/request-from-channel.injectable";

const addHelmRepositoryInjectable = getInjectable({
id: "add-public-helm-repository",

instantiate: (di) => {
const requestFromChannel = di.inject(requestFromChannelInjectionToken);
const requestFromChannel = di.inject(requestFromChannelInjectable);
const activeHelmRepositories = di.inject(activeHelmRepositoriesInjectable);
const showErrorNotification = di.inject(showErrorNotificationInjectable);
const showSuccessNotification = di.inject(showSuccessNotificationInjectable);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
*/
import { getInjectable } from "@ogre-tools/injectable";
import type { HelmRepo } from "../../../../../common/helm/helm-repo";
import { requestFromChannelInjectionToken } from "../../../../../common/utils/channel/request-from-channel-injection-token";
import activeHelmRepositoriesInjectable from "./active-helm-repositories.injectable";
import { removeHelmRepositoryChannel } from "../../../../../common/helm/remove-helm-repository-channel";
import requestFromChannelInjectable from "../../../../utils/channel/request-from-channel.injectable";

const removePublicHelmRepositoryInjectable = getInjectable({
id: "remove-public-helm-repository",

instantiate: (di) => {
const requestFromChannel = di.inject(requestFromChannelInjectionToken);
const requestFromChannel = di.inject(requestFromChannelInjectable);
const activeHelmRepositories = di.inject(activeHelmRepositoriesInjectable);

return async (repository: HelmRepo) => {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading