mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Merge branch 'master' into show-extension-preferences-in-separate-page
This commit is contained in:
commit
5cb9b69e1b
1475 files changed
+44666
-33264
No files matched your search
+10
-1
@@ -1,11 +1,20 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`extension special characters in page registrations renders 1`] = `<div />`;
|
||||
exports[`extension special characters in page registrations renders 1`] = `
|
||||
<div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`extension special characters in page registrations when navigating to route with ID having special characters renders 1`] = `
|
||||
<div>
|
||||
<div>
|
||||
Some page
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
@@ -1,12 +1,21 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`navigate to extension page renders 1`] = `<div />`;
|
||||
exports[`navigate to extension page renders 1`] = `
|
||||
<div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`navigate to extension page when extension navigates to child route renders 1`] = `
|
||||
<div>
|
||||
<div>
|
||||
Child page
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -31,6 +40,9 @@ exports[`navigate to extension page when extension navigates to route with param
|
||||
Some button
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -55,6 +67,9 @@ exports[`navigate to extension page when extension navigates to route without pa
|
||||
Some button
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -79,5 +94,8 @@ exports[`navigate to extension page when extension navigates to route without pa
|
||||
Some button
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
@@ -8,6 +8,9 @@ exports[`navigating between routes given route with optional path parameters whe
|
||||
"someOtherParameter": "some-other-value"
|
||||
}
|
||||
</pre>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -16,5 +19,8 @@ exports[`navigating between routes given route without path parameters when navi
|
||||
<div>
|
||||
Some component
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
+13
-6
@@ -1,6 +1,12 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`add-cluster - navigation using application menu renders 1`] = `<div />`;
|
||||
exports[`add-cluster - navigation using application menu renders 1`] = `
|
||||
<div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`add-cluster - navigation using application menu when navigating to add cluster using application menu renders 1`] = `
|
||||
<div>
|
||||
@@ -19,7 +25,7 @@ exports[`add-cluster - navigation using application menu when navigating to add
|
||||
Add Clusters from Kubeconfig
|
||||
</h2>
|
||||
<p>
|
||||
Clusters added here are
|
||||
Clusters added here are
|
||||
<b>
|
||||
not
|
||||
</b>
|
||||
@@ -27,16 +33,14 @@ exports[`add-cluster - navigation using application menu when navigating to add
|
||||
<code>
|
||||
~/.kube/config
|
||||
</code>
|
||||
file.
|
||||
|
||||
file.
|
||||
<a
|
||||
href="https://docs.k8slens.dev/main//catalog/add-clusters/"
|
||||
rel="noreferrer"
|
||||
target="_blank"
|
||||
>
|
||||
Read more about adding clusters
|
||||
Read more about adding clusters.
|
||||
</a>
|
||||
.
|
||||
</p>
|
||||
<div
|
||||
class="flex column"
|
||||
@@ -87,5 +91,8 @@ exports[`add-cluster - navigation using application menu when navigating to add
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
+15
-8
@@ -6,20 +6,27 @@
|
||||
import type { RenderResult } from "@testing-library/react";
|
||||
import type { ApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
import { getApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
import isAutoUpdateEnabledInjectable from "../../main/is-auto-update-enabled.injectable";
|
||||
import React from "react";
|
||||
|
||||
// TODO: Make components free of side effects by making them deterministic
|
||||
jest.mock("../../renderer/components/tooltip");
|
||||
jest.mock("../../renderer/components/monaco-editor/monaco-editor");
|
||||
jest.mock("../../renderer/components/tooltip/tooltip", () => ({
|
||||
Tooltip: () => null,
|
||||
}));
|
||||
|
||||
jest.mock("../../renderer/components/tooltip/withTooltip", () => ({
|
||||
withTooltip: (Target: any) => ({ tooltip, tooltipOverrideDisabled, ...props }: any) => <Target {...props} />,
|
||||
}));
|
||||
|
||||
jest.mock("../../renderer/components/monaco-editor/monaco-editor", () => ({
|
||||
MonacoEditor: () => null,
|
||||
}));
|
||||
|
||||
describe("add-cluster - navigation using application menu", () => {
|
||||
let applicationBuilder: ApplicationBuilder;
|
||||
let rendered: RenderResult;
|
||||
|
||||
beforeEach(async () => {
|
||||
applicationBuilder = getApplicationBuilder().beforeSetups(({ mainDi }) => {
|
||||
mainDi.override(isAutoUpdateEnabledInjectable, () => () => false);
|
||||
});
|
||||
applicationBuilder = getApplicationBuilder();
|
||||
|
||||
rendered = await applicationBuilder.render();
|
||||
});
|
||||
@@ -35,8 +42,8 @@ describe("add-cluster - navigation using application menu", () => {
|
||||
});
|
||||
|
||||
describe("when navigating to add cluster using application menu", () => {
|
||||
beforeEach(() => {
|
||||
applicationBuilder.applicationMenu.click("file.add-cluster");
|
||||
beforeEach(async () => {
|
||||
await applicationBuilder.applicationMenu.click("file.add-cluster");
|
||||
});
|
||||
|
||||
it("renders", () => {
|
||||
+536
@@ -0,0 +1,536 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`installing update using tray when started renders 1`] = `
|
||||
<body>
|
||||
<div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
</body>
|
||||
`;
|
||||
|
||||
exports[`installing update using tray when started when user checks for updates using tray renders 1`] = `
|
||||
<body>
|
||||
<div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
>
|
||||
<div
|
||||
class="Animate opacity notification flex info enter"
|
||||
style="--enter-duration: 100ms; --leave-duration: 100ms;"
|
||||
>
|
||||
<div
|
||||
class="box"
|
||||
>
|
||||
<i
|
||||
class="Icon material focusable"
|
||||
>
|
||||
<span
|
||||
class="icon"
|
||||
data-icon-name="info_outline"
|
||||
>
|
||||
info_outline
|
||||
</span>
|
||||
</i>
|
||||
</div>
|
||||
<div
|
||||
class="message box grow"
|
||||
>
|
||||
Checking for updates...
|
||||
</div>
|
||||
<div
|
||||
class="box"
|
||||
>
|
||||
<i
|
||||
class="Icon close material interactive focusable"
|
||||
data-testid="close-notification-for-notification_13"
|
||||
tabindex="0"
|
||||
>
|
||||
<span
|
||||
class="icon"
|
||||
data-icon-name="close"
|
||||
>
|
||||
close
|
||||
</span>
|
||||
</i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
`;
|
||||
|
||||
exports[`installing update using tray when started when user checks for updates using tray when new update is discovered renders 1`] = `
|
||||
<body>
|
||||
<div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
>
|
||||
<div
|
||||
class="Animate opacity notification flex info enter"
|
||||
style="--enter-duration: 100ms; --leave-duration: 100ms;"
|
||||
>
|
||||
<div
|
||||
class="box"
|
||||
>
|
||||
<i
|
||||
class="Icon material focusable"
|
||||
>
|
||||
<span
|
||||
class="icon"
|
||||
data-icon-name="info_outline"
|
||||
>
|
||||
info_outline
|
||||
</span>
|
||||
</i>
|
||||
</div>
|
||||
<div
|
||||
class="message box grow"
|
||||
>
|
||||
Checking for updates...
|
||||
</div>
|
||||
<div
|
||||
class="box"
|
||||
>
|
||||
<i
|
||||
class="Icon close material interactive focusable"
|
||||
data-testid="close-notification-for-notification_96"
|
||||
tabindex="0"
|
||||
>
|
||||
<span
|
||||
class="icon"
|
||||
data-icon-name="close"
|
||||
>
|
||||
close
|
||||
</span>
|
||||
</i>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Animate opacity notification flex info enter"
|
||||
style="--enter-duration: 100ms; --leave-duration: 100ms;"
|
||||
>
|
||||
<div
|
||||
class="box"
|
||||
>
|
||||
<i
|
||||
class="Icon material focusable"
|
||||
>
|
||||
<span
|
||||
class="icon"
|
||||
data-icon-name="info_outline"
|
||||
>
|
||||
info_outline
|
||||
</span>
|
||||
</i>
|
||||
</div>
|
||||
<div
|
||||
class="message box grow"
|
||||
>
|
||||
Download for version some-version started...
|
||||
</div>
|
||||
<div
|
||||
class="box"
|
||||
>
|
||||
<i
|
||||
class="Icon close material interactive focusable"
|
||||
data-testid="close-notification-for-notification_99"
|
||||
tabindex="0"
|
||||
>
|
||||
<span
|
||||
class="icon"
|
||||
data-icon-name="close"
|
||||
>
|
||||
close
|
||||
</span>
|
||||
</i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
`;
|
||||
|
||||
exports[`installing update using tray when started when user checks for updates using tray when new update is discovered when download fails renders 1`] = `
|
||||
<body>
|
||||
<div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
>
|
||||
<div
|
||||
class="Animate opacity notification flex info enter"
|
||||
style="--enter-duration: 100ms; --leave-duration: 100ms;"
|
||||
>
|
||||
<div
|
||||
class="box"
|
||||
>
|
||||
<i
|
||||
class="Icon material focusable"
|
||||
>
|
||||
<span
|
||||
class="icon"
|
||||
data-icon-name="info_outline"
|
||||
>
|
||||
info_outline
|
||||
</span>
|
||||
</i>
|
||||
</div>
|
||||
<div
|
||||
class="message box grow"
|
||||
>
|
||||
Checking for updates...
|
||||
</div>
|
||||
<div
|
||||
class="box"
|
||||
>
|
||||
<i
|
||||
class="Icon close material interactive focusable"
|
||||
data-testid="close-notification-for-notification_149"
|
||||
tabindex="0"
|
||||
>
|
||||
<span
|
||||
class="icon"
|
||||
data-icon-name="close"
|
||||
>
|
||||
close
|
||||
</span>
|
||||
</i>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Animate opacity notification flex info enter"
|
||||
style="--enter-duration: 100ms; --leave-duration: 100ms;"
|
||||
>
|
||||
<div
|
||||
class="box"
|
||||
>
|
||||
<i
|
||||
class="Icon material focusable"
|
||||
>
|
||||
<span
|
||||
class="icon"
|
||||
data-icon-name="info_outline"
|
||||
>
|
||||
info_outline
|
||||
</span>
|
||||
</i>
|
||||
</div>
|
||||
<div
|
||||
class="message box grow"
|
||||
>
|
||||
Download for version some-version started...
|
||||
</div>
|
||||
<div
|
||||
class="box"
|
||||
>
|
||||
<i
|
||||
class="Icon close material interactive focusable"
|
||||
data-testid="close-notification-for-notification_152"
|
||||
tabindex="0"
|
||||
>
|
||||
<span
|
||||
class="icon"
|
||||
data-icon-name="close"
|
||||
>
|
||||
close
|
||||
</span>
|
||||
</i>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Animate opacity notification flex info enter"
|
||||
style="--enter-duration: 100ms; --leave-duration: 100ms;"
|
||||
>
|
||||
<div
|
||||
class="box"
|
||||
>
|
||||
<i
|
||||
class="Icon material focusable"
|
||||
>
|
||||
<span
|
||||
class="icon"
|
||||
data-icon-name="info_outline"
|
||||
>
|
||||
info_outline
|
||||
</span>
|
||||
</i>
|
||||
</div>
|
||||
<div
|
||||
class="message box grow"
|
||||
>
|
||||
Download of update failed
|
||||
</div>
|
||||
<div
|
||||
class="box"
|
||||
>
|
||||
<i
|
||||
class="Icon close material interactive focusable"
|
||||
data-testid="close-notification-for-notification_157"
|
||||
tabindex="0"
|
||||
>
|
||||
<span
|
||||
class="icon"
|
||||
data-icon-name="close"
|
||||
>
|
||||
close
|
||||
</span>
|
||||
</i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
`;
|
||||
|
||||
exports[`installing update using tray when started when user checks for updates using tray when new update is discovered when download succeeds renders 1`] = `
|
||||
<body>
|
||||
<div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
>
|
||||
<div
|
||||
class="Animate opacity notification flex info enter"
|
||||
style="--enter-duration: 100ms; --leave-duration: 100ms;"
|
||||
>
|
||||
<div
|
||||
class="box"
|
||||
>
|
||||
<i
|
||||
class="Icon material focusable"
|
||||
>
|
||||
<span
|
||||
class="icon"
|
||||
data-icon-name="info_outline"
|
||||
>
|
||||
info_outline
|
||||
</span>
|
||||
</i>
|
||||
</div>
|
||||
<div
|
||||
class="message box grow"
|
||||
>
|
||||
Checking for updates...
|
||||
</div>
|
||||
<div
|
||||
class="box"
|
||||
>
|
||||
<i
|
||||
class="Icon close material interactive focusable"
|
||||
data-testid="close-notification-for-notification_215"
|
||||
tabindex="0"
|
||||
>
|
||||
<span
|
||||
class="icon"
|
||||
data-icon-name="close"
|
||||
>
|
||||
close
|
||||
</span>
|
||||
</i>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Animate opacity notification flex info enter"
|
||||
style="--enter-duration: 100ms; --leave-duration: 100ms;"
|
||||
>
|
||||
<div
|
||||
class="box"
|
||||
>
|
||||
<i
|
||||
class="Icon material focusable"
|
||||
>
|
||||
<span
|
||||
class="icon"
|
||||
data-icon-name="info_outline"
|
||||
>
|
||||
info_outline
|
||||
</span>
|
||||
</i>
|
||||
</div>
|
||||
<div
|
||||
class="message box grow"
|
||||
>
|
||||
Download for version some-version started...
|
||||
</div>
|
||||
<div
|
||||
class="box"
|
||||
>
|
||||
<i
|
||||
class="Icon close material interactive focusable"
|
||||
data-testid="close-notification-for-notification_218"
|
||||
tabindex="0"
|
||||
>
|
||||
<span
|
||||
class="icon"
|
||||
data-icon-name="close"
|
||||
>
|
||||
close
|
||||
</span>
|
||||
</i>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Animate opacity notification flex info enter"
|
||||
style="--enter-duration: 100ms; --leave-duration: 100ms;"
|
||||
>
|
||||
<div
|
||||
class="box"
|
||||
>
|
||||
<i
|
||||
class="Icon material focusable"
|
||||
>
|
||||
<span
|
||||
class="icon"
|
||||
data-icon-name="info_outline"
|
||||
>
|
||||
info_outline
|
||||
</span>
|
||||
</i>
|
||||
</div>
|
||||
<div
|
||||
class="message box grow"
|
||||
>
|
||||
<div
|
||||
class="flex column gaps"
|
||||
data-testid="ask-boolean-some-irrelevant-random-id"
|
||||
>
|
||||
<b>
|
||||
Update Available
|
||||
</b>
|
||||
<p>
|
||||
Version some-version of Lens IDE is available and ready to be installed. Would you like to update now?
|
||||
|
||||
Lens should restart automatically, if it doesn't please restart manually. Installed extensions might require updating.
|
||||
</p>
|
||||
<div
|
||||
class="flex gaps row align-left box grow"
|
||||
>
|
||||
<button
|
||||
class="Button light"
|
||||
data-testid="ask-boolean-some-irrelevant-random-id-button-yes"
|
||||
type="button"
|
||||
>
|
||||
Yes
|
||||
</button>
|
||||
<button
|
||||
class="Button active outlined"
|
||||
data-testid="ask-boolean-some-irrelevant-random-id-button-no"
|
||||
type="button"
|
||||
>
|
||||
No
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="box"
|
||||
>
|
||||
<i
|
||||
class="Icon close material interactive focusable"
|
||||
data-testid="close-notification-for-ask-boolean-for-some-irrelevant-random-id"
|
||||
tabindex="0"
|
||||
>
|
||||
<span
|
||||
class="icon"
|
||||
data-icon-name="close"
|
||||
>
|
||||
close
|
||||
</span>
|
||||
</i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
`;
|
||||
|
||||
exports[`installing update using tray when started when user checks for updates using tray when no new update is discovered renders 1`] = `
|
||||
<body>
|
||||
<div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
>
|
||||
<div
|
||||
class="Animate opacity notification flex info enter"
|
||||
style="--enter-duration: 100ms; --leave-duration: 100ms;"
|
||||
>
|
||||
<div
|
||||
class="box"
|
||||
>
|
||||
<i
|
||||
class="Icon material focusable"
|
||||
>
|
||||
<span
|
||||
class="icon"
|
||||
data-icon-name="info_outline"
|
||||
>
|
||||
info_outline
|
||||
</span>
|
||||
</i>
|
||||
</div>
|
||||
<div
|
||||
class="message box grow"
|
||||
>
|
||||
Checking for updates...
|
||||
</div>
|
||||
<div
|
||||
class="box"
|
||||
>
|
||||
<i
|
||||
class="Icon close material interactive focusable"
|
||||
data-testid="close-notification-for-notification_48"
|
||||
tabindex="0"
|
||||
>
|
||||
<span
|
||||
class="icon"
|
||||
data-icon-name="close"
|
||||
>
|
||||
close
|
||||
</span>
|
||||
</i>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Animate opacity notification flex info enter"
|
||||
style="--enter-duration: 100ms; --leave-duration: 100ms;"
|
||||
>
|
||||
<div
|
||||
class="box"
|
||||
>
|
||||
<i
|
||||
class="Icon material focusable"
|
||||
>
|
||||
<span
|
||||
class="icon"
|
||||
data-icon-name="info_outline"
|
||||
>
|
||||
info_outline
|
||||
</span>
|
||||
</i>
|
||||
</div>
|
||||
<div
|
||||
class="message box grow"
|
||||
>
|
||||
No new updates available
|
||||
</div>
|
||||
<div
|
||||
class="box"
|
||||
>
|
||||
<i
|
||||
class="Icon close material interactive focusable"
|
||||
data-testid="close-notification-for-notification_51"
|
||||
tabindex="0"
|
||||
>
|
||||
<span
|
||||
class="icon"
|
||||
data-icon-name="close"
|
||||
>
|
||||
close
|
||||
</span>
|
||||
</i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
`;
|
||||
@@ -0,0 +1,81 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`installing update when started renders 1`] = `
|
||||
<body>
|
||||
<div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
</body>
|
||||
`;
|
||||
|
||||
exports[`installing update when started when user checks for updates renders 1`] = `
|
||||
<body>
|
||||
<div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
</body>
|
||||
`;
|
||||
|
||||
exports[`installing update when started when user checks for updates when new update is discovered renders 1`] = `
|
||||
<body>
|
||||
<div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
</body>
|
||||
`;
|
||||
|
||||
exports[`installing update when started when user checks for updates when new update is discovered when download fails renders 1`] = `
|
||||
<body>
|
||||
<div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
</body>
|
||||
`;
|
||||
|
||||
exports[`installing update when started when user checks for updates when new update is discovered when download succeeds renders 1`] = `
|
||||
<body>
|
||||
<div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
</body>
|
||||
`;
|
||||
|
||||
exports[`installing update when started when user checks for updates when new update is discovered when download succeeds when user answers not to install the update renders 1`] = `
|
||||
<body>
|
||||
<div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
</body>
|
||||
`;
|
||||
|
||||
exports[`installing update when started when user checks for updates when new update is discovered when download succeeds when user answers to install the update renders 1`] = `
|
||||
<body>
|
||||
<div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
</body>
|
||||
`;
|
||||
|
||||
exports[`installing update when started when user checks for updates when no new update is discovered renders 1`] = `
|
||||
<body>
|
||||
<div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
</body>
|
||||
`;
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`periodical checking of updates given updater is enabled and configuration exists, when started renders 1`] = `
|
||||
<body>
|
||||
<div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
</body>
|
||||
`;
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`selection of update stability when started renders 1`] = `
|
||||
<body>
|
||||
<div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
</body>
|
||||
`;
|
||||
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import type { ApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
import { getApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
import electronUpdaterIsActiveInjectable from "../../main/electron-app/features/electron-updater-is-active.injectable";
|
||||
import publishIsConfiguredInjectable from "../../main/application-update/publish-is-configured.injectable";
|
||||
import type { AsyncFnMock } from "@async-fn/jest";
|
||||
import asyncFn from "@async-fn/jest";
|
||||
import type { CheckForPlatformUpdates } from "../../main/application-update/check-for-platform-updates/check-for-platform-updates.injectable";
|
||||
import checkForPlatformUpdatesInjectable from "../../main/application-update/check-for-platform-updates/check-for-platform-updates.injectable";
|
||||
import processCheckingForUpdatesInjectable from "../../main/application-update/check-for-updates/process-checking-for-updates.injectable";
|
||||
import selectedUpdateChannelInjectable from "../../common/application-update/selected-update-channel/selected-update-channel.injectable";
|
||||
import type { DiContainer } from "@ogre-tools/injectable";
|
||||
import appVersionInjectable from "../../common/get-configuration-file-model/app-version/app-version.injectable";
|
||||
import { updateChannels } from "../../common/application-update/update-channels";
|
||||
|
||||
describe("downgrading version update", () => {
|
||||
let applicationBuilder: ApplicationBuilder;
|
||||
let checkForPlatformUpdatesMock: AsyncFnMock<CheckForPlatformUpdates>;
|
||||
let mainDi: DiContainer;
|
||||
|
||||
beforeEach(() => {
|
||||
jest.useFakeTimers();
|
||||
|
||||
applicationBuilder = getApplicationBuilder();
|
||||
|
||||
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
|
||||
checkForPlatformUpdatesMock = asyncFn();
|
||||
|
||||
mainDi.override(
|
||||
checkForPlatformUpdatesInjectable,
|
||||
() => checkForPlatformUpdatesMock,
|
||||
);
|
||||
|
||||
mainDi.override(electronUpdaterIsActiveInjectable, () => true);
|
||||
mainDi.override(publishIsConfiguredInjectable, () => true);
|
||||
});
|
||||
|
||||
mainDi = applicationBuilder.dis.mainDi;
|
||||
});
|
||||
|
||||
[
|
||||
{
|
||||
updateChannel: updateChannels.latest,
|
||||
appVersion: "4.0.0-beta",
|
||||
downgradeIsAllowed: true,
|
||||
},
|
||||
{
|
||||
updateChannel: updateChannels.beta,
|
||||
appVersion: "4.0.0-beta",
|
||||
downgradeIsAllowed: false,
|
||||
},
|
||||
{
|
||||
updateChannel: updateChannels.beta,
|
||||
appVersion: "4.0.0-beta.1",
|
||||
downgradeIsAllowed: false,
|
||||
},
|
||||
{
|
||||
updateChannel: updateChannels.alpha,
|
||||
appVersion: "4.0.0-beta",
|
||||
downgradeIsAllowed: true,
|
||||
},
|
||||
{
|
||||
updateChannel: updateChannels.alpha,
|
||||
appVersion: "4.0.0-alpha",
|
||||
downgradeIsAllowed: false,
|
||||
},
|
||||
].forEach(({ appVersion, updateChannel, downgradeIsAllowed }) => {
|
||||
it(`given application version "${appVersion}" and update channel "${updateChannel.id}", when checking for updates, can${downgradeIsAllowed ? "": "not"} downgrade`, async () => {
|
||||
mainDi.override(appVersionInjectable, () => appVersion);
|
||||
|
||||
await applicationBuilder.render();
|
||||
|
||||
const selectedUpdateChannel = mainDi.inject(selectedUpdateChannelInjectable);
|
||||
|
||||
selectedUpdateChannel.setValue(updateChannel.id);
|
||||
|
||||
const processCheckingForUpdates = mainDi.inject(processCheckingForUpdatesInjectable);
|
||||
|
||||
processCheckingForUpdates();
|
||||
|
||||
expect(checkForPlatformUpdatesMock).toHaveBeenCalledWith(expect.any(Object), { allowDowngrade: downgradeIsAllowed });
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,235 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import type { ApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
import { getApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
import type { RenderResult } from "@testing-library/react";
|
||||
import electronUpdaterIsActiveInjectable from "../../main/electron-app/features/electron-updater-is-active.injectable";
|
||||
import publishIsConfiguredInjectable from "../../main/application-update/publish-is-configured.injectable";
|
||||
import type { CheckForPlatformUpdates } from "../../main/application-update/check-for-platform-updates/check-for-platform-updates.injectable";
|
||||
import checkForPlatformUpdatesInjectable from "../../main/application-update/check-for-platform-updates/check-for-platform-updates.injectable";
|
||||
import type { AsyncFnMock } from "@async-fn/jest";
|
||||
import asyncFn from "@async-fn/jest";
|
||||
import type { DownloadPlatformUpdate } from "../../main/application-update/download-platform-update/download-platform-update.injectable";
|
||||
import downloadPlatformUpdateInjectable from "../../main/application-update/download-platform-update/download-platform-update.injectable";
|
||||
import showApplicationWindowInjectable from "../../main/start-main-application/lens-window/show-application-window.injectable";
|
||||
import progressOfUpdateDownloadInjectable from "../../common/application-update/progress-of-update-download/progress-of-update-download.injectable";
|
||||
|
||||
describe("installing update using tray", () => {
|
||||
let applicationBuilder: ApplicationBuilder;
|
||||
let checkForPlatformUpdatesMock: AsyncFnMock<CheckForPlatformUpdates>;
|
||||
let downloadPlatformUpdateMock: AsyncFnMock<DownloadPlatformUpdate>;
|
||||
let showApplicationWindowMock: jest.Mock;
|
||||
|
||||
beforeEach(() => {
|
||||
applicationBuilder = getApplicationBuilder();
|
||||
|
||||
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
|
||||
checkForPlatformUpdatesMock = asyncFn();
|
||||
downloadPlatformUpdateMock = asyncFn();
|
||||
showApplicationWindowMock = jest.fn();
|
||||
|
||||
mainDi.override(showApplicationWindowInjectable, () => showApplicationWindowMock);
|
||||
|
||||
mainDi.override(
|
||||
checkForPlatformUpdatesInjectable,
|
||||
() => checkForPlatformUpdatesMock,
|
||||
);
|
||||
|
||||
mainDi.override(
|
||||
downloadPlatformUpdateInjectable,
|
||||
() => downloadPlatformUpdateMock,
|
||||
);
|
||||
|
||||
mainDi.override(electronUpdaterIsActiveInjectable, () => true);
|
||||
mainDi.override(publishIsConfiguredInjectable, () => true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("when started", () => {
|
||||
let rendered: RenderResult;
|
||||
|
||||
beforeEach(async () => {
|
||||
rendered = await applicationBuilder.render();
|
||||
});
|
||||
|
||||
it("renders", () => {
|
||||
expect(rendered.baseElement).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("user cannot install update yet", () => {
|
||||
expect(applicationBuilder.tray.get("install-update")).toBeUndefined();
|
||||
});
|
||||
|
||||
describe("when user checks for updates using tray", () => {
|
||||
let processCheckingForUpdatesPromise: Promise<void>;
|
||||
|
||||
beforeEach(async () => {
|
||||
processCheckingForUpdatesPromise =
|
||||
applicationBuilder.tray.click("check-for-updates");
|
||||
});
|
||||
|
||||
it("does not show application window yet", () => {
|
||||
expect(showApplicationWindowMock).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("user cannot check for updates again", () => {
|
||||
expect(
|
||||
applicationBuilder.tray.get("check-for-updates")?.enabled.get(),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("name of tray item for checking updates indicates that checking is happening", () => {
|
||||
expect(
|
||||
applicationBuilder.tray.get("check-for-updates")?.label?.get(),
|
||||
).toBe("Checking for updates...");
|
||||
});
|
||||
|
||||
it("user cannot install update yet", () => {
|
||||
expect(applicationBuilder.tray.get("install-update")).toBeUndefined();
|
||||
});
|
||||
|
||||
it("renders", () => {
|
||||
expect(rendered.baseElement).toMatchSnapshot();
|
||||
});
|
||||
|
||||
describe("when no new update is discovered", () => {
|
||||
beforeEach(async () => {
|
||||
await checkForPlatformUpdatesMock.resolve({
|
||||
updateWasDiscovered: false,
|
||||
});
|
||||
|
||||
await processCheckingForUpdatesPromise;
|
||||
});
|
||||
|
||||
it("shows application window", () => {
|
||||
expect(showApplicationWindowMock).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("user cannot install update", () => {
|
||||
expect(applicationBuilder.tray.get("install-update")).toBeUndefined();
|
||||
});
|
||||
|
||||
it("user can check for updates again", () => {
|
||||
expect(
|
||||
applicationBuilder.tray.get("check-for-updates")?.enabled.get(),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it("name of tray item for checking updates no longer indicates that checking is happening", () => {
|
||||
expect(
|
||||
applicationBuilder.tray.get("check-for-updates")?.label?.get(),
|
||||
).toBe("Check for updates");
|
||||
});
|
||||
|
||||
it("renders", () => {
|
||||
expect(rendered.baseElement).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
describe("when new update is discovered", () => {
|
||||
beforeEach(async () => {
|
||||
await checkForPlatformUpdatesMock.resolve({
|
||||
updateWasDiscovered: true,
|
||||
version: "some-version",
|
||||
});
|
||||
|
||||
await processCheckingForUpdatesPromise;
|
||||
});
|
||||
|
||||
it("shows application window", () => {
|
||||
expect(showApplicationWindowMock).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("user cannot check for updates again yet", () => {
|
||||
expect(
|
||||
applicationBuilder.tray.get("check-for-updates")?.enabled.get(),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("name of tray item for checking updates indicates that downloading is happening", () => {
|
||||
expect(
|
||||
applicationBuilder.tray.get("check-for-updates")?.label?.get(),
|
||||
).toBe("Downloading update some-version (0%)...");
|
||||
});
|
||||
|
||||
it("when download progresses with decimals, percentage increases as integers", () => {
|
||||
const progressOfUpdateDownload = applicationBuilder.dis.mainDi.inject(
|
||||
progressOfUpdateDownloadInjectable,
|
||||
);
|
||||
|
||||
progressOfUpdateDownload.set({ percentage: 42.424242 });
|
||||
|
||||
expect(
|
||||
applicationBuilder.tray.get("check-for-updates")?.label?.get(),
|
||||
).toBe("Downloading update some-version (42%)...");
|
||||
});
|
||||
|
||||
it("user still cannot install update", () => {
|
||||
expect(applicationBuilder.tray.get("install-update")).toBeUndefined();
|
||||
});
|
||||
|
||||
it("renders", () => {
|
||||
expect(rendered.baseElement).toMatchSnapshot();
|
||||
});
|
||||
|
||||
describe("when download fails", () => {
|
||||
beforeEach(async () => {
|
||||
await downloadPlatformUpdateMock.resolve({ downloadWasSuccessful: false });
|
||||
});
|
||||
|
||||
it("user cannot install update", () => {
|
||||
expect(
|
||||
applicationBuilder.tray.get("install-update"),
|
||||
).toBeUndefined();
|
||||
});
|
||||
|
||||
it("user can check for updates again", () => {
|
||||
expect(
|
||||
applicationBuilder.tray.get("check-for-updates")?.enabled.get(),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it("name of tray item for checking updates no longer indicates that downloading is happening", () => {
|
||||
expect(
|
||||
applicationBuilder.tray.get("check-for-updates")?.label?.get(),
|
||||
).toBe("Check for updates");
|
||||
});
|
||||
|
||||
it("renders", () => {
|
||||
expect(rendered.baseElement).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
describe("when download succeeds", () => {
|
||||
beforeEach(async () => {
|
||||
await downloadPlatformUpdateMock.resolve({ downloadWasSuccessful: true });
|
||||
});
|
||||
|
||||
it("user can install update", () => {
|
||||
expect(
|
||||
applicationBuilder.tray.get("install-update")?.label?.get(),
|
||||
).toBe("Install update some-version");
|
||||
});
|
||||
|
||||
it("user can check for updates again", () => {
|
||||
expect(
|
||||
applicationBuilder.tray.get("check-for-updates")?.enabled.get(),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it("name of tray item for checking updates no longer indicates that downloading is happening", () => {
|
||||
expect(
|
||||
applicationBuilder.tray.get("check-for-updates")?.label?.get(),
|
||||
).toBe("Check for updates");
|
||||
});
|
||||
|
||||
it("renders", () => {
|
||||
expect(rendered.baseElement).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,225 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import type { ApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
import { getApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
import quitAndInstallUpdateInjectable from "../../main/electron-app/features/quit-and-install-update.injectable";
|
||||
import type { RenderResult } from "@testing-library/react";
|
||||
import electronUpdaterIsActiveInjectable from "../../main/electron-app/features/electron-updater-is-active.injectable";
|
||||
import publishIsConfiguredInjectable from "../../main/application-update/publish-is-configured.injectable";
|
||||
import type { CheckForPlatformUpdates } from "../../main/application-update/check-for-platform-updates/check-for-platform-updates.injectable";
|
||||
import checkForPlatformUpdatesInjectable from "../../main/application-update/check-for-platform-updates/check-for-platform-updates.injectable";
|
||||
import type { AsyncFnMock } from "@async-fn/jest";
|
||||
import asyncFn from "@async-fn/jest";
|
||||
import type { DownloadPlatformUpdate } from "../../main/application-update/download-platform-update/download-platform-update.injectable";
|
||||
import downloadPlatformUpdateInjectable from "../../main/application-update/download-platform-update/download-platform-update.injectable";
|
||||
import setUpdateOnQuitInjectable from "../../main/electron-app/features/set-update-on-quit.injectable";
|
||||
import type { AskBoolean } from "../../main/ask-boolean/ask-boolean.injectable";
|
||||
import askBooleanInjectable from "../../main/ask-boolean/ask-boolean.injectable";
|
||||
import showInfoNotificationInjectable from "../../renderer/components/notifications/show-info-notification.injectable";
|
||||
import processCheckingForUpdatesInjectable from "../../main/application-update/check-for-updates/process-checking-for-updates.injectable";
|
||||
|
||||
describe("installing update", () => {
|
||||
let applicationBuilder: ApplicationBuilder;
|
||||
let quitAndInstallUpdateMock: jest.Mock;
|
||||
let checkForPlatformUpdatesMock: AsyncFnMock<CheckForPlatformUpdates>;
|
||||
let downloadPlatformUpdateMock: AsyncFnMock<DownloadPlatformUpdate>;
|
||||
let setUpdateOnQuitMock: jest.Mock;
|
||||
let showInfoNotificationMock: jest.Mock;
|
||||
let askBooleanMock: AsyncFnMock<AskBoolean>;
|
||||
|
||||
beforeEach(() => {
|
||||
applicationBuilder = getApplicationBuilder();
|
||||
|
||||
applicationBuilder.beforeApplicationStart(({ mainDi, rendererDi }) => {
|
||||
quitAndInstallUpdateMock = jest.fn();
|
||||
checkForPlatformUpdatesMock = asyncFn();
|
||||
downloadPlatformUpdateMock = asyncFn();
|
||||
setUpdateOnQuitMock = jest.fn();
|
||||
showInfoNotificationMock = jest.fn(() => () => {});
|
||||
askBooleanMock = asyncFn();
|
||||
|
||||
rendererDi.override(showInfoNotificationInjectable, () => showInfoNotificationMock);
|
||||
|
||||
mainDi.override(askBooleanInjectable, () => askBooleanMock);
|
||||
mainDi.override(setUpdateOnQuitInjectable, () => setUpdateOnQuitMock);
|
||||
|
||||
mainDi.override(
|
||||
checkForPlatformUpdatesInjectable,
|
||||
() => checkForPlatformUpdatesMock,
|
||||
);
|
||||
|
||||
mainDi.override(
|
||||
downloadPlatformUpdateInjectable,
|
||||
() => downloadPlatformUpdateMock,
|
||||
);
|
||||
|
||||
mainDi.override(
|
||||
quitAndInstallUpdateInjectable,
|
||||
() => quitAndInstallUpdateMock,
|
||||
);
|
||||
|
||||
mainDi.override(electronUpdaterIsActiveInjectable, () => true);
|
||||
mainDi.override(publishIsConfiguredInjectable, () => true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("when started", () => {
|
||||
let rendered: RenderResult;
|
||||
let processCheckingForUpdates: () => Promise<void>;
|
||||
|
||||
beforeEach(async () => {
|
||||
rendered = await applicationBuilder.render();
|
||||
|
||||
processCheckingForUpdates = applicationBuilder.dis.mainDi.inject(processCheckingForUpdatesInjectable);
|
||||
});
|
||||
|
||||
it("renders", () => {
|
||||
expect(rendered.baseElement).toMatchSnapshot();
|
||||
});
|
||||
|
||||
describe("when user checks for updates", () => {
|
||||
let processCheckingForUpdatesPromise: Promise<void>;
|
||||
|
||||
beforeEach(async () => {
|
||||
processCheckingForUpdatesPromise = processCheckingForUpdates();
|
||||
});
|
||||
|
||||
it("checks for updates", () => {
|
||||
expect(checkForPlatformUpdatesMock).toHaveBeenCalledWith(
|
||||
expect.any(Object),
|
||||
{ allowDowngrade: true },
|
||||
);
|
||||
});
|
||||
|
||||
it("notifies the user that checking for updates is happening", () => {
|
||||
expect(showInfoNotificationMock).toHaveBeenCalledWith("Checking for updates...");
|
||||
});
|
||||
|
||||
it("renders", () => {
|
||||
expect(rendered.baseElement).toMatchSnapshot();
|
||||
});
|
||||
|
||||
describe("when no new update is discovered", () => {
|
||||
beforeEach(async () => {
|
||||
showInfoNotificationMock.mockClear();
|
||||
|
||||
await checkForPlatformUpdatesMock.resolve({
|
||||
updateWasDiscovered: false,
|
||||
});
|
||||
|
||||
await processCheckingForUpdatesPromise;
|
||||
});
|
||||
|
||||
it("notifies the user", () => {
|
||||
expect(showInfoNotificationMock).toHaveBeenCalledWith("No new updates available");
|
||||
});
|
||||
|
||||
it("does not start downloading update", () => {
|
||||
expect(downloadPlatformUpdateMock).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("renders", () => {
|
||||
expect(rendered.baseElement).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
describe("when new update is discovered", () => {
|
||||
beforeEach(async () => {
|
||||
await checkForPlatformUpdatesMock.resolve({
|
||||
updateWasDiscovered: true,
|
||||
version: "some-version",
|
||||
});
|
||||
|
||||
await processCheckingForUpdatesPromise;
|
||||
});
|
||||
|
||||
it("starts downloading the update", () => {
|
||||
expect(downloadPlatformUpdateMock).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("notifies the user that download is happening", () => {
|
||||
expect(showInfoNotificationMock).toHaveBeenCalledWith("Download for version some-version started...");
|
||||
});
|
||||
|
||||
it("renders", () => {
|
||||
expect(rendered.baseElement).toMatchSnapshot();
|
||||
});
|
||||
|
||||
describe("when download fails", () => {
|
||||
beforeEach(async () => {
|
||||
await downloadPlatformUpdateMock.resolve({ downloadWasSuccessful: false });
|
||||
});
|
||||
|
||||
it("does not quit and install update yet", () => {
|
||||
expect(quitAndInstallUpdateMock).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("notifies the user about failed download", () => {
|
||||
expect(showInfoNotificationMock).toHaveBeenCalledWith("Download of update failed");
|
||||
});
|
||||
|
||||
it("does not ask user to install update", () => {
|
||||
expect(askBooleanMock).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("renders", () => {
|
||||
expect(rendered.baseElement).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
describe("when download succeeds", () => {
|
||||
beforeEach(async () => {
|
||||
await downloadPlatformUpdateMock.resolve({ downloadWasSuccessful: true });
|
||||
});
|
||||
|
||||
it("does not quit and install update yet", () => {
|
||||
expect(quitAndInstallUpdateMock).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("renders", () => {
|
||||
expect(rendered.baseElement).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("asks user to install update immediately", () => {
|
||||
expect(askBooleanMock).toHaveBeenCalledWith({
|
||||
title: "Update Available",
|
||||
question:
|
||||
"Version some-version of Lens IDE is available and ready to be installed. Would you like to update now?\n\n" +
|
||||
"Lens should restart automatically, if it doesn't please restart manually. Installed extensions might require updating.",
|
||||
});
|
||||
});
|
||||
|
||||
describe("when user answers to install the update", () => {
|
||||
beforeEach(async () => {
|
||||
await askBooleanMock.resolve(true);
|
||||
});
|
||||
|
||||
it("renders", () => {
|
||||
expect(rendered.baseElement).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("quits application and installs the update", () => {
|
||||
expect(quitAndInstallUpdateMock).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe("when user answers not to install the update", () => {
|
||||
beforeEach(async () => {
|
||||
await askBooleanMock.resolve(false);
|
||||
});
|
||||
|
||||
it("renders", () => {
|
||||
expect(rendered.baseElement).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("does not quit application and install the update", () => {
|
||||
expect(quitAndInstallUpdateMock).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,117 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import type { ApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
import { getApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
import type { RenderResult } from "@testing-library/react";
|
||||
import electronUpdaterIsActiveInjectable from "../../main/electron-app/features/electron-updater-is-active.injectable";
|
||||
import publishIsConfiguredInjectable from "../../main/application-update/publish-is-configured.injectable";
|
||||
import type { AsyncFnMock } from "@async-fn/jest";
|
||||
import asyncFn from "@async-fn/jest";
|
||||
import processCheckingForUpdatesInjectable from "../../main/application-update/check-for-updates/process-checking-for-updates.injectable";
|
||||
import periodicalCheckForUpdatesInjectable from "../../main/application-update/periodical-check-for-updates/periodical-check-for-updates.injectable";
|
||||
|
||||
const ENOUGH_TIME = 1000 * 60 * 60 * 2;
|
||||
|
||||
describe("periodical checking of updates", () => {
|
||||
let applicationBuilder: ApplicationBuilder;
|
||||
let processCheckingForUpdatesMock: AsyncFnMock<() => Promise<void>>;
|
||||
|
||||
beforeEach(() => {
|
||||
jest.useFakeTimers();
|
||||
|
||||
applicationBuilder = getApplicationBuilder();
|
||||
|
||||
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
|
||||
mainDi.unoverride(periodicalCheckForUpdatesInjectable);
|
||||
mainDi.permitSideEffects(periodicalCheckForUpdatesInjectable);
|
||||
|
||||
processCheckingForUpdatesMock = asyncFn();
|
||||
|
||||
mainDi.override(
|
||||
processCheckingForUpdatesInjectable,
|
||||
() => processCheckingForUpdatesMock,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("given updater is enabled and configuration exists, when started", () => {
|
||||
let rendered: RenderResult;
|
||||
|
||||
beforeEach(async () => {
|
||||
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
|
||||
mainDi.override(electronUpdaterIsActiveInjectable, () => true);
|
||||
mainDi.override(publishIsConfiguredInjectable, () => true);
|
||||
});
|
||||
|
||||
rendered = await applicationBuilder.render();
|
||||
});
|
||||
|
||||
it("renders", () => {
|
||||
expect(rendered.baseElement).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("checks for updates", () => {
|
||||
expect(processCheckingForUpdatesMock).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("when just not enough time passes, does not check for updates again automatically yet", () => {
|
||||
processCheckingForUpdatesMock.mockClear();
|
||||
|
||||
jest.advanceTimersByTime(ENOUGH_TIME - 1);
|
||||
|
||||
expect(processCheckingForUpdatesMock).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("when just enough time passes, checks for updates again automatically", () => {
|
||||
processCheckingForUpdatesMock.mockClear();
|
||||
|
||||
jest.advanceTimersByTime(ENOUGH_TIME);
|
||||
|
||||
expect(processCheckingForUpdatesMock).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe("given updater is enabled but no configuration exist, when started", () => {
|
||||
beforeEach(async () => {
|
||||
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
|
||||
mainDi.override(electronUpdaterIsActiveInjectable, () => true);
|
||||
mainDi.override(publishIsConfiguredInjectable, () => false);
|
||||
});
|
||||
|
||||
await applicationBuilder.render();
|
||||
});
|
||||
|
||||
it("does not check for updates", () => {
|
||||
expect(processCheckingForUpdatesMock).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("when time passes, never checks for updates", () => {
|
||||
jest.runOnlyPendingTimers();
|
||||
|
||||
expect(processCheckingForUpdatesMock).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe("given updater is not enabled but and configuration exist, when started", () => {
|
||||
beforeEach(async () => {
|
||||
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
|
||||
mainDi.override(electronUpdaterIsActiveInjectable, () => false);
|
||||
mainDi.override(publishIsConfiguredInjectable, () => true);
|
||||
});
|
||||
|
||||
await applicationBuilder.render();
|
||||
});
|
||||
|
||||
it("does not check for updates", () => {
|
||||
expect(processCheckingForUpdatesMock).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("when time passes, never checks for updates", () => {
|
||||
jest.runOnlyPendingTimers();
|
||||
|
||||
expect(processCheckingForUpdatesMock).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,331 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import type { ApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
import { getApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
import quitAndInstallUpdateInjectable from "../../main/electron-app/features/quit-and-install-update.injectable";
|
||||
import type { RenderResult } from "@testing-library/react";
|
||||
import electronUpdaterIsActiveInjectable from "../../main/electron-app/features/electron-updater-is-active.injectable";
|
||||
import publishIsConfiguredInjectable from "../../main/application-update/publish-is-configured.injectable";
|
||||
import type { CheckForPlatformUpdates } from "../../main/application-update/check-for-platform-updates/check-for-platform-updates.injectable";
|
||||
import checkForPlatformUpdatesInjectable from "../../main/application-update/check-for-platform-updates/check-for-platform-updates.injectable";
|
||||
import type { AsyncFnMock } from "@async-fn/jest";
|
||||
import asyncFn from "@async-fn/jest";
|
||||
import type { UpdateChannel, UpdateChannelId } from "../../common/application-update/update-channels";
|
||||
import { updateChannels } from "../../common/application-update/update-channels";
|
||||
import type { DownloadPlatformUpdate } from "../../main/application-update/download-platform-update/download-platform-update.injectable";
|
||||
import downloadPlatformUpdateInjectable from "../../main/application-update/download-platform-update/download-platform-update.injectable";
|
||||
import selectedUpdateChannelInjectable from "../../common/application-update/selected-update-channel/selected-update-channel.injectable";
|
||||
import type { IComputedValue } from "mobx";
|
||||
import setUpdateOnQuitInjectable from "../../main/electron-app/features/set-update-on-quit.injectable";
|
||||
import type { AskBoolean } from "../../main/ask-boolean/ask-boolean.injectable";
|
||||
import askBooleanInjectable from "../../main/ask-boolean/ask-boolean.injectable";
|
||||
import showInfoNotificationInjectable from "../../renderer/components/notifications/show-info-notification.injectable";
|
||||
import processCheckingForUpdatesInjectable from "../../main/application-update/check-for-updates/process-checking-for-updates.injectable";
|
||||
import appVersionInjectable from "../../common/get-configuration-file-model/app-version/app-version.injectable";
|
||||
|
||||
describe("selection of update stability", () => {
|
||||
let applicationBuilder: ApplicationBuilder;
|
||||
let quitAndInstallUpdateMock: jest.Mock;
|
||||
let checkForPlatformUpdatesMock: AsyncFnMock<CheckForPlatformUpdates>;
|
||||
let downloadPlatformUpdateMock: AsyncFnMock<DownloadPlatformUpdate>;
|
||||
let setUpdateOnQuitMock: jest.Mock;
|
||||
let showInfoNotificationMock: jest.Mock;
|
||||
let askBooleanMock: AsyncFnMock<AskBoolean>;
|
||||
|
||||
beforeEach(() => {
|
||||
applicationBuilder = getApplicationBuilder();
|
||||
|
||||
applicationBuilder.beforeApplicationStart(({ mainDi, rendererDi }) => {
|
||||
quitAndInstallUpdateMock = jest.fn();
|
||||
checkForPlatformUpdatesMock = asyncFn();
|
||||
downloadPlatformUpdateMock = asyncFn();
|
||||
setUpdateOnQuitMock = jest.fn();
|
||||
showInfoNotificationMock = jest.fn(() => () => {});
|
||||
askBooleanMock = asyncFn();
|
||||
|
||||
rendererDi.override(showInfoNotificationInjectable, () => showInfoNotificationMock);
|
||||
|
||||
mainDi.override(askBooleanInjectable, () => askBooleanMock);
|
||||
mainDi.override(setUpdateOnQuitInjectable, () => setUpdateOnQuitMock);
|
||||
|
||||
mainDi.override(
|
||||
checkForPlatformUpdatesInjectable,
|
||||
() => checkForPlatformUpdatesMock,
|
||||
);
|
||||
|
||||
mainDi.override(
|
||||
downloadPlatformUpdateInjectable,
|
||||
() => downloadPlatformUpdateMock,
|
||||
);
|
||||
|
||||
mainDi.override(
|
||||
quitAndInstallUpdateInjectable,
|
||||
() => quitAndInstallUpdateMock,
|
||||
);
|
||||
|
||||
mainDi.override(electronUpdaterIsActiveInjectable, () => true);
|
||||
mainDi.override(publishIsConfiguredInjectable, () => true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("when started", () => {
|
||||
let rendered: RenderResult;
|
||||
let processCheckingForUpdates: () => Promise<void>;
|
||||
|
||||
beforeEach(async () => {
|
||||
rendered = await applicationBuilder.render();
|
||||
|
||||
processCheckingForUpdates = applicationBuilder.dis.mainDi.inject(processCheckingForUpdatesInjectable);
|
||||
});
|
||||
|
||||
it("renders", () => {
|
||||
expect(rendered.baseElement).toMatchSnapshot();
|
||||
});
|
||||
|
||||
describe('given update channel "alpha" is selected, when checking for updates', () => {
|
||||
let selectedUpdateChannel: {
|
||||
value: IComputedValue<UpdateChannel>;
|
||||
setValue: (channelId: UpdateChannelId) => void;
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
selectedUpdateChannel = applicationBuilder.dis.mainDi.inject(
|
||||
selectedUpdateChannelInjectable,
|
||||
);
|
||||
|
||||
selectedUpdateChannel.setValue(updateChannels.alpha.id);
|
||||
|
||||
processCheckingForUpdates();
|
||||
});
|
||||
|
||||
it('checks updates from update channel "alpha"', () => {
|
||||
expect(checkForPlatformUpdatesMock).toHaveBeenCalledWith(
|
||||
updateChannels.alpha,
|
||||
{ allowDowngrade: true },
|
||||
);
|
||||
});
|
||||
|
||||
it("when update is discovered, does not check update from other update channels", async () => {
|
||||
checkForPlatformUpdatesMock.mockClear();
|
||||
|
||||
await checkForPlatformUpdatesMock.resolve({
|
||||
updateWasDiscovered: true,
|
||||
version: "some-version",
|
||||
});
|
||||
|
||||
expect(checkForPlatformUpdatesMock).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
describe("when no update is discovered", () => {
|
||||
beforeEach(async () => {
|
||||
checkForPlatformUpdatesMock.mockClear();
|
||||
|
||||
await checkForPlatformUpdatesMock.resolve({
|
||||
updateWasDiscovered: false,
|
||||
});
|
||||
});
|
||||
|
||||
it('checks updates from update channel "beta"', () => {
|
||||
expect(checkForPlatformUpdatesMock).toHaveBeenCalledWith(
|
||||
updateChannels.beta,
|
||||
{ allowDowngrade: true },
|
||||
);
|
||||
});
|
||||
|
||||
it("when update is discovered, does not check update from other update channels", async () => {
|
||||
checkForPlatformUpdatesMock.mockClear();
|
||||
|
||||
await checkForPlatformUpdatesMock.resolve({
|
||||
updateWasDiscovered: true,
|
||||
version: "some-version",
|
||||
});
|
||||
|
||||
expect(checkForPlatformUpdatesMock).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
describe("when no update is discovered again", () => {
|
||||
beforeEach(async () => {
|
||||
checkForPlatformUpdatesMock.mockClear();
|
||||
|
||||
await checkForPlatformUpdatesMock.resolve({
|
||||
updateWasDiscovered: false,
|
||||
});
|
||||
});
|
||||
|
||||
it('finally checks updates from update channel "latest"', () => {
|
||||
expect(checkForPlatformUpdatesMock).toHaveBeenCalledWith(
|
||||
updateChannels.latest,
|
||||
{ allowDowngrade: true },
|
||||
);
|
||||
});
|
||||
|
||||
it("when update is discovered, does not check update from other update channels", async () => {
|
||||
checkForPlatformUpdatesMock.mockClear();
|
||||
|
||||
await checkForPlatformUpdatesMock.resolve({
|
||||
updateWasDiscovered: true,
|
||||
version: "some-version",
|
||||
});
|
||||
|
||||
expect(checkForPlatformUpdatesMock).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('given update channel "beta" is selected', () => {
|
||||
let selectedUpdateChannel: {
|
||||
value: IComputedValue<UpdateChannel>;
|
||||
setValue: (channelId: UpdateChannelId) => void;
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
selectedUpdateChannel = applicationBuilder.dis.mainDi.inject(
|
||||
selectedUpdateChannelInjectable,
|
||||
);
|
||||
|
||||
selectedUpdateChannel.setValue(updateChannels.beta.id);
|
||||
});
|
||||
|
||||
describe("when checking for updates", () => {
|
||||
beforeEach(() => {
|
||||
processCheckingForUpdates();
|
||||
});
|
||||
|
||||
describe('when update from "beta" channel is discovered', () => {
|
||||
beforeEach(async () => {
|
||||
await checkForPlatformUpdatesMock.resolve({
|
||||
updateWasDiscovered: true,
|
||||
version: "some-beta-version",
|
||||
});
|
||||
});
|
||||
|
||||
describe("when update is downloaded", () => {
|
||||
beforeEach(async () => {
|
||||
await downloadPlatformUpdateMock.resolve({ downloadWasSuccessful: true });
|
||||
});
|
||||
|
||||
it("when user would close the application, installs the update", () => {
|
||||
expect(setUpdateOnQuitMock).toHaveBeenLastCalledWith(true);
|
||||
});
|
||||
|
||||
it('given user changes update channel to "latest", when user would close the application, does not install the update for not being stable enough', () => {
|
||||
selectedUpdateChannel.setValue(updateChannels.latest.id);
|
||||
|
||||
expect(setUpdateOnQuitMock).toHaveBeenLastCalledWith(false);
|
||||
});
|
||||
|
||||
it('given user changes update channel to "alpha", when user would close the application, installs the update for being stable enough', () => {
|
||||
selectedUpdateChannel.setValue(updateChannels.alpha.id);
|
||||
|
||||
expect(setUpdateOnQuitMock).toHaveBeenLastCalledWith(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it("given valid update channel selection is stored, when checking for updates, checks for updates from the update channel", async () => {
|
||||
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
|
||||
// TODO: Switch to more natural way of setting initial value
|
||||
// TODO: UserStore is currently responsible for getting and setting initial value
|
||||
const selectedUpdateChannel = mainDi.inject(selectedUpdateChannelInjectable);
|
||||
|
||||
selectedUpdateChannel.setValue(updateChannels.beta.id);
|
||||
});
|
||||
|
||||
await applicationBuilder.render();
|
||||
|
||||
const processCheckingForUpdates = applicationBuilder.dis.mainDi.inject(processCheckingForUpdatesInjectable);
|
||||
|
||||
processCheckingForUpdates();
|
||||
|
||||
expect(checkForPlatformUpdatesMock).toHaveBeenCalledWith(updateChannels.beta, expect.any(Object));
|
||||
});
|
||||
|
||||
it("given invalid update channel selection is stored, when checking for updates, checks for updates from the update channel", async () => {
|
||||
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
|
||||
// TODO: Switch to more natural way of setting initial value
|
||||
// TODO: UserStore is currently responsible for getting and setting initial value
|
||||
const selectedUpdateChannel = mainDi.inject(selectedUpdateChannelInjectable);
|
||||
|
||||
selectedUpdateChannel.setValue("something-invalid" as UpdateChannelId);
|
||||
});
|
||||
|
||||
await applicationBuilder.render();
|
||||
|
||||
const processCheckingForUpdates = applicationBuilder.dis.mainDi.inject(processCheckingForUpdatesInjectable);
|
||||
|
||||
processCheckingForUpdates();
|
||||
|
||||
expect(checkForPlatformUpdatesMock).toHaveBeenCalledWith(updateChannels.latest, expect.any(Object));
|
||||
});
|
||||
|
||||
it('given no update channel selection is stored and currently using stable release, when user checks for updates, checks for updates from "latest" update channel by default', async () => {
|
||||
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
|
||||
mainDi.override(appVersionInjectable, () => "1.0.0");
|
||||
});
|
||||
|
||||
await applicationBuilder.render();
|
||||
|
||||
const processCheckingForUpdates = applicationBuilder.dis.mainDi.inject(processCheckingForUpdatesInjectable);
|
||||
|
||||
processCheckingForUpdates();
|
||||
|
||||
expect(checkForPlatformUpdatesMock).toHaveBeenCalledWith(
|
||||
updateChannels.latest,
|
||||
{ allowDowngrade: true },
|
||||
);
|
||||
});
|
||||
|
||||
it('given no update channel selection is stored and currently using alpha release, when checking for updates, checks for updates from "alpha" channel', async () => {
|
||||
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
|
||||
mainDi.override(appVersionInjectable, () => "1.0.0-alpha");
|
||||
});
|
||||
|
||||
await applicationBuilder.render();
|
||||
|
||||
const processCheckingForUpdates = applicationBuilder.dis.mainDi.inject(processCheckingForUpdatesInjectable);
|
||||
|
||||
processCheckingForUpdates();
|
||||
|
||||
expect(checkForPlatformUpdatesMock).toHaveBeenCalledWith(updateChannels.alpha, expect.any(Object));
|
||||
});
|
||||
|
||||
it('given no update channel selection is stored and currently using beta release, when checking for updates, checks for updates from "beta" channel', async () => {
|
||||
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
|
||||
mainDi.override(appVersionInjectable, () => "1.0.0-beta");
|
||||
});
|
||||
|
||||
await applicationBuilder.render();
|
||||
|
||||
const processCheckingForUpdates = applicationBuilder.dis.mainDi.inject(processCheckingForUpdatesInjectable);
|
||||
|
||||
processCheckingForUpdates();
|
||||
|
||||
expect(checkForPlatformUpdatesMock).toHaveBeenCalledWith(updateChannels.beta, expect.any(Object));
|
||||
});
|
||||
|
||||
it("given update channel selection is stored and currently using prerelease, when checking for updates, checks for updates from stored channel", async () => {
|
||||
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
|
||||
mainDi.override(appVersionInjectable, () => "1.0.0-alpha");
|
||||
|
||||
// TODO: Switch to more natural way of setting initial value
|
||||
// TODO: UserStore is currently responsible for getting and setting initial value
|
||||
const selectedUpdateChannel = mainDi.inject(selectedUpdateChannelInjectable);
|
||||
|
||||
selectedUpdateChannel.setValue(updateChannels.beta.id);
|
||||
});
|
||||
|
||||
await applicationBuilder.render();
|
||||
|
||||
const processCheckingForUpdates = applicationBuilder.dis.mainDi.inject(processCheckingForUpdatesInjectable);
|
||||
|
||||
processCheckingForUpdates();
|
||||
|
||||
expect(checkForPlatformUpdatesMock).toHaveBeenCalledWith(updateChannels.beta, expect.any(Object));
|
||||
});
|
||||
});
|
||||
@@ -328,6 +328,9 @@ exports[`cluster - order of sidebar items when rendered renders 1`] = `
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -723,5 +726,8 @@ exports[`cluster - order of sidebar items when rendered when parent is expanded
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
+21
@@ -293,6 +293,9 @@ exports[`cluster - sidebar and tab navigation for core given core registrations
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -589,6 +592,9 @@ exports[`cluster - sidebar and tab navigation for core given core registrations
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -909,6 +915,9 @@ exports[`cluster - sidebar and tab navigation for core given core registrations
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -1234,6 +1243,9 @@ exports[`cluster - sidebar and tab navigation for core given core registrations
|
||||
<div
|
||||
data-testid="some-child-page"
|
||||
/>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -1534,6 +1546,9 @@ exports[`cluster - sidebar and tab navigation for core given core registrations
|
||||
<div
|
||||
data-testid="some-child-page"
|
||||
/>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -1854,6 +1869,9 @@ exports[`cluster - sidebar and tab navigation for core given core registrations
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -2150,5 +2168,8 @@ exports[`cluster - sidebar and tab navigation for core given core registrations
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
+86
-62
@@ -261,14 +261,14 @@ exports[`cluster - sidebar and tab navigation for extensions given extension wit
|
||||
</div>
|
||||
<div
|
||||
class="SidebarItem"
|
||||
data-id-test="some-extension-id-some-parent-id"
|
||||
data-id-test="some-extension-name-some-parent-id"
|
||||
data-is-active-test="false"
|
||||
data-test-id="some-extension-id-some-parent-id"
|
||||
data-test-id="some-extension-name-some-parent-id"
|
||||
data-testid="sidebar-item"
|
||||
>
|
||||
<a
|
||||
class="nav-item flex gaps align-center expandable"
|
||||
data-testid="sidebar-item-link-for-some-extension-id-some-parent-id"
|
||||
data-testid="sidebar-item-link-for-some-extension-name-some-parent-id"
|
||||
href="/"
|
||||
>
|
||||
<div>
|
||||
@@ -293,6 +293,9 @@ exports[`cluster - sidebar and tab navigation for extensions given extension wit
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -557,14 +560,14 @@ exports[`cluster - sidebar and tab navigation for extensions given extension wit
|
||||
</div>
|
||||
<div
|
||||
class="SidebarItem"
|
||||
data-id-test="some-extension-id-some-parent-id"
|
||||
data-id-test="some-extension-name-some-parent-id"
|
||||
data-is-active-test="false"
|
||||
data-test-id="some-extension-id-some-parent-id"
|
||||
data-test-id="some-extension-name-some-parent-id"
|
||||
data-testid="sidebar-item"
|
||||
>
|
||||
<a
|
||||
class="nav-item flex gaps align-center expandable"
|
||||
data-testid="sidebar-item-link-for-some-extension-id-some-parent-id"
|
||||
data-testid="sidebar-item-link-for-some-extension-name-some-parent-id"
|
||||
href="/"
|
||||
>
|
||||
<div>
|
||||
@@ -589,6 +592,9 @@ exports[`cluster - sidebar and tab navigation for extensions given extension wit
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -853,14 +859,14 @@ exports[`cluster - sidebar and tab navigation for extensions given extension wit
|
||||
</div>
|
||||
<div
|
||||
class="SidebarItem"
|
||||
data-id-test="some-extension-id-some-parent-id"
|
||||
data-id-test="some-extension-name-some-parent-id"
|
||||
data-is-active-test="false"
|
||||
data-test-id="some-extension-id-some-parent-id"
|
||||
data-test-id="some-extension-name-some-parent-id"
|
||||
data-testid="sidebar-item"
|
||||
>
|
||||
<a
|
||||
class="nav-item flex gaps align-center expandable"
|
||||
data-testid="sidebar-item-link-for-some-extension-id-some-parent-id"
|
||||
data-testid="sidebar-item-link-for-some-extension-name-some-parent-id"
|
||||
href="/"
|
||||
>
|
||||
<div>
|
||||
@@ -887,15 +893,15 @@ exports[`cluster - sidebar and tab navigation for extensions given extension wit
|
||||
>
|
||||
<div
|
||||
class="SidebarItem"
|
||||
data-id-test="some-extension-id-some-child-id"
|
||||
data-id-test="some-extension-name-some-child-id"
|
||||
data-is-active-test="false"
|
||||
data-parent-id-test="some-extension-id-some-parent-id"
|
||||
data-test-id="some-extension-id-some-child-id"
|
||||
data-parent-id-test="some-extension-name-some-parent-id"
|
||||
data-test-id="some-extension-name-some-child-id"
|
||||
data-testid="sidebar-item"
|
||||
>
|
||||
<a
|
||||
class="nav-item flex gaps align-center"
|
||||
data-testid="sidebar-item-link-for-some-extension-id-some-child-id"
|
||||
data-testid="sidebar-item-link-for-some-extension-name-some-child-id"
|
||||
href="/"
|
||||
>
|
||||
<span
|
||||
@@ -907,15 +913,15 @@ exports[`cluster - sidebar and tab navigation for extensions given extension wit
|
||||
</div>
|
||||
<div
|
||||
class="SidebarItem"
|
||||
data-id-test="some-extension-id-some-other-child-id"
|
||||
data-id-test="some-extension-name-some-other-child-id"
|
||||
data-is-active-test="false"
|
||||
data-parent-id-test="some-extension-id-some-parent-id"
|
||||
data-test-id="some-extension-id-some-other-child-id"
|
||||
data-parent-id-test="some-extension-name-some-parent-id"
|
||||
data-test-id="some-extension-name-some-other-child-id"
|
||||
data-testid="sidebar-item"
|
||||
>
|
||||
<a
|
||||
class="nav-item flex gaps align-center"
|
||||
data-testid="sidebar-item-link-for-some-extension-id-some-other-child-id"
|
||||
data-testid="sidebar-item-link-for-some-extension-name-some-other-child-id"
|
||||
href="/"
|
||||
>
|
||||
<span
|
||||
@@ -929,6 +935,9 @@ exports[`cluster - sidebar and tab navigation for extensions given extension wit
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -1193,15 +1202,15 @@ exports[`cluster - sidebar and tab navigation for extensions given extension wit
|
||||
</div>
|
||||
<div
|
||||
class="SidebarItem"
|
||||
data-id-test="some-extension-id-some-parent-id"
|
||||
data-id-test="some-extension-name-some-parent-id"
|
||||
data-is-active-test="true"
|
||||
data-test-id="some-extension-id-some-parent-id"
|
||||
data-test-id="some-extension-name-some-parent-id"
|
||||
data-testid="sidebar-item"
|
||||
>
|
||||
<a
|
||||
aria-current="page"
|
||||
class="nav-item flex gaps align-center expandable active"
|
||||
data-testid="sidebar-item-link-for-some-extension-id-some-parent-id"
|
||||
data-testid="sidebar-item-link-for-some-extension-name-some-parent-id"
|
||||
href="/"
|
||||
>
|
||||
<div>
|
||||
@@ -1228,16 +1237,16 @@ exports[`cluster - sidebar and tab navigation for extensions given extension wit
|
||||
>
|
||||
<div
|
||||
class="SidebarItem"
|
||||
data-id-test="some-extension-id-some-child-id"
|
||||
data-id-test="some-extension-name-some-child-id"
|
||||
data-is-active-test="true"
|
||||
data-parent-id-test="some-extension-id-some-parent-id"
|
||||
data-test-id="some-extension-id-some-child-id"
|
||||
data-parent-id-test="some-extension-name-some-parent-id"
|
||||
data-test-id="some-extension-name-some-child-id"
|
||||
data-testid="sidebar-item"
|
||||
>
|
||||
<a
|
||||
aria-current="page"
|
||||
class="nav-item flex gaps align-center active"
|
||||
data-testid="sidebar-item-link-for-some-extension-id-some-child-id"
|
||||
data-testid="sidebar-item-link-for-some-extension-name-some-child-id"
|
||||
href="/"
|
||||
>
|
||||
<span
|
||||
@@ -1249,15 +1258,15 @@ exports[`cluster - sidebar and tab navigation for extensions given extension wit
|
||||
</div>
|
||||
<div
|
||||
class="SidebarItem"
|
||||
data-id-test="some-extension-id-some-other-child-id"
|
||||
data-id-test="some-extension-name-some-other-child-id"
|
||||
data-is-active-test="false"
|
||||
data-parent-id-test="some-extension-id-some-parent-id"
|
||||
data-test-id="some-extension-id-some-other-child-id"
|
||||
data-parent-id-test="some-extension-name-some-parent-id"
|
||||
data-test-id="some-extension-name-some-other-child-id"
|
||||
data-testid="sidebar-item"
|
||||
>
|
||||
<a
|
||||
class="nav-item flex gaps align-center"
|
||||
data-testid="sidebar-item-link-for-some-extension-id-some-other-child-id"
|
||||
data-testid="sidebar-item-link-for-some-extension-name-some-other-child-id"
|
||||
href="/"
|
||||
>
|
||||
<span
|
||||
@@ -1281,7 +1290,7 @@ exports[`cluster - sidebar and tab navigation for extensions given extension wit
|
||||
<div
|
||||
class="Tab flex gaps align-center active"
|
||||
data-is-active-test="true"
|
||||
data-testid="tab-link-for-some-extension-id-some-child-id"
|
||||
data-testid="tab-link-for-some-extension-name-some-child-id"
|
||||
role="tab"
|
||||
tabindex="0"
|
||||
>
|
||||
@@ -1294,7 +1303,7 @@ exports[`cluster - sidebar and tab navigation for extensions given extension wit
|
||||
<div
|
||||
class="Tab flex gaps align-center"
|
||||
data-is-active-test="false"
|
||||
data-testid="tab-link-for-some-extension-id-some-other-child-id"
|
||||
data-testid="tab-link-for-some-extension-name-some-other-child-id"
|
||||
role="tab"
|
||||
tabindex="0"
|
||||
>
|
||||
@@ -1313,6 +1322,9 @@ exports[`cluster - sidebar and tab navigation for extensions given extension wit
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -1577,15 +1589,15 @@ exports[`cluster - sidebar and tab navigation for extensions given extension wit
|
||||
</div>
|
||||
<div
|
||||
class="SidebarItem"
|
||||
data-id-test="some-extension-id-some-parent-id"
|
||||
data-id-test="some-extension-name-some-parent-id"
|
||||
data-is-active-test="true"
|
||||
data-test-id="some-extension-id-some-parent-id"
|
||||
data-test-id="some-extension-name-some-parent-id"
|
||||
data-testid="sidebar-item"
|
||||
>
|
||||
<a
|
||||
aria-current="page"
|
||||
class="nav-item flex gaps align-center expandable active"
|
||||
data-testid="sidebar-item-link-for-some-extension-id-some-parent-id"
|
||||
data-testid="sidebar-item-link-for-some-extension-name-some-parent-id"
|
||||
href="/"
|
||||
>
|
||||
<div>
|
||||
@@ -1612,15 +1624,15 @@ exports[`cluster - sidebar and tab navigation for extensions given extension wit
|
||||
>
|
||||
<div
|
||||
class="SidebarItem"
|
||||
data-id-test="some-extension-id-some-child-id"
|
||||
data-id-test="some-extension-name-some-child-id"
|
||||
data-is-active-test="false"
|
||||
data-parent-id-test="some-extension-id-some-parent-id"
|
||||
data-test-id="some-extension-id-some-child-id"
|
||||
data-parent-id-test="some-extension-name-some-parent-id"
|
||||
data-test-id="some-extension-name-some-child-id"
|
||||
data-testid="sidebar-item"
|
||||
>
|
||||
<a
|
||||
class="nav-item flex gaps align-center"
|
||||
data-testid="sidebar-item-link-for-some-extension-id-some-child-id"
|
||||
data-testid="sidebar-item-link-for-some-extension-name-some-child-id"
|
||||
href="/"
|
||||
>
|
||||
<span
|
||||
@@ -1632,16 +1644,16 @@ exports[`cluster - sidebar and tab navigation for extensions given extension wit
|
||||
</div>
|
||||
<div
|
||||
class="SidebarItem"
|
||||
data-id-test="some-extension-id-some-other-child-id"
|
||||
data-id-test="some-extension-name-some-other-child-id"
|
||||
data-is-active-test="true"
|
||||
data-parent-id-test="some-extension-id-some-parent-id"
|
||||
data-test-id="some-extension-id-some-other-child-id"
|
||||
data-parent-id-test="some-extension-name-some-parent-id"
|
||||
data-test-id="some-extension-name-some-other-child-id"
|
||||
data-testid="sidebar-item"
|
||||
>
|
||||
<a
|
||||
aria-current="page"
|
||||
class="nav-item flex gaps align-center active"
|
||||
data-testid="sidebar-item-link-for-some-extension-id-some-other-child-id"
|
||||
data-testid="sidebar-item-link-for-some-extension-name-some-other-child-id"
|
||||
href="/"
|
||||
>
|
||||
<span
|
||||
@@ -1665,7 +1677,7 @@ exports[`cluster - sidebar and tab navigation for extensions given extension wit
|
||||
<div
|
||||
class="Tab flex gaps align-center"
|
||||
data-is-active-test="false"
|
||||
data-testid="tab-link-for-some-extension-id-some-child-id"
|
||||
data-testid="tab-link-for-some-extension-name-some-child-id"
|
||||
role="tab"
|
||||
tabindex="0"
|
||||
>
|
||||
@@ -1678,7 +1690,7 @@ exports[`cluster - sidebar and tab navigation for extensions given extension wit
|
||||
<div
|
||||
class="Tab flex gaps align-center active"
|
||||
data-is-active-test="true"
|
||||
data-testid="tab-link-for-some-extension-id-some-other-child-id"
|
||||
data-testid="tab-link-for-some-extension-name-some-other-child-id"
|
||||
role="tab"
|
||||
tabindex="0"
|
||||
>
|
||||
@@ -1697,6 +1709,9 @@ exports[`cluster - sidebar and tab navigation for extensions given extension wit
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -1961,15 +1976,15 @@ exports[`cluster - sidebar and tab navigation for extensions given extension wit
|
||||
</div>
|
||||
<div
|
||||
class="SidebarItem"
|
||||
data-id-test="some-extension-id-some-parent-id"
|
||||
data-id-test="some-extension-name-some-parent-id"
|
||||
data-is-active-test="true"
|
||||
data-test-id="some-extension-id-some-parent-id"
|
||||
data-test-id="some-extension-name-some-parent-id"
|
||||
data-testid="sidebar-item"
|
||||
>
|
||||
<a
|
||||
aria-current="page"
|
||||
class="nav-item flex gaps align-center expandable active"
|
||||
data-testid="sidebar-item-link-for-some-extension-id-some-parent-id"
|
||||
data-testid="sidebar-item-link-for-some-extension-name-some-parent-id"
|
||||
href="/"
|
||||
>
|
||||
<div>
|
||||
@@ -2004,7 +2019,7 @@ exports[`cluster - sidebar and tab navigation for extensions given extension wit
|
||||
<div
|
||||
class="Tab flex gaps align-center active"
|
||||
data-is-active-test="true"
|
||||
data-testid="tab-link-for-some-extension-id-some-child-id"
|
||||
data-testid="tab-link-for-some-extension-name-some-child-id"
|
||||
role="tab"
|
||||
tabindex="0"
|
||||
>
|
||||
@@ -2017,7 +2032,7 @@ exports[`cluster - sidebar and tab navigation for extensions given extension wit
|
||||
<div
|
||||
class="Tab flex gaps align-center"
|
||||
data-is-active-test="false"
|
||||
data-testid="tab-link-for-some-extension-id-some-other-child-id"
|
||||
data-testid="tab-link-for-some-extension-name-some-other-child-id"
|
||||
role="tab"
|
||||
tabindex="0"
|
||||
>
|
||||
@@ -2036,6 +2051,9 @@ exports[`cluster - sidebar and tab navigation for extensions given extension wit
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -2300,14 +2318,14 @@ exports[`cluster - sidebar and tab navigation for extensions given extension wit
|
||||
</div>
|
||||
<div
|
||||
class="SidebarItem"
|
||||
data-id-test="some-extension-id-some-parent-id"
|
||||
data-id-test="some-extension-name-some-parent-id"
|
||||
data-is-active-test="false"
|
||||
data-test-id="some-extension-id-some-parent-id"
|
||||
data-test-id="some-extension-name-some-parent-id"
|
||||
data-testid="sidebar-item"
|
||||
>
|
||||
<a
|
||||
class="nav-item flex gaps align-center expandable"
|
||||
data-testid="sidebar-item-link-for-some-extension-id-some-parent-id"
|
||||
data-testid="sidebar-item-link-for-some-extension-name-some-parent-id"
|
||||
href="/"
|
||||
>
|
||||
<div>
|
||||
@@ -2334,15 +2352,15 @@ exports[`cluster - sidebar and tab navigation for extensions given extension wit
|
||||
>
|
||||
<div
|
||||
class="SidebarItem"
|
||||
data-id-test="some-extension-id-some-child-id"
|
||||
data-id-test="some-extension-name-some-child-id"
|
||||
data-is-active-test="false"
|
||||
data-parent-id-test="some-extension-id-some-parent-id"
|
||||
data-test-id="some-extension-id-some-child-id"
|
||||
data-parent-id-test="some-extension-name-some-parent-id"
|
||||
data-test-id="some-extension-name-some-child-id"
|
||||
data-testid="sidebar-item"
|
||||
>
|
||||
<a
|
||||
class="nav-item flex gaps align-center"
|
||||
data-testid="sidebar-item-link-for-some-extension-id-some-child-id"
|
||||
data-testid="sidebar-item-link-for-some-extension-name-some-child-id"
|
||||
href="/"
|
||||
>
|
||||
<span
|
||||
@@ -2354,15 +2372,15 @@ exports[`cluster - sidebar and tab navigation for extensions given extension wit
|
||||
</div>
|
||||
<div
|
||||
class="SidebarItem"
|
||||
data-id-test="some-extension-id-some-other-child-id"
|
||||
data-id-test="some-extension-name-some-other-child-id"
|
||||
data-is-active-test="false"
|
||||
data-parent-id-test="some-extension-id-some-parent-id"
|
||||
data-test-id="some-extension-id-some-other-child-id"
|
||||
data-parent-id-test="some-extension-name-some-parent-id"
|
||||
data-test-id="some-extension-name-some-other-child-id"
|
||||
data-testid="sidebar-item"
|
||||
>
|
||||
<a
|
||||
class="nav-item flex gaps align-center"
|
||||
data-testid="sidebar-item-link-for-some-extension-id-some-other-child-id"
|
||||
data-testid="sidebar-item-link-for-some-extension-name-some-other-child-id"
|
||||
href="/"
|
||||
>
|
||||
<span
|
||||
@@ -2376,6 +2394,9 @@ exports[`cluster - sidebar and tab navigation for extensions given extension wit
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -2640,14 +2661,14 @@ exports[`cluster - sidebar and tab navigation for extensions given extension wit
|
||||
</div>
|
||||
<div
|
||||
class="SidebarItem"
|
||||
data-id-test="some-extension-id-some-parent-id"
|
||||
data-id-test="some-extension-name-some-parent-id"
|
||||
data-is-active-test="false"
|
||||
data-test-id="some-extension-id-some-parent-id"
|
||||
data-test-id="some-extension-name-some-parent-id"
|
||||
data-testid="sidebar-item"
|
||||
>
|
||||
<a
|
||||
class="nav-item flex gaps align-center expandable"
|
||||
data-testid="sidebar-item-link-for-some-extension-id-some-parent-id"
|
||||
data-testid="sidebar-item-link-for-some-extension-name-some-parent-id"
|
||||
href="/"
|
||||
>
|
||||
<div>
|
||||
@@ -2672,5 +2693,8 @@ exports[`cluster - sidebar and tab navigation for extensions given extension wit
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
@@ -261,6 +261,9 @@ exports[`cluster - visibility of sidebar items given kube resource for route is
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -573,5 +576,8 @@ exports[`cluster - visibility of sidebar items given kube resource for route is
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
@@ -19,7 +19,7 @@ describe("cluster - order of sidebar items", () => {
|
||||
beforeEach(() => {
|
||||
applicationBuilder = getApplicationBuilder().setEnvironmentToClusterFrame();
|
||||
|
||||
applicationBuilder.beforeSetups(({ rendererDi }) => {
|
||||
applicationBuilder.beforeApplicationStart(({ rendererDi }) => {
|
||||
rendererDi.register(testSidebarItemsInjectable);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -21,6 +21,8 @@ import writeJsonFileInjectable from "../../common/fs/write-json-file.injectable"
|
||||
import pathExistsInjectable from "../../common/fs/path-exists.injectable";
|
||||
import readJsonFileInjectable from "../../common/fs/read-json-file.injectable";
|
||||
import { navigateToRouteInjectionToken } from "../../common/front-end-routing/navigate-to-route-injection-token";
|
||||
import { getSidebarItem } from "../utils";
|
||||
import sidebarStorageInjectable from "../../renderer/components/layout/sidebar-storage/sidebar-storage.injectable";
|
||||
|
||||
describe("cluster - sidebar and tab navigation for core", () => {
|
||||
let applicationBuilder: ApplicationBuilder;
|
||||
@@ -35,7 +37,7 @@ describe("cluster - sidebar and tab navigation for core", () => {
|
||||
|
||||
applicationBuilder.setEnvironmentToClusterFrame();
|
||||
|
||||
applicationBuilder.beforeSetups(({ rendererDi }) => {
|
||||
applicationBuilder.beforeApplicationStart(({ rendererDi }) => {
|
||||
rendererDi.override(
|
||||
directoryForLensLocalStorageInjectable,
|
||||
() => "/some-directory-for-lens-local-storage",
|
||||
@@ -45,7 +47,7 @@ describe("cluster - sidebar and tab navigation for core", () => {
|
||||
|
||||
describe("given core registrations", () => {
|
||||
beforeEach(() => {
|
||||
applicationBuilder.beforeSetups(({ rendererDi }) => {
|
||||
applicationBuilder.beforeApplicationStart(({ rendererDi }) => {
|
||||
rendererDi.register(testRouteInjectable);
|
||||
rendererDi.register(testRouteComponentInjectable);
|
||||
rendererDi.register(testSidebarItemsInjectable);
|
||||
@@ -72,13 +74,13 @@ describe("cluster - sidebar and tab navigation for core", () => {
|
||||
it("parent is highlighted", () => {
|
||||
const parent = getSidebarItem(rendered, "some-parent-id");
|
||||
|
||||
expect(parent.dataset.isActiveTest).toBe("true");
|
||||
expect(parent?.dataset.isActiveTest).toBe("true");
|
||||
});
|
||||
|
||||
it("parent sidebar item is not expanded", () => {
|
||||
const child = getSidebarItem(rendered, "some-child-id");
|
||||
|
||||
expect(child).toBe(null);
|
||||
expect(child).toBeUndefined();
|
||||
});
|
||||
|
||||
it("child page is shown", () => {
|
||||
@@ -102,6 +104,12 @@ describe("cluster - sidebar and tab navigation for core", () => {
|
||||
);
|
||||
});
|
||||
|
||||
applicationBuilder.beforeRender(async ({ rendererDi }) => {
|
||||
const sidebarStorage = rendererDi.inject(sidebarStorageInjectable);
|
||||
|
||||
await sidebarStorage.whenReady;
|
||||
});
|
||||
|
||||
rendered = await applicationBuilder.render();
|
||||
});
|
||||
|
||||
@@ -112,13 +120,13 @@ describe("cluster - sidebar and tab navigation for core", () => {
|
||||
it("parent sidebar item is not highlighted", () => {
|
||||
const parent = getSidebarItem(rendered, "some-parent-id");
|
||||
|
||||
expect(parent.dataset.isActiveTest).toBe("false");
|
||||
expect(parent?.dataset.isActiveTest).toBe("false");
|
||||
});
|
||||
|
||||
it("parent sidebar item is expanded", () => {
|
||||
const child = getSidebarItem(rendered, "some-child-id");
|
||||
|
||||
expect(child).not.toBe(null);
|
||||
expect(child).not.toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -148,7 +156,7 @@ describe("cluster - sidebar and tab navigation for core", () => {
|
||||
it("parent sidebar item is not expanded", () => {
|
||||
const child = getSidebarItem(rendered, "some-child-id");
|
||||
|
||||
expect(child).toBe(null);
|
||||
expect(child).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -175,7 +183,7 @@ describe("cluster - sidebar and tab navigation for core", () => {
|
||||
it("parent sidebar item is not expanded", () => {
|
||||
const child = getSidebarItem(rendered, "some-child-id");
|
||||
|
||||
expect(child).toBe(null);
|
||||
expect(child).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -191,13 +199,13 @@ describe("cluster - sidebar and tab navigation for core", () => {
|
||||
it("parent sidebar item is not highlighted", () => {
|
||||
const parent = getSidebarItem(rendered, "some-parent-id");
|
||||
|
||||
expect(parent.dataset.isActiveTest).toBe("false");
|
||||
expect(parent?.dataset.isActiveTest).toBe("false");
|
||||
});
|
||||
|
||||
it("parent sidebar item is not expanded", () => {
|
||||
const child = getSidebarItem(rendered, "some-child-id");
|
||||
|
||||
expect(child).toBe(null);
|
||||
expect(child).toBeUndefined();
|
||||
});
|
||||
|
||||
describe("when a parent sidebar item is expanded", () => {
|
||||
@@ -216,13 +224,13 @@ describe("cluster - sidebar and tab navigation for core", () => {
|
||||
it("parent sidebar item is not highlighted", () => {
|
||||
const parent = getSidebarItem(rendered, "some-parent-id");
|
||||
|
||||
expect(parent.dataset.isActiveTest).toBe("false");
|
||||
expect(parent?.dataset.isActiveTest).toBe("false");
|
||||
});
|
||||
|
||||
it("parent sidebar item is expanded", () => {
|
||||
const child = getSidebarItem(rendered, "some-child-id");
|
||||
|
||||
expect(child).not.toBe(null);
|
||||
expect(child).not.toBeUndefined();
|
||||
});
|
||||
|
||||
describe("when a child of the parent is selected", () => {
|
||||
@@ -241,13 +249,13 @@ describe("cluster - sidebar and tab navigation for core", () => {
|
||||
it("parent is highlighted", () => {
|
||||
const parent = getSidebarItem(rendered, "some-parent-id");
|
||||
|
||||
expect(parent.dataset.isActiveTest).toBe("true");
|
||||
expect(parent?.dataset.isActiveTest).toBe("true");
|
||||
});
|
||||
|
||||
it("child is highlighted", () => {
|
||||
const child = getSidebarItem(rendered, "some-child-id");
|
||||
|
||||
expect(child.dataset.isActiveTest).toBe("true");
|
||||
expect(child?.dataset.isActiveTest).toBe("true");
|
||||
});
|
||||
|
||||
it("child page is shown", () => {
|
||||
@@ -288,11 +296,6 @@ describe("cluster - sidebar and tab navigation for core", () => {
|
||||
});
|
||||
});
|
||||
|
||||
const getSidebarItem = (rendered: RenderResult, itemId: string) =>
|
||||
rendered
|
||||
.queryAllByTestId("sidebar-item")
|
||||
.find((x) => x.dataset.idTest === itemId) || null;
|
||||
|
||||
const testSidebarItemsInjectable = getInjectable({
|
||||
id: "some-sidebar-items-injectable",
|
||||
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
import React from "react";
|
||||
import type { RenderResult } from "@testing-library/react";
|
||||
import { fireEvent } from "@testing-library/react";
|
||||
import { getRendererExtensionFake } from "../../renderer/components/test-utils/get-renderer-extension-fake";
|
||||
import type { LensRendererExtension } from "../../extensions/lens-renderer-extension";
|
||||
import directoryForLensLocalStorageInjectable from "../../common/directory-for-lens-local-storage/directory-for-lens-local-storage.injectable";
|
||||
import routesInjectable from "../../renderer/routes/routes.injectable";
|
||||
import { matches } from "lodash/fp";
|
||||
@@ -17,6 +15,10 @@ import pathExistsInjectable from "../../common/fs/path-exists.injectable";
|
||||
import readJsonFileInjectable from "../../common/fs/read-json-file.injectable";
|
||||
import type { DiContainer } from "@ogre-tools/injectable";
|
||||
import { navigateToRouteInjectionToken } from "../../common/front-end-routing/navigate-to-route-injection-token";
|
||||
import assert from "assert";
|
||||
import { getSidebarItem } from "../utils";
|
||||
import type { FakeExtensionData } from "../../renderer/components/test-utils/get-renderer-extension-fake";
|
||||
import { getRendererExtensionFakeFor } from "../../renderer/components/test-utils/get-renderer-extension-fake";
|
||||
|
||||
describe("cluster - sidebar and tab navigation for extensions", () => {
|
||||
let applicationBuilder: ApplicationBuilder;
|
||||
@@ -31,7 +33,7 @@ describe("cluster - sidebar and tab navigation for extensions", () => {
|
||||
|
||||
applicationBuilder.setEnvironmentToClusterFrame();
|
||||
|
||||
applicationBuilder.beforeSetups(({ rendererDi }) => {
|
||||
applicationBuilder.beforeApplicationStart(({ rendererDi }) => {
|
||||
rendererDi.override(
|
||||
directoryForLensLocalStorageInjectable,
|
||||
() => "/some-directory-for-lens-local-storage",
|
||||
@@ -41,9 +43,8 @@ describe("cluster - sidebar and tab navigation for extensions", () => {
|
||||
|
||||
describe("given extension with cluster pages and cluster page menus", () => {
|
||||
beforeEach(async () => {
|
||||
const testExtension = getRendererExtensionFake(
|
||||
extensionStubWithSidebarItems,
|
||||
);
|
||||
const getRendererExtensionFake = getRendererExtensionFakeFor(applicationBuilder);
|
||||
const testExtension = getRendererExtensionFake(extensionStubWithSidebarItems);
|
||||
|
||||
await applicationBuilder.addExtensions(testExtension);
|
||||
});
|
||||
@@ -51,19 +52,17 @@ describe("cluster - sidebar and tab navigation for extensions", () => {
|
||||
describe("given no state for expanded sidebar items exists, and navigated to child sidebar item, when rendered", () => {
|
||||
beforeEach(async () => {
|
||||
applicationBuilder.beforeRender(({ rendererDi }) => {
|
||||
const navigateToRoute = rendererDi.inject(
|
||||
navigateToRouteInjectionToken,
|
||||
);
|
||||
|
||||
const navigateToRoute = rendererDi.inject(navigateToRouteInjectionToken);
|
||||
const route = rendererDi
|
||||
.inject(routesInjectable)
|
||||
.get()
|
||||
.find(
|
||||
matches({
|
||||
path: "/extension/some-extension-id/some-child-page-id",
|
||||
path: "/extension/some-extension-name/some-child-page-id",
|
||||
}),
|
||||
);
|
||||
|
||||
assert(route);
|
||||
navigateToRoute(route);
|
||||
});
|
||||
|
||||
@@ -77,19 +76,19 @@ describe("cluster - sidebar and tab navigation for extensions", () => {
|
||||
it("parent is highlighted", () => {
|
||||
const parent = getSidebarItem(
|
||||
rendered,
|
||||
"some-extension-id-some-parent-id",
|
||||
"some-extension-name-some-parent-id",
|
||||
);
|
||||
|
||||
expect(parent.dataset.isActiveTest).toBe("true");
|
||||
expect(parent?.dataset.isActiveTest).toBe("true");
|
||||
});
|
||||
|
||||
it("parent sidebar item is not expanded", () => {
|
||||
const child = getSidebarItem(
|
||||
rendered,
|
||||
"some-extension-id-some-child-id",
|
||||
"some-extension-name-some-child-id",
|
||||
);
|
||||
|
||||
expect(child).toBe(null);
|
||||
expect(child).toBeUndefined();
|
||||
});
|
||||
|
||||
it("child page is shown", () => {
|
||||
@@ -106,7 +105,7 @@ describe("cluster - sidebar and tab navigation for extensions", () => {
|
||||
"/some-directory-for-lens-local-storage/app.json",
|
||||
{
|
||||
sidebar: {
|
||||
expanded: { "some-extension-id-some-parent-id": true },
|
||||
expanded: { "some-extension-name-some-parent-id": true },
|
||||
width: 200,
|
||||
},
|
||||
},
|
||||
@@ -123,19 +122,19 @@ describe("cluster - sidebar and tab navigation for extensions", () => {
|
||||
it("parent sidebar item is not highlighted", () => {
|
||||
const parent = getSidebarItem(
|
||||
rendered,
|
||||
"some-extension-id-some-parent-id",
|
||||
"some-extension-name-some-parent-id",
|
||||
);
|
||||
|
||||
expect(parent.dataset.isActiveTest).toBe("false");
|
||||
expect(parent?.dataset.isActiveTest).toBe("false");
|
||||
});
|
||||
|
||||
it("parent sidebar item is expanded", () => {
|
||||
const child = getSidebarItem(
|
||||
rendered,
|
||||
"some-extension-id-some-child-id",
|
||||
"some-extension-name-some-child-id",
|
||||
);
|
||||
|
||||
expect(child).not.toBe(null);
|
||||
expect(child).not.toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -148,7 +147,7 @@ describe("cluster - sidebar and tab navigation for extensions", () => {
|
||||
"/some-directory-for-lens-local-storage/app.json",
|
||||
{
|
||||
sidebar: {
|
||||
expanded: { "some-extension-id-some-unknown-parent-id": true },
|
||||
expanded: { "some-extension-name-some-unknown-parent-id": true },
|
||||
width: 200,
|
||||
},
|
||||
},
|
||||
@@ -165,10 +164,10 @@ describe("cluster - sidebar and tab navigation for extensions", () => {
|
||||
it("parent sidebar item is not expanded", () => {
|
||||
const child = getSidebarItem(
|
||||
rendered,
|
||||
"some-extension-id-some-child-id",
|
||||
"some-extension-name-some-child-id",
|
||||
);
|
||||
|
||||
expect(child).toBe(null);
|
||||
expect(child).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -195,10 +194,10 @@ describe("cluster - sidebar and tab navigation for extensions", () => {
|
||||
it("parent sidebar item is not expanded", () => {
|
||||
const child = getSidebarItem(
|
||||
rendered,
|
||||
"some-extension-id-some-child-id",
|
||||
"some-extension-name-some-child-id",
|
||||
);
|
||||
|
||||
expect(child).toBe(null);
|
||||
expect(child).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -214,25 +213,25 @@ describe("cluster - sidebar and tab navigation for extensions", () => {
|
||||
it("parent sidebar item is not highlighted", () => {
|
||||
const parent = getSidebarItem(
|
||||
rendered,
|
||||
"some-extension-id-some-parent-id",
|
||||
"some-extension-name-some-parent-id",
|
||||
);
|
||||
|
||||
expect(parent.dataset.isActiveTest).toBe("false");
|
||||
expect(parent?.dataset.isActiveTest).toBe("false");
|
||||
});
|
||||
|
||||
it("parent sidebar item is not expanded", () => {
|
||||
const child = getSidebarItem(
|
||||
rendered,
|
||||
"some-extension-id-some-child-id",
|
||||
"some-extension-name-some-child-id",
|
||||
);
|
||||
|
||||
expect(child).toBe(null);
|
||||
expect(child).toBeUndefined();
|
||||
});
|
||||
|
||||
describe("when a parent sidebar item is expanded", () => {
|
||||
beforeEach(() => {
|
||||
const parentLink = rendered.getByTestId(
|
||||
"sidebar-item-link-for-some-extension-id-some-parent-id",
|
||||
"sidebar-item-link-for-some-extension-name-some-parent-id",
|
||||
);
|
||||
|
||||
fireEvent.click(parentLink);
|
||||
@@ -245,25 +244,25 @@ describe("cluster - sidebar and tab navigation for extensions", () => {
|
||||
it("parent sidebar item is not highlighted", () => {
|
||||
const parent = getSidebarItem(
|
||||
rendered,
|
||||
"some-extension-id-some-parent-id",
|
||||
"some-extension-name-some-parent-id",
|
||||
);
|
||||
|
||||
expect(parent.dataset.isActiveTest).toBe("false");
|
||||
expect(parent?.dataset.isActiveTest).toBe("false");
|
||||
});
|
||||
|
||||
it("parent sidebar item is expanded", () => {
|
||||
const child = getSidebarItem(
|
||||
rendered,
|
||||
"some-extension-id-some-child-id",
|
||||
"some-extension-name-some-child-id",
|
||||
);
|
||||
|
||||
expect(child).not.toBe(null);
|
||||
expect(child).not.toBeUndefined();
|
||||
});
|
||||
|
||||
describe("when a child of the parent is selected", () => {
|
||||
beforeEach(() => {
|
||||
const childLink = rendered.getByTestId(
|
||||
"sidebar-item-link-for-some-extension-id-some-child-id",
|
||||
"sidebar-item-link-for-some-extension-name-some-child-id",
|
||||
);
|
||||
|
||||
fireEvent.click(childLink);
|
||||
@@ -276,19 +275,19 @@ describe("cluster - sidebar and tab navigation for extensions", () => {
|
||||
it("parent is highlighted", () => {
|
||||
const parent = getSidebarItem(
|
||||
rendered,
|
||||
"some-extension-id-some-parent-id",
|
||||
"some-extension-name-some-parent-id",
|
||||
);
|
||||
|
||||
expect(parent.dataset.isActiveTest).toBe("true");
|
||||
expect(parent?.dataset.isActiveTest).toBe("true");
|
||||
});
|
||||
|
||||
it("child is highlighted", () => {
|
||||
const child = getSidebarItem(
|
||||
rendered,
|
||||
"some-extension-id-some-child-id",
|
||||
"some-extension-name-some-child-id",
|
||||
);
|
||||
|
||||
expect(child.dataset.isActiveTest).toBe("true");
|
||||
expect(child?.dataset.isActiveTest).toBe("true");
|
||||
});
|
||||
|
||||
it("child page is shown", () => {
|
||||
@@ -301,7 +300,7 @@ describe("cluster - sidebar and tab navigation for extensions", () => {
|
||||
|
||||
it("tab for child page is active", () => {
|
||||
const tabLink = rendered.getByTestId(
|
||||
"tab-link-for-some-extension-id-some-child-id",
|
||||
"tab-link-for-some-extension-name-some-child-id",
|
||||
);
|
||||
|
||||
expect(tabLink.dataset.isActiveTest).toBe("true");
|
||||
@@ -309,7 +308,7 @@ describe("cluster - sidebar and tab navigation for extensions", () => {
|
||||
|
||||
it("tab for sibling page is not active", () => {
|
||||
const tabLink = rendered.getByTestId(
|
||||
"tab-link-for-some-extension-id-some-other-child-id",
|
||||
"tab-link-for-some-extension-name-some-other-child-id",
|
||||
);
|
||||
|
||||
expect(tabLink.dataset.isActiveTest).toBe("false");
|
||||
@@ -338,7 +337,7 @@ describe("cluster - sidebar and tab navigation for extensions", () => {
|
||||
|
||||
expect(actual).toEqual({
|
||||
sidebar: {
|
||||
expanded: { "some-extension-id-some-parent-id": true },
|
||||
expanded: { "some-extension-name-some-parent-id": true },
|
||||
width: 200,
|
||||
},
|
||||
});
|
||||
@@ -347,7 +346,7 @@ describe("cluster - sidebar and tab navigation for extensions", () => {
|
||||
describe("when selecting sibling tab", () => {
|
||||
beforeEach(() => {
|
||||
const childTabLink = rendered.getByTestId(
|
||||
"tab-link-for-some-extension-id-some-other-child-id",
|
||||
"tab-link-for-some-extension-name-some-other-child-id",
|
||||
);
|
||||
|
||||
fireEvent.click(childTabLink);
|
||||
@@ -365,7 +364,7 @@ describe("cluster - sidebar and tab navigation for extensions", () => {
|
||||
|
||||
it("tab for sibling page is active", () => {
|
||||
const tabLink = rendered.getByTestId(
|
||||
"tab-link-for-some-extension-id-some-other-child-id",
|
||||
"tab-link-for-some-extension-name-some-other-child-id",
|
||||
);
|
||||
|
||||
expect(tabLink.dataset.isActiveTest).toBe("true");
|
||||
@@ -373,7 +372,7 @@ describe("cluster - sidebar and tab navigation for extensions", () => {
|
||||
|
||||
it("tab for previous page is not active", () => {
|
||||
const tabLink = rendered.getByTestId(
|
||||
"tab-link-for-some-extension-id-some-child-id",
|
||||
"tab-link-for-some-extension-name-some-child-id",
|
||||
);
|
||||
|
||||
expect(tabLink.dataset.isActiveTest).toBe("false");
|
||||
@@ -385,9 +384,9 @@ describe("cluster - sidebar and tab navigation for extensions", () => {
|
||||
});
|
||||
});
|
||||
|
||||
const extensionStubWithSidebarItems: Partial<LensRendererExtension> = {
|
||||
const extensionStubWithSidebarItems: FakeExtensionData = {
|
||||
id: "some-extension-id",
|
||||
|
||||
name: "some-extension-name",
|
||||
clusterPages: [
|
||||
{
|
||||
components: {
|
||||
@@ -396,7 +395,6 @@ const extensionStubWithSidebarItems: Partial<LensRendererExtension> = {
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
id: "some-child-page-id",
|
||||
|
||||
@@ -404,7 +402,6 @@ const extensionStubWithSidebarItems: Partial<LensRendererExtension> = {
|
||||
Page: () => <div data-testid="some-child-page">Some child page</div>,
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
id: "some-other-child-page-id",
|
||||
|
||||
@@ -415,7 +412,6 @@ const extensionStubWithSidebarItems: Partial<LensRendererExtension> = {
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
clusterPageMenus: [
|
||||
{
|
||||
id: "some-parent-id",
|
||||
@@ -433,7 +429,7 @@ const extensionStubWithSidebarItems: Partial<LensRendererExtension> = {
|
||||
title: "Child 1",
|
||||
|
||||
components: {
|
||||
Icon: null,
|
||||
Icon: null as never,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -444,13 +440,8 @@ const extensionStubWithSidebarItems: Partial<LensRendererExtension> = {
|
||||
title: "Child 2",
|
||||
|
||||
components: {
|
||||
Icon: null,
|
||||
Icon: null as never,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const getSidebarItem = (rendered: RenderResult, itemId: string) =>
|
||||
rendered
|
||||
.queryAllByTestId("sidebar-item")
|
||||
.find((x) => x.dataset.idTest === itemId) || null;
|
||||
@@ -14,6 +14,7 @@ import { routeInjectionToken } from "../../common/front-end-routing/route-inject
|
||||
import type { ApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
import { getApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
import { navigateToRouteInjectionToken } from "../../common/front-end-routing/navigate-to-route-injection-token";
|
||||
import { getSidebarItem } from "../utils";
|
||||
|
||||
describe("cluster - visibility of sidebar items", () => {
|
||||
let applicationBuilder: ApplicationBuilder;
|
||||
@@ -24,7 +25,7 @@ describe("cluster - visibility of sidebar items", () => {
|
||||
|
||||
applicationBuilder.setEnvironmentToClusterFrame();
|
||||
|
||||
applicationBuilder.beforeSetups(({ rendererDi }) => {
|
||||
applicationBuilder.beforeApplicationStart(({ rendererDi }) => {
|
||||
rendererDi.register(testRouteInjectable);
|
||||
rendererDi.register(testRouteComponentInjectable);
|
||||
rendererDi.register(testSidebarItemsInjectable);
|
||||
@@ -43,7 +44,7 @@ describe("cluster - visibility of sidebar items", () => {
|
||||
it("related sidebar item does not exist", () => {
|
||||
const item = getSidebarItem(rendered, "some-item-id");
|
||||
|
||||
expect(item).toBeNull();
|
||||
expect(item).toBeUndefined();
|
||||
});
|
||||
|
||||
describe("when kube resource becomes allowed", () => {
|
||||
@@ -58,17 +59,12 @@ describe("cluster - visibility of sidebar items", () => {
|
||||
it("related sidebar item exists", () => {
|
||||
const item = getSidebarItem(rendered, "some-item-id");
|
||||
|
||||
expect(item).not.toBeNull();
|
||||
expect(item).not.toBeUndefined();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
const getSidebarItem = (rendered: RenderResult, itemId: string) =>
|
||||
rendered
|
||||
.queryAllByTestId("sidebar-item")
|
||||
.find((x) => x.dataset.idTest === itemId) || null;
|
||||
|
||||
const testRouteInjectable = getInjectable({
|
||||
id: "some-route-injectable-id",
|
||||
|
||||
|
||||
@@ -2,12 +2,11 @@
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import type { TestExtension } from "../renderer/components/test-utils/get-renderer-extension-fake";
|
||||
import { getRendererExtensionFake } from "../renderer/components/test-utils/get-renderer-extension-fake";
|
||||
import type { FakeExtensionData, TestExtension } from "../renderer/components/test-utils/get-renderer-extension-fake";
|
||||
import { getRendererExtensionFakeFor } from "../renderer/components/test-utils/get-renderer-extension-fake";
|
||||
import React from "react";
|
||||
import type { RenderResult } from "@testing-library/react";
|
||||
import currentPathInjectable from "../renderer/routes/current-path.injectable";
|
||||
import type { LensRendererExtension } from "../extensions/lens-renderer-extension";
|
||||
import type { ApplicationBuilder } from "../renderer/components/test-utils/get-application-builder";
|
||||
import { getApplicationBuilder } from "../renderer/components/test-utils/get-application-builder";
|
||||
|
||||
@@ -18,6 +17,7 @@ describe("extension special characters in page registrations", () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
applicationBuilder = getApplicationBuilder();
|
||||
const getRendererExtensionFake = getRendererExtensionFakeFor(applicationBuilder);
|
||||
|
||||
testExtension = getRendererExtensionFake(
|
||||
extensionWithPagesHavingSpecialCharacters,
|
||||
@@ -44,14 +44,14 @@ describe("extension special characters in page registrations", () => {
|
||||
it("knows URL", () => {
|
||||
const currentPath = applicationBuilder.dis.rendererDi.inject(currentPathInjectable);
|
||||
|
||||
expect(currentPath.get()).toBe("/extension/some-extension-id--/some-page-id");
|
||||
expect(currentPath.get()).toBe("/extension/some-extension-name--/some-page-id");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
const extensionWithPagesHavingSpecialCharacters: Partial<LensRendererExtension> = {
|
||||
id: "@some-extension-id/",
|
||||
|
||||
const extensionWithPagesHavingSpecialCharacters: FakeExtensionData = {
|
||||
id: "some-extension-id",
|
||||
name: "@some-extension-name/",
|
||||
globalPages: [
|
||||
{
|
||||
id: "/some-page-id/",
|
||||
|
||||
+12
-6
@@ -1,6 +1,12 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`extensions - navigation using application menu renders 1`] = `<div />`;
|
||||
exports[`extensions - navigation using application menu renders 1`] = `
|
||||
<div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`extensions - navigation using application menu when navigating to extensions using application menu renders 1`] = `
|
||||
<div>
|
||||
@@ -23,9 +29,7 @@ exports[`extensions - navigation using application menu when navigating to exten
|
||||
class="notice mb-14 mt-3"
|
||||
>
|
||||
<p>
|
||||
Add new features via Lens Extensions.
|
||||
|
||||
Check out
|
||||
Add new features via Lens Extensions. Check out the
|
||||
<a
|
||||
href="https://docs.k8slens.dev/main//extensions/"
|
||||
rel="noreferrer"
|
||||
@@ -33,8 +37,7 @@ exports[`extensions - navigation using application menu when navigating to exten
|
||||
>
|
||||
docs
|
||||
</a>
|
||||
|
||||
and list of
|
||||
and list of
|
||||
<a
|
||||
href="https://github.com/lensapp/lens-extensions/blob/main/README.md"
|
||||
rel="noreferrer"
|
||||
@@ -121,5 +124,8 @@ exports[`extensions - navigation using application menu when navigating to exten
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
@@ -6,12 +6,7 @@
|
||||
import type { RenderResult } from "@testing-library/react";
|
||||
import type { ApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
import { getApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
import isAutoUpdateEnabledInjectable from "../../main/is-auto-update-enabled.injectable";
|
||||
import extensionsStoreInjectable from "../../extensions/extensions-store/extensions-store.injectable";
|
||||
import type { ExtensionsStore } from "../../extensions/extensions-store/extensions-store";
|
||||
import fileSystemProvisionerStoreInjectable from "../../extensions/extension-loader/create-extension-instance/file-system-provisioner-store/file-system-provisioner-store.injectable";
|
||||
import type { FileSystemProvisionerStore } from "../../extensions/extension-loader/create-extension-instance/file-system-provisioner-store/file-system-provisioner-store";
|
||||
import focusWindowInjectable from "../../renderer/ipc-channel-listeners/focus-window.injectable";
|
||||
import focusWindowInjectable from "../../renderer/navigation/focus-window.injectable";
|
||||
|
||||
// TODO: Make components free of side effects by making them deterministic
|
||||
jest.mock("../../renderer/components/input/input");
|
||||
@@ -22,11 +17,7 @@ describe("extensions - navigation using application menu", () => {
|
||||
let focusWindowMock: jest.Mock;
|
||||
|
||||
beforeEach(async () => {
|
||||
applicationBuilder = getApplicationBuilder().beforeSetups(({ mainDi, rendererDi }) => {
|
||||
mainDi.override(isAutoUpdateEnabledInjectable, () => () => false);
|
||||
rendererDi.override(extensionsStoreInjectable, () => ({}) as unknown as ExtensionsStore);
|
||||
rendererDi.override(fileSystemProvisionerStoreInjectable, () => ({}) as unknown as FileSystemProvisionerStore);
|
||||
|
||||
applicationBuilder = getApplicationBuilder().beforeApplicationStart(({ rendererDi }) => {
|
||||
focusWindowMock = jest.fn();
|
||||
|
||||
rendererDi.override(focusWindowInjectable, () => focusWindowMock);
|
||||
@@ -46,8 +37,8 @@ describe("extensions - navigation using application menu", () => {
|
||||
});
|
||||
|
||||
describe("when navigating to extensions using application menu", () => {
|
||||
beforeEach(() => {
|
||||
applicationBuilder.applicationMenu.click("root.extensions");
|
||||
beforeEach(async () => {
|
||||
await applicationBuilder.applicationMenu.click("root.extensions");
|
||||
});
|
||||
|
||||
it("focuses the window", () => {
|
||||
|
||||
@@ -0,0 +1,461 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`helm-charts - navigation to Helm charts when navigating to Helm charts renders 1`] = `
|
||||
<div>
|
||||
<div
|
||||
class="flex flex-col"
|
||||
data-testid="cluster-sidebar"
|
||||
>
|
||||
<div
|
||||
class="SidebarCluster"
|
||||
>
|
||||
<div
|
||||
class="Avatar rounded loadingAvatar"
|
||||
style="width: 40px; height: 40px;"
|
||||
>
|
||||
??
|
||||
</div>
|
||||
<div
|
||||
class="loadingClusterName"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="sidebarNav sidebar-active-status"
|
||||
>
|
||||
<div
|
||||
class="SidebarItem"
|
||||
data-id-test="workloads"
|
||||
data-is-active-test="false"
|
||||
data-test-id="workloads"
|
||||
data-testid="sidebar-item"
|
||||
>
|
||||
<a
|
||||
class="nav-item flex gaps align-center expandable"
|
||||
data-testid="sidebar-item-link-for-workloads"
|
||||
href="/"
|
||||
>
|
||||
<i
|
||||
class="Icon svg focusable"
|
||||
>
|
||||
<span
|
||||
class="icon"
|
||||
/>
|
||||
</i>
|
||||
<span
|
||||
class="link-text box grow"
|
||||
>
|
||||
Workloads
|
||||
</span>
|
||||
<i
|
||||
class="Icon expand-icon box right material focusable"
|
||||
>
|
||||
<span
|
||||
class="icon"
|
||||
data-icon-name="keyboard_arrow_down"
|
||||
>
|
||||
keyboard_arrow_down
|
||||
</span>
|
||||
</i>
|
||||
</a>
|
||||
</div>
|
||||
<div
|
||||
class="SidebarItem"
|
||||
data-id-test="config"
|
||||
data-is-active-test="false"
|
||||
data-test-id="config"
|
||||
data-testid="sidebar-item"
|
||||
>
|
||||
<a
|
||||
class="nav-item flex gaps align-center"
|
||||
data-testid="sidebar-item-link-for-config"
|
||||
href="/"
|
||||
>
|
||||
<i
|
||||
class="Icon material focusable"
|
||||
>
|
||||
<span
|
||||
class="icon"
|
||||
data-icon-name="list"
|
||||
>
|
||||
list
|
||||
</span>
|
||||
</i>
|
||||
<span
|
||||
class="link-text box grow"
|
||||
>
|
||||
Config
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
<div
|
||||
class="SidebarItem"
|
||||
data-id-test="network"
|
||||
data-is-active-test="false"
|
||||
data-test-id="network"
|
||||
data-testid="sidebar-item"
|
||||
>
|
||||
<a
|
||||
class="nav-item flex gaps align-center expandable"
|
||||
data-testid="sidebar-item-link-for-network"
|
||||
href="/"
|
||||
>
|
||||
<i
|
||||
class="Icon material focusable"
|
||||
>
|
||||
<span
|
||||
class="icon"
|
||||
data-icon-name="device_hub"
|
||||
>
|
||||
device_hub
|
||||
</span>
|
||||
</i>
|
||||
<span
|
||||
class="link-text box grow"
|
||||
>
|
||||
Network
|
||||
</span>
|
||||
<i
|
||||
class="Icon expand-icon box right material focusable"
|
||||
>
|
||||
<span
|
||||
class="icon"
|
||||
data-icon-name="keyboard_arrow_down"
|
||||
>
|
||||
keyboard_arrow_down
|
||||
</span>
|
||||
</i>
|
||||
</a>
|
||||
</div>
|
||||
<div
|
||||
class="SidebarItem"
|
||||
data-id-test="storage"
|
||||
data-is-active-test="false"
|
||||
data-test-id="storage"
|
||||
data-testid="sidebar-item"
|
||||
>
|
||||
<a
|
||||
class="nav-item flex gaps align-center"
|
||||
data-testid="sidebar-item-link-for-storage"
|
||||
href="/"
|
||||
>
|
||||
<i
|
||||
class="Icon material focusable"
|
||||
>
|
||||
<span
|
||||
class="icon"
|
||||
data-icon-name="storage"
|
||||
>
|
||||
storage
|
||||
</span>
|
||||
</i>
|
||||
<span
|
||||
class="link-text box grow"
|
||||
>
|
||||
Storage
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
<div
|
||||
class="SidebarItem"
|
||||
data-id-test="helm"
|
||||
data-is-active-test="true"
|
||||
data-test-id="helm"
|
||||
data-testid="sidebar-item"
|
||||
>
|
||||
<a
|
||||
aria-current="page"
|
||||
class="nav-item flex gaps align-center expandable active"
|
||||
data-testid="sidebar-item-link-for-helm"
|
||||
href="/"
|
||||
>
|
||||
<i
|
||||
class="Icon svg focusable"
|
||||
>
|
||||
<span
|
||||
class="icon"
|
||||
/>
|
||||
</i>
|
||||
<span
|
||||
class="link-text box grow"
|
||||
>
|
||||
Helm
|
||||
</span>
|
||||
<i
|
||||
class="Icon expand-icon box right material focusable"
|
||||
>
|
||||
<span
|
||||
class="icon"
|
||||
data-icon-name="keyboard_arrow_down"
|
||||
>
|
||||
keyboard_arrow_down
|
||||
</span>
|
||||
</i>
|
||||
</a>
|
||||
</div>
|
||||
<div
|
||||
class="SidebarItem"
|
||||
data-id-test="user-management"
|
||||
data-is-active-test="false"
|
||||
data-test-id="user-management"
|
||||
data-testid="sidebar-item"
|
||||
>
|
||||
<a
|
||||
class="nav-item flex gaps align-center"
|
||||
data-testid="sidebar-item-link-for-user-management"
|
||||
href="/"
|
||||
>
|
||||
<i
|
||||
class="Icon material focusable"
|
||||
>
|
||||
<span
|
||||
class="icon"
|
||||
data-icon-name="security"
|
||||
>
|
||||
security
|
||||
</span>
|
||||
</i>
|
||||
<span
|
||||
class="link-text box grow"
|
||||
>
|
||||
Access Control
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
<div
|
||||
class="SidebarItem"
|
||||
data-id-test="custom-resources"
|
||||
data-is-active-test="false"
|
||||
data-test-id="custom-resources"
|
||||
data-testid="sidebar-item"
|
||||
>
|
||||
<a
|
||||
class="nav-item flex gaps align-center expandable"
|
||||
data-testid="sidebar-item-link-for-custom-resources"
|
||||
href="/"
|
||||
>
|
||||
<i
|
||||
class="Icon material focusable"
|
||||
>
|
||||
<span
|
||||
class="icon"
|
||||
data-icon-name="extension"
|
||||
>
|
||||
extension
|
||||
</span>
|
||||
</i>
|
||||
<span
|
||||
class="link-text box grow"
|
||||
>
|
||||
Custom Resources
|
||||
</span>
|
||||
<i
|
||||
class="Icon expand-icon box right material focusable"
|
||||
>
|
||||
<span
|
||||
class="icon"
|
||||
data-icon-name="keyboard_arrow_down"
|
||||
>
|
||||
keyboard_arrow_down
|
||||
</span>
|
||||
</i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="TabLayout"
|
||||
data-testid="tab-layout"
|
||||
>
|
||||
<div
|
||||
class="Tabs center scrollable"
|
||||
>
|
||||
<div
|
||||
class="Tab flex gaps align-center active"
|
||||
data-is-active-test="true"
|
||||
data-testid="tab-link-for-charts"
|
||||
role="tab"
|
||||
tabindex="0"
|
||||
>
|
||||
<div
|
||||
class="label"
|
||||
>
|
||||
Charts
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Tab flex gaps align-center"
|
||||
data-is-active-test="false"
|
||||
data-testid="tab-link-for-releases"
|
||||
role="tab"
|
||||
tabindex="0"
|
||||
>
|
||||
<div
|
||||
class="label"
|
||||
>
|
||||
Releases
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<main>
|
||||
<div
|
||||
data-testid="page-for-helm-charts"
|
||||
style="display: none;"
|
||||
/>
|
||||
<div
|
||||
class="ItemListLayout flex column HelmCharts"
|
||||
>
|
||||
<div
|
||||
class="header flex gaps align-center"
|
||||
>
|
||||
<div
|
||||
class="Input SearchInput focused"
|
||||
>
|
||||
<label
|
||||
class="input-area flex gaps align-center"
|
||||
id=""
|
||||
>
|
||||
<input
|
||||
class="input box grow"
|
||||
placeholder="Search Helm Charts..."
|
||||
spellcheck="false"
|
||||
value=""
|
||||
/>
|
||||
<i
|
||||
class="Icon material focusable small"
|
||||
>
|
||||
<span
|
||||
class="icon"
|
||||
data-icon-name="search"
|
||||
>
|
||||
search
|
||||
</span>
|
||||
</i>
|
||||
</label>
|
||||
<div
|
||||
class="input-info flex gaps"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="items box grow flex column"
|
||||
>
|
||||
<div
|
||||
class="Table flex column HelmCharts box grow dark selectable scrollable sortable autoSize virtual"
|
||||
>
|
||||
<div
|
||||
class="TableHead sticky nowrap topLine"
|
||||
>
|
||||
<div
|
||||
class="TableCell icon nowrap"
|
||||
>
|
||||
<div
|
||||
class="content"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="TableCell name nowrap sorting"
|
||||
id="name"
|
||||
>
|
||||
<div
|
||||
class="content"
|
||||
>
|
||||
Name
|
||||
</div>
|
||||
<i
|
||||
class="Icon sortIcon material focusable"
|
||||
>
|
||||
<span
|
||||
class="icon"
|
||||
data-icon-name="arrow_drop_down"
|
||||
>
|
||||
arrow_drop_down
|
||||
</span>
|
||||
</i>
|
||||
</div>
|
||||
<div
|
||||
class="TableCell description nowrap"
|
||||
id="description"
|
||||
>
|
||||
<div
|
||||
class="content"
|
||||
>
|
||||
Description
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="TableCell version nowrap"
|
||||
id="version"
|
||||
>
|
||||
<div
|
||||
class="content"
|
||||
>
|
||||
Version
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="TableCell app-version nowrap"
|
||||
id="app-version"
|
||||
>
|
||||
<div
|
||||
class="content"
|
||||
>
|
||||
App Version
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="TableCell repository nowrap sorting"
|
||||
id="repo"
|
||||
>
|
||||
<div
|
||||
class="content"
|
||||
>
|
||||
Repository
|
||||
</div>
|
||||
<i
|
||||
class="Icon sortIcon material focusable"
|
||||
>
|
||||
<span
|
||||
class="icon"
|
||||
data-icon-name="arrow_drop_down"
|
||||
>
|
||||
arrow_drop_down
|
||||
</span>
|
||||
</i>
|
||||
</div>
|
||||
<div
|
||||
class="TableCell menu nowrap"
|
||||
>
|
||||
<div
|
||||
class="content"
|
||||
>
|
||||
<i
|
||||
class="Icon material interactive focusable"
|
||||
id="menu_actions_17"
|
||||
tabindex="0"
|
||||
>
|
||||
<span
|
||||
class="icon"
|
||||
data-icon-name="more_vert"
|
||||
>
|
||||
more_vert
|
||||
</span>
|
||||
</i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Spinner singleColor center"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="AddRemoveButtons flex gaps"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import type { RenderResult } from "@testing-library/react";
|
||||
import type { ApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
import { getApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
|
||||
describe("helm-charts - navigation to Helm charts", () => {
|
||||
let applicationBuilder: ApplicationBuilder;
|
||||
|
||||
beforeEach(() => {
|
||||
applicationBuilder = getApplicationBuilder();
|
||||
});
|
||||
|
||||
describe("when navigating to Helm charts", () => {
|
||||
let rendered: RenderResult;
|
||||
|
||||
beforeEach(async () => {
|
||||
applicationBuilder.setEnvironmentToClusterFrame();
|
||||
|
||||
rendered = await applicationBuilder.render();
|
||||
|
||||
applicationBuilder.helmCharts.navigate();
|
||||
});
|
||||
|
||||
it("renders", () => {
|
||||
expect(rendered.container).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("shows page for Helm charts", () => {
|
||||
const page = rendered.getByTestId("page-for-helm-charts");
|
||||
|
||||
expect(page).not.toBeNull();
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -2,8 +2,8 @@
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import type { TestExtension } from "../renderer/components/test-utils/get-renderer-extension-fake";
|
||||
import { getRendererExtensionFake } from "../renderer/components/test-utils/get-renderer-extension-fake";
|
||||
import type { FakeExtensionData, TestExtension } from "../renderer/components/test-utils/get-renderer-extension-fake";
|
||||
import { getRendererExtensionFakeFor } from "../renderer/components/test-utils/get-renderer-extension-fake";
|
||||
import React from "react";
|
||||
import type { RenderResult } from "@testing-library/react";
|
||||
import { fireEvent } from "@testing-library/react";
|
||||
@@ -11,7 +11,6 @@ import isEmpty from "lodash/isEmpty";
|
||||
import queryParametersInjectable from "../renderer/routes/query-parameters.injectable";
|
||||
import currentPathInjectable from "../renderer/routes/current-path.injectable";
|
||||
import type { IComputedValue } from "mobx";
|
||||
import type { LensRendererExtension } from "../extensions/lens-renderer-extension";
|
||||
import { getApplicationBuilder } from "../renderer/components/test-utils/get-application-builder";
|
||||
|
||||
describe("navigate to extension page", () => {
|
||||
@@ -22,6 +21,7 @@ describe("navigate to extension page", () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
const applicationBuilder = getApplicationBuilder();
|
||||
const getRendererExtensionFake = getRendererExtensionFakeFor(applicationBuilder);
|
||||
|
||||
testExtension = getRendererExtensionFake(
|
||||
extensionWithPagesHavingParameters,
|
||||
@@ -51,7 +51,7 @@ describe("navigate to extension page", () => {
|
||||
});
|
||||
|
||||
it("URL is correct", () => {
|
||||
expect(currentPath.get()).toBe("/extension/some-extension-id");
|
||||
expect(currentPath.get()).toBe("/extension/some-extension-name");
|
||||
});
|
||||
|
||||
it("query parameters is empty", () => {
|
||||
@@ -70,7 +70,7 @@ describe("navigate to extension page", () => {
|
||||
});
|
||||
|
||||
it("URL is correct", () => {
|
||||
expect(currentPath.get()).toBe("/extension/some-extension-id");
|
||||
expect(currentPath.get()).toBe("/extension/some-extension-name");
|
||||
});
|
||||
|
||||
it("knows query parameters", () => {
|
||||
@@ -98,7 +98,7 @@ describe("navigate to extension page", () => {
|
||||
});
|
||||
|
||||
it("URL is correct", () => {
|
||||
expect(currentPath.get()).toBe("/extension/some-extension-id");
|
||||
expect(currentPath.get()).toBe("/extension/some-extension-name");
|
||||
});
|
||||
|
||||
it("knows query parameters", () => {
|
||||
@@ -120,14 +120,14 @@ describe("navigate to extension page", () => {
|
||||
});
|
||||
|
||||
it("URL is correct", () => {
|
||||
expect(currentPath.get()).toBe("/extension/some-extension-id/some-child-page-id");
|
||||
expect(currentPath.get()).toBe("/extension/some-extension-name/some-child-page-id");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
const extensionWithPagesHavingParameters: Partial<LensRendererExtension> = {
|
||||
const extensionWithPagesHavingParameters: FakeExtensionData = {
|
||||
id: "some-extension-id",
|
||||
|
||||
name: "some-extension-name",
|
||||
globalPages: [
|
||||
{
|
||||
components: {
|
||||
@@ -159,20 +159,14 @@ const extensionWithPagesHavingParameters: Partial<LensRendererExtension> = {
|
||||
|
||||
params: {
|
||||
someStringParameter: "some-string-value",
|
||||
|
||||
someNumberParameter: {
|
||||
defaultValue: 42,
|
||||
|
||||
stringify: (value) => value.toString(),
|
||||
|
||||
parse: (value) => (value ? Number(value) : undefined),
|
||||
},
|
||||
|
||||
someArrayParameter: {
|
||||
defaultValue: ["some-array-value", "some-other-array-value"],
|
||||
|
||||
stringify: (value) => value.join(","),
|
||||
|
||||
parse: (value: string[]) => (!isEmpty(value) ? value : undefined),
|
||||
},
|
||||
},
|
||||
|
||||
@@ -31,7 +31,7 @@ describe("navigating between routes", () => {
|
||||
|
||||
describe("given route without path parameters", () => {
|
||||
beforeEach(async () => {
|
||||
applicationBuilder.beforeSetups(({ rendererDi }) => {
|
||||
applicationBuilder.beforeApplicationStart(({ rendererDi }) => {
|
||||
rendererDi.register(testRouteWithoutPathParametersInjectable);
|
||||
rendererDi.register(testRouteWithoutPathParametersComponentInjectable);
|
||||
});
|
||||
@@ -102,7 +102,7 @@ describe("navigating between routes", () => {
|
||||
describe("given route with optional path parameters", () => {
|
||||
beforeEach(async () => {
|
||||
|
||||
applicationBuilder.beforeSetups(({ rendererDi }) => {
|
||||
applicationBuilder.beforeApplicationStart(({ rendererDi }) => {
|
||||
rendererDi.register(routeWithOptionalPathParametersInjectable);
|
||||
rendererDi.register(routeWithOptionalPathParametersComponentInjectable);
|
||||
});
|
||||
|
||||
@@ -124,7 +124,7 @@ exports[`preferences - closing-preferences given accessing preferences directly
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-26-live-region"
|
||||
id="react-select-theme-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -140,7 +140,7 @@ exports[`preferences - closing-preferences given accessing preferences directly
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-26-placeholder"
|
||||
id="react-select-theme-input-placeholder"
|
||||
>
|
||||
Select...
|
||||
</div>
|
||||
@@ -150,7 +150,7 @@ exports[`preferences - closing-preferences given accessing preferences directly
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-26-placeholder"
|
||||
aria-describedby="react-select-theme-input-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
@@ -209,7 +209,7 @@ exports[`preferences - closing-preferences given accessing preferences directly
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-27-live-region"
|
||||
id="react-select-extension-install-registry-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -225,7 +225,7 @@ exports[`preferences - closing-preferences given accessing preferences directly
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-27-placeholder"
|
||||
id="react-select-extension-install-registry-input-placeholder"
|
||||
>
|
||||
Select...
|
||||
</div>
|
||||
@@ -235,7 +235,7 @@ exports[`preferences - closing-preferences given accessing preferences directly
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-27-placeholder"
|
||||
aria-describedby="react-select-extension-install-registry-input-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
@@ -281,17 +281,12 @@ exports[`preferences - closing-preferences given accessing preferences directly
|
||||
<p
|
||||
class="mt-4 mb-5 leading-relaxed"
|
||||
>
|
||||
This setting is to change the registry URL for installing extensions by name.
|
||||
|
||||
If you are unable to access the default registry (
|
||||
https://registry.npmjs.org
|
||||
)
|
||||
|
||||
you can change it in your
|
||||
This setting is to change the registry URL for installing extensions by name.
|
||||
If you are unable to access the default registry (https://registry.npmjs.org) you can change it in your
|
||||
<b>
|
||||
.npmrc
|
||||
</b>
|
||||
file or in the input below.
|
||||
file or in the input below.
|
||||
</p>
|
||||
<div
|
||||
class="Input theme round black disabled invalid"
|
||||
@@ -349,7 +344,7 @@ exports[`preferences - closing-preferences given accessing preferences directly
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-28-live-region"
|
||||
id="react-select-update-channel-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -361,13 +356,12 @@ exports[`preferences - closing-preferences given accessing preferences directly
|
||||
class="Select__control css-1s2u09g-control"
|
||||
>
|
||||
<div
|
||||
class="Select__value-container css-319lph-ValueContainer"
|
||||
class="Select__value-container Select__value-container--has-value css-319lph-ValueContainer"
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-28-placeholder"
|
||||
class="Select__single-value css-qc6sy-singleValue"
|
||||
>
|
||||
Select...
|
||||
Stable
|
||||
</div>
|
||||
<div
|
||||
class="Select__input-container css-6j8wv5-Input"
|
||||
@@ -375,7 +369,6 @@ exports[`preferences - closing-preferences given accessing preferences directly
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-28-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
@@ -434,7 +427,7 @@ exports[`preferences - closing-preferences given accessing preferences directly
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-29-live-region"
|
||||
id="react-select-timezone-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -450,7 +443,7 @@ exports[`preferences - closing-preferences given accessing preferences directly
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-29-placeholder"
|
||||
id="react-select-timezone-input-placeholder"
|
||||
>
|
||||
Select...
|
||||
</div>
|
||||
@@ -460,7 +453,7 @@ exports[`preferences - closing-preferences given accessing preferences directly
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-29-placeholder"
|
||||
aria-describedby="react-select-timezone-input-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
@@ -542,6 +535,9 @@ exports[`preferences - closing-preferences given accessing preferences directly
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -684,6 +680,9 @@ exports[`preferences - closing-preferences given accessing preferences directly
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -692,6 +691,9 @@ exports[`preferences - closing-preferences given accessing preferences directly
|
||||
<div>
|
||||
Some front page
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -700,6 +702,9 @@ exports[`preferences - closing-preferences given accessing preferences directly
|
||||
<div>
|
||||
Some front page
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -827,7 +832,7 @@ exports[`preferences - closing-preferences given already in a page and then navi
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-2-live-region"
|
||||
id="react-select-theme-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -843,7 +848,7 @@ exports[`preferences - closing-preferences given already in a page and then navi
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-2-placeholder"
|
||||
id="react-select-theme-input-placeholder"
|
||||
>
|
||||
Select...
|
||||
</div>
|
||||
@@ -853,7 +858,7 @@ exports[`preferences - closing-preferences given already in a page and then navi
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-2-placeholder"
|
||||
aria-describedby="react-select-theme-input-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
@@ -912,7 +917,7 @@ exports[`preferences - closing-preferences given already in a page and then navi
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-3-live-region"
|
||||
id="react-select-extension-install-registry-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -928,7 +933,7 @@ exports[`preferences - closing-preferences given already in a page and then navi
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-3-placeholder"
|
||||
id="react-select-extension-install-registry-input-placeholder"
|
||||
>
|
||||
Select...
|
||||
</div>
|
||||
@@ -938,7 +943,7 @@ exports[`preferences - closing-preferences given already in a page and then navi
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-3-placeholder"
|
||||
aria-describedby="react-select-extension-install-registry-input-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
@@ -984,17 +989,12 @@ exports[`preferences - closing-preferences given already in a page and then navi
|
||||
<p
|
||||
class="mt-4 mb-5 leading-relaxed"
|
||||
>
|
||||
This setting is to change the registry URL for installing extensions by name.
|
||||
|
||||
If you are unable to access the default registry (
|
||||
https://registry.npmjs.org
|
||||
)
|
||||
|
||||
you can change it in your
|
||||
This setting is to change the registry URL for installing extensions by name.
|
||||
If you are unable to access the default registry (https://registry.npmjs.org) you can change it in your
|
||||
<b>
|
||||
.npmrc
|
||||
</b>
|
||||
file or in the input below.
|
||||
file or in the input below.
|
||||
</p>
|
||||
<div
|
||||
class="Input theme round black disabled invalid"
|
||||
@@ -1052,7 +1052,7 @@ exports[`preferences - closing-preferences given already in a page and then navi
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-4-live-region"
|
||||
id="react-select-update-channel-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -1064,13 +1064,12 @@ exports[`preferences - closing-preferences given already in a page and then navi
|
||||
class="Select__control css-1s2u09g-control"
|
||||
>
|
||||
<div
|
||||
class="Select__value-container css-319lph-ValueContainer"
|
||||
class="Select__value-container Select__value-container--has-value css-319lph-ValueContainer"
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-4-placeholder"
|
||||
class="Select__single-value css-qc6sy-singleValue"
|
||||
>
|
||||
Select...
|
||||
Stable
|
||||
</div>
|
||||
<div
|
||||
class="Select__input-container css-6j8wv5-Input"
|
||||
@@ -1078,7 +1077,6 @@ exports[`preferences - closing-preferences given already in a page and then navi
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-4-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
@@ -1137,7 +1135,7 @@ exports[`preferences - closing-preferences given already in a page and then navi
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-5-live-region"
|
||||
id="react-select-timezone-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -1153,7 +1151,7 @@ exports[`preferences - closing-preferences given already in a page and then navi
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-5-placeholder"
|
||||
id="react-select-timezone-input-placeholder"
|
||||
>
|
||||
Select...
|
||||
</div>
|
||||
@@ -1163,7 +1161,7 @@ exports[`preferences - closing-preferences given already in a page and then navi
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-5-placeholder"
|
||||
aria-describedby="react-select-timezone-input-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
@@ -1245,6 +1243,9 @@ exports[`preferences - closing-preferences given already in a page and then navi
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -1387,6 +1388,9 @@ exports[`preferences - closing-preferences given already in a page and then navi
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -1529,6 +1533,9 @@ exports[`preferences - closing-preferences given already in a page and then navi
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -1671,5 +1678,8 @@ exports[`preferences - closing-preferences given already in a page and then navi
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
+22
-23
@@ -199,6 +199,9 @@ exports[`preferences - navigation to application preferences given in some child
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -314,7 +317,7 @@ exports[`preferences - navigation to application preferences given in some child
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-2-live-region"
|
||||
id="react-select-theme-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -330,7 +333,7 @@ exports[`preferences - navigation to application preferences given in some child
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-2-placeholder"
|
||||
id="react-select-theme-input-placeholder"
|
||||
>
|
||||
Select...
|
||||
</div>
|
||||
@@ -340,7 +343,7 @@ exports[`preferences - navigation to application preferences given in some child
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-2-placeholder"
|
||||
aria-describedby="react-select-theme-input-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
@@ -399,7 +402,7 @@ exports[`preferences - navigation to application preferences given in some child
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-3-live-region"
|
||||
id="react-select-extension-install-registry-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -415,7 +418,7 @@ exports[`preferences - navigation to application preferences given in some child
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-3-placeholder"
|
||||
id="react-select-extension-install-registry-input-placeholder"
|
||||
>
|
||||
Select...
|
||||
</div>
|
||||
@@ -425,7 +428,7 @@ exports[`preferences - navigation to application preferences given in some child
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-3-placeholder"
|
||||
aria-describedby="react-select-extension-install-registry-input-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
@@ -471,17 +474,12 @@ exports[`preferences - navigation to application preferences given in some child
|
||||
<p
|
||||
class="mt-4 mb-5 leading-relaxed"
|
||||
>
|
||||
This setting is to change the registry URL for installing extensions by name.
|
||||
|
||||
If you are unable to access the default registry (
|
||||
https://registry.npmjs.org
|
||||
)
|
||||
|
||||
you can change it in your
|
||||
This setting is to change the registry URL for installing extensions by name.
|
||||
If you are unable to access the default registry (https://registry.npmjs.org) you can change it in your
|
||||
<b>
|
||||
.npmrc
|
||||
</b>
|
||||
file or in the input below.
|
||||
file or in the input below.
|
||||
</p>
|
||||
<div
|
||||
class="Input theme round black disabled invalid"
|
||||
@@ -539,7 +537,7 @@ exports[`preferences - navigation to application preferences given in some child
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-4-live-region"
|
||||
id="react-select-update-channel-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -551,13 +549,12 @@ exports[`preferences - navigation to application preferences given in some child
|
||||
class="Select__control css-1s2u09g-control"
|
||||
>
|
||||
<div
|
||||
class="Select__value-container css-319lph-ValueContainer"
|
||||
class="Select__value-container Select__value-container--has-value css-319lph-ValueContainer"
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-4-placeholder"
|
||||
class="Select__single-value css-qc6sy-singleValue"
|
||||
>
|
||||
Select...
|
||||
Stable
|
||||
</div>
|
||||
<div
|
||||
class="Select__input-container css-6j8wv5-Input"
|
||||
@@ -565,7 +562,6 @@ exports[`preferences - navigation to application preferences given in some child
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-4-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
@@ -624,7 +620,7 @@ exports[`preferences - navigation to application preferences given in some child
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-5-live-region"
|
||||
id="react-select-timezone-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -640,7 +636,7 @@ exports[`preferences - navigation to application preferences given in some child
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-5-placeholder"
|
||||
id="react-select-timezone-input-placeholder"
|
||||
>
|
||||
Select...
|
||||
</div>
|
||||
@@ -650,7 +646,7 @@ exports[`preferences - navigation to application preferences given in some child
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-5-placeholder"
|
||||
aria-describedby="react-select-timezone-input-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
@@ -732,5 +728,8 @@ exports[`preferences - navigation to application preferences given in some child
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
+28
-29
@@ -112,7 +112,7 @@ exports[`preferences - navigation to editor preferences given in preferences, wh
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-2-live-region"
|
||||
id="react-select-theme-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -128,7 +128,7 @@ exports[`preferences - navigation to editor preferences given in preferences, wh
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-2-placeholder"
|
||||
id="react-select-theme-input-placeholder"
|
||||
>
|
||||
Select...
|
||||
</div>
|
||||
@@ -138,7 +138,7 @@ exports[`preferences - navigation to editor preferences given in preferences, wh
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-2-placeholder"
|
||||
aria-describedby="react-select-theme-input-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
@@ -197,7 +197,7 @@ exports[`preferences - navigation to editor preferences given in preferences, wh
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-3-live-region"
|
||||
id="react-select-extension-install-registry-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -213,7 +213,7 @@ exports[`preferences - navigation to editor preferences given in preferences, wh
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-3-placeholder"
|
||||
id="react-select-extension-install-registry-input-placeholder"
|
||||
>
|
||||
Select...
|
||||
</div>
|
||||
@@ -223,7 +223,7 @@ exports[`preferences - navigation to editor preferences given in preferences, wh
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-3-placeholder"
|
||||
aria-describedby="react-select-extension-install-registry-input-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
@@ -269,17 +269,12 @@ exports[`preferences - navigation to editor preferences given in preferences, wh
|
||||
<p
|
||||
class="mt-4 mb-5 leading-relaxed"
|
||||
>
|
||||
This setting is to change the registry URL for installing extensions by name.
|
||||
|
||||
If you are unable to access the default registry (
|
||||
https://registry.npmjs.org
|
||||
)
|
||||
|
||||
you can change it in your
|
||||
This setting is to change the registry URL for installing extensions by name.
|
||||
If you are unable to access the default registry (https://registry.npmjs.org) you can change it in your
|
||||
<b>
|
||||
.npmrc
|
||||
</b>
|
||||
file or in the input below.
|
||||
file or in the input below.
|
||||
</p>
|
||||
<div
|
||||
class="Input theme round black disabled invalid"
|
||||
@@ -337,7 +332,7 @@ exports[`preferences - navigation to editor preferences given in preferences, wh
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-4-live-region"
|
||||
id="react-select-update-channel-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -349,13 +344,12 @@ exports[`preferences - navigation to editor preferences given in preferences, wh
|
||||
class="Select__control css-1s2u09g-control"
|
||||
>
|
||||
<div
|
||||
class="Select__value-container css-319lph-ValueContainer"
|
||||
class="Select__value-container Select__value-container--has-value css-319lph-ValueContainer"
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-4-placeholder"
|
||||
class="Select__single-value css-qc6sy-singleValue"
|
||||
>
|
||||
Select...
|
||||
Stable
|
||||
</div>
|
||||
<div
|
||||
class="Select__input-container css-6j8wv5-Input"
|
||||
@@ -363,7 +357,6 @@ exports[`preferences - navigation to editor preferences given in preferences, wh
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-4-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
@@ -422,7 +415,7 @@ exports[`preferences - navigation to editor preferences given in preferences, wh
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-5-live-region"
|
||||
id="react-select-timezone-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -438,7 +431,7 @@ exports[`preferences - navigation to editor preferences given in preferences, wh
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-5-placeholder"
|
||||
id="react-select-timezone-input-placeholder"
|
||||
>
|
||||
Select...
|
||||
</div>
|
||||
@@ -448,7 +441,7 @@ exports[`preferences - navigation to editor preferences given in preferences, wh
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-5-placeholder"
|
||||
aria-describedby="react-select-timezone-input-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
@@ -530,6 +523,9 @@ exports[`preferences - navigation to editor preferences given in preferences, wh
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -668,7 +664,7 @@ exports[`preferences - navigation to editor preferences given in preferences, wh
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-14-live-region"
|
||||
id="react-select-minimap-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -684,7 +680,7 @@ exports[`preferences - navigation to editor preferences given in preferences, wh
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-14-placeholder"
|
||||
id="react-select-minimap-input-placeholder"
|
||||
>
|
||||
Select...
|
||||
</div>
|
||||
@@ -694,7 +690,7 @@ exports[`preferences - navigation to editor preferences given in preferences, wh
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-14-placeholder"
|
||||
aria-describedby="react-select-minimap-input-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
@@ -752,7 +748,7 @@ exports[`preferences - navigation to editor preferences given in preferences, wh
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-15-live-region"
|
||||
id="react-select-editor-line-numbers-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -768,7 +764,7 @@ exports[`preferences - navigation to editor preferences given in preferences, wh
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-15-placeholder"
|
||||
id="react-select-editor-line-numbers-input-placeholder"
|
||||
>
|
||||
Select...
|
||||
</div>
|
||||
@@ -778,7 +774,7 @@ exports[`preferences - navigation to editor preferences given in preferences, wh
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-15-placeholder"
|
||||
aria-describedby="react-select-editor-line-numbers-input-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
@@ -940,5 +936,8 @@ exports[`preferences - navigation to editor preferences given in preferences, wh
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
+54
-877
File diff suppressed because it is too large.
Load diff
+50
-38
@@ -112,7 +112,7 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-2-live-region"
|
||||
id="react-select-theme-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -128,7 +128,7 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-2-placeholder"
|
||||
id="react-select-theme-input-placeholder"
|
||||
>
|
||||
Select...
|
||||
</div>
|
||||
@@ -138,7 +138,7 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-2-placeholder"
|
||||
aria-describedby="react-select-theme-input-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
@@ -197,7 +197,7 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-3-live-region"
|
||||
id="react-select-extension-install-registry-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -213,7 +213,7 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-3-placeholder"
|
||||
id="react-select-extension-install-registry-input-placeholder"
|
||||
>
|
||||
Select...
|
||||
</div>
|
||||
@@ -223,7 +223,7 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-3-placeholder"
|
||||
aria-describedby="react-select-extension-install-registry-input-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
@@ -269,17 +269,12 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
|
||||
<p
|
||||
class="mt-4 mb-5 leading-relaxed"
|
||||
>
|
||||
This setting is to change the registry URL for installing extensions by name.
|
||||
|
||||
If you are unable to access the default registry (
|
||||
https://registry.npmjs.org
|
||||
)
|
||||
|
||||
you can change it in your
|
||||
This setting is to change the registry URL for installing extensions by name.
|
||||
If you are unable to access the default registry (https://registry.npmjs.org) you can change it in your
|
||||
<b>
|
||||
.npmrc
|
||||
</b>
|
||||
file or in the input below.
|
||||
file or in the input below.
|
||||
</p>
|
||||
<div
|
||||
class="Input theme round black disabled invalid"
|
||||
@@ -337,7 +332,7 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-4-live-region"
|
||||
id="react-select-update-channel-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -349,13 +344,12 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
|
||||
class="Select__control css-1s2u09g-control"
|
||||
>
|
||||
<div
|
||||
class="Select__value-container css-319lph-ValueContainer"
|
||||
class="Select__value-container Select__value-container--has-value css-319lph-ValueContainer"
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-4-placeholder"
|
||||
class="Select__single-value css-qc6sy-singleValue"
|
||||
>
|
||||
Select...
|
||||
Stable
|
||||
</div>
|
||||
<div
|
||||
class="Select__input-container css-6j8wv5-Input"
|
||||
@@ -363,7 +357,6 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-4-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
@@ -422,7 +415,7 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-5-live-region"
|
||||
id="react-select-timezone-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -438,7 +431,7 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-5-placeholder"
|
||||
id="react-select-timezone-input-placeholder"
|
||||
>
|
||||
Select...
|
||||
</div>
|
||||
@@ -448,7 +441,7 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-5-placeholder"
|
||||
aria-describedby="react-select-timezone-input-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
@@ -530,6 +523,9 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -664,7 +660,7 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-14-live-region"
|
||||
id="react-select-download-mirror-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -680,7 +676,7 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-14-placeholder"
|
||||
id="react-select-download-mirror-input-placeholder"
|
||||
>
|
||||
Download mirror for kubectl
|
||||
</div>
|
||||
@@ -690,7 +686,7 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-14-placeholder"
|
||||
aria-describedby="react-select-download-mirror-input-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
@@ -841,11 +837,11 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
|
||||
class="flex gaps"
|
||||
>
|
||||
<div
|
||||
class="Select theme-lens box grow css-b62m3t-container"
|
||||
class="Select theme-lens box grow Select--is-disabled css-3iigni-container"
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-15-live-region"
|
||||
id="react-select-HelmRepoSelect-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -854,30 +850,31 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
/>
|
||||
<div
|
||||
class="Select__control css-1s2u09g-control"
|
||||
class="Select__control Select__control--is-disabled css-1insrsq-control"
|
||||
>
|
||||
<div
|
||||
class="Select__value-container css-319lph-ValueContainer"
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-15-placeholder"
|
||||
id="react-select-HelmRepoSelect-placeholder"
|
||||
>
|
||||
Repositories
|
||||
</div>
|
||||
<div
|
||||
class="Select__input-container css-6j8wv5-Input"
|
||||
class="Select__input-container css-jzldcf-Input"
|
||||
data-value=""
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-15-placeholder"
|
||||
aria-describedby="react-select-HelmRepoSelect-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
autocomplete="off"
|
||||
autocorrect="off"
|
||||
class="Select__input"
|
||||
disabled=""
|
||||
id="HelmRepoSelect"
|
||||
role="combobox"
|
||||
spellcheck="false"
|
||||
@@ -891,8 +888,22 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
|
||||
<div
|
||||
class="Select__indicators css-1hb7zxy-IndicatorsContainer"
|
||||
>
|
||||
<div
|
||||
aria-hidden="true"
|
||||
class="Select__indicator Select__loading-indicator css-at12u2-loadingIndicator"
|
||||
>
|
||||
<span
|
||||
class="css-1xtdfmb-LoadingDot"
|
||||
/>
|
||||
<span
|
||||
class="css-zoievk-LoadingDot"
|
||||
/>
|
||||
<span
|
||||
class="css-x748d8-LoadingDot"
|
||||
/>
|
||||
</div>
|
||||
<span
|
||||
class="Select__indicator-separator css-1okebmr-indicatorSeparator"
|
||||
class="Select__indicator-separator css-109onse-indicatorSeparator"
|
||||
/>
|
||||
<div
|
||||
aria-hidden="true"
|
||||
@@ -925,13 +936,11 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
|
||||
class="repos"
|
||||
>
|
||||
<div
|
||||
class="notice"
|
||||
class="pt-5 relative"
|
||||
>
|
||||
<div
|
||||
class="flex-grow text-center"
|
||||
>
|
||||
The repositories have not been added yet
|
||||
</div>
|
||||
class="Spinner singleColor center"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -974,5 +983,8 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
+22
-23
@@ -112,7 +112,7 @@ exports[`preferences - navigation to proxy preferences given in preferences, whe
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-2-live-region"
|
||||
id="react-select-theme-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -128,7 +128,7 @@ exports[`preferences - navigation to proxy preferences given in preferences, whe
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-2-placeholder"
|
||||
id="react-select-theme-input-placeholder"
|
||||
>
|
||||
Select...
|
||||
</div>
|
||||
@@ -138,7 +138,7 @@ exports[`preferences - navigation to proxy preferences given in preferences, whe
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-2-placeholder"
|
||||
aria-describedby="react-select-theme-input-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
@@ -197,7 +197,7 @@ exports[`preferences - navigation to proxy preferences given in preferences, whe
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-3-live-region"
|
||||
id="react-select-extension-install-registry-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -213,7 +213,7 @@ exports[`preferences - navigation to proxy preferences given in preferences, whe
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-3-placeholder"
|
||||
id="react-select-extension-install-registry-input-placeholder"
|
||||
>
|
||||
Select...
|
||||
</div>
|
||||
@@ -223,7 +223,7 @@ exports[`preferences - navigation to proxy preferences given in preferences, whe
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-3-placeholder"
|
||||
aria-describedby="react-select-extension-install-registry-input-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
@@ -269,17 +269,12 @@ exports[`preferences - navigation to proxy preferences given in preferences, whe
|
||||
<p
|
||||
class="mt-4 mb-5 leading-relaxed"
|
||||
>
|
||||
This setting is to change the registry URL for installing extensions by name.
|
||||
|
||||
If you are unable to access the default registry (
|
||||
https://registry.npmjs.org
|
||||
)
|
||||
|
||||
you can change it in your
|
||||
This setting is to change the registry URL for installing extensions by name.
|
||||
If you are unable to access the default registry (https://registry.npmjs.org) you can change it in your
|
||||
<b>
|
||||
.npmrc
|
||||
</b>
|
||||
file or in the input below.
|
||||
file or in the input below.
|
||||
</p>
|
||||
<div
|
||||
class="Input theme round black disabled invalid"
|
||||
@@ -337,7 +332,7 @@ exports[`preferences - navigation to proxy preferences given in preferences, whe
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-4-live-region"
|
||||
id="react-select-update-channel-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -349,13 +344,12 @@ exports[`preferences - navigation to proxy preferences given in preferences, whe
|
||||
class="Select__control css-1s2u09g-control"
|
||||
>
|
||||
<div
|
||||
class="Select__value-container css-319lph-ValueContainer"
|
||||
class="Select__value-container Select__value-container--has-value css-319lph-ValueContainer"
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-4-placeholder"
|
||||
class="Select__single-value css-qc6sy-singleValue"
|
||||
>
|
||||
Select...
|
||||
Stable
|
||||
</div>
|
||||
<div
|
||||
class="Select__input-container css-6j8wv5-Input"
|
||||
@@ -363,7 +357,6 @@ exports[`preferences - navigation to proxy preferences given in preferences, whe
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-4-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
@@ -422,7 +415,7 @@ exports[`preferences - navigation to proxy preferences given in preferences, whe
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-5-live-region"
|
||||
id="react-select-timezone-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -438,7 +431,7 @@ exports[`preferences - navigation to proxy preferences given in preferences, whe
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-5-placeholder"
|
||||
id="react-select-timezone-input-placeholder"
|
||||
>
|
||||
Select...
|
||||
</div>
|
||||
@@ -448,7 +441,7 @@ exports[`preferences - navigation to proxy preferences given in preferences, whe
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-5-placeholder"
|
||||
aria-describedby="react-select-timezone-input-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
@@ -530,6 +523,9 @@ exports[`preferences - navigation to proxy preferences given in preferences, whe
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -732,5 +728,8 @@ exports[`preferences - navigation to proxy preferences given in preferences, whe
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
+47
-46
@@ -185,6 +185,9 @@ exports[`preferences - navigation to telemetry preferences given URL for Sentry
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -300,7 +303,7 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-2-live-region"
|
||||
id="react-select-theme-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -316,7 +319,7 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-2-placeholder"
|
||||
id="react-select-theme-input-placeholder"
|
||||
>
|
||||
Select...
|
||||
</div>
|
||||
@@ -326,7 +329,7 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-2-placeholder"
|
||||
aria-describedby="react-select-theme-input-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
@@ -385,7 +388,7 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-3-live-region"
|
||||
id="react-select-extension-install-registry-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -401,7 +404,7 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-3-placeholder"
|
||||
id="react-select-extension-install-registry-input-placeholder"
|
||||
>
|
||||
Select...
|
||||
</div>
|
||||
@@ -411,7 +414,7 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-3-placeholder"
|
||||
aria-describedby="react-select-extension-install-registry-input-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
@@ -457,17 +460,12 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
|
||||
<p
|
||||
class="mt-4 mb-5 leading-relaxed"
|
||||
>
|
||||
This setting is to change the registry URL for installing extensions by name.
|
||||
|
||||
If you are unable to access the default registry (
|
||||
https://registry.npmjs.org
|
||||
)
|
||||
|
||||
you can change it in your
|
||||
This setting is to change the registry URL for installing extensions by name.
|
||||
If you are unable to access the default registry (https://registry.npmjs.org) you can change it in your
|
||||
<b>
|
||||
.npmrc
|
||||
</b>
|
||||
file or in the input below.
|
||||
file or in the input below.
|
||||
</p>
|
||||
<div
|
||||
class="Input theme round black disabled invalid"
|
||||
@@ -525,7 +523,7 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-4-live-region"
|
||||
id="react-select-update-channel-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -537,13 +535,12 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
|
||||
class="Select__control css-1s2u09g-control"
|
||||
>
|
||||
<div
|
||||
class="Select__value-container css-319lph-ValueContainer"
|
||||
class="Select__value-container Select__value-container--has-value css-319lph-ValueContainer"
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-4-placeholder"
|
||||
class="Select__single-value css-qc6sy-singleValue"
|
||||
>
|
||||
Select...
|
||||
Stable
|
||||
</div>
|
||||
<div
|
||||
class="Select__input-container css-6j8wv5-Input"
|
||||
@@ -551,7 +548,6 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-4-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
@@ -610,7 +606,7 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-5-live-region"
|
||||
id="react-select-timezone-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -626,7 +622,7 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-5-placeholder"
|
||||
id="react-select-timezone-input-placeholder"
|
||||
>
|
||||
Select...
|
||||
</div>
|
||||
@@ -636,7 +632,7 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-5-placeholder"
|
||||
aria-describedby="react-select-timezone-input-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
@@ -718,6 +714,9 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -845,7 +844,7 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-14-live-region"
|
||||
id="react-select-theme-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -861,7 +860,7 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-14-placeholder"
|
||||
id="react-select-theme-input-placeholder"
|
||||
>
|
||||
Select...
|
||||
</div>
|
||||
@@ -871,7 +870,7 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-14-placeholder"
|
||||
aria-describedby="react-select-theme-input-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
@@ -930,7 +929,7 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-15-live-region"
|
||||
id="react-select-extension-install-registry-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -946,7 +945,7 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-15-placeholder"
|
||||
id="react-select-extension-install-registry-input-placeholder"
|
||||
>
|
||||
Select...
|
||||
</div>
|
||||
@@ -956,7 +955,7 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-15-placeholder"
|
||||
aria-describedby="react-select-extension-install-registry-input-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
@@ -1002,17 +1001,12 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
|
||||
<p
|
||||
class="mt-4 mb-5 leading-relaxed"
|
||||
>
|
||||
This setting is to change the registry URL for installing extensions by name.
|
||||
|
||||
If you are unable to access the default registry (
|
||||
https://registry.npmjs.org
|
||||
)
|
||||
|
||||
you can change it in your
|
||||
This setting is to change the registry URL for installing extensions by name.
|
||||
If you are unable to access the default registry (https://registry.npmjs.org) you can change it in your
|
||||
<b>
|
||||
.npmrc
|
||||
</b>
|
||||
file or in the input below.
|
||||
file or in the input below.
|
||||
</p>
|
||||
<div
|
||||
class="Input theme round black disabled invalid"
|
||||
@@ -1070,7 +1064,7 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-16-live-region"
|
||||
id="react-select-update-channel-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -1082,13 +1076,12 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
|
||||
class="Select__control css-1s2u09g-control"
|
||||
>
|
||||
<div
|
||||
class="Select__value-container css-319lph-ValueContainer"
|
||||
class="Select__value-container Select__value-container--has-value css-319lph-ValueContainer"
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-16-placeholder"
|
||||
class="Select__single-value css-qc6sy-singleValue"
|
||||
>
|
||||
Select...
|
||||
Stable
|
||||
</div>
|
||||
<div
|
||||
class="Select__input-container css-6j8wv5-Input"
|
||||
@@ -1096,7 +1089,6 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-16-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
@@ -1155,7 +1147,7 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-17-live-region"
|
||||
id="react-select-timezone-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -1171,7 +1163,7 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-17-placeholder"
|
||||
id="react-select-timezone-input-placeholder"
|
||||
>
|
||||
Select...
|
||||
</div>
|
||||
@@ -1181,7 +1173,7 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-17-placeholder"
|
||||
aria-describedby="react-select-timezone-input-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
@@ -1263,6 +1255,9 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -1439,6 +1434,9 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -1578,5 +1576,8 @@ exports[`preferences - navigation to telemetry preferences given no URL for Sent
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
+96
-40
@@ -112,7 +112,7 @@ exports[`preferences - navigation to terminal preferences given in preferences,
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-2-live-region"
|
||||
id="react-select-theme-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -128,7 +128,7 @@ exports[`preferences - navigation to terminal preferences given in preferences,
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-2-placeholder"
|
||||
id="react-select-theme-input-placeholder"
|
||||
>
|
||||
Select...
|
||||
</div>
|
||||
@@ -138,7 +138,7 @@ exports[`preferences - navigation to terminal preferences given in preferences,
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-2-placeholder"
|
||||
aria-describedby="react-select-theme-input-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
@@ -197,7 +197,7 @@ exports[`preferences - navigation to terminal preferences given in preferences,
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-3-live-region"
|
||||
id="react-select-extension-install-registry-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -213,7 +213,7 @@ exports[`preferences - navigation to terminal preferences given in preferences,
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-3-placeholder"
|
||||
id="react-select-extension-install-registry-input-placeholder"
|
||||
>
|
||||
Select...
|
||||
</div>
|
||||
@@ -223,7 +223,7 @@ exports[`preferences - navigation to terminal preferences given in preferences,
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-3-placeholder"
|
||||
aria-describedby="react-select-extension-install-registry-input-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
@@ -269,17 +269,12 @@ exports[`preferences - navigation to terminal preferences given in preferences,
|
||||
<p
|
||||
class="mt-4 mb-5 leading-relaxed"
|
||||
>
|
||||
This setting is to change the registry URL for installing extensions by name.
|
||||
|
||||
If you are unable to access the default registry (
|
||||
https://registry.npmjs.org
|
||||
)
|
||||
|
||||
you can change it in your
|
||||
This setting is to change the registry URL for installing extensions by name.
|
||||
If you are unable to access the default registry (https://registry.npmjs.org) you can change it in your
|
||||
<b>
|
||||
.npmrc
|
||||
</b>
|
||||
file or in the input below.
|
||||
file or in the input below.
|
||||
</p>
|
||||
<div
|
||||
class="Input theme round black disabled invalid"
|
||||
@@ -337,7 +332,7 @@ exports[`preferences - navigation to terminal preferences given in preferences,
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-4-live-region"
|
||||
id="react-select-update-channel-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -349,13 +344,12 @@ exports[`preferences - navigation to terminal preferences given in preferences,
|
||||
class="Select__control css-1s2u09g-control"
|
||||
>
|
||||
<div
|
||||
class="Select__value-container css-319lph-ValueContainer"
|
||||
class="Select__value-container Select__value-container--has-value css-319lph-ValueContainer"
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-4-placeholder"
|
||||
class="Select__single-value css-qc6sy-singleValue"
|
||||
>
|
||||
Select...
|
||||
Stable
|
||||
</div>
|
||||
<div
|
||||
class="Select__input-container css-6j8wv5-Input"
|
||||
@@ -363,7 +357,6 @@ exports[`preferences - navigation to terminal preferences given in preferences,
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-4-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
@@ -422,7 +415,7 @@ exports[`preferences - navigation to terminal preferences given in preferences,
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-5-live-region"
|
||||
id="react-select-timezone-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -438,7 +431,7 @@ exports[`preferences - navigation to terminal preferences given in preferences,
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-5-placeholder"
|
||||
id="react-select-timezone-input-placeholder"
|
||||
>
|
||||
Select...
|
||||
</div>
|
||||
@@ -448,7 +441,7 @@ exports[`preferences - navigation to terminal preferences given in preferences,
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-5-placeholder"
|
||||
aria-describedby="react-select-timezone-input-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
@@ -530,6 +523,9 @@ exports[`preferences - navigation to terminal preferences given in preferences,
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -689,7 +685,7 @@ exports[`preferences - navigation to terminal preferences given in preferences,
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-14-live-region"
|
||||
id="react-select-terminal-theme-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -705,7 +701,7 @@ exports[`preferences - navigation to terminal preferences given in preferences,
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-14-placeholder"
|
||||
id="react-select-terminal-theme-input-placeholder"
|
||||
>
|
||||
Select...
|
||||
</div>
|
||||
@@ -715,7 +711,7 @@ exports[`preferences - navigation to terminal preferences given in preferences,
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-14-placeholder"
|
||||
aria-describedby="react-select-terminal-theme-input-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
@@ -775,6 +771,7 @@ exports[`preferences - navigation to terminal preferences given in preferences,
|
||||
>
|
||||
<input
|
||||
class="input box grow"
|
||||
max="50"
|
||||
min="10"
|
||||
spellcheck="false"
|
||||
type="number"
|
||||
@@ -794,22 +791,78 @@ exports[`preferences - navigation to terminal preferences given in preferences,
|
||||
|
||||
</div>
|
||||
<div
|
||||
class="Input theme round black"
|
||||
class="Select theme-lens css-b62m3t-container"
|
||||
>
|
||||
<label
|
||||
class="input-area flex gaps align-center"
|
||||
id=""
|
||||
>
|
||||
<input
|
||||
class="input box grow"
|
||||
spellcheck="false"
|
||||
type="text"
|
||||
value=""
|
||||
/>
|
||||
</label>
|
||||
<div
|
||||
class="input-info flex gaps"
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-2-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
aria-live="polite"
|
||||
aria-relevant="additions text"
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
/>
|
||||
<div
|
||||
class="Select__control css-1s2u09g-control"
|
||||
>
|
||||
<div
|
||||
class="Select__value-container css-319lph-ValueContainer"
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-2-placeholder"
|
||||
>
|
||||
Select...
|
||||
</div>
|
||||
<div
|
||||
class="Select__input-container css-6j8wv5-Input"
|
||||
data-value=""
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-2-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
autocomplete="off"
|
||||
autocorrect="off"
|
||||
class="Select__input"
|
||||
id="react-select-2-input"
|
||||
role="combobox"
|
||||
spellcheck="false"
|
||||
style="opacity: 1; width: 100%; grid-area: 1 / 2; min-width: 2px; border: 0px; margin: 0px; outline: 0; padding: 0px;"
|
||||
tabindex="0"
|
||||
type="text"
|
||||
value=""
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Select__indicators css-1hb7zxy-IndicatorsContainer"
|
||||
>
|
||||
<span
|
||||
class="Select__indicator-separator css-1okebmr-indicatorSeparator"
|
||||
/>
|
||||
<div
|
||||
aria-hidden="true"
|
||||
class="Select__indicator Select__dropdown-indicator css-tlfecz-indicatorContainer"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class="css-tj5bde-Svg"
|
||||
focusable="false"
|
||||
height="20"
|
||||
viewBox="0 0 20 20"
|
||||
width="20"
|
||||
>
|
||||
<path
|
||||
d="M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</section>
|
||||
@@ -850,5 +903,8 @@ exports[`preferences - navigation to terminal preferences given in preferences,
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
+26
-24
@@ -1,6 +1,12 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`preferences - navigation using application menu renders 1`] = `<div />`;
|
||||
exports[`preferences - navigation using application menu renders 1`] = `
|
||||
<div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`preferences - navigation using application menu when navigating to preferences using application menu renders 1`] = `
|
||||
<div>
|
||||
@@ -114,7 +120,7 @@ exports[`preferences - navigation using application menu when navigating to pref
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-2-live-region"
|
||||
id="react-select-theme-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -130,7 +136,7 @@ exports[`preferences - navigation using application menu when navigating to pref
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-2-placeholder"
|
||||
id="react-select-theme-input-placeholder"
|
||||
>
|
||||
Select...
|
||||
</div>
|
||||
@@ -140,7 +146,7 @@ exports[`preferences - navigation using application menu when navigating to pref
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-2-placeholder"
|
||||
aria-describedby="react-select-theme-input-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
@@ -199,7 +205,7 @@ exports[`preferences - navigation using application menu when navigating to pref
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-3-live-region"
|
||||
id="react-select-extension-install-registry-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -215,7 +221,7 @@ exports[`preferences - navigation using application menu when navigating to pref
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-3-placeholder"
|
||||
id="react-select-extension-install-registry-input-placeholder"
|
||||
>
|
||||
Select...
|
||||
</div>
|
||||
@@ -225,7 +231,7 @@ exports[`preferences - navigation using application menu when navigating to pref
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-3-placeholder"
|
||||
aria-describedby="react-select-extension-install-registry-input-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
@@ -271,17 +277,12 @@ exports[`preferences - navigation using application menu when navigating to pref
|
||||
<p
|
||||
class="mt-4 mb-5 leading-relaxed"
|
||||
>
|
||||
This setting is to change the registry URL for installing extensions by name.
|
||||
|
||||
If you are unable to access the default registry (
|
||||
https://registry.npmjs.org
|
||||
)
|
||||
|
||||
you can change it in your
|
||||
This setting is to change the registry URL for installing extensions by name.
|
||||
If you are unable to access the default registry (https://registry.npmjs.org) you can change it in your
|
||||
<b>
|
||||
.npmrc
|
||||
</b>
|
||||
file or in the input below.
|
||||
file or in the input below.
|
||||
</p>
|
||||
<div
|
||||
class="Input theme round black disabled invalid"
|
||||
@@ -339,7 +340,7 @@ exports[`preferences - navigation using application menu when navigating to pref
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-4-live-region"
|
||||
id="react-select-update-channel-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -351,13 +352,12 @@ exports[`preferences - navigation using application menu when navigating to pref
|
||||
class="Select__control css-1s2u09g-control"
|
||||
>
|
||||
<div
|
||||
class="Select__value-container css-319lph-ValueContainer"
|
||||
class="Select__value-container Select__value-container--has-value css-319lph-ValueContainer"
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-4-placeholder"
|
||||
class="Select__single-value css-qc6sy-singleValue"
|
||||
>
|
||||
Select...
|
||||
Stable
|
||||
</div>
|
||||
<div
|
||||
class="Select__input-container css-6j8wv5-Input"
|
||||
@@ -365,7 +365,6 @@ exports[`preferences - navigation using application menu when navigating to pref
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-4-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
@@ -424,7 +423,7 @@ exports[`preferences - navigation using application menu when navigating to pref
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-5-live-region"
|
||||
id="react-select-timezone-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
@@ -440,7 +439,7 @@ exports[`preferences - navigation using application menu when navigating to pref
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-5-placeholder"
|
||||
id="react-select-timezone-input-placeholder"
|
||||
>
|
||||
Select...
|
||||
</div>
|
||||
@@ -450,7 +449,7 @@ exports[`preferences - navigation using application menu when navigating to pref
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-5-placeholder"
|
||||
aria-describedby="react-select-timezone-input-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
@@ -532,5 +531,8 @@ exports[`preferences - navigation using application menu when navigating to pref
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
@@ -0,0 +1,542 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`show-about-using-tray renders 1`] = `
|
||||
<body>
|
||||
<div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
</body>
|
||||
`;
|
||||
|
||||
exports[`show-about-using-tray when navigating using tray renders 1`] = `
|
||||
<body>
|
||||
<div>
|
||||
<div
|
||||
class="SettingLayout showNavigation Preferences"
|
||||
data-testid="application-preferences-page"
|
||||
>
|
||||
<nav
|
||||
class="sidebarRegion"
|
||||
>
|
||||
<div
|
||||
class="sidebar"
|
||||
>
|
||||
<div
|
||||
class="Tabs flex column"
|
||||
>
|
||||
<div
|
||||
class="header"
|
||||
>
|
||||
Preferences
|
||||
</div>
|
||||
<div
|
||||
class="Tab flex gaps align-center active"
|
||||
data-testid="tab-link-for-application"
|
||||
role="tab"
|
||||
tabindex="0"
|
||||
>
|
||||
<div
|
||||
class="label"
|
||||
>
|
||||
App
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Tab flex gaps align-center"
|
||||
data-testid="tab-link-for-proxy"
|
||||
role="tab"
|
||||
tabindex="0"
|
||||
>
|
||||
<div
|
||||
class="label"
|
||||
>
|
||||
Proxy
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Tab flex gaps align-center"
|
||||
data-testid="tab-link-for-kubernetes"
|
||||
role="tab"
|
||||
tabindex="0"
|
||||
>
|
||||
<div
|
||||
class="label"
|
||||
>
|
||||
Kubernetes
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Tab flex gaps align-center"
|
||||
data-testid="tab-link-for-editor"
|
||||
role="tab"
|
||||
tabindex="0"
|
||||
>
|
||||
<div
|
||||
class="label"
|
||||
>
|
||||
Editor
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Tab flex gaps align-center"
|
||||
data-testid="tab-link-for-terminal"
|
||||
role="tab"
|
||||
tabindex="0"
|
||||
>
|
||||
<div
|
||||
class="label"
|
||||
>
|
||||
Terminal
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div
|
||||
class="contentRegion"
|
||||
id="ScrollSpyRoot"
|
||||
>
|
||||
<div
|
||||
class="content"
|
||||
>
|
||||
<section
|
||||
id="application"
|
||||
>
|
||||
<h2
|
||||
data-testid="application-header"
|
||||
>
|
||||
Application
|
||||
</h2>
|
||||
<section
|
||||
id="appearance"
|
||||
>
|
||||
<div
|
||||
class="SubTitle"
|
||||
>
|
||||
Theme
|
||||
|
||||
</div>
|
||||
<div
|
||||
class="Select theme-lens css-b62m3t-container"
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-theme-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
aria-live="polite"
|
||||
aria-relevant="additions text"
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
/>
|
||||
<div
|
||||
class="Select__control css-1s2u09g-control"
|
||||
>
|
||||
<div
|
||||
class="Select__value-container css-319lph-ValueContainer"
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-theme-input-placeholder"
|
||||
>
|
||||
Select...
|
||||
</div>
|
||||
<div
|
||||
class="Select__input-container css-6j8wv5-Input"
|
||||
data-value=""
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-theme-input-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
autocomplete="off"
|
||||
autocorrect="off"
|
||||
class="Select__input"
|
||||
id="theme-input"
|
||||
role="combobox"
|
||||
spellcheck="false"
|
||||
style="opacity: 1; width: 100%; grid-area: 1 / 2; min-width: 2px; border: 0px; margin: 0px; outline: 0; padding: 0px;"
|
||||
tabindex="0"
|
||||
type="text"
|
||||
value=""
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Select__indicators css-1hb7zxy-IndicatorsContainer"
|
||||
>
|
||||
<span
|
||||
class="Select__indicator-separator css-1okebmr-indicatorSeparator"
|
||||
/>
|
||||
<div
|
||||
aria-hidden="true"
|
||||
class="Select__indicator Select__dropdown-indicator css-tlfecz-indicatorContainer"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class="css-tj5bde-Svg"
|
||||
focusable="false"
|
||||
height="20"
|
||||
viewBox="0 0 20 20"
|
||||
width="20"
|
||||
>
|
||||
<path
|
||||
d="M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<hr />
|
||||
<section
|
||||
id="extensionRegistryUrl"
|
||||
>
|
||||
<div
|
||||
class="SubTitle"
|
||||
>
|
||||
Extension Install Registry
|
||||
|
||||
</div>
|
||||
<div
|
||||
class="Select theme-lens css-b62m3t-container"
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-extension-install-registry-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
aria-live="polite"
|
||||
aria-relevant="additions text"
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
/>
|
||||
<div
|
||||
class="Select__control css-1s2u09g-control"
|
||||
>
|
||||
<div
|
||||
class="Select__value-container css-319lph-ValueContainer"
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-extension-install-registry-input-placeholder"
|
||||
>
|
||||
Select...
|
||||
</div>
|
||||
<div
|
||||
class="Select__input-container css-6j8wv5-Input"
|
||||
data-value=""
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-extension-install-registry-input-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
autocomplete="off"
|
||||
autocorrect="off"
|
||||
class="Select__input"
|
||||
id="extension-install-registry-input"
|
||||
role="combobox"
|
||||
spellcheck="false"
|
||||
style="opacity: 1; width: 100%; grid-area: 1 / 2; min-width: 2px; border: 0px; margin: 0px; outline: 0; padding: 0px;"
|
||||
tabindex="0"
|
||||
type="text"
|
||||
value=""
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Select__indicators css-1hb7zxy-IndicatorsContainer"
|
||||
>
|
||||
<span
|
||||
class="Select__indicator-separator css-1okebmr-indicatorSeparator"
|
||||
/>
|
||||
<div
|
||||
aria-hidden="true"
|
||||
class="Select__indicator Select__dropdown-indicator css-tlfecz-indicatorContainer"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class="css-tj5bde-Svg"
|
||||
focusable="false"
|
||||
height="20"
|
||||
viewBox="0 0 20 20"
|
||||
width="20"
|
||||
>
|
||||
<path
|
||||
d="M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p
|
||||
class="mt-4 mb-5 leading-relaxed"
|
||||
>
|
||||
This setting is to change the registry URL for installing extensions by name.
|
||||
If you are unable to access the default registry (https://registry.npmjs.org) you can change it in your
|
||||
<b>
|
||||
.npmrc
|
||||
</b>
|
||||
file or in the input below.
|
||||
</p>
|
||||
<div
|
||||
class="Input theme round black disabled invalid"
|
||||
>
|
||||
<label
|
||||
class="input-area flex gaps align-center"
|
||||
id=""
|
||||
>
|
||||
<input
|
||||
class="input box grow"
|
||||
disabled=""
|
||||
placeholder="Custom Extension Registry URL..."
|
||||
spellcheck="false"
|
||||
value="some-custom-url"
|
||||
/>
|
||||
</label>
|
||||
<div
|
||||
class="input-info flex gaps"
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
<hr />
|
||||
<section
|
||||
id="other"
|
||||
>
|
||||
<div
|
||||
class="SubTitle"
|
||||
>
|
||||
Start-up
|
||||
|
||||
</div>
|
||||
<label
|
||||
class="Switch"
|
||||
data-testid="switch"
|
||||
>
|
||||
Automatically start Lens on login
|
||||
<input
|
||||
role="switch"
|
||||
type="checkbox"
|
||||
/>
|
||||
</label>
|
||||
</section>
|
||||
<hr />
|
||||
<section
|
||||
id="update-channel"
|
||||
>
|
||||
<div
|
||||
class="SubTitle"
|
||||
>
|
||||
Update Channel
|
||||
|
||||
</div>
|
||||
<div
|
||||
class="Select theme-lens css-b62m3t-container"
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-update-channel-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
aria-live="polite"
|
||||
aria-relevant="additions text"
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
/>
|
||||
<div
|
||||
class="Select__control css-1s2u09g-control"
|
||||
>
|
||||
<div
|
||||
class="Select__value-container Select__value-container--has-value css-319lph-ValueContainer"
|
||||
>
|
||||
<div
|
||||
class="Select__single-value css-qc6sy-singleValue"
|
||||
>
|
||||
Stable
|
||||
</div>
|
||||
<div
|
||||
class="Select__input-container css-6j8wv5-Input"
|
||||
data-value=""
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
autocomplete="off"
|
||||
autocorrect="off"
|
||||
class="Select__input"
|
||||
id="update-channel-input"
|
||||
role="combobox"
|
||||
spellcheck="false"
|
||||
style="opacity: 1; width: 100%; grid-area: 1 / 2; min-width: 2px; border: 0px; margin: 0px; outline: 0; padding: 0px;"
|
||||
tabindex="0"
|
||||
type="text"
|
||||
value=""
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Select__indicators css-1hb7zxy-IndicatorsContainer"
|
||||
>
|
||||
<span
|
||||
class="Select__indicator-separator css-1okebmr-indicatorSeparator"
|
||||
/>
|
||||
<div
|
||||
aria-hidden="true"
|
||||
class="Select__indicator Select__dropdown-indicator css-tlfecz-indicatorContainer"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class="css-tj5bde-Svg"
|
||||
focusable="false"
|
||||
height="20"
|
||||
viewBox="0 0 20 20"
|
||||
width="20"
|
||||
>
|
||||
<path
|
||||
d="M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<hr />
|
||||
<section
|
||||
id="locale"
|
||||
>
|
||||
<div
|
||||
class="SubTitle"
|
||||
>
|
||||
Locale Timezone
|
||||
|
||||
</div>
|
||||
<div
|
||||
class="Select theme-lens css-b62m3t-container"
|
||||
>
|
||||
<span
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
id="react-select-timezone-input-live-region"
|
||||
/>
|
||||
<span
|
||||
aria-atomic="false"
|
||||
aria-live="polite"
|
||||
aria-relevant="additions text"
|
||||
class="css-1f43avz-a11yText-A11yText"
|
||||
/>
|
||||
<div
|
||||
class="Select__control css-1s2u09g-control"
|
||||
>
|
||||
<div
|
||||
class="Select__value-container css-319lph-ValueContainer"
|
||||
>
|
||||
<div
|
||||
class="Select__placeholder css-14el2xx-placeholder"
|
||||
id="react-select-timezone-input-placeholder"
|
||||
>
|
||||
Select...
|
||||
</div>
|
||||
<div
|
||||
class="Select__input-container css-6j8wv5-Input"
|
||||
data-value=""
|
||||
>
|
||||
<input
|
||||
aria-autocomplete="list"
|
||||
aria-describedby="react-select-timezone-input-placeholder"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="true"
|
||||
autocapitalize="none"
|
||||
autocomplete="off"
|
||||
autocorrect="off"
|
||||
class="Select__input"
|
||||
id="timezone-input"
|
||||
role="combobox"
|
||||
spellcheck="false"
|
||||
style="opacity: 1; width: 100%; grid-area: 1 / 2; min-width: 2px; border: 0px; margin: 0px; outline: 0; padding: 0px;"
|
||||
tabindex="0"
|
||||
type="text"
|
||||
value=""
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Select__indicators css-1hb7zxy-IndicatorsContainer"
|
||||
>
|
||||
<span
|
||||
class="Select__indicator-separator css-1okebmr-indicatorSeparator"
|
||||
/>
|
||||
<div
|
||||
aria-hidden="true"
|
||||
class="Select__indicator Select__dropdown-indicator css-tlfecz-indicatorContainer"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class="css-tj5bde-Svg"
|
||||
focusable="false"
|
||||
height="20"
|
||||
viewBox="0 0 20 20"
|
||||
width="20"
|
||||
>
|
||||
<path
|
||||
d="M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</section>
|
||||
</div>
|
||||
<div
|
||||
class="toolsRegion"
|
||||
>
|
||||
<div
|
||||
class="fixed top-[60px]"
|
||||
>
|
||||
<div
|
||||
data-testid="close-preferences"
|
||||
>
|
||||
<div
|
||||
aria-label="Close"
|
||||
class="closeButton"
|
||||
role="button"
|
||||
>
|
||||
<i
|
||||
class="Icon icon material focusable"
|
||||
>
|
||||
<span
|
||||
class="icon"
|
||||
data-icon-name="close"
|
||||
>
|
||||
close
|
||||
</span>
|
||||
</i>
|
||||
</div>
|
||||
<div
|
||||
aria-hidden="true"
|
||||
class="esc"
|
||||
>
|
||||
ESC
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
</body>
|
||||
`;
|
||||
@@ -10,10 +10,6 @@ import { getApplicationBuilder } from "../../renderer/components/test-utils/get-
|
||||
import currentPathInjectable from "../../renderer/routes/current-path.injectable";
|
||||
import { routeInjectionToken } from "../../common/front-end-routing/route-injection-token";
|
||||
import { computed } from "mobx";
|
||||
import type { UserStore } from "../../common/user-store";
|
||||
import userStoreInjectable from "../../common/user-store/user-store.injectable";
|
||||
import type { ThemeStore } from "../../renderer/theme.store";
|
||||
import themeStoreInjectable from "../../renderer/theme-store.injectable";
|
||||
import { preferenceNavigationItemInjectionToken } from "../../renderer/components/+preferences/preferences-navigation/preference-navigation-items.injectable";
|
||||
import routeIsActiveInjectable from "../../renderer/routes/route-is-active.injectable";
|
||||
import { Preferences } from "../../renderer/components/+preferences";
|
||||
@@ -33,23 +29,13 @@ describe("preferences - closing-preferences", () => {
|
||||
beforeEach(() => {
|
||||
applicationBuilder = getApplicationBuilder();
|
||||
|
||||
applicationBuilder.beforeSetups(({ rendererDi }) => {
|
||||
applicationBuilder.beforeApplicationStart(({ rendererDi }) => {
|
||||
rendererDi.register(testPreferencesRouteInjectable);
|
||||
rendererDi.register(testPreferencesRouteComponentInjectable);
|
||||
rendererDi.register(testFrontPageRouteInjectable);
|
||||
rendererDi.register(testFrontPageRouteComponentInjectable);
|
||||
rendererDi.register(testNavigationItemInjectable);
|
||||
|
||||
const userStoreStub = {
|
||||
extensionRegistryUrl: { customUrl: "some-custom-url" },
|
||||
} as unknown as UserStore;
|
||||
|
||||
rendererDi.override(userStoreInjectable, () => userStoreStub);
|
||||
|
||||
const themeStoreStub = { themeOptions: [] } as unknown as ThemeStore;
|
||||
|
||||
rendererDi.override(themeStoreInjectable, () => themeStoreStub);
|
||||
|
||||
rendererDi.override(navigateToFrontPageInjectable, (di) => {
|
||||
const navigateToRoute = di.inject(navigateToRouteInjectionToken);
|
||||
const testFrontPage = di.inject(testFrontPageRouteInjectable);
|
||||
@@ -66,7 +52,7 @@ describe("preferences - closing-preferences", () => {
|
||||
let rendererDi: DiContainer;
|
||||
|
||||
beforeEach(async () => {
|
||||
applicationBuilder.beforeSetups(({ rendererDi }) => {
|
||||
applicationBuilder.beforeApplicationStart(({ rendererDi }) => {
|
||||
rendererDi.override(observableHistoryInjectable, () => {
|
||||
const historyFake = createMemoryHistory({
|
||||
initialEntries: ["/some-test-path"],
|
||||
@@ -139,7 +125,7 @@ describe("preferences - closing-preferences", () => {
|
||||
let rendererDi: DiContainer;
|
||||
|
||||
beforeEach(async () => {
|
||||
applicationBuilder.beforeSetups(({ rendererDi }) => {
|
||||
applicationBuilder.beforeApplicationStart(({ rendererDi }) => {
|
||||
rendererDi.override(observableHistoryInjectable, () => {
|
||||
const historyFake = createMemoryHistory({
|
||||
initialEntries: ["/preferences/app"],
|
||||
|
||||
@@ -5,30 +5,13 @@
|
||||
import type { RenderResult } from "@testing-library/react";
|
||||
import type { ApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
import { getApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
import userStoreInjectable from "../../common/user-store/user-store.injectable";
|
||||
import type { UserStore } from "../../common/user-store";
|
||||
import themeStoreInjectable from "../../renderer/theme-store.injectable";
|
||||
import type { ThemeStore } from "../../renderer/theme.store";
|
||||
import navigateToProxyPreferencesInjectable
|
||||
from "../../common/front-end-routing/routes/preferences/proxy/navigate-to-proxy-preferences.injectable";
|
||||
import navigateToProxyPreferencesInjectable from "../../common/front-end-routing/routes/preferences/proxy/navigate-to-proxy-preferences.injectable";
|
||||
|
||||
describe("preferences - navigation to application preferences", () => {
|
||||
let applicationBuilder: ApplicationBuilder;
|
||||
|
||||
beforeEach(() => {
|
||||
applicationBuilder = getApplicationBuilder();
|
||||
|
||||
applicationBuilder.beforeSetups(({ rendererDi }) => {
|
||||
const userStoreStub = {
|
||||
extensionRegistryUrl: { customUrl: "some-custom-url" },
|
||||
} as unknown as UserStore;
|
||||
|
||||
rendererDi.override(userStoreInjectable, () => userStoreStub);
|
||||
|
||||
const themeStoreStub = ({ themeOptions: [] }) as unknown as ThemeStore;
|
||||
|
||||
rendererDi.override(themeStoreInjectable, () => themeStoreStub);
|
||||
});
|
||||
});
|
||||
|
||||
describe("given in some child page of preferences, when rendered", () => {
|
||||
|
||||
@@ -5,29 +5,12 @@
|
||||
import type { RenderResult } from "@testing-library/react";
|
||||
import type { ApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
import { getApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
import userStoreInjectable from "../../common/user-store/user-store.injectable";
|
||||
import type { UserStore } from "../../common/user-store";
|
||||
import themeStoreInjectable from "../../renderer/theme-store.injectable";
|
||||
import type { ThemeStore } from "../../renderer/theme.store";
|
||||
|
||||
describe("preferences - navigation to editor preferences", () => {
|
||||
let applicationBuilder: ApplicationBuilder;
|
||||
|
||||
beforeEach(() => {
|
||||
applicationBuilder = getApplicationBuilder();
|
||||
|
||||
applicationBuilder.beforeSetups(({ rendererDi }) => {
|
||||
const userStoreStub = {
|
||||
extensionRegistryUrl: { customUrl: "some-custom-url" },
|
||||
editorConfiguration: { minimap: {}, tabSize: 42, fontSize: 42 },
|
||||
} as unknown as UserStore;
|
||||
|
||||
rendererDi.override(userStoreInjectable, () => userStoreStub);
|
||||
|
||||
const themeStoreStub = ({ themeOptions: [] }) as unknown as ThemeStore;
|
||||
|
||||
rendererDi.override(themeStoreInjectable, () => themeStoreStub);
|
||||
});
|
||||
});
|
||||
|
||||
describe("given in preferences, when rendered", () => {
|
||||
|
||||
@@ -5,32 +5,16 @@
|
||||
import type { RenderResult } from "@testing-library/react";
|
||||
import type { ApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
import { getApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
import userStoreInjectable from "../../common/user-store/user-store.injectable";
|
||||
import type { UserStore } from "../../common/user-store";
|
||||
import themeStoreInjectable from "../../renderer/theme-store.injectable";
|
||||
import type { ThemeStore } from "../../renderer/theme.store";
|
||||
import type { LensRendererExtension } from "../../extensions/lens-renderer-extension";
|
||||
import React from "react";
|
||||
import { getRendererExtensionFake } from "../../renderer/components/test-utils/get-renderer-extension-fake";
|
||||
import "@testing-library/jest-dom/extend-expect";
|
||||
import type { FakeExtensionData } from "../../renderer/components/test-utils/get-renderer-extension-fake";
|
||||
import { getRendererExtensionFakeFor } from "../../renderer/components/test-utils/get-renderer-extension-fake";
|
||||
|
||||
describe("preferences - navigation to extension specific preferences", () => {
|
||||
let applicationBuilder: ApplicationBuilder;
|
||||
|
||||
beforeEach(() => {
|
||||
applicationBuilder = getApplicationBuilder();
|
||||
|
||||
applicationBuilder.beforeSetups(({ rendererDi }) => {
|
||||
const userStoreStub = {
|
||||
extensionRegistryUrl: { customUrl: "some-custom-url" },
|
||||
} as unknown as UserStore;
|
||||
|
||||
rendererDi.override(userStoreInjectable, () => userStoreStub);
|
||||
|
||||
const themeStoreStub = { themeOptions: [] } as unknown as ThemeStore;
|
||||
|
||||
rendererDi.override(themeStoreInjectable, () => themeStoreStub);
|
||||
});
|
||||
});
|
||||
|
||||
describe("given in preferences, when rendered", () => {
|
||||
@@ -62,6 +46,7 @@ describe("preferences - navigation to extension specific preferences", () => {
|
||||
|
||||
describe("given multiple extensions with specific preferences, when navigating to extension specific preferences page", () => {
|
||||
beforeEach(async () => {
|
||||
const getRendererExtensionFake = getRendererExtensionFakeFor(applicationBuilder);
|
||||
const someTestExtension = getRendererExtensionFake(extensionStubWithExtensionSpecificPreferenceItems);
|
||||
const someOtherTestExtension = getRendererExtensionFake(someOtherExtensionStubWithExtensionSpecificPreferenceItems);
|
||||
|
||||
@@ -88,6 +73,7 @@ describe("preferences - navigation to extension specific preferences", () => {
|
||||
|
||||
describe("given multiple extensions with and without specific preferences, when navigating to extension specific preferences page", () => {
|
||||
beforeEach(async () => {
|
||||
const getRendererExtensionFake = getRendererExtensionFakeFor(applicationBuilder);
|
||||
const someTestExtension = getRendererExtensionFake(extensionStubWithExtensionSpecificPreferenceItems);
|
||||
const extensionWithoutPreferences = getRendererExtensionFake(extensionStubWithoutPreferences);
|
||||
const extensionWithSpecificTab = getRendererExtensionFake(extensionStubWithShowInPreferencesTab);
|
||||
@@ -109,10 +95,11 @@ describe("preferences - navigation to extension specific preferences", () => {
|
||||
});
|
||||
|
||||
describe("when extension with specific preferences is enabled", () => {
|
||||
beforeEach(async () => {
|
||||
beforeEach(() => {
|
||||
const getRendererExtensionFake = getRendererExtensionFakeFor(applicationBuilder);
|
||||
const testExtension = getRendererExtensionFake(extensionStubWithExtensionSpecificPreferenceItems);
|
||||
|
||||
await applicationBuilder.addExtensions(testExtension);
|
||||
applicationBuilder.addExtensions(testExtension);
|
||||
});
|
||||
|
||||
it("renders", () => {
|
||||
@@ -168,6 +155,7 @@ describe("preferences - navigation to extension specific preferences", () => {
|
||||
|
||||
describe("given extension with registered tab", () => {
|
||||
beforeEach(async () => {
|
||||
const getRendererExtensionFake = getRendererExtensionFakeFor(applicationBuilder);
|
||||
const extension = getRendererExtensionFake(extensionStubWithWithRegisteredTab);
|
||||
|
||||
await applicationBuilder.addExtensions(extension);
|
||||
@@ -207,6 +195,7 @@ describe("preferences - navigation to extension specific preferences", () => {
|
||||
|
||||
describe("given extension with few registered tabs", () => {
|
||||
beforeEach(async () => {
|
||||
const getRendererExtensionFake = getRendererExtensionFakeFor(applicationBuilder);
|
||||
const extension = getRendererExtensionFake(extensionStubWithWithRegisteredTabs);
|
||||
|
||||
await applicationBuilder.addExtensions(extension);
|
||||
@@ -223,6 +212,7 @@ describe("preferences - navigation to extension specific preferences", () => {
|
||||
|
||||
describe("given extensions with tabs having same id", () => {
|
||||
beforeEach(async () => {
|
||||
const getRendererExtensionFake = getRendererExtensionFakeFor(applicationBuilder);
|
||||
const extension = getRendererExtensionFake(extensionStubWithWithRegisteredTab);
|
||||
const otherExtension = getRendererExtensionFake(extensionStubWithWithSameRegisteredTab);
|
||||
|
||||
@@ -288,9 +278,9 @@ describe("preferences - navigation to extension specific preferences", () => {
|
||||
});
|
||||
});
|
||||
|
||||
const extensionStubWithExtensionSpecificPreferenceItems: Partial<LensRendererExtension> = {
|
||||
id: "some-test-extension-id",
|
||||
|
||||
const extensionStubWithExtensionSpecificPreferenceItems: FakeExtensionData = {
|
||||
id: "some-extension-id",
|
||||
name: "some-extension-name",
|
||||
appPreferences: [
|
||||
{
|
||||
title: "Some preference item",
|
||||
@@ -315,8 +305,9 @@ const extensionStubWithExtensionSpecificPreferenceItems: Partial<LensRendererExt
|
||||
],
|
||||
};
|
||||
|
||||
const someOtherExtensionStubWithExtensionSpecificPreferenceItems: Partial<LensRendererExtension> = {
|
||||
const someOtherExtensionStubWithExtensionSpecificPreferenceItems: FakeExtensionData = {
|
||||
id: "some-other-test-extension-id",
|
||||
name: "some-other-test-extension-name",
|
||||
|
||||
appPreferences: [
|
||||
{
|
||||
@@ -331,12 +322,14 @@ const someOtherExtensionStubWithExtensionSpecificPreferenceItems: Partial<LensRe
|
||||
],
|
||||
};
|
||||
|
||||
const extensionStubWithoutPreferences: Partial<LensRendererExtension> = {
|
||||
const extensionStubWithoutPreferences: FakeExtensionData = {
|
||||
id: "without-preferences-id",
|
||||
name: "without-preferences-name",
|
||||
};
|
||||
|
||||
const extensionStubWithShowInPreferencesTab: Partial<LensRendererExtension> = {
|
||||
const extensionStubWithShowInPreferencesTab: FakeExtensionData = {
|
||||
id: "specified-preferences-page-id",
|
||||
name: "specified-preferences-page-name",
|
||||
|
||||
appPreferences: [
|
||||
{
|
||||
@@ -352,8 +345,9 @@ const extensionStubWithShowInPreferencesTab: Partial<LensRendererExtension> = {
|
||||
],
|
||||
};
|
||||
|
||||
const extensionStubWithWithRegisteredTab: Partial<LensRendererExtension> = {
|
||||
const extensionStubWithWithRegisteredTab: FakeExtensionData = {
|
||||
id: "registered-tab-page-id",
|
||||
name: "registered-tab-page-name",
|
||||
|
||||
appPreferences: [
|
||||
{
|
||||
@@ -395,8 +389,9 @@ const extensionStubWithWithRegisteredTab: Partial<LensRendererExtension> = {
|
||||
}],
|
||||
};
|
||||
|
||||
const extensionStubWithWithRegisteredTabs: Partial<LensRendererExtension> = {
|
||||
const extensionStubWithWithRegisteredTabs: FakeExtensionData = {
|
||||
id: "hello-world-tab-page-id",
|
||||
name: "hello-world-tab-page-name",
|
||||
|
||||
appPreferences: [
|
||||
{
|
||||
@@ -432,8 +427,9 @@ const extensionStubWithWithRegisteredTabs: Partial<LensRendererExtension> = {
|
||||
}],
|
||||
};
|
||||
|
||||
const extensionStubWithWithSameRegisteredTab: Partial<LensRendererExtension> = {
|
||||
const extensionStubWithWithSameRegisteredTab: FakeExtensionData = {
|
||||
id: "duplicated-tab-page-id",
|
||||
name: "duplicated-tab-page-name",
|
||||
|
||||
appPreferences: [
|
||||
{
|
||||
|
||||
@@ -5,30 +5,12 @@
|
||||
import type { RenderResult } from "@testing-library/react";
|
||||
import type { ApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
import { getApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
import userStoreInjectable from "../../common/user-store/user-store.injectable";
|
||||
import type { UserStore } from "../../common/user-store";
|
||||
import themeStoreInjectable from "../../renderer/theme-store.injectable";
|
||||
import type { ThemeStore } from "../../renderer/theme.store";
|
||||
import { observable } from "mobx";
|
||||
|
||||
describe("preferences - navigation to kubernetes preferences", () => {
|
||||
let applicationBuilder: ApplicationBuilder;
|
||||
|
||||
beforeEach(() => {
|
||||
applicationBuilder = getApplicationBuilder();
|
||||
|
||||
applicationBuilder.beforeSetups(({ rendererDi }) => {
|
||||
const userStoreStub = {
|
||||
extensionRegistryUrl: { customUrl: "some-custom-url" },
|
||||
syncKubeconfigEntries: observable.map(),
|
||||
} as unknown as UserStore;
|
||||
|
||||
rendererDi.override(userStoreInjectable, () => userStoreStub);
|
||||
|
||||
const themeStoreStub = ({ themeOptions: [] }) as unknown as ThemeStore;
|
||||
|
||||
rendererDi.override(themeStoreInjectable, () => themeStoreStub);
|
||||
});
|
||||
});
|
||||
|
||||
describe("given in preferences, when rendered", () => {
|
||||
|
||||
@@ -5,28 +5,12 @@
|
||||
import type { RenderResult } from "@testing-library/react";
|
||||
import type { ApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
import { getApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
import userStoreInjectable from "../../common/user-store/user-store.injectable";
|
||||
import type { UserStore } from "../../common/user-store";
|
||||
import themeStoreInjectable from "../../renderer/theme-store.injectable";
|
||||
import type { ThemeStore } from "../../renderer/theme.store";
|
||||
|
||||
describe("preferences - navigation to proxy preferences", () => {
|
||||
let applicationBuilder: ApplicationBuilder;
|
||||
|
||||
beforeEach(() => {
|
||||
applicationBuilder = getApplicationBuilder();
|
||||
|
||||
applicationBuilder.beforeSetups(({ rendererDi }) => {
|
||||
const userStoreStub = {
|
||||
extensionRegistryUrl: { customUrl: "some-custom-url" },
|
||||
} as unknown as UserStore;
|
||||
|
||||
rendererDi.override(userStoreInjectable, () => userStoreStub);
|
||||
|
||||
const themeStoreStub = ({ themeOptions: [] }) as unknown as ThemeStore;
|
||||
|
||||
rendererDi.override(themeStoreInjectable, () => themeStoreStub);
|
||||
});
|
||||
});
|
||||
|
||||
describe("given in preferences, when rendered", () => {
|
||||
|
||||
@@ -6,11 +6,8 @@ import type { RenderResult } from "@testing-library/react";
|
||||
import React from "react";
|
||||
import type { ApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
import { getApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
import { getRendererExtensionFake } from "../../renderer/components/test-utils/get-renderer-extension-fake";
|
||||
import type { UserStore } from "../../common/user-store";
|
||||
import userStoreInjectable from "../../common/user-store/user-store.injectable";
|
||||
import type { ThemeStore } from "../../renderer/theme.store";
|
||||
import themeStoreInjectable from "../../renderer/theme-store.injectable";
|
||||
import type { FakeExtensionData } from "../../renderer/components/test-utils/get-renderer-extension-fake";
|
||||
import { getRendererExtensionFakeFor } from "../../renderer/components/test-utils/get-renderer-extension-fake";
|
||||
import navigateToTelemetryPreferencesInjectable from "../../common/front-end-routing/routes/preferences/telemetry/navigate-to-telemetry-preferences.injectable";
|
||||
import sentryDnsUrlInjectable from "../../renderer/components/+preferences/sentry-dns-url.injectable";
|
||||
|
||||
@@ -19,18 +16,6 @@ describe("preferences - navigation to telemetry preferences", () => {
|
||||
|
||||
beforeEach(() => {
|
||||
applicationBuilder = getApplicationBuilder();
|
||||
|
||||
applicationBuilder.beforeSetups(({ rendererDi }) => {
|
||||
const userStoreStub = {
|
||||
extensionRegistryUrl: { customUrl: "some-custom-url" },
|
||||
} as unknown as UserStore;
|
||||
|
||||
rendererDi.override(userStoreInjectable, () => userStoreStub);
|
||||
|
||||
const themeStoreStub = { themeOptions: [] } as unknown as ThemeStore;
|
||||
|
||||
rendererDi.override(themeStoreInjectable, () => themeStoreStub);
|
||||
});
|
||||
});
|
||||
|
||||
describe("given in preferences, when rendered", () => {
|
||||
@@ -62,8 +47,8 @@ describe("preferences - navigation to telemetry preferences", () => {
|
||||
|
||||
describe("when extension with telemetry preference items gets enabled", () => {
|
||||
beforeEach(() => {
|
||||
const testExtensionWithTelemetryPreferenceItems =
|
||||
getRendererExtensionFake(extensionStubWithTelemetryPreferenceItems);
|
||||
const getRendererExtensionFake = getRendererExtensionFakeFor(applicationBuilder);
|
||||
const testExtensionWithTelemetryPreferenceItems = getRendererExtensionFake(extensionStubWithTelemetryPreferenceItems);
|
||||
|
||||
applicationBuilder.addExtensions(
|
||||
testExtensionWithTelemetryPreferenceItems,
|
||||
@@ -106,18 +91,19 @@ describe("preferences - navigation to telemetry preferences", () => {
|
||||
});
|
||||
|
||||
it("given extensions but no telemetry preference items, does not show link for telemetry preferences", () => {
|
||||
const testExtensionWithTelemetryPreferenceItems =
|
||||
getRendererExtensionFake({
|
||||
id: "some-test-extension-id",
|
||||
appPreferences: [
|
||||
{
|
||||
title: "irrelevant",
|
||||
id: "irrelevant",
|
||||
showInPreferencesTab: "not-telemetry",
|
||||
components: { Hint: () => <div />, Input: () => <div /> },
|
||||
},
|
||||
],
|
||||
});
|
||||
const getRendererExtensionFake = getRendererExtensionFakeFor(applicationBuilder);
|
||||
const testExtensionWithTelemetryPreferenceItems = getRendererExtensionFake({
|
||||
id: "some-test-extension-id",
|
||||
name: "some-test-extension-name",
|
||||
appPreferences: [
|
||||
{
|
||||
title: "irrelevant",
|
||||
id: "irrelevant",
|
||||
showInPreferencesTab: "not-telemetry",
|
||||
components: { Hint: () => <div />, Input: () => <div /> },
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
applicationBuilder.addExtensions(
|
||||
testExtensionWithTelemetryPreferenceItems,
|
||||
@@ -133,7 +119,7 @@ describe("preferences - navigation to telemetry preferences", () => {
|
||||
let rendered: RenderResult;
|
||||
|
||||
beforeEach(async () => {
|
||||
applicationBuilder.beforeSetups(({ rendererDi }) => {
|
||||
applicationBuilder.beforeApplicationStart(({ rendererDi }) => {
|
||||
rendererDi.override(sentryDnsUrlInjectable, () => "some-sentry-dns-url");
|
||||
});
|
||||
|
||||
@@ -163,7 +149,7 @@ describe("preferences - navigation to telemetry preferences", () => {
|
||||
let rendered: RenderResult;
|
||||
|
||||
beforeEach(async () => {
|
||||
applicationBuilder.beforeSetups(({ rendererDi }) => {
|
||||
applicationBuilder.beforeApplicationStart(({ rendererDi }) => {
|
||||
rendererDi.override(sentryDnsUrlInjectable, () => null);
|
||||
});
|
||||
|
||||
@@ -186,8 +172,9 @@ describe("preferences - navigation to telemetry preferences", () => {
|
||||
});
|
||||
});
|
||||
|
||||
const extensionStubWithTelemetryPreferenceItems = {
|
||||
const extensionStubWithTelemetryPreferenceItems: FakeExtensionData = {
|
||||
id: "some-test-extension-id",
|
||||
name: "some-test-extension-name",
|
||||
appPreferences: [
|
||||
{
|
||||
title: "Some telemetry-preference item",
|
||||
|
||||
@@ -5,34 +5,12 @@
|
||||
import type { RenderResult } from "@testing-library/react";
|
||||
import type { ApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
import { getApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
import userStoreInjectable from "../../common/user-store/user-store.injectable";
|
||||
import type { UserStore } from "../../common/user-store";
|
||||
import themeStoreInjectable from "../../renderer/theme-store.injectable";
|
||||
import type { ThemeStore } from "../../renderer/theme.store";
|
||||
import { observable } from "mobx";
|
||||
import defaultShellInjectable from "../../renderer/components/+preferences/default-shell.injectable";
|
||||
|
||||
describe("preferences - navigation to terminal preferences", () => {
|
||||
let applicationBuilder: ApplicationBuilder;
|
||||
|
||||
beforeEach(() => {
|
||||
applicationBuilder = getApplicationBuilder();
|
||||
|
||||
applicationBuilder.beforeSetups(({ rendererDi }) => {
|
||||
const userStoreStub = {
|
||||
extensionRegistryUrl: { customUrl: "some-custom-url" },
|
||||
syncKubeconfigEntries: observable.map(),
|
||||
terminalConfig: { fontSize: 42 },
|
||||
} as unknown as UserStore;
|
||||
|
||||
rendererDi.override(userStoreInjectable, () => userStoreStub);
|
||||
|
||||
rendererDi.override(defaultShellInjectable, () => "some-default-shell");
|
||||
|
||||
const themeStoreStub = ({ themeOptions: [] }) as unknown as ThemeStore;
|
||||
|
||||
rendererDi.override(themeStoreInjectable, () => themeStoreStub);
|
||||
});
|
||||
});
|
||||
|
||||
describe("given in preferences, when rendered", () => {
|
||||
|
||||
@@ -6,11 +6,6 @@
|
||||
import type { RenderResult } from "@testing-library/react";
|
||||
import type { ApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
import { getApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
import isAutoUpdateEnabledInjectable from "../../main/is-auto-update-enabled.injectable";
|
||||
import type { UserStore } from "../../common/user-store";
|
||||
import userStoreInjectable from "../../common/user-store/user-store.injectable";
|
||||
import type { ThemeStore } from "../../renderer/theme.store";
|
||||
import themeStoreInjectable from "../../renderer/theme-store.injectable";
|
||||
|
||||
describe("preferences - navigation using application menu", () => {
|
||||
let applicationBuilder: ApplicationBuilder;
|
||||
@@ -19,20 +14,6 @@ describe("preferences - navigation using application menu", () => {
|
||||
beforeEach(async () => {
|
||||
applicationBuilder = getApplicationBuilder();
|
||||
|
||||
applicationBuilder.beforeSetups(({ rendererDi, mainDi }) => {
|
||||
mainDi.override(isAutoUpdateEnabledInjectable, () => () => false);
|
||||
|
||||
const userStoreStub = {
|
||||
extensionRegistryUrl: { customUrl: "some-custom-url" },
|
||||
} as unknown as UserStore;
|
||||
|
||||
rendererDi.override(userStoreInjectable, () => userStoreStub);
|
||||
|
||||
const themeStoreStub = { themeOptions: [] } as unknown as ThemeStore;
|
||||
|
||||
rendererDi.override(themeStoreInjectable, () => themeStoreStub);
|
||||
});
|
||||
|
||||
rendered = await applicationBuilder.render();
|
||||
});
|
||||
|
||||
@@ -47,8 +28,8 @@ describe("preferences - navigation using application menu", () => {
|
||||
});
|
||||
|
||||
describe("when navigating to preferences using application menu", () => {
|
||||
beforeEach(() => {
|
||||
applicationBuilder.applicationMenu.click("root.preferences");
|
||||
beforeEach(async () => {
|
||||
await applicationBuilder.applicationMenu.click("root.preferences");
|
||||
});
|
||||
|
||||
it("renders", () => {
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import type { RenderResult } from "@testing-library/react";
|
||||
import type { ApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
import { getApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
|
||||
describe("show-about-using-tray", () => {
|
||||
let applicationBuilder: ApplicationBuilder;
|
||||
let rendered: RenderResult;
|
||||
|
||||
beforeEach(async () => {
|
||||
applicationBuilder = getApplicationBuilder();
|
||||
|
||||
rendered = await applicationBuilder.render();
|
||||
});
|
||||
|
||||
it("renders", () => {
|
||||
expect(rendered.baseElement).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("does not show application preferences page yet", () => {
|
||||
const actual = rendered.queryByTestId("application-preferences-page");
|
||||
|
||||
expect(actual).toBeNull();
|
||||
});
|
||||
|
||||
describe("when navigating using tray", () => {
|
||||
beforeEach(async () => {
|
||||
await applicationBuilder.tray.click("open-preferences");
|
||||
});
|
||||
|
||||
it("renders", () => {
|
||||
expect(rendered.baseElement).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("shows application preferences page", () => {
|
||||
const actual = rendered.getByTestId("application-preferences-page");
|
||||
|
||||
expect(actual).not.toBeNull();
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import type { RenderResult } from "@testing-library/react";
|
||||
|
||||
export function getSidebarItem(rendered: RenderResult, itemId: string) {
|
||||
return rendered
|
||||
.queryAllByTestId("sidebar-item")
|
||||
.find((x) => x.dataset.idTest === itemId);
|
||||
}
|
||||
+18
-8
@@ -1,6 +1,12 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`welcome - navigation using application menu renders 1`] = `<div />`;
|
||||
exports[`welcome - navigation using application menu renders 1`] = `
|
||||
<div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`welcome - navigation using application menu when navigating to welcome using application menu renders 1`] = `
|
||||
<div>
|
||||
@@ -27,16 +33,17 @@ exports[`welcome - navigation using application menu when navigating to welcome
|
||||
style="width: 320px;"
|
||||
>
|
||||
<h2>
|
||||
Welcome to
|
||||
OpenLens
|
||||
5!
|
||||
Welcome to OpenLens 5!
|
||||
</h2>
|
||||
<p>
|
||||
To get you started we have auto-detected your clusters in your kubeconfig file and added them to the catalog, your centralized view for managing all your cloud-native resources.
|
||||
<br />
|
||||
<br />
|
||||
If you have any questions or feedback, please join our
|
||||
To get you started we have auto-detected your clusters in your
|
||||
|
||||
kubeconfig file and added them to the catalog, your centralized
|
||||
|
||||
view for managing all your cloud-native resources.
|
||||
<br />
|
||||
<br />
|
||||
If you have any questions or feedback, please join our
|
||||
<a
|
||||
class="link"
|
||||
href="https://join.slack.com/t/k8slens/shared_invite/zt-wcl8jq3k-68R5Wcmk1o95MLBE5igUDQ"
|
||||
@@ -86,5 +93,8 @@ exports[`welcome - navigation using application menu when navigating to welcome
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="Notifications flex column align-flex-end"
|
||||
/>
|
||||
</div>
|
||||
`;
|
||||
@@ -6,16 +6,13 @@
|
||||
import type { RenderResult } from "@testing-library/react";
|
||||
import type { ApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
import { getApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
import isAutoUpdateEnabledInjectable from "../../main/is-auto-update-enabled.injectable";
|
||||
|
||||
describe("welcome - navigation using application menu", () => {
|
||||
let applicationBuilder: ApplicationBuilder;
|
||||
let rendered: RenderResult;
|
||||
|
||||
beforeEach(async () => {
|
||||
applicationBuilder = getApplicationBuilder().beforeSetups(({ mainDi }) => {
|
||||
mainDi.override(isAutoUpdateEnabledInjectable, () => () => false);
|
||||
});
|
||||
applicationBuilder = getApplicationBuilder();
|
||||
|
||||
rendered = await applicationBuilder.render();
|
||||
});
|
||||
@@ -31,8 +28,8 @@ describe("welcome - navigation using application menu", () => {
|
||||
});
|
||||
|
||||
describe("when navigating to welcome using application menu", () => {
|
||||
beforeEach(() => {
|
||||
applicationBuilder.applicationMenu.click("help.welcome");
|
||||
beforeEach(async () => {
|
||||
await applicationBuilder.applicationMenu.click("help.welcome");
|
||||
});
|
||||
|
||||
it("renders", () => {
|
||||
|
||||
@@ -30,9 +30,9 @@ interface TestStoreModel {
|
||||
}
|
||||
|
||||
class TestStore extends BaseStore<TestStoreModel> {
|
||||
@observable a: string;
|
||||
@observable b: string;
|
||||
@observable c: string;
|
||||
@observable a = "";
|
||||
@observable b = "";
|
||||
@observable c = "";
|
||||
|
||||
constructor() {
|
||||
super({
|
||||
@@ -81,16 +81,13 @@ class TestStore extends BaseStore<TestStoreModel> {
|
||||
describe("BaseStore", () => {
|
||||
let store: TestStore;
|
||||
|
||||
beforeEach(async () => {
|
||||
beforeEach(() => {
|
||||
const mainDi = getDiForUnitTesting({ doGeneralOverrides: true });
|
||||
|
||||
mainDi.override(directoryForUserDataInjectable, () => "some-user-data-directory");
|
||||
mainDi.permitSideEffects(getConfigurationFileModelInjectable);
|
||||
mainDi.permitSideEffects(appVersionInjectable);
|
||||
|
||||
await mainDi.runSetups();
|
||||
|
||||
store = undefined;
|
||||
TestStore.resetInstance();
|
||||
|
||||
const mockOpts = {
|
||||
|
||||
@@ -8,22 +8,23 @@ import mockFs from "mock-fs";
|
||||
import path from "path";
|
||||
import fse from "fs-extra";
|
||||
import type { Cluster } from "../cluster/cluster";
|
||||
import { ClusterStore } from "../cluster-store/cluster-store";
|
||||
import type { ClusterStore } from "../cluster-store/cluster-store";
|
||||
import { Console } from "console";
|
||||
import { stdout, stderr } from "process";
|
||||
import getCustomKubeConfigDirectoryInjectable from "../app-paths/get-custom-kube-config-directory/get-custom-kube-config-directory.injectable";
|
||||
import clusterStoreInjectable from "../cluster-store/cluster-store.injectable";
|
||||
import type { ClusterModel } from "../cluster-types";
|
||||
import type {
|
||||
DiContainer,
|
||||
} from "@ogre-tools/injectable";
|
||||
|
||||
import type { DiContainer } from "@ogre-tools/injectable";
|
||||
import { createClusterInjectionToken } from "../cluster/create-cluster-injection-token";
|
||||
|
||||
import directoryForUserDataInjectable from "../app-paths/directory-for-user-data/directory-for-user-data.injectable";
|
||||
import { getDiForUnitTesting } from "../../main/getDiForUnitTesting";
|
||||
import getConfigurationFileModelInjectable from "../get-configuration-file-model/get-configuration-file-model.injectable";
|
||||
import appVersionInjectable from "../get-configuration-file-model/app-version/app-version.injectable";
|
||||
import assert from "assert";
|
||||
import directoryForTempInjectable from "../app-paths/directory-for-temp/directory-for-temp.injectable";
|
||||
import kubectlBinaryNameInjectable from "../../main/kubectl/binary-name.injectable";
|
||||
import kubectlDownloadingNormalizedArchInjectable from "../../main/kubectl/normalized-arch.injectable";
|
||||
import normalizedPlatformInjectable from "../vars/normalized-platform.injectable";
|
||||
|
||||
console = new Console(stdout, stderr);
|
||||
|
||||
@@ -84,15 +85,17 @@ describe("cluster-store", () => {
|
||||
|
||||
mockFs();
|
||||
|
||||
mainDi.override(clusterStoreInjectable, (di) => ClusterStore.createInstance({ createCluster: di.inject(createClusterInjectionToken) }));
|
||||
mainDi.override(directoryForUserDataInjectable, () => "some-directory-for-user-data");
|
||||
mainDi.override(directoryForTempInjectable, () => "some-temp-directory");
|
||||
mainDi.override(kubectlBinaryNameInjectable, () => "kubectl");
|
||||
mainDi.override(kubectlDownloadingNormalizedArchInjectable, () => "amd64");
|
||||
mainDi.override(normalizedPlatformInjectable, () => "darwin");
|
||||
|
||||
mainDi.permitSideEffects(getConfigurationFileModelInjectable);
|
||||
mainDi.permitSideEffects(appVersionInjectable);
|
||||
mainDi.permitSideEffects(clusterStoreInjectable);
|
||||
|
||||
await mainDi.runSetups();
|
||||
|
||||
createCluster = mainDi.inject(createClusterInjectionToken);
|
||||
mainDi.unoverride(clusterStoreInjectable);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@@ -107,10 +110,6 @@ describe("cluster-store", () => {
|
||||
getCustomKubeConfigDirectoryInjectable,
|
||||
);
|
||||
|
||||
// TODO: Remove these by removing Singleton base-class from BaseStore
|
||||
ClusterStore.getInstance(false)?.unregisterIpcListener();
|
||||
ClusterStore.resetInstance();
|
||||
|
||||
const mockOpts = {
|
||||
"some-directory-for-user-data": {
|
||||
"lens-cluster-store.json": JSON.stringify({}),
|
||||
@@ -119,7 +118,11 @@ describe("cluster-store", () => {
|
||||
|
||||
mockFs(mockOpts);
|
||||
|
||||
createCluster = mainDi.inject(createClusterInjectionToken);
|
||||
|
||||
clusterStore = mainDi.inject(clusterStoreInjectable);
|
||||
|
||||
clusterStore.unregisterIpcListener();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@@ -148,6 +151,8 @@ describe("cluster-store", () => {
|
||||
it("adds new cluster to store", async () => {
|
||||
const storedCluster = clusterStore.getById("foo");
|
||||
|
||||
assert(storedCluster);
|
||||
|
||||
expect(storedCluster.id).toBe("foo");
|
||||
expect(storedCluster.preferences.terminalCWD).toBe("/some-directory-for-user-data");
|
||||
expect(storedCluster.preferences.icon).toBe(
|
||||
@@ -199,8 +204,6 @@ describe("cluster-store", () => {
|
||||
|
||||
describe("config with existing clusters", () => {
|
||||
beforeEach(() => {
|
||||
ClusterStore.resetInstance();
|
||||
|
||||
const mockOpts = {
|
||||
"temp-kube-config": kubeconfig,
|
||||
"some-directory-for-user-data": {
|
||||
@@ -239,6 +242,8 @@ describe("cluster-store", () => {
|
||||
|
||||
mockFs(mockOpts);
|
||||
|
||||
createCluster = mainDi.inject(createClusterInjectionToken);
|
||||
|
||||
clusterStore = mainDi.inject(clusterStoreInjectable);
|
||||
});
|
||||
|
||||
@@ -249,6 +254,8 @@ describe("cluster-store", () => {
|
||||
it("allows to retrieve a cluster", () => {
|
||||
const storedCluster = clusterStore.getById("cluster1");
|
||||
|
||||
assert(storedCluster);
|
||||
|
||||
expect(storedCluster.id).toBe("cluster1");
|
||||
expect(storedCluster.preferences.terminalCWD).toBe("/foo");
|
||||
});
|
||||
@@ -287,8 +294,6 @@ users:
|
||||
token: kubeconfig-user-q4lm4:xxxyyyy
|
||||
`;
|
||||
|
||||
ClusterStore.resetInstance();
|
||||
|
||||
const mockOpts = {
|
||||
"invalid-kube-config": invalidKubeconfig,
|
||||
"valid-kube-config": kubeconfig,
|
||||
@@ -321,6 +326,8 @@ users:
|
||||
|
||||
mockFs(mockOpts);
|
||||
|
||||
createCluster = mainDi.inject(createClusterInjectionToken);
|
||||
|
||||
clusterStore = mainDi.inject(clusterStoreInjectable);
|
||||
});
|
||||
|
||||
@@ -337,7 +344,6 @@ users:
|
||||
|
||||
describe("pre 3.6.0-beta.1 config with an existing cluster", () => {
|
||||
beforeEach(() => {
|
||||
ClusterStore.resetInstance();
|
||||
const mockOpts = {
|
||||
"some-directory-for-user-data": {
|
||||
"lens-cluster-store.json": JSON.stringify({
|
||||
@@ -363,6 +369,10 @@ users:
|
||||
|
||||
mockFs(mockOpts);
|
||||
|
||||
mainDi.override(appVersionInjectable, () => "3.6.0");
|
||||
|
||||
createCluster = mainDi.inject(createClusterInjectionToken);
|
||||
|
||||
clusterStore = mainDi.inject(clusterStoreInjectable);
|
||||
});
|
||||
|
||||
@@ -379,6 +389,7 @@ users:
|
||||
it("migrates to modern format with icon not in file", async () => {
|
||||
const { icon } = clusterStore.clustersList[0].preferences;
|
||||
|
||||
assert(icon);
|
||||
expect(icon.startsWith("data:;base64,")).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import type { AppEvent } from "../app-event-bus/event-bus";
|
||||
import { appEventBus } from "../app-event-bus/event-bus";
|
||||
import { Console } from "console";
|
||||
import { assert, Console } from "console";
|
||||
import { stdout, stderr } from "process";
|
||||
|
||||
console = new Console(stdout, stderr);
|
||||
@@ -13,14 +13,15 @@ console = new Console(stdout, stderr);
|
||||
describe("event bus tests", () => {
|
||||
describe("emit", () => {
|
||||
it("emits an event", () => {
|
||||
let event: AppEvent = null;
|
||||
let event: AppEvent | undefined;
|
||||
|
||||
appEventBus.addListener((data) => {
|
||||
event = data;
|
||||
});
|
||||
|
||||
appEventBus.emit({ name: "foo", action: "bar" });
|
||||
expect(event.name).toBe("foo");
|
||||
assert(event);
|
||||
expect(event?.name).toBe("foo");
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -21,7 +21,7 @@ describe("EventEmitter", () => {
|
||||
let called = false;
|
||||
const e = new EventEmitter<[]>();
|
||||
|
||||
e.addListener(() => 0 as any, {});
|
||||
e.addListener(() => 0 as never, {});
|
||||
e.addListener(() => { called = true; }, {});
|
||||
e.emit();
|
||||
|
||||
|
||||
@@ -5,69 +5,20 @@
|
||||
|
||||
import { anyObject } from "jest-mock-extended";
|
||||
import mockFs from "mock-fs";
|
||||
import logger from "../../main/logger";
|
||||
import type { CatalogEntity, CatalogEntityData, CatalogEntityKindData } from "../catalog";
|
||||
import { getDiForUnitTesting } from "../../main/getDiForUnitTesting";
|
||||
import getConfigurationFileModelInjectable from "../get-configuration-file-model/get-configuration-file-model.injectable";
|
||||
import appVersionInjectable from "../get-configuration-file-model/app-version/app-version.injectable";
|
||||
import type { DiContainer } from "@ogre-tools/injectable";
|
||||
import hotbarStoreInjectable from "../hotbar-store.injectable";
|
||||
import { HotbarStore } from "../hotbar-store";
|
||||
import hotbarStoreInjectable from "../hotbars/store.injectable";
|
||||
import type { HotbarStore } from "../hotbars/store";
|
||||
import catalogEntityRegistryInjectable from "../../main/catalog/entity-registry.injectable";
|
||||
import { computed } from "mobx";
|
||||
import hasCategoryForEntityInjectable from "../catalog/has-category-for-entity.injectable";
|
||||
import catalogCatalogEntityInjectable from "../catalog-entities/general-catalog-entities/implementations/catalog-catalog-entity.injectable";
|
||||
|
||||
jest.mock("../../main/catalog/catalog-entity-registry", () => ({
|
||||
catalogEntityRegistry: {
|
||||
items: [
|
||||
getMockCatalogEntity({
|
||||
apiVersion: "v1",
|
||||
kind: "Cluster",
|
||||
|
||||
status: {
|
||||
phase: "Running",
|
||||
},
|
||||
|
||||
metadata: {
|
||||
uid: "1dfa26e2ebab15780a3547e9c7fa785c",
|
||||
name: "mycluster",
|
||||
source: "local",
|
||||
labels: {},
|
||||
},
|
||||
}),
|
||||
|
||||
getMockCatalogEntity({
|
||||
apiVersion: "v1",
|
||||
kind: "Cluster",
|
||||
|
||||
status: {
|
||||
phase: "Running",
|
||||
},
|
||||
|
||||
metadata: {
|
||||
uid: "55b42c3c7ba3b04193416cda405269a5",
|
||||
name: "my_shiny_cluster",
|
||||
source: "remote",
|
||||
labels: {},
|
||||
},
|
||||
}),
|
||||
|
||||
getMockCatalogEntity({
|
||||
apiVersion: "v1",
|
||||
kind: "Cluster",
|
||||
|
||||
status: {
|
||||
phase: "Running",
|
||||
},
|
||||
|
||||
metadata: {
|
||||
uid: "catalog-entity",
|
||||
name: "Catalog",
|
||||
source: "app",
|
||||
labels: {},
|
||||
},
|
||||
}),
|
||||
],
|
||||
},
|
||||
}));
|
||||
import loggerInjectable from "../logger.injectable";
|
||||
import type { Logger } from "../logger";
|
||||
import directoryForUserDataInjectable from "../app-paths/directory-for-user-data/directory-for-user-data.injectable";
|
||||
|
||||
function getMockCatalogEntity(data: Partial<CatalogEntityData> & CatalogEntityKindData): CatalogEntity {
|
||||
return {
|
||||
@@ -84,75 +35,99 @@ function getMockCatalogEntity(data: Partial<CatalogEntityData> & CatalogEntityKi
|
||||
} as CatalogEntity;
|
||||
}
|
||||
|
||||
const testCluster = getMockCatalogEntity({
|
||||
apiVersion: "v1",
|
||||
kind: "Cluster",
|
||||
status: {
|
||||
phase: "Running",
|
||||
},
|
||||
metadata: {
|
||||
uid: "test",
|
||||
name: "test",
|
||||
labels: {},
|
||||
},
|
||||
});
|
||||
|
||||
const minikubeCluster = getMockCatalogEntity({
|
||||
apiVersion: "v1",
|
||||
kind: "Cluster",
|
||||
status: {
|
||||
phase: "Running",
|
||||
},
|
||||
metadata: {
|
||||
uid: "minikube",
|
||||
name: "minikube",
|
||||
labels: {},
|
||||
},
|
||||
});
|
||||
|
||||
const awsCluster = getMockCatalogEntity({
|
||||
apiVersion: "v1",
|
||||
kind: "Cluster",
|
||||
status: {
|
||||
phase: "Running",
|
||||
},
|
||||
metadata: {
|
||||
uid: "aws",
|
||||
name: "aws",
|
||||
labels: {},
|
||||
},
|
||||
});
|
||||
|
||||
describe("HotbarStore", () => {
|
||||
let di: DiContainer;
|
||||
let hotbarStore: HotbarStore;
|
||||
let testCluster: CatalogEntity;
|
||||
let minikubeCluster: CatalogEntity;
|
||||
let awsCluster: CatalogEntity;
|
||||
let loggerMock: jest.Mocked<Logger>;
|
||||
|
||||
beforeEach(async () => {
|
||||
di = getDiForUnitTesting({ doGeneralOverrides: true });
|
||||
|
||||
(di as any).unoverride(hotbarStoreInjectable);
|
||||
|
||||
testCluster = getMockCatalogEntity({
|
||||
apiVersion: "v1",
|
||||
kind: "Cluster",
|
||||
status: {
|
||||
phase: "Running",
|
||||
},
|
||||
metadata: {
|
||||
uid: "some-test-id",
|
||||
name: "my-test-cluster",
|
||||
source: "local",
|
||||
labels: {},
|
||||
},
|
||||
});
|
||||
minikubeCluster = getMockCatalogEntity({
|
||||
apiVersion: "v1",
|
||||
kind: "Cluster",
|
||||
status: {
|
||||
phase: "Running",
|
||||
},
|
||||
metadata: {
|
||||
uid: "some-minikube-id",
|
||||
name: "my-minikube-cluster",
|
||||
source: "local",
|
||||
labels: {},
|
||||
},
|
||||
});
|
||||
awsCluster = getMockCatalogEntity({
|
||||
apiVersion: "v1",
|
||||
kind: "Cluster",
|
||||
status: {
|
||||
phase: "Running",
|
||||
},
|
||||
metadata: {
|
||||
uid: "some-aws-id",
|
||||
name: "my-aws-cluster",
|
||||
source: "local",
|
||||
labels: {},
|
||||
},
|
||||
});
|
||||
|
||||
di.override(hasCategoryForEntityInjectable, () => () => true);
|
||||
|
||||
loggerMock = {
|
||||
warn: jest.fn(),
|
||||
debug: jest.fn(),
|
||||
error: jest.fn(),
|
||||
info: jest.fn(),
|
||||
silly: jest.fn(),
|
||||
};
|
||||
|
||||
di.override(loggerInjectable, () => loggerMock);
|
||||
|
||||
di.override(directoryForUserDataInjectable, () => "some-directory-for-user-data");
|
||||
|
||||
const catalogEntityRegistry = di.inject(catalogEntityRegistryInjectable);
|
||||
const catalogCatalogEntity = di.inject(catalogCatalogEntityInjectable);
|
||||
|
||||
catalogEntityRegistry.addComputedSource("some-id", computed(() => [
|
||||
testCluster,
|
||||
minikubeCluster,
|
||||
awsCluster,
|
||||
catalogCatalogEntity,
|
||||
]));
|
||||
|
||||
di.permitSideEffects(getConfigurationFileModelInjectable);
|
||||
di.permitSideEffects(appVersionInjectable);
|
||||
|
||||
di.override(hotbarStoreInjectable, () => {
|
||||
HotbarStore.resetInstance();
|
||||
|
||||
return HotbarStore.createInstance({
|
||||
catalogCatalogEntity: di.inject(catalogCatalogEntityInjectable),
|
||||
});
|
||||
});
|
||||
di.permitSideEffects(hotbarStoreInjectable);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
mockFs.restore();
|
||||
});
|
||||
|
||||
describe("given no migrations", () => {
|
||||
beforeEach(async () => {
|
||||
describe("given no previous data in store, running all migrations", () => {
|
||||
beforeEach(() => {
|
||||
mockFs();
|
||||
|
||||
await di.runSetups();
|
||||
|
||||
hotbarStore = di.inject(hotbarStoreInjectable);
|
||||
|
||||
hotbarStore.load();
|
||||
});
|
||||
|
||||
describe("load", () => {
|
||||
@@ -174,7 +149,7 @@ describe("HotbarStore", () => {
|
||||
});
|
||||
|
||||
it("initially adds catalog entity as first item", () => {
|
||||
expect(hotbarStore.getActive().items[0].entity.name).toEqual("Catalog");
|
||||
expect(hotbarStore.getActive().items[0]?.entity.name).toEqual("Catalog");
|
||||
});
|
||||
|
||||
it("adds items", () => {
|
||||
@@ -186,7 +161,7 @@ describe("HotbarStore", () => {
|
||||
|
||||
it("removes items", () => {
|
||||
hotbarStore.addToHotbar(testCluster);
|
||||
hotbarStore.removeFromHotbar("test");
|
||||
hotbarStore.removeFromHotbar("some-test-id");
|
||||
hotbarStore.removeFromHotbar("catalog-entity");
|
||||
const items = hotbarStore.getActive().items.filter(Boolean);
|
||||
|
||||
@@ -211,7 +186,7 @@ describe("HotbarStore", () => {
|
||||
hotbarStore.restackItems(1, 5);
|
||||
|
||||
expect(hotbarStore.getActive().items[5]).toBeTruthy();
|
||||
expect(hotbarStore.getActive().items[5].entity.uid).toEqual("test");
|
||||
expect(hotbarStore.getActive().items[5]?.entity.uid).toEqual("some-test-id");
|
||||
});
|
||||
|
||||
it("moves items down", () => {
|
||||
@@ -224,7 +199,7 @@ describe("HotbarStore", () => {
|
||||
|
||||
const items = hotbarStore.getActive().items.map(item => item?.entity.uid || null);
|
||||
|
||||
expect(items.slice(0, 4)).toEqual(["aws", "catalog-entity", "test", "minikube"]);
|
||||
expect(items.slice(0, 4)).toEqual(["some-aws-id", "catalog-entity", "some-test-id", "some-minikube-id"]);
|
||||
});
|
||||
|
||||
it("moves items up", () => {
|
||||
@@ -237,28 +212,21 @@ describe("HotbarStore", () => {
|
||||
|
||||
const items = hotbarStore.getActive().items.map(item => item?.entity.uid || null);
|
||||
|
||||
expect(items.slice(0, 4)).toEqual(["catalog-entity", "minikube", "aws", "test"]);
|
||||
expect(items.slice(0, 4)).toEqual(["catalog-entity", "some-minikube-id", "some-aws-id", "some-test-id"]);
|
||||
});
|
||||
|
||||
it("logs an error if cellIndex is out of bounds", () => {
|
||||
hotbarStore.add({ name: "hottest", id: "hottest" });
|
||||
hotbarStore.setActiveHotbar("hottest");
|
||||
|
||||
const { error } = logger;
|
||||
const mocked = jest.fn();
|
||||
|
||||
logger.error = mocked;
|
||||
|
||||
hotbarStore.addToHotbar(testCluster, -1);
|
||||
expect(mocked).toBeCalledWith("[HOTBAR-STORE]: cannot pin entity to hotbar outside of index range", anyObject());
|
||||
expect(loggerMock.error).toBeCalledWith("[HOTBAR-STORE]: cannot pin entity to hotbar outside of index range", anyObject());
|
||||
|
||||
hotbarStore.addToHotbar(testCluster, 12);
|
||||
expect(mocked).toBeCalledWith("[HOTBAR-STORE]: cannot pin entity to hotbar outside of index range", anyObject());
|
||||
expect(loggerMock.error).toBeCalledWith("[HOTBAR-STORE]: cannot pin entity to hotbar outside of index range", anyObject());
|
||||
|
||||
hotbarStore.addToHotbar(testCluster, 13);
|
||||
expect(mocked).toBeCalledWith("[HOTBAR-STORE]: cannot pin entity to hotbar outside of index range", anyObject());
|
||||
|
||||
logger.error = error;
|
||||
expect(loggerMock.error).toBeCalledWith("[HOTBAR-STORE]: cannot pin entity to hotbar outside of index range", anyObject());
|
||||
});
|
||||
|
||||
it("throws an error if getId is invalid or returns not a string", () => {
|
||||
@@ -275,7 +243,7 @@ describe("HotbarStore", () => {
|
||||
hotbarStore.addToHotbar(testCluster);
|
||||
hotbarStore.restackItems(1, 1);
|
||||
|
||||
expect(hotbarStore.getActive().items[1].entity.uid).toEqual("test");
|
||||
expect(hotbarStore.getActive().items[1]?.entity.uid).toEqual("some-test-id");
|
||||
});
|
||||
|
||||
it("new items takes first empty cell", () => {
|
||||
@@ -284,7 +252,7 @@ describe("HotbarStore", () => {
|
||||
hotbarStore.restackItems(0, 3);
|
||||
hotbarStore.addToHotbar(minikubeCluster);
|
||||
|
||||
expect(hotbarStore.getActive().items[0].entity.uid).toEqual("minikube");
|
||||
expect(hotbarStore.getActive().items[0]?.entity.uid).toEqual("some-minikube-id");
|
||||
});
|
||||
|
||||
it("throws if invalid arguments provided", () => {
|
||||
@@ -315,10 +283,10 @@ describe("HotbarStore", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("given pre beta-5 configurations", () => {
|
||||
beforeEach(async () => {
|
||||
describe("given data from 5.0.0-beta.3 and version being 5.0.0-beta.10", () => {
|
||||
beforeEach(() => {
|
||||
const configurationToBeMigrated = {
|
||||
"some-electron-app-path-for-user-data": {
|
||||
"some-directory-for-user-data": {
|
||||
"lens-hotbar-store.json": JSON.stringify({
|
||||
__internal__: {
|
||||
migrations: {
|
||||
@@ -332,7 +300,7 @@ describe("HotbarStore", () => {
|
||||
items: [
|
||||
{
|
||||
entity: {
|
||||
uid: "1dfa26e2ebab15780a3547e9c7fa785c",
|
||||
uid: "some-aws-id",
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -381,15 +349,17 @@ describe("HotbarStore", () => {
|
||||
|
||||
mockFs(configurationToBeMigrated);
|
||||
|
||||
await di.runSetups();
|
||||
di.override(appVersionInjectable, () => "5.0.0-beta.10");
|
||||
|
||||
hotbarStore = di.inject(hotbarStoreInjectable);
|
||||
|
||||
hotbarStore.load();
|
||||
});
|
||||
|
||||
it("allows to retrieve a hotbar", () => {
|
||||
const hotbar = hotbarStore.getById("3caac17f-aec2-4723-9694-ad204465d935");
|
||||
const hotbar = hotbarStore.findById("3caac17f-aec2-4723-9694-ad204465d935");
|
||||
|
||||
expect(hotbar.id).toBe("3caac17f-aec2-4723-9694-ad204465d935");
|
||||
expect(hotbar?.id).toBe("3caac17f-aec2-4723-9694-ad204465d935");
|
||||
});
|
||||
|
||||
it("clears cells without entity", () => {
|
||||
@@ -403,17 +373,9 @@ describe("HotbarStore", () => {
|
||||
|
||||
expect(items[0]).toEqual({
|
||||
entity: {
|
||||
name: "mycluster",
|
||||
name: "my-aws-cluster",
|
||||
source: "local",
|
||||
uid: "1dfa26e2ebab15780a3547e9c7fa785c",
|
||||
},
|
||||
});
|
||||
|
||||
expect(items[1]).toEqual({
|
||||
entity: {
|
||||
name: "my_shiny_cluster",
|
||||
source: "remote",
|
||||
uid: "55b42c3c7ba3b04193416cda405269a5",
|
||||
uid: "some-aws-id",
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -6,13 +6,14 @@ import https from "https";
|
||||
import os from "os";
|
||||
import { getMacRootCA, getWinRootCA, injectCAs, DSTRootCAX3 } from "../system-ca";
|
||||
import { dependencies, devDependencies } from "../../../package.json";
|
||||
import assert from "assert";
|
||||
|
||||
const deps = { ...dependencies, ...devDependencies };
|
||||
|
||||
// Skip the test if mac-ca is not installed, or os is not darwin
|
||||
(deps["mac-ca"] && os.platform().includes("darwin") ? describe: describe.skip)("inject CA for Mac", () => {
|
||||
// for reset https.globalAgent.options.ca after testing
|
||||
let _ca: string | Buffer | (string | Buffer)[];
|
||||
let _ca: string | Buffer | (string | Buffer)[] | undefined;
|
||||
|
||||
beforeEach(() => {
|
||||
_ca = https.globalAgent.options.ca;
|
||||
@@ -44,6 +45,7 @@ const deps = { ...dependencies, ...devDependencies };
|
||||
injectCAs(osxCAs);
|
||||
const injected = https.globalAgent.options.ca;
|
||||
|
||||
assert(injected);
|
||||
expect(injected.includes(DSTRootCAX3)).toBeFalsy();
|
||||
});
|
||||
});
|
||||
@@ -51,7 +53,7 @@ const deps = { ...dependencies, ...devDependencies };
|
||||
// Skip the test if win-ca is not installed, or os is not win32
|
||||
(deps["win-ca"] && os.platform().includes("win32") ? describe: describe.skip)("inject CA for Windows", () => {
|
||||
// for reset https.globalAgent.options.ca after testing
|
||||
let _ca: string | Buffer | (string | Buffer)[];
|
||||
let _ca: string | Buffer | (string | Buffer)[] | undefined;
|
||||
|
||||
beforeEach(() => {
|
||||
_ca = https.globalAgent.options.ca;
|
||||
|
||||
@@ -21,7 +21,7 @@ jest.mock("electron", () => ({
|
||||
},
|
||||
}));
|
||||
|
||||
import { UserStore } from "../user-store";
|
||||
import type { UserStore } from "../user-store";
|
||||
import { Console } from "console";
|
||||
import { SemVer } from "semver";
|
||||
import electron from "electron";
|
||||
@@ -30,13 +30,11 @@ import userStoreInjectable from "../user-store/user-store.injectable";
|
||||
import type { DiContainer } from "@ogre-tools/injectable";
|
||||
import directoryForUserDataInjectable from "../app-paths/directory-for-user-data/directory-for-user-data.injectable";
|
||||
import type { ClusterStoreModel } from "../cluster-store/cluster-store";
|
||||
import { defaultTheme } from "../vars";
|
||||
import { defaultThemeId } from "../vars";
|
||||
import writeFileInjectable from "../fs/write-file.injectable";
|
||||
import { getDiForUnitTesting } from "../../main/getDiForUnitTesting";
|
||||
import getConfigurationFileModelInjectable
|
||||
from "../get-configuration-file-model/get-configuration-file-model.injectable";
|
||||
import appVersionInjectable
|
||||
from "../get-configuration-file-model/app-version/app-version.injectable";
|
||||
import getConfigurationFileModelInjectable from "../get-configuration-file-model/get-configuration-file-model.injectable";
|
||||
import appVersionInjectable from "../get-configuration-file-model/app-version/app-version.injectable";
|
||||
|
||||
console = new Console(stdout, stderr);
|
||||
|
||||
@@ -44,23 +42,22 @@ describe("user store tests", () => {
|
||||
let userStore: UserStore;
|
||||
let di: DiContainer;
|
||||
|
||||
beforeEach(async () => {
|
||||
beforeEach(() => {
|
||||
di = getDiForUnitTesting({ doGeneralOverrides: true });
|
||||
|
||||
mockFs();
|
||||
|
||||
di.override(writeFileInjectable, () => () => undefined);
|
||||
di.override(writeFileInjectable, () => () => Promise.resolve());
|
||||
di.override(directoryForUserDataInjectable, () => "some-directory-for-user-data");
|
||||
di.override(userStoreInjectable, () => UserStore.createInstance());
|
||||
|
||||
di.permitSideEffects(getConfigurationFileModelInjectable);
|
||||
di.permitSideEffects(appVersionInjectable);
|
||||
|
||||
await di.runSetups();
|
||||
di.permitSideEffects(appVersionInjectable);
|
||||
di.permitSideEffects(userStoreInjectable);
|
||||
|
||||
di.unoverride(userStoreInjectable);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
UserStore.resetInstance();
|
||||
mockFs.restore();
|
||||
});
|
||||
|
||||
@@ -80,7 +77,7 @@ describe("user store tests", () => {
|
||||
userStore.httpsProxy = "abcd://defg";
|
||||
|
||||
expect(userStore.httpsProxy).toBe("abcd://defg");
|
||||
expect(userStore.colorTheme).toBe(defaultTheme);
|
||||
expect(userStore.colorTheme).toBe(defaultThemeId);
|
||||
|
||||
userStore.colorTheme = "light";
|
||||
expect(userStore.colorTheme).toBe("light");
|
||||
@@ -89,7 +86,7 @@ describe("user store tests", () => {
|
||||
it("correctly resets theme to default value", async () => {
|
||||
userStore.colorTheme = "some other theme";
|
||||
userStore.resetTheme();
|
||||
expect(userStore.colorTheme).toBe(defaultTheme);
|
||||
expect(userStore.colorTheme).toBe(defaultThemeId);
|
||||
});
|
||||
|
||||
it("correctly calculates if the last seen version is an old release", () => {
|
||||
@@ -130,6 +127,8 @@ describe("user store tests", () => {
|
||||
},
|
||||
});
|
||||
|
||||
di.override(appVersionInjectable, () => "10.0.0");
|
||||
|
||||
userStore = di.inject(userStoreInjectable);
|
||||
});
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import { appEventBus } from "./event-bus";
|
||||
const appEventBusInjectable = getInjectable({
|
||||
id: "app-event-bus",
|
||||
instantiate: () => appEventBus,
|
||||
causesSideEffects: true,
|
||||
});
|
||||
|
||||
export default appEventBusInjectable;
|
||||
@@ -4,12 +4,9 @@
|
||||
*/
|
||||
import { getInjectionToken } from "@ogre-tools/injectable";
|
||||
import type { PathName } from "./app-path-names";
|
||||
import { createChannel } from "../ipc-channel/create-channel/create-channel";
|
||||
|
||||
export type AppPaths = Record<PathName, string>;
|
||||
|
||||
export const appPathsInjectionToken = getInjectionToken<AppPaths>({ id: "app-paths-token" });
|
||||
|
||||
export const appPathsIpcChannel = createChannel<AppPaths>("app-paths");
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* 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 type { AppPaths } from "./app-path-injection-token";
|
||||
import type { RequestChannel } from "../utils/channel/request-channel-injection-token";
|
||||
import { messageChannelInjectionToken } from "../utils/channel/message-channel-injection-token";
|
||||
|
||||
export type AppPathsChannel = RequestChannel<void, AppPaths>;
|
||||
|
||||
const appPathsChannelInjectable = getInjectable({
|
||||
id: "app-paths-channel",
|
||||
|
||||
instantiate: (): AppPathsChannel => ({
|
||||
id: "app-paths",
|
||||
}),
|
||||
|
||||
injectionToken: messageChannelInjectionToken,
|
||||
});
|
||||
|
||||
export default appPathsChannelInjectable;
|
||||
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* 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 type { AppPaths } from "./app-path-injection-token";
|
||||
|
||||
const appPathsStateInjectable = getInjectable({
|
||||
id: "app-paths-state",
|
||||
|
||||
instantiate: () => {
|
||||
let state: AppPaths;
|
||||
|
||||
return {
|
||||
get: () =>{
|
||||
if (!state) {
|
||||
throw new Error("Tried to get app paths before state is setupped.");
|
||||
}
|
||||
|
||||
return state;
|
||||
},
|
||||
|
||||
set: (newState: AppPaths) => {
|
||||
if (state) {
|
||||
throw new Error("Tried to overwrite existing state of app paths.");
|
||||
}
|
||||
|
||||
state = newState;
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
export default appPathsStateInjectable;
|
||||
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* 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 { appPathsInjectionToken } from "./app-path-injection-token";
|
||||
import appPathsStateInjectable from "./app-paths-state.injectable";
|
||||
|
||||
const appPathsInjectable = getInjectable({
|
||||
id: "app-paths",
|
||||
instantiate: (di) => di.inject(appPathsStateInjectable).get(),
|
||||
injectionToken: appPathsInjectionToken,
|
||||
});
|
||||
|
||||
export default appPathsInjectable;
|
||||
@@ -2,27 +2,27 @@
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import type { DiContainer } from "@ogre-tools/injectable";
|
||||
import type { AppPaths } from "./app-path-injection-token";
|
||||
import { appPathsInjectionToken } from "./app-path-injection-token";
|
||||
import getElectronAppPathInjectable from "../../main/app-paths/get-electron-app-path/get-electron-app-path.injectable";
|
||||
import { getDisForUnitTesting } from "../../test-utils/get-dis-for-unit-testing";
|
||||
import type { PathName } from "./app-path-names";
|
||||
import setElectronAppPathInjectable from "../../main/app-paths/set-electron-app-path/set-electron-app-path.injectable";
|
||||
import appNameInjectable from "../../main/app-paths/app-name/app-name.injectable";
|
||||
import directoryForIntegrationTestingInjectable from "../../main/app-paths/directory-for-integration-testing/directory-for-integration-testing.injectable";
|
||||
import type { ApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
import { getApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
import type { DiContainer } from "@ogre-tools/injectable";
|
||||
|
||||
describe("app-paths", () => {
|
||||
let mainDi: DiContainer;
|
||||
let applicationBuilder: ApplicationBuilder;
|
||||
let rendererDi: DiContainer;
|
||||
let runSetups: () => Promise<void[]>;
|
||||
let mainDi: DiContainer;
|
||||
|
||||
beforeEach(() => {
|
||||
const dis = getDisForUnitTesting({ doGeneralOverrides: true });
|
||||
applicationBuilder = getApplicationBuilder();
|
||||
|
||||
mainDi = dis.mainDi;
|
||||
rendererDi = dis.rendererDi;
|
||||
runSetups = dis.runSetups;
|
||||
rendererDi = applicationBuilder.dis.rendererDi;
|
||||
mainDi = applicationBuilder.dis.mainDi;
|
||||
|
||||
const defaultAppPathsStub: AppPaths = {
|
||||
appData: "some-app-data",
|
||||
@@ -40,30 +40,32 @@ describe("app-paths", () => {
|
||||
recent: "some-recent",
|
||||
temp: "some-temp",
|
||||
videos: "some-videos",
|
||||
userData: "some-irrelevant",
|
||||
userData: "some-irrelevant-user-data",
|
||||
};
|
||||
|
||||
mainDi.override(
|
||||
getElectronAppPathInjectable,
|
||||
() =>
|
||||
(key: PathName): string | null =>
|
||||
defaultAppPathsStub[key],
|
||||
);
|
||||
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
|
||||
mainDi.override(
|
||||
getElectronAppPathInjectable,
|
||||
() =>
|
||||
(key: PathName): string | null =>
|
||||
defaultAppPathsStub[key],
|
||||
);
|
||||
|
||||
mainDi.override(
|
||||
setElectronAppPathInjectable,
|
||||
() =>
|
||||
(key: PathName, path: string): void => {
|
||||
defaultAppPathsStub[key] = path;
|
||||
},
|
||||
);
|
||||
mainDi.override(
|
||||
setElectronAppPathInjectable,
|
||||
() =>
|
||||
(key: PathName, path: string): void => {
|
||||
defaultAppPathsStub[key] = path;
|
||||
},
|
||||
);
|
||||
|
||||
mainDi.override(appNameInjectable, () => "some-app-name");
|
||||
mainDi.override(appNameInjectable, () => "some-app-name");
|
||||
});
|
||||
});
|
||||
|
||||
describe("normally", () => {
|
||||
beforeEach(async () => {
|
||||
await runSetups();
|
||||
await applicationBuilder.render();
|
||||
});
|
||||
|
||||
it("given in renderer, when injecting app paths, returns application specific app paths", () => {
|
||||
@@ -115,12 +117,14 @@ describe("app-paths", () => {
|
||||
|
||||
describe("when running integration tests", () => {
|
||||
beforeEach(async () => {
|
||||
mainDi.override(
|
||||
directoryForIntegrationTestingInjectable,
|
||||
() => "some-integration-testing-app-data",
|
||||
);
|
||||
applicationBuilder.beforeApplicationStart(({ mainDi }) => {
|
||||
mainDi.override(
|
||||
directoryForIntegrationTestingInjectable,
|
||||
() => "some-integration-testing-app-data",
|
||||
);
|
||||
});
|
||||
|
||||
await runSetups();
|
||||
await applicationBuilder.render();
|
||||
});
|
||||
|
||||
it("given in renderer, when injecting path for app data, has integration specific app data path", () => {
|
||||
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
/**
|
||||
* 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 { baseBinariesDir } from "../../vars";
|
||||
|
||||
const directoryForBundledBinariesInjectable = getInjectable({
|
||||
id: "directory-for-bundled-binaries",
|
||||
instantiate: () => baseBinariesDir.get(),
|
||||
});
|
||||
|
||||
export default directoryForBundledBinariesInjectable;
|
||||
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* 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 type { MessageChannel } from "../utils/channel/message-channel-injection-token";
|
||||
import { messageChannelInjectionToken } from "../utils/channel/message-channel-injection-token";
|
||||
|
||||
export type ApplicationUpdateStatusEventId =
|
||||
| "checking-for-updates"
|
||||
| "no-updates-available"
|
||||
| "download-for-update-started"
|
||||
| "download-for-update-failed";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
|
||||
export type ApplicationUpdateStatusChannelMessage = { eventId: ApplicationUpdateStatusEventId; version?: string };
|
||||
export type ApplicationUpdateStatusChannel = MessageChannel<ApplicationUpdateStatusChannelMessage>;
|
||||
|
||||
const applicationUpdateStatusChannelInjectable = getInjectable({
|
||||
id: "application-update-status-channel",
|
||||
|
||||
instantiate: (): ApplicationUpdateStatusChannel => ({
|
||||
id: "application-update-status-channel",
|
||||
}),
|
||||
|
||||
injectionToken: messageChannelInjectionToken,
|
||||
});
|
||||
|
||||
export default applicationUpdateStatusChannelInjectable;
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* 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 createSyncBoxInjectable from "../../utils/sync-box/create-sync-box.injectable";
|
||||
import type { UpdateChannel } from "../update-channels";
|
||||
import { syncBoxInjectionToken } from "../../utils/sync-box/sync-box-injection-token";
|
||||
|
||||
const discoveredUpdateVersionInjectable = getInjectable({
|
||||
id: "discovered-update-version",
|
||||
|
||||
instantiate: (di) => {
|
||||
const createSyncBox = di.inject(createSyncBoxInjectable);
|
||||
|
||||
return createSyncBox<
|
||||
| { version: string; updateChannel: UpdateChannel }
|
||||
| null
|
||||
>(
|
||||
"discovered-update-version",
|
||||
null,
|
||||
);
|
||||
},
|
||||
|
||||
injectionToken: syncBoxInjectionToken,
|
||||
});
|
||||
|
||||
export default discoveredUpdateVersionInjectable;
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* 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 createSyncBoxInjectable from "../../utils/sync-box/create-sync-box.injectable";
|
||||
import { syncBoxInjectionToken } from "../../utils/sync-box/sync-box-injection-token";
|
||||
|
||||
export interface ProgressOfDownload {
|
||||
percentage: number;
|
||||
}
|
||||
|
||||
const progressOfUpdateDownloadInjectable = getInjectable({
|
||||
id: "progress-of-update-download-state",
|
||||
|
||||
instantiate: (di) => {
|
||||
const createSyncBox = di.inject(createSyncBoxInjectable);
|
||||
|
||||
return createSyncBox<ProgressOfDownload>("progress-of-update-download", { percentage: 0 });
|
||||
},
|
||||
|
||||
injectionToken: syncBoxInjectionToken,
|
||||
});
|
||||
|
||||
export default progressOfUpdateDownloadInjectable;
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* 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 { SemVer } from "semver";
|
||||
import appVersionInjectable from "../../get-configuration-file-model/app-version/app-version.injectable";
|
||||
import type { UpdateChannelId } from "../update-channels";
|
||||
import { updateChannels } from "../update-channels";
|
||||
|
||||
const defaultUpdateChannelInjectable = getInjectable({
|
||||
id: "default-update-channel",
|
||||
|
||||
instantiate: (di) => {
|
||||
const appVersion = di.inject(appVersionInjectable);
|
||||
|
||||
const currentReleaseChannel = new SemVer(appVersion).prerelease[0]?.toString() as UpdateChannelId;
|
||||
|
||||
if (currentReleaseChannel && updateChannels[currentReleaseChannel]) {
|
||||
return updateChannels[currentReleaseChannel];
|
||||
}
|
||||
|
||||
return updateChannels.latest;
|
||||
},
|
||||
});
|
||||
|
||||
export default defaultUpdateChannelInjectable;
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* 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 type { IComputedValue } from "mobx";
|
||||
import { action, computed, observable } from "mobx";
|
||||
import type { UpdateChannel, UpdateChannelId } from "../update-channels";
|
||||
import { updateChannels } from "../update-channels";
|
||||
import defaultUpdateChannelInjectable from "./default-update-channel.injectable";
|
||||
|
||||
export interface SelectedUpdateChannel {
|
||||
value: IComputedValue<UpdateChannel>;
|
||||
setValue: (channelId?: UpdateChannelId) => void;
|
||||
}
|
||||
|
||||
const selectedUpdateChannelInjectable = getInjectable({
|
||||
id: "selected-update-channel",
|
||||
|
||||
instantiate: (di): SelectedUpdateChannel => {
|
||||
const defaultUpdateChannel = di.inject(defaultUpdateChannelInjectable);
|
||||
const state = observable.box(defaultUpdateChannel);
|
||||
|
||||
return {
|
||||
value: computed(() => state.get()),
|
||||
|
||||
setValue: action((channelId) => {
|
||||
const targetUpdateChannel =
|
||||
channelId && updateChannels[channelId]
|
||||
? updateChannels[channelId]
|
||||
: defaultUpdateChannel;
|
||||
|
||||
state.set(targetUpdateChannel);
|
||||
}),
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
export default selectedUpdateChannelInjectable;
|
||||
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
export type UpdateChannelId = "alpha" | "beta" | "latest";
|
||||
|
||||
const latestChannel: UpdateChannel = {
|
||||
id: "latest",
|
||||
label: "Stable",
|
||||
moreStableUpdateChannel: null,
|
||||
};
|
||||
|
||||
const betaChannel: UpdateChannel = {
|
||||
id: "beta",
|
||||
label: "Beta",
|
||||
moreStableUpdateChannel: latestChannel,
|
||||
};
|
||||
|
||||
const alphaChannel: UpdateChannel = {
|
||||
id: "alpha",
|
||||
label: "Alpha",
|
||||
moreStableUpdateChannel: betaChannel,
|
||||
};
|
||||
|
||||
export const updateChannels: Record<UpdateChannelId, UpdateChannel> = {
|
||||
latest: latestChannel,
|
||||
beta: betaChannel,
|
||||
alpha: alphaChannel,
|
||||
};
|
||||
|
||||
export interface UpdateChannel {
|
||||
readonly id: UpdateChannelId;
|
||||
readonly label: string;
|
||||
readonly moreStableUpdateChannel: UpdateChannel | null;
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* 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 createSyncBoxInjectable from "../../utils/sync-box/create-sync-box.injectable";
|
||||
import { syncBoxInjectionToken } from "../../utils/sync-box/sync-box-injection-token";
|
||||
|
||||
const updateIsBeingDownloadedInjectable = getInjectable({
|
||||
id: "update-is-being-downloaded",
|
||||
|
||||
instantiate: (di) => {
|
||||
const createSyncBox = di.inject(createSyncBoxInjectable);
|
||||
|
||||
return createSyncBox("update-is-being-downloaded", false);
|
||||
},
|
||||
|
||||
injectionToken: syncBoxInjectionToken,
|
||||
});
|
||||
|
||||
export default updateIsBeingDownloadedInjectable;
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* 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 createSyncBoxInjectable from "../../utils/sync-box/create-sync-box.injectable";
|
||||
import { syncBoxInjectionToken } from "../../utils/sync-box/sync-box-injection-token";
|
||||
|
||||
const updatesAreBeingDiscoveredInjectable = getInjectable({
|
||||
id: "updates-are-being-discovered",
|
||||
|
||||
instantiate: (di) => {
|
||||
const createSyncBox = di.inject(createSyncBoxInjectable);
|
||||
|
||||
return createSyncBox("updates-are-being-discovered", false);
|
||||
},
|
||||
|
||||
injectionToken: syncBoxInjectionToken,
|
||||
});
|
||||
|
||||
export default updatesAreBeingDiscoveredInjectable;
|
||||
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* 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 type { MessageChannel } from "../utils/channel/message-channel-injection-token";
|
||||
import { messageChannelInjectionToken } from "../utils/channel/message-channel-injection-token";
|
||||
|
||||
export type AskBooleanAnswerChannel = MessageChannel<{ id: string; value: boolean }>;
|
||||
|
||||
const askBooleanAnswerChannelInjectable = getInjectable({
|
||||
id: "ask-boolean-answer-channel",
|
||||
|
||||
instantiate: (): AskBooleanAnswerChannel => ({
|
||||
id: "ask-boolean-answer",
|
||||
}),
|
||||
|
||||
injectionToken: messageChannelInjectionToken,
|
||||
});
|
||||
|
||||
export default askBooleanAnswerChannelInjectable;
|
||||
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* 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 type { MessageChannel } from "../utils/channel/message-channel-injection-token";
|
||||
import { messageChannelInjectionToken } from "../utils/channel/message-channel-injection-token";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
|
||||
export type AskBooleanQuestionParameters = { id: string; title: string; question: string };
|
||||
export type AskBooleanQuestionChannel = MessageChannel<AskBooleanQuestionParameters>;
|
||||
|
||||
const askBooleanQuestionChannelInjectable = getInjectable({
|
||||
id: "ask-boolean-question-channel",
|
||||
|
||||
instantiate: (): AskBooleanQuestionChannel => ({
|
||||
id: "ask-boolean-question",
|
||||
}),
|
||||
|
||||
injectionToken: messageChannelInjectionToken,
|
||||
});
|
||||
|
||||
export default askBooleanQuestionChannelInjectable;
|
||||
@@ -2,20 +2,30 @@
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { kubernetesClusterCategory } from "../kubernetes-cluster";
|
||||
|
||||
import { getDiForUnitTesting } from "../../../renderer/getDiForUnitTesting";
|
||||
import kubernetesClusterCategoryInjectable from "../../catalog/categories/kubernetes-cluster.injectable";
|
||||
import type { KubernetesClusterCategory } from "../kubernetes-cluster";
|
||||
|
||||
|
||||
describe("kubernetesClusterCategory", () => {
|
||||
let kubernetesClusterCategory: KubernetesClusterCategory;
|
||||
|
||||
beforeEach(() => {
|
||||
const di = getDiForUnitTesting();
|
||||
|
||||
kubernetesClusterCategory = di.inject(kubernetesClusterCategoryInjectable);
|
||||
});
|
||||
|
||||
describe("filteredItems", () => {
|
||||
const item1 = {
|
||||
icon: "Icon",
|
||||
title: "Title",
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
onClick: () => {},
|
||||
};
|
||||
const item2 = {
|
||||
icon: "Icon 2",
|
||||
title: "Title 2",
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
onClick: () => {},
|
||||
};
|
||||
|
||||
|
||||
@@ -5,8 +5,7 @@
|
||||
|
||||
import { navigate } from "../../renderer/navigation";
|
||||
import type { CatalogEntityMetadata, CatalogEntitySpec, CatalogEntityStatus } from "../catalog";
|
||||
import { CatalogCategory, CatalogEntity } from "../catalog";
|
||||
import { catalogCategoryRegistry } from "../catalog/catalog-category-registry";
|
||||
import { CatalogCategory, CatalogEntity, categoryVersion } from "../catalog/catalog-entity";
|
||||
|
||||
interface GeneralEntitySpec extends CatalogEntitySpec {
|
||||
path: string;
|
||||
@@ -23,18 +22,6 @@ export class GeneralEntity extends CatalogEntity<CatalogEntityMetadata, CatalogE
|
||||
async onRun() {
|
||||
navigate(this.spec.path);
|
||||
}
|
||||
|
||||
public onSettingsOpen(): void {
|
||||
return;
|
||||
}
|
||||
|
||||
public onDetailsOpen(): void {
|
||||
return;
|
||||
}
|
||||
|
||||
public onContextMenuOpen(): void {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
export class GeneralCategory extends CatalogCategory {
|
||||
@@ -47,15 +34,10 @@ export class GeneralCategory extends CatalogCategory {
|
||||
public spec = {
|
||||
group: "entity.k8slens.dev",
|
||||
versions: [
|
||||
{
|
||||
name: "v1alpha1",
|
||||
entityClass: GeneralEntity,
|
||||
},
|
||||
categoryVersion("v1alpha1", GeneralEntity),
|
||||
],
|
||||
names: {
|
||||
kind: "General",
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
catalogCategoryRegistry.add(new GeneralCategory());
|
||||
@@ -3,13 +3,12 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import { catalogCategoryRegistry } from "../catalog/catalog-category-registry";
|
||||
import type { CatalogEntityActionContext, CatalogEntityContextMenuContext, CatalogEntityMetadata, CatalogEntityStatus, CatalogCategorySpec } from "../catalog";
|
||||
import { CatalogEntity, CatalogCategory } from "../catalog";
|
||||
import { CatalogEntity, CatalogCategory, categoryVersion } from "../catalog/catalog-entity";
|
||||
import { ClusterStore } from "../cluster-store/cluster-store";
|
||||
import { broadcastMessage } from "../ipc";
|
||||
import { app } from "electron";
|
||||
import type { CatalogEntitySpec } from "../catalog/catalog-entity";
|
||||
import type { CatalogEntityConstructor, CatalogEntitySpec } from "../catalog/catalog-entity";
|
||||
import { IpcRendererNavigationEvents } from "../../renderer/navigation/events";
|
||||
import { requestClusterActivation, requestClusterDisconnection } from "../../renderer/ipc";
|
||||
import KubeClusterCategoryIcon from "./icons/kubernetes.svg";
|
||||
@@ -60,6 +59,10 @@ export type KubernetesClusterStatusPhase = "connected" | "connecting" | "disconn
|
||||
export interface KubernetesClusterStatus extends CatalogEntityStatus {
|
||||
}
|
||||
|
||||
export function isKubernetesCluster(item: unknown): item is KubernetesCluster {
|
||||
return item instanceof KubernetesCluster;
|
||||
}
|
||||
|
||||
export class KubernetesCluster<
|
||||
Metadata extends KubernetesClusterMetadata = KubernetesClusterMetadata,
|
||||
Status extends KubernetesClusterStatus = KubernetesClusterStatus,
|
||||
@@ -99,7 +102,7 @@ export class KubernetesCluster<
|
||||
//
|
||||
}
|
||||
|
||||
async onContextMenuOpen(context: CatalogEntityContextMenuContext) {
|
||||
onContextMenuOpen(context: CatalogEntityContextMenuContext) {
|
||||
if (!this.metadata.source || this.metadata.source === "local") {
|
||||
context.menuItems.push({
|
||||
title: "Settings",
|
||||
@@ -128,14 +131,10 @@ export class KubernetesCluster<
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
catalogCategoryRegistry
|
||||
.getCategoryForEntity<KubernetesClusterCategory>(this)
|
||||
?.emit("contextMenuOpen", this, context);
|
||||
}
|
||||
}
|
||||
|
||||
class KubernetesClusterCategory extends CatalogCategory {
|
||||
export class KubernetesClusterCategory extends CatalogCategory {
|
||||
public readonly apiVersion = "catalog.k8slens.dev/v1alpha1";
|
||||
public readonly kind = "CatalogCategory";
|
||||
public metadata = {
|
||||
@@ -145,17 +144,10 @@ class KubernetesClusterCategory extends CatalogCategory {
|
||||
public spec: CatalogCategorySpec = {
|
||||
group: "entity.k8slens.dev",
|
||||
versions: [
|
||||
{
|
||||
name: "v1alpha1",
|
||||
entityClass: KubernetesCluster,
|
||||
},
|
||||
categoryVersion("v1alpha1", KubernetesCluster as CatalogEntityConstructor<KubernetesCluster>),
|
||||
],
|
||||
names: {
|
||||
kind: "KubernetesCluster",
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export const kubernetesClusterCategory = new KubernetesClusterCategory();
|
||||
|
||||
catalogCategoryRegistry.add(kubernetesClusterCategory);
|
||||
@@ -4,8 +4,7 @@
|
||||
*/
|
||||
|
||||
import type { CatalogEntityContextMenuContext, CatalogEntityMetadata, CatalogEntityStatus } from "../catalog";
|
||||
import { CatalogCategory, CatalogEntity } from "../catalog";
|
||||
import { catalogCategoryRegistry } from "../catalog/catalog-category-registry";
|
||||
import { CatalogCategory, CatalogEntity, categoryVersion } from "../catalog/catalog-entity";
|
||||
import { productName } from "../vars";
|
||||
import { WeblinkStore } from "../weblink-store";
|
||||
|
||||
@@ -30,11 +29,7 @@ export class WebLink extends CatalogEntity<CatalogEntityMetadata, WebLinkStatus,
|
||||
window.open(this.spec.url, "_blank");
|
||||
}
|
||||
|
||||
public onSettingsOpen(): void {
|
||||
return;
|
||||
}
|
||||
|
||||
async onContextMenuOpen(context: CatalogEntityContextMenuContext) {
|
||||
onContextMenuOpen(context: CatalogEntityContextMenuContext) {
|
||||
if (this.metadata.source === "local") {
|
||||
context.menuItems.push({
|
||||
title: "Delete",
|
||||
@@ -45,10 +40,6 @@ export class WebLink extends CatalogEntity<CatalogEntityMetadata, WebLinkStatus,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
catalogCategoryRegistry
|
||||
.getCategoryForEntity<WebLinkCategory>(this)
|
||||
?.emit("contextMenuOpen", this, context);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,15 +53,10 @@ export class WebLinkCategory extends CatalogCategory {
|
||||
public spec = {
|
||||
group: "entity.k8slens.dev",
|
||||
versions: [
|
||||
{
|
||||
name: "v1alpha1",
|
||||
entityClass: WebLink,
|
||||
},
|
||||
categoryVersion("v1alpha1", WebLink),
|
||||
],
|
||||
names: {
|
||||
kind: "WebLink",
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
catalogCategoryRegistry.add(new WebLinkCategory());
|
||||
@@ -3,96 +3,10 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import { action, computed, observable, makeObservable } from "mobx";
|
||||
import { once } from "lodash";
|
||||
import { iter, getOrInsertMap, strictSet } from "../utils";
|
||||
import type { Disposer } from "../utils";
|
||||
import type { CatalogCategory, CatalogEntityData, CatalogEntityKindData } from "./catalog-entity";
|
||||
import { asLegacyGlobalForExtensionApi } from "../../extensions/as-legacy-globals-for-extension-api/as-legacy-global-object-for-extension-api";
|
||||
import catalogCategoryRegistryInjectable from "./category-registry.injectable";
|
||||
|
||||
export type CategoryFilter = (category: CatalogCategory) => any;
|
||||
|
||||
export class CatalogCategoryRegistry {
|
||||
protected categories = observable.set<CatalogCategory>();
|
||||
protected groupKinds = new Map<string, Map<string, CatalogCategory>>();
|
||||
protected filters = observable.set<CategoryFilter>([], {
|
||||
deep: false,
|
||||
});
|
||||
|
||||
constructor() {
|
||||
makeObservable(this);
|
||||
}
|
||||
|
||||
@action add(category: CatalogCategory): Disposer {
|
||||
const byGroup = getOrInsertMap(this.groupKinds, category.spec.group);
|
||||
|
||||
this.categories.add(category);
|
||||
strictSet(byGroup, category.spec.names.kind, category);
|
||||
|
||||
return () => {
|
||||
this.categories.delete(category);
|
||||
byGroup.delete(category.spec.names.kind);
|
||||
};
|
||||
}
|
||||
|
||||
@computed get items() {
|
||||
return Array.from(this.categories);
|
||||
}
|
||||
|
||||
@computed get filteredItems() {
|
||||
return Array.from(
|
||||
iter.reduce(
|
||||
this.filters,
|
||||
iter.filter,
|
||||
this.items.values(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
getForGroupKind<T extends CatalogCategory>(group: string, kind: string): T | undefined {
|
||||
return this.groupKinds.get(group)?.get(kind) as T;
|
||||
}
|
||||
|
||||
getEntityForData(data: CatalogEntityData & CatalogEntityKindData) {
|
||||
const category = this.getCategoryForEntity(data);
|
||||
|
||||
if (!category) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const splitApiVersion = data.apiVersion.split("/");
|
||||
const version = splitApiVersion[1];
|
||||
|
||||
const specVersion = category.spec.versions.find((v) => v.name === version);
|
||||
|
||||
if (!specVersion) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new specVersion.entityClass(data);
|
||||
}
|
||||
|
||||
getCategoryForEntity<T extends CatalogCategory>(data: CatalogEntityData & CatalogEntityKindData): T | undefined {
|
||||
const splitApiVersion = data.apiVersion.split("/");
|
||||
const group = splitApiVersion[0];
|
||||
|
||||
return this.getForGroupKind(group, data.kind);
|
||||
}
|
||||
|
||||
getByName(name: string) {
|
||||
return this.items.find(category => category.metadata?.name == name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new filter to the set of category filters
|
||||
* @param fn The function that should return a truthy value if that category should be displayed
|
||||
* @returns A function to remove that filter
|
||||
*/
|
||||
addCatalogCategoryFilter(fn: CategoryFilter): Disposer {
|
||||
this.filters.add(fn);
|
||||
|
||||
return once(() => void this.filters.delete(fn));
|
||||
}
|
||||
}
|
||||
|
||||
export const catalogCategoryRegistry = new CatalogCategoryRegistry();
|
||||
/**
|
||||
* @deprecated use `di.inject(catalogCategoryRegistryInjectable)` instead
|
||||
*/
|
||||
export const catalogCategoryRegistry = asLegacyGlobalForExtensionApi(catalogCategoryRegistryInjectable);
|
||||
@@ -11,19 +11,19 @@ import type { Disposer } from "../utils";
|
||||
import { iter } from "../utils";
|
||||
import type { CategoryColumnRegistration } from "../../renderer/components/+catalog/custom-category-columns";
|
||||
|
||||
type ExtractEntityMetadataType<Entity> = Entity extends CatalogEntity<infer Metadata> ? Metadata : never;
|
||||
type ExtractEntityStatusType<Entity> = Entity extends CatalogEntity<any, infer Status> ? Status : never;
|
||||
type ExtractEntitySpecType<Entity> = Entity extends CatalogEntity<any, any, infer Spec> ? Spec : never;
|
||||
export type CatalogEntityDataFor<Entity> = Entity extends CatalogEntity<infer Metadata, infer Status, infer Spec>
|
||||
? CatalogEntityData<Metadata, Status, Spec>
|
||||
: never;
|
||||
|
||||
export type CatalogEntityInstanceFrom<Constructor> = Constructor extends CatalogEntityConstructor<infer Entity>
|
||||
? Entity
|
||||
: never;
|
||||
|
||||
export type CatalogEntityConstructor<Entity extends CatalogEntity> = (
|
||||
(new (data: CatalogEntityData<
|
||||
ExtractEntityMetadataType<Entity>,
|
||||
ExtractEntityStatusType<Entity>,
|
||||
ExtractEntitySpecType<Entity>
|
||||
>) => Entity)
|
||||
new (data: CatalogEntityDataFor<Entity>) => Entity
|
||||
);
|
||||
|
||||
export interface CatalogCategoryVersion<Entity extends CatalogEntity> {
|
||||
export interface CatalogCategoryVersion {
|
||||
/**
|
||||
* The specific version that the associated constructor is for. This MUST be
|
||||
* a DNS label and SHOULD be of the form `vN`, `vNalphaY`, or `vNbetaY` where
|
||||
@@ -35,19 +35,19 @@ export interface CatalogCategoryVersion<Entity extends CatalogEntity> {
|
||||
* - `v1alpha2`
|
||||
* - `v3beta2`
|
||||
*/
|
||||
name: string;
|
||||
readonly name: string;
|
||||
|
||||
/**
|
||||
* The constructor for the entities.
|
||||
*/
|
||||
entityClass: CatalogEntityConstructor<Entity>;
|
||||
readonly entityClass: CatalogEntityConstructor<CatalogEntity>;
|
||||
}
|
||||
|
||||
export interface CatalogCategorySpec {
|
||||
/**
|
||||
* The grouping for for the category. This MUST be a DNS label.
|
||||
*/
|
||||
group: string;
|
||||
readonly group: string;
|
||||
|
||||
/**
|
||||
* The specific versions of the constructors.
|
||||
@@ -56,18 +56,18 @@ export interface CatalogCategorySpec {
|
||||
* For example, if `group = "entity.k8slens.dev"` and there is an entry in `.versions` with
|
||||
* `name = "v1alpha1"` then the resulting `.apiVersion` MUST be `entity.k8slens.dev/v1alpha1`
|
||||
*/
|
||||
versions: CatalogCategoryVersion<CatalogEntity>[];
|
||||
readonly versions: CatalogCategoryVersion[];
|
||||
|
||||
/**
|
||||
* This is the concerning the category
|
||||
*/
|
||||
names: {
|
||||
readonly names: {
|
||||
/**
|
||||
* The kind of entity that this category is for. This value MUST be a DNS
|
||||
* label and MUST be equal to the `kind` fields that are produced by the
|
||||
* `.versions.[] | .entityClass` fields.
|
||||
*/
|
||||
kind: string;
|
||||
readonly kind: string;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -81,7 +81,7 @@ export interface CatalogCategorySpec {
|
||||
*
|
||||
* These columns will not be used in the "Browse" view.
|
||||
*/
|
||||
displayColumns?: CategoryColumnRegistration[];
|
||||
readonly displayColumns?: CategoryColumnRegistration[];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -109,6 +109,30 @@ export interface CatalogCategoryEvents {
|
||||
contextMenuOpen: (entity: CatalogEntity, context: CatalogEntityContextMenuContext) => void;
|
||||
}
|
||||
|
||||
export interface CatalogCategoryMetadata {
|
||||
/**
|
||||
* The name of your category. The category can be searched for by this
|
||||
* value. This will also be used for the catalog menu.
|
||||
*/
|
||||
readonly name: string;
|
||||
/**
|
||||
* Either an `<svg>` or the name of an icon from {@link IconProps}
|
||||
*/
|
||||
readonly icon: string;
|
||||
}
|
||||
|
||||
export function categoryVersion<
|
||||
T extends CatalogEntity<Metadata, Status, Spec>,
|
||||
Metadata extends CatalogEntityMetadata,
|
||||
Status extends CatalogEntityStatus,
|
||||
Spec extends CatalogEntitySpec,
|
||||
>(name: string, entityClass: new (data: CatalogEntityData<Metadata, Status, Spec>) => T): CatalogCategoryVersion {
|
||||
return {
|
||||
name,
|
||||
entityClass: entityClass as CatalogEntityConstructor<T>,
|
||||
};
|
||||
}
|
||||
|
||||
export abstract class CatalogCategory extends (EventEmitter as new () => TypedEmitter<CatalogCategoryEvents>) {
|
||||
/**
|
||||
* The version of category that you are wanting to declare.
|
||||
@@ -131,28 +155,17 @@ export abstract class CatalogCategory extends (EventEmitter as new () => TypedEm
|
||||
/**
|
||||
* The data about the category itself
|
||||
*/
|
||||
abstract readonly metadata: {
|
||||
/**
|
||||
* The name of your category. The category can be searched for by this
|
||||
* value. This will also be used for the catalog menu.
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* Either an `<svg>` or the name of an icon from {@link IconProps}
|
||||
*/
|
||||
icon: string;
|
||||
};
|
||||
abstract readonly metadata: CatalogCategoryMetadata;
|
||||
|
||||
/**
|
||||
* The most important part of a category, as it is where entity versions are declared.
|
||||
*/
|
||||
abstract spec: CatalogCategorySpec;
|
||||
abstract readonly spec: CatalogCategorySpec;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
protected filters = observable.set<AddMenuFilter>([], {
|
||||
protected readonly filters = observable.set<AddMenuFilter>([], {
|
||||
deep: false,
|
||||
});
|
||||
|
||||
@@ -217,14 +230,16 @@ export abstract class CatalogCategory extends (EventEmitter as new () => TypedEm
|
||||
}
|
||||
}
|
||||
|
||||
export interface CatalogEntityMetadata {
|
||||
export type EntityMetadataObject = { [Key in string]?: EntityMetadataValue };
|
||||
export type EntityMetadataValue = string | number | boolean | EntityMetadataObject | undefined;
|
||||
|
||||
export interface CatalogEntityMetadata extends EntityMetadataObject {
|
||||
uid: string;
|
||||
name: string;
|
||||
shortName?: string;
|
||||
description?: string;
|
||||
source?: string;
|
||||
labels: Record<string, string>;
|
||||
[key: string]: string | object;
|
||||
}
|
||||
|
||||
export interface CatalogEntityStatus {
|
||||
@@ -392,7 +407,7 @@ export abstract class CatalogEntity<
|
||||
return this.status.enabled ?? true;
|
||||
}
|
||||
|
||||
public abstract onRun?(context: CatalogEntityActionContext): void | Promise<void>;
|
||||
public abstract onContextMenuOpen(context: CatalogEntityContextMenuContext): void | Promise<void>;
|
||||
public abstract onSettingsOpen(context: CatalogEntitySettingsContext): void | Promise<void>;
|
||||
public onRun?(context: CatalogEntityActionContext): void | Promise<void>;
|
||||
public onContextMenuOpen?(context: CatalogEntityContextMenuContext): void | Promise<void>;
|
||||
public onSettingsOpen?(context: CatalogEntitySettingsContext): void | Promise<void>;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* 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 { GeneralCategory } from "../../catalog-entities";
|
||||
import { builtInCategoryInjectionToken } from "../category-registry.injectable";
|
||||
|
||||
const generalCategoryInjectable = getInjectable({
|
||||
id: "general-category",
|
||||
instantiate: () => new GeneralCategory(),
|
||||
injectionToken: builtInCategoryInjectionToken,
|
||||
});
|
||||
|
||||
export default generalCategoryInjectable;
|
||||
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* 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 { KubernetesClusterCategory } from "../../catalog-entities/kubernetes-cluster";
|
||||
import { builtInCategoryInjectionToken } from "../category-registry.injectable";
|
||||
|
||||
const kubernetesClusterCategoryInjectable = getInjectable({
|
||||
id: "kubernetes-cluster-category",
|
||||
instantiate: () => new KubernetesClusterCategory(),
|
||||
injectionToken: builtInCategoryInjectionToken,
|
||||
});
|
||||
|
||||
export default kubernetesClusterCategoryInjectable;
|
||||
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* 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 { WebLinkCategory } from "../../catalog-entities";
|
||||
import { builtInCategoryInjectionToken } from "../category-registry.injectable";
|
||||
|
||||
const weblinkCategoryInjectable = getInjectable({
|
||||
id: "weblink-category",
|
||||
instantiate: () => new WebLinkCategory(),
|
||||
injectionToken: builtInCategoryInjectionToken,
|
||||
});
|
||||
|
||||
export default weblinkCategoryInjectable;
|
||||
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable, getInjectionToken } from "@ogre-tools/injectable";
|
||||
import type { CatalogCategory } from "./catalog-entity";
|
||||
import { CatalogCategoryRegistry } from "./category-registry";
|
||||
|
||||
export const builtInCategoryInjectionToken = getInjectionToken<CatalogCategory>({
|
||||
id: "built-in-category-token",
|
||||
});
|
||||
|
||||
const catalogCategoryRegistryInjectable = getInjectable({
|
||||
id: "catalog-category-registry",
|
||||
instantiate: (di) => {
|
||||
const registry = new CatalogCategoryRegistry();
|
||||
const categories = di.injectMany(builtInCategoryInjectionToken);
|
||||
|
||||
for (const category of categories) {
|
||||
registry.add(category);
|
||||
}
|
||||
|
||||
return registry;
|
||||
},
|
||||
});
|
||||
|
||||
export default catalogCategoryRegistryInjectable;
|
||||
@@ -0,0 +1,103 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import { action, computed, observable, makeObservable } from "mobx";
|
||||
import { once } from "lodash";
|
||||
import { iter, getOrInsertMap, strictSet } from "../utils";
|
||||
import type { Disposer } from "../utils";
|
||||
import type { CatalogCategory, CatalogEntityData, CatalogEntityKindData } from "./catalog-entity";
|
||||
|
||||
export type CategoryFilter = (category: CatalogCategory) => any;
|
||||
|
||||
export class CatalogCategoryRegistry {
|
||||
protected readonly categories = observable.set<CatalogCategory>();
|
||||
protected readonly groupKinds = new Map<string, Map<string, CatalogCategory>>();
|
||||
protected readonly filters = observable.set<CategoryFilter>([], {
|
||||
deep: false,
|
||||
});
|
||||
|
||||
constructor() {
|
||||
makeObservable(this);
|
||||
}
|
||||
|
||||
@action add(category: CatalogCategory): Disposer {
|
||||
const byGroup = getOrInsertMap(this.groupKinds, category.spec.group);
|
||||
|
||||
this.categories.add(category);
|
||||
strictSet(byGroup, category.spec.names.kind, category);
|
||||
|
||||
return () => {
|
||||
this.categories.delete(category);
|
||||
byGroup.delete(category.spec.names.kind);
|
||||
};
|
||||
}
|
||||
|
||||
@computed get items() {
|
||||
return Array.from(this.categories);
|
||||
}
|
||||
|
||||
@computed get filteredItems() {
|
||||
return Array.from(
|
||||
iter.reduce(
|
||||
this.filters,
|
||||
iter.filter,
|
||||
this.items.values(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
getForGroupKind<T extends CatalogCategory>(group: string, kind: string): T | undefined {
|
||||
return this.groupKinds.get(group)?.get(kind) as T;
|
||||
}
|
||||
|
||||
getEntityForData(data: CatalogEntityData & CatalogEntityKindData) {
|
||||
const category = this.getCategoryForEntity(data);
|
||||
|
||||
if (!category) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const splitApiVersion = data.apiVersion.split("/");
|
||||
const version = splitApiVersion[1];
|
||||
|
||||
const specVersion = category.spec.versions.find((v) => v.name === version);
|
||||
|
||||
if (!specVersion) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new specVersion.entityClass(data);
|
||||
}
|
||||
|
||||
hasCategoryForEntity({ kind, apiVersion }: CatalogEntityData & CatalogEntityKindData): boolean {
|
||||
const splitApiVersion = apiVersion.split("/");
|
||||
const group = splitApiVersion[0];
|
||||
|
||||
return this.groupKinds.get(group)?.has(kind) ?? false;
|
||||
}
|
||||
|
||||
getCategoryForEntity<T extends CatalogCategory>(data: CatalogEntityData & CatalogEntityKindData): T | undefined {
|
||||
const splitApiVersion = data.apiVersion.split("/");
|
||||
const group = splitApiVersion[0];
|
||||
|
||||
return this.getForGroupKind(group, data.kind);
|
||||
}
|
||||
|
||||
getByName(name: string) {
|
||||
return this.items.find(category => category.metadata?.name == name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new filter to the set of category filters
|
||||
* @param fn The function that should return a truthy value if that category should be displayed
|
||||
* @returns A function to remove that filter
|
||||
*/
|
||||
addCatalogCategoryFilter(fn: CategoryFilter): Disposer {
|
||||
this.filters.add(fn);
|
||||
|
||||
return once(() => void this.filters.delete(fn));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* 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 type { CatalogEntityData, CatalogEntityKindData } from "./catalog-entity";
|
||||
import catalogCategoryRegistryInjectable from "./category-registry.injectable";
|
||||
|
||||
export type HasCategoryForEntity = (data: CatalogEntityData & CatalogEntityKindData) => boolean;
|
||||
|
||||
const hasCategoryForEntityInjectable = getInjectable({
|
||||
id: "has-category-for-entity",
|
||||
|
||||
instantiate: (di): HasCategoryForEntity => {
|
||||
const registry = di.inject(catalogCategoryRegistryInjectable);
|
||||
|
||||
return (data) => registry.hasCategoryForEntity(data);
|
||||
},
|
||||
});
|
||||
|
||||
export default hasCategoryForEntityInjectable;
|
||||
@@ -4,4 +4,5 @@
|
||||
*/
|
||||
|
||||
export * from "./catalog-category-registry";
|
||||
export * from "./category-registry";
|
||||
export * from "./catalog-entity";
|
||||
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* 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 type { CatalogEntity, CatalogEntityContextMenuContext } from "./catalog-entity";
|
||||
import catalogCategoryRegistryInjectable from "./category-registry.injectable";
|
||||
|
||||
export type VisitEntityContextMenu = (entity: CatalogEntity, context: CatalogEntityContextMenuContext) => void;
|
||||
|
||||
const visitEntityContextMenuInjectable = getInjectable({
|
||||
id: "visit-entity-context-menu",
|
||||
instantiate: (di): VisitEntityContextMenu => {
|
||||
const categoryRegistry = di.inject(catalogCategoryRegistryInjectable);
|
||||
|
||||
return (entity, context) => {
|
||||
entity.onContextMenuOpen?.(context);
|
||||
categoryRegistry.getCategoryForEntity(entity)?.emit("contextMenuOpen", entity, context);
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
export default visitEntityContextMenuInjectable;
|
||||
+5
-6
@@ -3,13 +3,12 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { daemonSetStore } from "./daemonsets.store";
|
||||
import { clusterFrameMap } from "./cluster-frames";
|
||||
|
||||
const daemonsetsStoreInjectable = getInjectable({
|
||||
id: "daemonsets-store",
|
||||
instantiate: () => daemonSetStore,
|
||||
const clusterFramesInjectable = getInjectable({
|
||||
id: "cluster-frames",
|
||||
instantiate: () => clusterFrameMap,
|
||||
causesSideEffects: true,
|
||||
});
|
||||
|
||||
export default daemonsetsStoreInjectable;
|
||||
|
||||
export default clusterFramesInjectable;
|
||||
@@ -12,7 +12,7 @@ const allowedResourcesInjectable = getInjectable({
|
||||
instantiate: (di) => {
|
||||
const cluster = di.inject(hostedClusterInjectable);
|
||||
|
||||
return computed(() => new Set(cluster.allowedResources), {
|
||||
return computed(() => new Set(cluster?.allowedResources), {
|
||||
// This needs to be here so that during refresh changes are only propogated when necessary
|
||||
equals: (cur, prev) => comparer.structural(cur, prev),
|
||||
});
|
||||
|
||||
@@ -9,10 +9,13 @@ import { createClusterInjectionToken } from "../cluster/create-cluster-injection
|
||||
const clusterStoreInjectable = getInjectable({
|
||||
id: "cluster-store",
|
||||
|
||||
instantiate: (di) =>
|
||||
ClusterStore.createInstance({
|
||||
instantiate: (di) => {
|
||||
ClusterStore.resetInstance();
|
||||
|
||||
return ClusterStore.createInstance({
|
||||
createCluster: di.inject(createClusterInjectionToken),
|
||||
}),
|
||||
});
|
||||
},
|
||||
|
||||
causesSideEffects: true,
|
||||
});
|
||||
|
||||
@@ -103,8 +103,12 @@ export class ClusterStore extends BaseStore<ClusterStoreModel> {
|
||||
return this.clusters.size > 0;
|
||||
}
|
||||
|
||||
getById(id: ClusterId): Cluster | null {
|
||||
return this.clusters.get(id) ?? null;
|
||||
getById(id: ClusterId | undefined): Cluster | undefined {
|
||||
if (id) {
|
||||
return this.clusters.get(id);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
addCluster(clusterOrModel: ClusterModel | Cluster): Cluster {
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* 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 { getClusterIdFromHost } from "../utils";
|
||||
|
||||
const hostedClusterIdInjectable = getInjectable({
|
||||
id: "hosted-cluster-id",
|
||||
instantiate: () => getClusterIdFromHost(location.host),
|
||||
causesSideEffects: true,
|
||||
});
|
||||
|
||||
export default hostedClusterIdInjectable;
|
||||
@@ -3,16 +3,17 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { getHostedClusterId } from "../utils";
|
||||
import hostedClusterIdInjectable from "./hosted-cluster-id.injectable";
|
||||
import clusterStoreInjectable from "./cluster-store.injectable";
|
||||
|
||||
const hostedClusterInjectable = getInjectable({
|
||||
id: "hosted-cluster",
|
||||
|
||||
instantiate: (di) => {
|
||||
const hostedClusterId = getHostedClusterId();
|
||||
const hostedClusterId = di.inject(hostedClusterIdInjectable);
|
||||
const store = di.inject(clusterStoreInjectable);
|
||||
|
||||
return di.inject(clusterStoreInjectable).getById(hostedClusterId);
|
||||
return store.getById(hostedClusterId);
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -3,10 +3,9 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import { ipcMain } from "electron";
|
||||
import { action, comparer, computed, makeObservable, observable, reaction, when } from "mobx";
|
||||
import { broadcastMessage } from "../ipc";
|
||||
import type { ContextHandler } from "../../main/context-handler/context-handler";
|
||||
import type { ClusterContextHandler } from "../../main/context-handler/context-handler";
|
||||
import type { KubeConfig } from "@kubernetes/client-node";
|
||||
import { HttpError } from "@kubernetes/client-node";
|
||||
import type { Kubectl } from "../../main/kubectl/kubectl";
|
||||
@@ -14,25 +13,29 @@ import type { KubeconfigManager } from "../../main/kubeconfig-manager/kubeconfig
|
||||
import { loadConfigFromFile, loadConfigFromFileSync, validateKubeConfig } from "../kube-helpers";
|
||||
import type { KubeApiResource, KubeResource } from "../rbac";
|
||||
import { apiResourceRecord, apiResources } from "../rbac";
|
||||
import logger from "../../main/logger";
|
||||
import { VersionDetector } from "../../main/cluster-detectors/version-detector";
|
||||
import { DetectorRegistry } from "../../main/cluster-detectors/detector-registry";
|
||||
import type { VersionDetector } from "../../main/cluster-detectors/version-detector";
|
||||
import type { DetectorRegistry } from "../../main/cluster-detectors/detector-registry";
|
||||
import plimit from "p-limit";
|
||||
import type { ClusterState, ClusterRefreshOptions, ClusterMetricsResourceType, ClusterId, ClusterMetadata, ClusterModel, ClusterPreferences, ClusterPrometheusPreferences, UpdateClusterModel, KubeAuthUpdate } from "../cluster-types";
|
||||
import { ClusterMetadataKey, initialNodeShellImage, ClusterStatus } from "../cluster-types";
|
||||
import { disposer, toJS } from "../utils";
|
||||
import { disposer, isDefined, isRequestError, toJS } from "../utils";
|
||||
import type { Response } from "request";
|
||||
import { clusterListNamespaceForbiddenChannel } from "../ipc/cluster";
|
||||
import type { CanI } from "./authorization-review.injectable";
|
||||
import type { ListNamespaces } from "./list-namespaces.injectable";
|
||||
import assert from "assert";
|
||||
import type { Logger } from "../logger";
|
||||
|
||||
export interface ClusterDependencies {
|
||||
readonly directoryForKubeConfigs: string;
|
||||
readonly logger: Logger;
|
||||
readonly detectorRegistry: DetectorRegistry;
|
||||
createKubeconfigManager: (cluster: Cluster) => KubeconfigManager;
|
||||
createContextHandler: (cluster: Cluster) => ContextHandler;
|
||||
createContextHandler: (cluster: Cluster) => ClusterContextHandler;
|
||||
createKubectl: (clusterVersion: string) => Kubectl;
|
||||
createAuthorizationReview: (config: KubeConfig) => CanI;
|
||||
createListNamespaces: (config: KubeConfig) => ListNamespaces;
|
||||
createVersionDetector: (cluster: Cluster) => VersionDetector;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -43,17 +46,31 @@ export interface ClusterDependencies {
|
||||
export class Cluster implements ClusterModel, ClusterState {
|
||||
/** Unique id for a cluster */
|
||||
public readonly id: ClusterId;
|
||||
private kubeCtl: Kubectl;
|
||||
private kubeCtl: Kubectl | undefined;
|
||||
/**
|
||||
* Context handler
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public contextHandler: ContextHandler;
|
||||
protected proxyKubeconfigManager: KubeconfigManager;
|
||||
protected eventsDisposer = disposer();
|
||||
protected readonly _contextHandler: ClusterContextHandler | undefined;
|
||||
protected readonly _proxyKubeconfigManager: KubeconfigManager | undefined;
|
||||
protected readonly eventsDisposer = disposer();
|
||||
protected activated = false;
|
||||
private resourceAccessStatuses: Map<KubeApiResource, boolean> = new Map();
|
||||
private readonly resourceAccessStatuses = new Map<KubeApiResource, boolean>();
|
||||
|
||||
public get contextHandler() {
|
||||
// TODO: remove these once main/renderer are seperate classes
|
||||
assert(this._contextHandler, "contextHandler is only defined in the main environment");
|
||||
|
||||
return this._contextHandler;
|
||||
}
|
||||
|
||||
protected get proxyKubeconfigManager() {
|
||||
// TODO: remove these once main/renderer are seperate classes
|
||||
assert(this._proxyKubeconfigManager, "proxyKubeconfigManager is only defined in the main environment");
|
||||
|
||||
return this._proxyKubeconfigManager;
|
||||
}
|
||||
|
||||
get whenReady() {
|
||||
return when(() => this.ready);
|
||||
@@ -64,21 +81,21 @@ export class Cluster implements ClusterModel, ClusterState {
|
||||
*
|
||||
* @observable
|
||||
*/
|
||||
@observable contextName: string;
|
||||
@observable contextName!: string;
|
||||
/**
|
||||
* Path to kubeconfig
|
||||
*
|
||||
* @observable
|
||||
*/
|
||||
@observable kubeConfigPath: string;
|
||||
@observable kubeConfigPath!: string;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
@observable workspace: string;
|
||||
@observable workspace?: string;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
@observable workspaces: string[];
|
||||
@observable workspaces?: string[];
|
||||
/**
|
||||
* Kubernetes API server URL
|
||||
*
|
||||
@@ -215,7 +232,7 @@ export class Cluster implements ClusterModel, ClusterState {
|
||||
* @computed
|
||||
* @internal
|
||||
*/
|
||||
@computed get defaultNamespace(): string {
|
||||
@computed get defaultNamespace(): string | undefined {
|
||||
return this.preferences.defaultNamespace;
|
||||
}
|
||||
|
||||
@@ -231,19 +248,24 @@ export class Cluster implements ClusterModel, ClusterState {
|
||||
throw validationError;
|
||||
}
|
||||
|
||||
this.apiUrl = config.getCluster(config.getContextObject(this.contextName).cluster).server;
|
||||
const context = config.getContextObject(this.contextName);
|
||||
|
||||
if (ipcMain) {
|
||||
// for the time being, until renderer gets its own cluster type
|
||||
this.contextHandler = this.dependencies.createContextHandler(this);
|
||||
this.proxyKubeconfigManager = this.dependencies.createKubeconfigManager(this);
|
||||
assert(context);
|
||||
|
||||
logger.debug(`[CLUSTER]: Cluster init success`, {
|
||||
id: this.id,
|
||||
context: this.contextName,
|
||||
apiUrl: this.apiUrl,
|
||||
});
|
||||
}
|
||||
const cluster = config.getCluster(context.cluster);
|
||||
|
||||
assert(cluster);
|
||||
|
||||
this.apiUrl = cluster.server;
|
||||
|
||||
// for the time being, until renderer gets its own cluster type
|
||||
this._contextHandler = this.dependencies.createContextHandler(this);
|
||||
this._proxyKubeconfigManager = this.dependencies.createKubeconfigManager(this);
|
||||
this.dependencies.logger.debug(`[CLUSTER]: Cluster init success`, {
|
||||
id: this.id,
|
||||
context: this.contextName,
|
||||
apiUrl: this.apiUrl,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -255,6 +277,7 @@ export class Cluster implements ClusterModel, ClusterState {
|
||||
// Note: do not assign ID as that should never be updated
|
||||
|
||||
this.kubeConfigPath = model.kubeConfigPath;
|
||||
this.contextName = model.contextName;
|
||||
|
||||
if (model.workspace) {
|
||||
this.workspace = model.workspace;
|
||||
@@ -264,10 +287,6 @@ export class Cluster implements ClusterModel, ClusterState {
|
||||
this.workspaces = model.workspaces;
|
||||
}
|
||||
|
||||
if (model.contextName) {
|
||||
this.contextName = model.contextName;
|
||||
}
|
||||
|
||||
if (model.preferences) {
|
||||
this.preferences = model.preferences;
|
||||
}
|
||||
@@ -289,7 +308,7 @@ export class Cluster implements ClusterModel, ClusterState {
|
||||
* @internal
|
||||
*/
|
||||
protected bindEvents() {
|
||||
logger.info(`[CLUSTER]: bind events`, this.getMeta());
|
||||
this.dependencies.logger.info(`[CLUSTER]: bind events`, this.getMeta());
|
||||
const refreshTimer = setInterval(() => !this.disconnected && this.refresh(), 30000); // every 30s
|
||||
const refreshMetadataTimer = setInterval(() => !this.disconnected && this.refreshMetadata(), 900000); // every 15 minutes
|
||||
|
||||
@@ -310,13 +329,13 @@ export class Cluster implements ClusterModel, ClusterState {
|
||||
* @internal
|
||||
*/
|
||||
protected async recreateProxyKubeconfig() {
|
||||
logger.info("[CLUSTER]: Recreating proxy kubeconfig");
|
||||
this.dependencies.logger.info("[CLUSTER]: Recreating proxy kubeconfig");
|
||||
|
||||
try {
|
||||
await this.proxyKubeconfigManager.clear();
|
||||
await this.getProxyKubeconfig();
|
||||
} catch (error) {
|
||||
logger.error(`[CLUSTER]: failed to recreate proxy kubeconfig`, error);
|
||||
this.dependencies.logger.error(`[CLUSTER]: failed to recreate proxy kubeconfig`, error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -330,7 +349,7 @@ export class Cluster implements ClusterModel, ClusterState {
|
||||
return this.pushState();
|
||||
}
|
||||
|
||||
logger.info(`[CLUSTER]: activate`, this.getMeta());
|
||||
this.dependencies.logger.info(`[CLUSTER]: activate`, this.getMeta());
|
||||
|
||||
if (!this.eventsDisposer.length) {
|
||||
this.bindEvents();
|
||||
@@ -348,7 +367,7 @@ export class Cluster implements ClusterModel, ClusterState {
|
||||
await this.refreshAccessibility();
|
||||
// download kubectl in background, so it's not blocking dashboard
|
||||
this.ensureKubectl()
|
||||
.catch(error => logger.warn(`[CLUSTER]: failed to download kubectl for clusterId=${this.id}`, error));
|
||||
.catch(error => this.dependencies.logger.warn(`[CLUSTER]: failed to download kubectl for clusterId=${this.id}`, error));
|
||||
this.broadcastConnectUpdate("Connected, waiting for view to load ...");
|
||||
}
|
||||
|
||||
@@ -372,9 +391,8 @@ export class Cluster implements ClusterModel, ClusterState {
|
||||
*/
|
||||
@action
|
||||
async reconnect() {
|
||||
logger.info(`[CLUSTER]: reconnect`, this.getMeta());
|
||||
this.contextHandler?.stopServer();
|
||||
await this.contextHandler?.ensureServer();
|
||||
this.dependencies.logger.info(`[CLUSTER]: reconnect`, this.getMeta());
|
||||
await this.contextHandler?.restartServer();
|
||||
this.disconnected = false;
|
||||
}
|
||||
|
||||
@@ -383,10 +401,10 @@ export class Cluster implements ClusterModel, ClusterState {
|
||||
*/
|
||||
@action disconnect(): void {
|
||||
if (this.disconnected) {
|
||||
return void logger.debug("[CLUSTER]: already disconnected", { id: this.id });
|
||||
return void this.dependencies.logger.debug("[CLUSTER]: already disconnected", { id: this.id });
|
||||
}
|
||||
|
||||
logger.info(`[CLUSTER]: disconnecting`, { id: this.id });
|
||||
this.dependencies.logger.info(`[CLUSTER]: disconnecting`, { id: this.id });
|
||||
this.eventsDisposer();
|
||||
this.contextHandler?.stopServer();
|
||||
this.disconnected = true;
|
||||
@@ -397,7 +415,7 @@ export class Cluster implements ClusterModel, ClusterState {
|
||||
this.allowedNamespaces = [];
|
||||
this.resourceAccessStatuses.clear();
|
||||
this.pushState();
|
||||
logger.info(`[CLUSTER]: disconnected`, { id: this.id });
|
||||
this.dependencies.logger.info(`[CLUSTER]: disconnected`, { id: this.id });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -406,7 +424,7 @@ export class Cluster implements ClusterModel, ClusterState {
|
||||
*/
|
||||
@action
|
||||
async refresh(opts: ClusterRefreshOptions = {}) {
|
||||
logger.info(`[CLUSTER]: refresh`, this.getMeta());
|
||||
this.dependencies.logger.info(`[CLUSTER]: refresh`, this.getMeta());
|
||||
await this.refreshConnectionStatus();
|
||||
|
||||
if (this.accessible) {
|
||||
@@ -424,8 +442,8 @@ export class Cluster implements ClusterModel, ClusterState {
|
||||
*/
|
||||
@action
|
||||
async refreshMetadata() {
|
||||
logger.info(`[CLUSTER]: refreshMetadata`, this.getMeta());
|
||||
const metadata = await DetectorRegistry.getInstance().detectForCluster(this);
|
||||
this.dependencies.logger.info(`[CLUSTER]: refreshMetadata`, this.getMeta());
|
||||
const metadata = await this.dependencies.detectorRegistry.detectForCluster(this);
|
||||
const existingMetadata = this.metadata;
|
||||
|
||||
this.metadata = Object.assign(existingMetadata, metadata);
|
||||
@@ -488,41 +506,49 @@ export class Cluster implements ClusterModel, ClusterState {
|
||||
|
||||
protected async getConnectionStatus(): Promise<ClusterStatus> {
|
||||
try {
|
||||
const versionDetector = new VersionDetector(this);
|
||||
const versionDetector = this.dependencies.createVersionDetector(this);
|
||||
const versionData = await versionDetector.detect();
|
||||
|
||||
this.metadata.version = versionData.value;
|
||||
|
||||
return ClusterStatus.AccessGranted;
|
||||
} catch (error) {
|
||||
logger.error(`[CLUSTER]: Failed to connect to "${this.contextName}": ${error}`);
|
||||
this.dependencies.logger.error(`[CLUSTER]: Failed to connect to "${this.contextName}": ${error}`);
|
||||
|
||||
if (error.statusCode) {
|
||||
if (error.statusCode >= 400 && error.statusCode < 500) {
|
||||
this.broadcastConnectUpdate("Invalid credentials", true);
|
||||
if (isRequestError(error)) {
|
||||
if (error.statusCode) {
|
||||
if (error.statusCode >= 400 && error.statusCode < 500) {
|
||||
this.broadcastConnectUpdate("Invalid credentials", true);
|
||||
|
||||
return ClusterStatus.AccessDenied;
|
||||
}
|
||||
return ClusterStatus.AccessDenied;
|
||||
}
|
||||
|
||||
this.broadcastConnectUpdate(error.error || error.message, true);
|
||||
const message = String(error.error || error.message) || String(error);
|
||||
|
||||
return ClusterStatus.Offline;
|
||||
}
|
||||
|
||||
if (error.failed === true) {
|
||||
if (error.timedOut === true) {
|
||||
this.broadcastConnectUpdate("Connection timed out", true);
|
||||
this.broadcastConnectUpdate(message, true);
|
||||
|
||||
return ClusterStatus.Offline;
|
||||
}
|
||||
|
||||
this.broadcastConnectUpdate("Failed to fetch credentials", true);
|
||||
if (error.failed === true) {
|
||||
if (error.timedOut === true) {
|
||||
this.broadcastConnectUpdate("Connection timed out", true);
|
||||
|
||||
return ClusterStatus.AccessDenied;
|
||||
return ClusterStatus.Offline;
|
||||
}
|
||||
|
||||
this.broadcastConnectUpdate("Failed to fetch credentials", true);
|
||||
|
||||
return ClusterStatus.AccessDenied;
|
||||
}
|
||||
|
||||
const message = String(error.error || error.message) || String(error);
|
||||
|
||||
this.broadcastConnectUpdate(message, true);
|
||||
} else {
|
||||
this.broadcastConnectUpdate("Unknown error has occurred", true);
|
||||
}
|
||||
|
||||
this.broadcastConnectUpdate(error.message, true);
|
||||
|
||||
return ClusterStatus.Offline;
|
||||
}
|
||||
}
|
||||
@@ -571,7 +597,7 @@ export class Cluster implements ClusterModel, ClusterState {
|
||||
* @param state cluster state
|
||||
*/
|
||||
pushState(state = this.getState()) {
|
||||
logger.silly(`[CLUSTER]: push-state`, state);
|
||||
this.dependencies.logger.silly(`[CLUSTER]: push-state`, state);
|
||||
broadcastMessage("cluster:state", this.id, state);
|
||||
}
|
||||
|
||||
@@ -594,7 +620,7 @@ export class Cluster implements ClusterModel, ClusterState {
|
||||
broadcastConnectUpdate(message: string, isError = false): void {
|
||||
const update: KubeAuthUpdate = { message, isError };
|
||||
|
||||
logger.debug(`[CLUSTER]: broadcasting connection update`, { ...update, meta: this.getMeta() });
|
||||
this.dependencies.logger.debug(`[CLUSTER]: broadcasting connection update`, { ...update, meta: this.getMeta() });
|
||||
broadcastMessage(`cluster:${this.id}:connection-update`, update);
|
||||
}
|
||||
|
||||
@@ -609,12 +635,12 @@ export class Cluster implements ClusterModel, ClusterState {
|
||||
return await listNamespaces();
|
||||
} catch (error) {
|
||||
const ctx = proxyConfig.getContextObject(this.contextName);
|
||||
const namespaceList = [ctx.namespace].filter(Boolean);
|
||||
const namespaceList = [ctx?.namespace].filter(isDefined);
|
||||
|
||||
if (namespaceList.length === 0 && error instanceof HttpError && error.statusCode === 403) {
|
||||
const { response } = error as HttpError & { response: Response };
|
||||
|
||||
logger.info("[CLUSTER]: listing namespaces is forbidden, broadcasting", { clusterId: this.id, error: response.body });
|
||||
this.dependencies.logger.info("[CLUSTER]: listing namespaces is forbidden, broadcasting", { clusterId: this.id, error: response.body });
|
||||
broadcastMessage(clusterListNamespaceForbiddenChannel, this.id);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,5 +6,8 @@ import { getInjectionToken } from "@ogre-tools/injectable";
|
||||
import type { ClusterModel } from "../cluster-types";
|
||||
import type { Cluster } from "./cluster";
|
||||
|
||||
export const createClusterInjectionToken =
|
||||
getInjectionToken<(model: ClusterModel) => Cluster>({ id: "create-cluster-token" });
|
||||
export type CreateCluster = (model: ClusterModel) => Cluster;
|
||||
|
||||
export const createClusterInjectionToken = getInjectionToken<CreateCluster>({
|
||||
id: "create-cluster-token",
|
||||
});
|
||||
@@ -5,6 +5,7 @@
|
||||
import type { KubeConfig } from "@kubernetes/client-node";
|
||||
import { CoreV1Api } from "@kubernetes/client-node";
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { isDefined } from "../utils";
|
||||
|
||||
export type ListNamespaces = () => Promise<string[]>;
|
||||
|
||||
@@ -14,7 +15,9 @@ export function listNamespaces(config: KubeConfig): ListNamespaces {
|
||||
return async () => {
|
||||
const { body: { items }} = await coreApi.listNamespace();
|
||||
|
||||
return items.map(ns => ns.metadata.name);
|
||||
return items
|
||||
.map(ns => ns.metadata?.name)
|
||||
.filter(isDefined);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* 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 { IpcRendererNavigationEvents } from "../../renderer/navigation/events";
|
||||
import type { MessageChannel } from "../utils/channel/message-channel-injection-token";
|
||||
import { messageChannelInjectionToken } from "../utils/channel/message-channel-injection-token";
|
||||
|
||||
export type AppNavigationChannel = MessageChannel<string>;
|
||||
|
||||
const appNavigationChannelInjectable = getInjectable({
|
||||
id: "app-navigation-channel",
|
||||
|
||||
instantiate: (): AppNavigationChannel => ({
|
||||
id: IpcRendererNavigationEvents.NAVIGATE_IN_APP,
|
||||
}),
|
||||
|
||||
injectionToken: messageChannelInjectionToken,
|
||||
});
|
||||
|
||||
export default appNavigationChannelInjectable;
|
||||
Loaded 100 of 1475 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user