1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

fix tests from rebase

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2022-04-27 11:21:09 -04:00
parent 5d1609e0e4
commit 3def62cd8d
33 changed files with 457 additions and 449 deletions

View File

@ -364,7 +364,6 @@
"flex.box": "^3.4.4", "flex.box": "^3.4.4",
"fork-ts-checker-webpack-plugin": "^6.5.0", "fork-ts-checker-webpack-plugin": "^6.5.0",
"gunzip-maybe": "^1.4.2", "gunzip-maybe": "^1.4.2",
"hoist-non-react-statics": "^3.3.2",
"html-webpack-plugin": "^5.5.0", "html-webpack-plugin": "^5.5.0",
"identity-obj-proxy": "^3.0.0", "identity-obj-proxy": "^3.0.0",
"ignore-loader": "^0.1.2", "ignore-loader": "^0.1.2",

View File

@ -9,7 +9,10 @@ import { getApplicationBuilder } from "../../renderer/components/test-utils/get-
import isAutoUpdateEnabledInjectable from "../../main/is-auto-update-enabled.injectable"; import isAutoUpdateEnabledInjectable from "../../main/is-auto-update-enabled.injectable";
// TODO: Make components free of side effects by making them deterministic // TODO: Make components free of side effects by making them deterministic
jest.mock("../../renderer/components/tooltip"); jest.mock("../../renderer/components/tooltip/tooltip");
jest.mock("../../renderer/components/tooltip/withTooltip", () => ({
withTooltip: (target: any) => target,
}));
jest.mock("../../renderer/components/monaco-editor/monaco-editor"); jest.mock("../../renderer/components/monaco-editor/monaco-editor");
describe("add-cluster - navigation using application menu", () => { describe("add-cluster - navigation using application menu", () => {

View File

@ -5,8 +5,6 @@
import React from "react"; import React from "react";
import type { RenderResult } from "@testing-library/react"; import type { RenderResult } from "@testing-library/react";
import { fireEvent } from "@testing-library/react"; import { fireEvent } from "@testing-library/react";
import { getRendererExtensionFake } from "../../renderer/components/test-utils/get-renderer-extension-fake";
import { LensRendererExtension } from "../../extensions/lens-renderer-extension";
import directoryForLensLocalStorageInjectable from "../../common/directory-for-lens-local-storage/directory-for-lens-local-storage.injectable"; import directoryForLensLocalStorageInjectable from "../../common/directory-for-lens-local-storage/directory-for-lens-local-storage.injectable";
import routesInjectable from "../../renderer/routes/routes.injectable"; import routesInjectable from "../../renderer/routes/routes.injectable";
import { matches } from "lodash/fp"; import { matches } from "lodash/fp";
@ -19,6 +17,8 @@ import type { DiContainer } from "@ogre-tools/injectable";
import { navigateToRouteInjectionToken } from "../../common/front-end-routing/navigate-to-route-injection-token"; import { navigateToRouteInjectionToken } from "../../common/front-end-routing/navigate-to-route-injection-token";
import assert from "assert"; import assert from "assert";
import { getSidebarItem } from "../utils"; 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", () => { describe("cluster - sidebar and tab navigation for extensions", () => {
let applicationBuilder: ApplicationBuilder; let applicationBuilder: ApplicationBuilder;
@ -43,6 +43,7 @@ describe("cluster - sidebar and tab navigation for extensions", () => {
describe("given extension with cluster pages and cluster page menus", () => { describe("given extension with cluster pages and cluster page menus", () => {
beforeEach(async () => { beforeEach(async () => {
const getRendererExtensionFake = getRendererExtensionFakeFor(applicationBuilder);
const testExtension = getRendererExtensionFake(extensionStubWithSidebarItems); const testExtension = getRendererExtensionFake(extensionStubWithSidebarItems);
await applicationBuilder.addExtensions(testExtension); await applicationBuilder.addExtensions(testExtension);
@ -383,8 +384,10 @@ describe("cluster - sidebar and tab navigation for extensions", () => {
}); });
}); });
const extensionStubWithSidebarItems = new (class extends LensRendererExtension { const extensionStubWithSidebarItems: FakeExtensionData = {
clusterPages = [ id: "some-extension-id",
name: "some-extension-name",
clusterPages: [
{ {
components: { components: {
Page: () => { Page: () => {
@ -408,9 +411,8 @@ const extensionStubWithSidebarItems = new (class extends LensRendererExtension {
), ),
}, },
}, },
]; ],
clusterPageMenus: [
clusterPageMenus = [
{ {
id: "some-parent-id", id: "some-parent-id",
title: "Parent", title: "Parent",
@ -441,16 +443,5 @@ const extensionStubWithSidebarItems = new (class extends LensRendererExtension {
Icon: null as never, Icon: null as never,
}, },
}, },
]; ],
})({ };
absolutePath: "/some/absolute/path",
id: "some-extension-id",
isBundled: true,
isCompatible: true,
isEnabled: true,
manifest: {
name: "some-extension-name",
version: "1.0.0",
},
manifestPath: "/some/manifest/path",
});

View File

@ -2,15 +2,13 @@
* Copyright (c) OpenLens Authors. All rights reserved. * Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information. * 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 type { FakeExtensionData, TestExtension } from "../renderer/components/test-utils/get-renderer-extension-fake";
import { getRendererExtensionFake } 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 React from "react";
import type { RenderResult } from "@testing-library/react"; import type { RenderResult } from "@testing-library/react";
import currentPathInjectable from "../renderer/routes/current-path.injectable"; 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 type { ApplicationBuilder } from "../renderer/components/test-utils/get-application-builder";
import { getApplicationBuilder } from "../renderer/components/test-utils/get-application-builder"; import { getApplicationBuilder } from "../renderer/components/test-utils/get-application-builder";
import type { SetRequired } from "type-fest";
describe("extension special characters in page registrations", () => { describe("extension special characters in page registrations", () => {
let applicationBuilder: ApplicationBuilder; let applicationBuilder: ApplicationBuilder;
@ -19,6 +17,7 @@ describe("extension special characters in page registrations", () => {
beforeEach(async () => { beforeEach(async () => {
applicationBuilder = getApplicationBuilder(); applicationBuilder = getApplicationBuilder();
const getRendererExtensionFake = getRendererExtensionFakeFor(applicationBuilder);
testExtension = getRendererExtensionFake( testExtension = getRendererExtensionFake(
extensionWithPagesHavingSpecialCharacters, extensionWithPagesHavingSpecialCharacters,
@ -50,9 +49,9 @@ describe("extension special characters in page registrations", () => {
}); });
}); });
const extensionWithPagesHavingSpecialCharacters: SetRequired<Partial<LensRendererExtension>, "id"> = { const extensionWithPagesHavingSpecialCharacters: FakeExtensionData = {
id: "@some-extension-id/", id: "some-extension-id",
name: "@some-extension-name/",
globalPages: [ globalPages: [
{ {
id: "/some-page-id/", id: "/some-page-id/",

View File

@ -2,8 +2,8 @@
* Copyright (c) OpenLens Authors. All rights reserved. * Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information. * 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 type { FakeExtensionData, TestExtension } from "../renderer/components/test-utils/get-renderer-extension-fake";
import { getRendererExtensionFake } 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 React from "react";
import type { RenderResult } from "@testing-library/react"; import type { RenderResult } from "@testing-library/react";
import { fireEvent } from "@testing-library/react"; import { fireEvent } from "@testing-library/react";
@ -11,9 +11,7 @@ import isEmpty from "lodash/isEmpty";
import queryParametersInjectable from "../renderer/routes/query-parameters.injectable"; import queryParametersInjectable from "../renderer/routes/query-parameters.injectable";
import currentPathInjectable from "../renderer/routes/current-path.injectable"; import currentPathInjectable from "../renderer/routes/current-path.injectable";
import type { IComputedValue } from "mobx"; import type { IComputedValue } from "mobx";
import type { LensRendererExtension } from "../extensions/lens-renderer-extension";
import { getApplicationBuilder } from "../renderer/components/test-utils/get-application-builder"; import { getApplicationBuilder } from "../renderer/components/test-utils/get-application-builder";
import type { SetRequired } from "type-fest";
describe("navigate to extension page", () => { describe("navigate to extension page", () => {
let rendered: RenderResult; let rendered: RenderResult;
@ -23,6 +21,7 @@ describe("navigate to extension page", () => {
beforeEach(async () => { beforeEach(async () => {
const applicationBuilder = getApplicationBuilder(); const applicationBuilder = getApplicationBuilder();
const getRendererExtensionFake = getRendererExtensionFakeFor(applicationBuilder);
testExtension = getRendererExtensionFake( testExtension = getRendererExtensionFake(
extensionWithPagesHavingParameters, extensionWithPagesHavingParameters,
@ -126,9 +125,9 @@ describe("navigate to extension page", () => {
}); });
}); });
const extensionWithPagesHavingParameters: SetRequired<Partial<LensRendererExtension>, "id"> = { const extensionWithPagesHavingParameters: FakeExtensionData = {
id: "some-extension-id", id: "some-extension-id",
name: "some-extension-name",
globalPages: [ globalPages: [
{ {
components: { components: {

View File

@ -117,14 +117,14 @@ exports[`preferences - closing-preferences given accessing preferences directly
class="SubTitle" class="SubTitle"
> >
Theme Theme
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
> >
<span <span
class="css-1f43avz-a11yText-A11yText" class="css-1f43avz-a11yText-A11yText"
id="react-select-26-live-region" id="react-select-6-live-region"
/> />
<span <span
aria-atomic="false" aria-atomic="false"
@ -140,7 +140,7 @@ exports[`preferences - closing-preferences given accessing preferences directly
> >
<div <div
class="Select__placeholder css-14el2xx-placeholder" class="Select__placeholder css-14el2xx-placeholder"
id="react-select-26-placeholder" id="react-select-6-placeholder"
> >
Select... Select...
</div> </div>
@ -150,7 +150,7 @@ exports[`preferences - closing-preferences given accessing preferences directly
> >
<input <input
aria-autocomplete="list" aria-autocomplete="list"
aria-describedby="react-select-26-placeholder" aria-describedby="react-select-6-placeholder"
aria-expanded="false" aria-expanded="false"
aria-haspopup="true" aria-haspopup="true"
autocapitalize="none" autocapitalize="none"
@ -202,14 +202,14 @@ exports[`preferences - closing-preferences given accessing preferences directly
class="SubTitle" class="SubTitle"
> >
Extension Install Registry Extension Install Registry
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
> >
<span <span
class="css-1f43avz-a11yText-A11yText" class="css-1f43avz-a11yText-A11yText"
id="react-select-27-live-region" id="react-select-7-live-region"
/> />
<span <span
aria-atomic="false" aria-atomic="false"
@ -225,7 +225,7 @@ exports[`preferences - closing-preferences given accessing preferences directly
> >
<div <div
class="Select__placeholder css-14el2xx-placeholder" class="Select__placeholder css-14el2xx-placeholder"
id="react-select-27-placeholder" id="react-select-7-placeholder"
> >
Select... Select...
</div> </div>
@ -235,7 +235,7 @@ exports[`preferences - closing-preferences given accessing preferences directly
> >
<input <input
aria-autocomplete="list" aria-autocomplete="list"
aria-describedby="react-select-27-placeholder" aria-describedby="react-select-7-placeholder"
aria-expanded="false" aria-expanded="false"
aria-haspopup="true" aria-haspopup="true"
autocapitalize="none" autocapitalize="none"
@ -281,8 +281,8 @@ exports[`preferences - closing-preferences given accessing preferences directly
<p <p
class="mt-4 mb-5 leading-relaxed" class="mt-4 mb-5 leading-relaxed"
> >
This setting is to change the registry URL for installing extensions by name. 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 If you are unable to access the default registry (https://registry.npmjs.org) you can change it in your
<b> <b>
.npmrc .npmrc
</b> </b>
@ -316,7 +316,7 @@ exports[`preferences - closing-preferences given accessing preferences directly
class="SubTitle" class="SubTitle"
> >
Start-up Start-up
</div> </div>
<label <label
class="Switch" class="Switch"
@ -337,14 +337,14 @@ exports[`preferences - closing-preferences given accessing preferences directly
class="SubTitle" class="SubTitle"
> >
Update Channel Update Channel
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
> >
<span <span
class="css-1f43avz-a11yText-A11yText" class="css-1f43avz-a11yText-A11yText"
id="react-select-28-live-region" id="react-select-8-live-region"
/> />
<span <span
aria-atomic="false" aria-atomic="false"
@ -360,7 +360,7 @@ exports[`preferences - closing-preferences given accessing preferences directly
> >
<div <div
class="Select__placeholder css-14el2xx-placeholder" class="Select__placeholder css-14el2xx-placeholder"
id="react-select-28-placeholder" id="react-select-8-placeholder"
> >
Select... Select...
</div> </div>
@ -370,7 +370,7 @@ exports[`preferences - closing-preferences given accessing preferences directly
> >
<input <input
aria-autocomplete="list" aria-autocomplete="list"
aria-describedby="react-select-28-placeholder" aria-describedby="react-select-8-placeholder"
aria-expanded="false" aria-expanded="false"
aria-haspopup="true" aria-haspopup="true"
autocapitalize="none" autocapitalize="none"
@ -422,14 +422,14 @@ exports[`preferences - closing-preferences given accessing preferences directly
class="SubTitle" class="SubTitle"
> >
Locale Timezone Locale Timezone
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
> >
<span <span
class="css-1f43avz-a11yText-A11yText" class="css-1f43avz-a11yText-A11yText"
id="react-select-29-live-region" id="react-select-9-live-region"
/> />
<span <span
aria-atomic="false" aria-atomic="false"
@ -445,7 +445,7 @@ exports[`preferences - closing-preferences given accessing preferences directly
> >
<div <div
class="Select__placeholder css-14el2xx-placeholder" class="Select__placeholder css-14el2xx-placeholder"
id="react-select-29-placeholder" id="react-select-9-placeholder"
> >
Select... Select...
</div> </div>
@ -455,7 +455,7 @@ exports[`preferences - closing-preferences given accessing preferences directly
> >
<input <input
aria-autocomplete="list" aria-autocomplete="list"
aria-describedby="react-select-29-placeholder" aria-describedby="react-select-9-placeholder"
aria-expanded="false" aria-expanded="false"
aria-haspopup="true" aria-haspopup="true"
autocapitalize="none" autocapitalize="none"
@ -815,7 +815,7 @@ exports[`preferences - closing-preferences given already in a page and then navi
class="SubTitle" class="SubTitle"
> >
Theme Theme
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
@ -900,7 +900,7 @@ exports[`preferences - closing-preferences given already in a page and then navi
class="SubTitle" class="SubTitle"
> >
Extension Install Registry Extension Install Registry
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
@ -979,8 +979,8 @@ exports[`preferences - closing-preferences given already in a page and then navi
<p <p
class="mt-4 mb-5 leading-relaxed" class="mt-4 mb-5 leading-relaxed"
> >
This setting is to change the registry URL for installing extensions by name. 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 If you are unable to access the default registry (https://registry.npmjs.org) you can change it in your
<b> <b>
.npmrc .npmrc
</b> </b>
@ -1014,7 +1014,7 @@ exports[`preferences - closing-preferences given already in a page and then navi
class="SubTitle" class="SubTitle"
> >
Start-up Start-up
</div> </div>
<label <label
class="Switch" class="Switch"
@ -1035,7 +1035,7 @@ exports[`preferences - closing-preferences given already in a page and then navi
class="SubTitle" class="SubTitle"
> >
Update Channel Update Channel
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
@ -1120,7 +1120,7 @@ exports[`preferences - closing-preferences given already in a page and then navi
class="SubTitle" class="SubTitle"
> >
Locale Timezone Locale Timezone
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"

View File

@ -103,7 +103,7 @@ exports[`preferences - navigation to application preferences given in some child
class="SubTitle" class="SubTitle"
> >
HTTP Proxy HTTP Proxy
</div> </div>
<div <div
class="Input theme round black" class="Input theme round black"
@ -139,7 +139,7 @@ exports[`preferences - navigation to application preferences given in some child
class="SubTitle" class="SubTitle"
> >
Certificate Trust Certificate Trust
</div> </div>
<label <label
class="Switch" class="Switch"
@ -155,9 +155,9 @@ exports[`preferences - navigation to application preferences given in some child
class="hint" class="hint"
> >
This will make Lens to trust ANY certificate authority without any validations. This will make Lens to trust ANY certificate authority without any validations.
Needed with some corporate proxies that do certificate re-writing. Needed with some corporate proxies that do certificate re-writing.
Does not affect cluster communications! Does not affect cluster communications!
</small> </small>
</section> </section>
@ -307,7 +307,7 @@ exports[`preferences - navigation to application preferences given in some child
class="SubTitle" class="SubTitle"
> >
Theme Theme
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
@ -392,7 +392,7 @@ exports[`preferences - navigation to application preferences given in some child
class="SubTitle" class="SubTitle"
> >
Extension Install Registry Extension Install Registry
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
@ -471,8 +471,8 @@ exports[`preferences - navigation to application preferences given in some child
<p <p
class="mt-4 mb-5 leading-relaxed" class="mt-4 mb-5 leading-relaxed"
> >
This setting is to change the registry URL for installing extensions by name. 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 If you are unable to access the default registry (https://registry.npmjs.org) you can change it in your
<b> <b>
.npmrc .npmrc
</b> </b>
@ -506,7 +506,7 @@ exports[`preferences - navigation to application preferences given in some child
class="SubTitle" class="SubTitle"
> >
Start-up Start-up
</div> </div>
<label <label
class="Switch" class="Switch"
@ -527,7 +527,7 @@ exports[`preferences - navigation to application preferences given in some child
class="SubTitle" class="SubTitle"
> >
Update Channel Update Channel
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
@ -612,7 +612,7 @@ exports[`preferences - navigation to application preferences given in some child
class="SubTitle" class="SubTitle"
> >
Locale Timezone Locale Timezone
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"

View File

@ -105,7 +105,7 @@ exports[`preferences - navigation to editor preferences given in preferences, wh
class="SubTitle" class="SubTitle"
> >
Theme Theme
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
@ -190,7 +190,7 @@ exports[`preferences - navigation to editor preferences given in preferences, wh
class="SubTitle" class="SubTitle"
> >
Extension Install Registry Extension Install Registry
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
@ -269,8 +269,8 @@ exports[`preferences - navigation to editor preferences given in preferences, wh
<p <p
class="mt-4 mb-5 leading-relaxed" class="mt-4 mb-5 leading-relaxed"
> >
This setting is to change the registry URL for installing extensions by name. 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 If you are unable to access the default registry (https://registry.npmjs.org) you can change it in your
<b> <b>
.npmrc .npmrc
</b> </b>
@ -304,7 +304,7 @@ exports[`preferences - navigation to editor preferences given in preferences, wh
class="SubTitle" class="SubTitle"
> >
Start-up Start-up
</div> </div>
<label <label
class="Switch" class="Switch"
@ -325,7 +325,7 @@ exports[`preferences - navigation to editor preferences given in preferences, wh
class="SubTitle" class="SubTitle"
> >
Update Channel Update Channel
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
@ -410,7 +410,7 @@ exports[`preferences - navigation to editor preferences given in preferences, wh
class="SubTitle" class="SubTitle"
> >
Locale Timezone Locale Timezone
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
@ -630,7 +630,7 @@ exports[`preferences - navigation to editor preferences given in preferences, wh
class="SubTitle" class="SubTitle"
> >
Minimap Minimap
</div> </div>
<section> <section>
<div <div
@ -663,7 +663,7 @@ exports[`preferences - navigation to editor preferences given in preferences, wh
> >
<span <span
class="css-1f43avz-a11yText-A11yText" class="css-1f43avz-a11yText-A11yText"
id="react-select-14-live-region" id="react-select-10-live-region"
/> />
<span <span
aria-atomic="false" aria-atomic="false"
@ -679,7 +679,7 @@ exports[`preferences - navigation to editor preferences given in preferences, wh
> >
<div <div
class="Select__placeholder css-14el2xx-placeholder" class="Select__placeholder css-14el2xx-placeholder"
id="react-select-14-placeholder" id="react-select-10-placeholder"
> >
Select... Select...
</div> </div>
@ -689,7 +689,7 @@ exports[`preferences - navigation to editor preferences given in preferences, wh
> >
<input <input
aria-autocomplete="list" aria-autocomplete="list"
aria-describedby="react-select-14-placeholder" aria-describedby="react-select-10-placeholder"
aria-expanded="false" aria-expanded="false"
aria-haspopup="true" aria-haspopup="true"
autocapitalize="none" autocapitalize="none"
@ -740,14 +740,14 @@ exports[`preferences - navigation to editor preferences given in preferences, wh
class="SubTitle" class="SubTitle"
> >
Line numbers Line numbers
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
> >
<span <span
class="css-1f43avz-a11yText-A11yText" class="css-1f43avz-a11yText-A11yText"
id="react-select-15-live-region" id="react-select-11-live-region"
/> />
<span <span
aria-atomic="false" aria-atomic="false"
@ -763,7 +763,7 @@ exports[`preferences - navigation to editor preferences given in preferences, wh
> >
<div <div
class="Select__placeholder css-14el2xx-placeholder" class="Select__placeholder css-14el2xx-placeholder"
id="react-select-15-placeholder" id="react-select-11-placeholder"
> >
Select... Select...
</div> </div>
@ -773,7 +773,7 @@ exports[`preferences - navigation to editor preferences given in preferences, wh
> >
<input <input
aria-autocomplete="list" aria-autocomplete="list"
aria-describedby="react-select-15-placeholder" aria-describedby="react-select-11-placeholder"
aria-expanded="false" aria-expanded="false"
aria-haspopup="true" aria-haspopup="true"
autocapitalize="none" autocapitalize="none"
@ -822,7 +822,7 @@ exports[`preferences - navigation to editor preferences given in preferences, wh
class="SubTitle" class="SubTitle"
> >
Tab size Tab size
</div> </div>
<div <div
class="Input theme round black" class="Input theme round black"
@ -849,7 +849,7 @@ exports[`preferences - navigation to editor preferences given in preferences, wh
class="SubTitle" class="SubTitle"
> >
Font size Font size
</div> </div>
<div <div
class="Input theme round black" class="Input theme round black"
@ -876,7 +876,7 @@ exports[`preferences - navigation to editor preferences given in preferences, wh
class="SubTitle" class="SubTitle"
> >
Font family Font family
</div> </div>
<div <div
class="Input theme round black" class="Input theme round black"

View File

@ -105,7 +105,7 @@ exports[`preferences - navigation to extension specific preferences given in pre
class="SubTitle" class="SubTitle"
> >
Theme Theme
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
@ -190,7 +190,7 @@ exports[`preferences - navigation to extension specific preferences given in pre
class="SubTitle" class="SubTitle"
> >
Extension Install Registry Extension Install Registry
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
@ -269,8 +269,8 @@ exports[`preferences - navigation to extension specific preferences given in pre
<p <p
class="mt-4 mb-5 leading-relaxed" class="mt-4 mb-5 leading-relaxed"
> >
This setting is to change the registry URL for installing extensions by name. 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 If you are unable to access the default registry (https://registry.npmjs.org) you can change it in your
<b> <b>
.npmrc .npmrc
</b> </b>
@ -304,7 +304,7 @@ exports[`preferences - navigation to extension specific preferences given in pre
class="SubTitle" class="SubTitle"
> >
Start-up Start-up
</div> </div>
<label <label
class="Switch" class="Switch"
@ -325,7 +325,7 @@ exports[`preferences - navigation to extension specific preferences given in pre
class="SubTitle" class="SubTitle"
> >
Update Channel Update Channel
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
@ -410,7 +410,7 @@ exports[`preferences - navigation to extension specific preferences given in pre
class="SubTitle" class="SubTitle"
> >
Locale Timezone Locale Timezone
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
@ -645,14 +645,14 @@ exports[`preferences - navigation to extension specific preferences given in pre
class="SubTitle" class="SubTitle"
> >
Theme Theme
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
> >
<span <span
class="css-1f43avz-a11yText-A11yText" class="css-1f43avz-a11yText-A11yText"
id="react-select-14-live-region" id="react-select-6-live-region"
/> />
<span <span
aria-atomic="false" aria-atomic="false"
@ -668,7 +668,7 @@ exports[`preferences - navigation to extension specific preferences given in pre
> >
<div <div
class="Select__placeholder css-14el2xx-placeholder" class="Select__placeholder css-14el2xx-placeholder"
id="react-select-14-placeholder" id="react-select-6-placeholder"
> >
Select... Select...
</div> </div>
@ -678,7 +678,7 @@ exports[`preferences - navigation to extension specific preferences given in pre
> >
<input <input
aria-autocomplete="list" aria-autocomplete="list"
aria-describedby="react-select-14-placeholder" aria-describedby="react-select-6-placeholder"
aria-expanded="false" aria-expanded="false"
aria-haspopup="true" aria-haspopup="true"
autocapitalize="none" autocapitalize="none"
@ -730,14 +730,14 @@ exports[`preferences - navigation to extension specific preferences given in pre
class="SubTitle" class="SubTitle"
> >
Extension Install Registry Extension Install Registry
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
> >
<span <span
class="css-1f43avz-a11yText-A11yText" class="css-1f43avz-a11yText-A11yText"
id="react-select-15-live-region" id="react-select-7-live-region"
/> />
<span <span
aria-atomic="false" aria-atomic="false"
@ -753,7 +753,7 @@ exports[`preferences - navigation to extension specific preferences given in pre
> >
<div <div
class="Select__placeholder css-14el2xx-placeholder" class="Select__placeholder css-14el2xx-placeholder"
id="react-select-15-placeholder" id="react-select-7-placeholder"
> >
Select... Select...
</div> </div>
@ -763,7 +763,7 @@ exports[`preferences - navigation to extension specific preferences given in pre
> >
<input <input
aria-autocomplete="list" aria-autocomplete="list"
aria-describedby="react-select-15-placeholder" aria-describedby="react-select-7-placeholder"
aria-expanded="false" aria-expanded="false"
aria-haspopup="true" aria-haspopup="true"
autocapitalize="none" autocapitalize="none"
@ -809,8 +809,8 @@ exports[`preferences - navigation to extension specific preferences given in pre
<p <p
class="mt-4 mb-5 leading-relaxed" class="mt-4 mb-5 leading-relaxed"
> >
This setting is to change the registry URL for installing extensions by name. 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 If you are unable to access the default registry (https://registry.npmjs.org) you can change it in your
<b> <b>
.npmrc .npmrc
</b> </b>
@ -844,7 +844,7 @@ exports[`preferences - navigation to extension specific preferences given in pre
class="SubTitle" class="SubTitle"
> >
Start-up Start-up
</div> </div>
<label <label
class="Switch" class="Switch"
@ -865,14 +865,14 @@ exports[`preferences - navigation to extension specific preferences given in pre
class="SubTitle" class="SubTitle"
> >
Update Channel Update Channel
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
> >
<span <span
class="css-1f43avz-a11yText-A11yText" class="css-1f43avz-a11yText-A11yText"
id="react-select-16-live-region" id="react-select-8-live-region"
/> />
<span <span
aria-atomic="false" aria-atomic="false"
@ -888,7 +888,7 @@ exports[`preferences - navigation to extension specific preferences given in pre
> >
<div <div
class="Select__placeholder css-14el2xx-placeholder" class="Select__placeholder css-14el2xx-placeholder"
id="react-select-16-placeholder" id="react-select-8-placeholder"
> >
Select... Select...
</div> </div>
@ -898,7 +898,7 @@ exports[`preferences - navigation to extension specific preferences given in pre
> >
<input <input
aria-autocomplete="list" aria-autocomplete="list"
aria-describedby="react-select-16-placeholder" aria-describedby="react-select-8-placeholder"
aria-expanded="false" aria-expanded="false"
aria-haspopup="true" aria-haspopup="true"
autocapitalize="none" autocapitalize="none"
@ -950,14 +950,14 @@ exports[`preferences - navigation to extension specific preferences given in pre
class="SubTitle" class="SubTitle"
> >
Locale Timezone Locale Timezone
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
> >
<span <span
class="css-1f43avz-a11yText-A11yText" class="css-1f43avz-a11yText-A11yText"
id="react-select-17-live-region" id="react-select-9-live-region"
/> />
<span <span
aria-atomic="false" aria-atomic="false"
@ -973,7 +973,7 @@ exports[`preferences - navigation to extension specific preferences given in pre
> >
<div <div
class="Select__placeholder css-14el2xx-placeholder" class="Select__placeholder css-14el2xx-placeholder"
id="react-select-17-placeholder" id="react-select-9-placeholder"
> >
Select... Select...
</div> </div>
@ -983,7 +983,7 @@ exports[`preferences - navigation to extension specific preferences given in pre
> >
<input <input
aria-autocomplete="list" aria-autocomplete="list"
aria-describedby="react-select-17-placeholder" aria-describedby="react-select-9-placeholder"
aria-expanded="false" aria-expanded="false"
aria-haspopup="true" aria-haspopup="true"
autocapitalize="none" autocapitalize="none"
@ -1185,7 +1185,7 @@ exports[`preferences - navigation to extension specific preferences given in pre
class="SubTitle" class="SubTitle"
> >
Some preference item Some preference item
</div> </div>
<div <div
data-testid="some-preference-item-input" data-testid="some-preference-item-input"

View File

@ -105,7 +105,7 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
class="SubTitle" class="SubTitle"
> >
Theme Theme
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
@ -190,7 +190,7 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
class="SubTitle" class="SubTitle"
> >
Extension Install Registry Extension Install Registry
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
@ -269,8 +269,8 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
<p <p
class="mt-4 mb-5 leading-relaxed" class="mt-4 mb-5 leading-relaxed"
> >
This setting is to change the registry URL for installing extensions by name. 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 If you are unable to access the default registry (https://registry.npmjs.org) you can change it in your
<b> <b>
.npmrc .npmrc
</b> </b>
@ -304,7 +304,7 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
class="SubTitle" class="SubTitle"
> >
Start-up Start-up
</div> </div>
<label <label
class="Switch" class="Switch"
@ -325,7 +325,7 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
class="SubTitle" class="SubTitle"
> >
Update Channel Update Channel
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
@ -410,7 +410,7 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
class="SubTitle" class="SubTitle"
> >
Locale Timezone Locale Timezone
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
@ -634,7 +634,7 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
class="SubTitle" class="SubTitle"
> >
Kubectl binary download Kubectl binary download
</div> </div>
<label <label
class="Switch" class="Switch"
@ -652,14 +652,14 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
class="SubTitle" class="SubTitle"
> >
Download mirror Download mirror
</div> </div>
<div <div
class="Select theme-lens Select--is-disabled css-3iigni-container" class="Select theme-lens Select--is-disabled css-3iigni-container"
> >
<span <span
class="css-1f43avz-a11yText-A11yText" class="css-1f43avz-a11yText-A11yText"
id="react-select-14-live-region" id="react-select-10-live-region"
/> />
<span <span
aria-atomic="false" aria-atomic="false"
@ -675,7 +675,7 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
> >
<div <div
class="Select__placeholder css-14el2xx-placeholder" class="Select__placeholder css-14el2xx-placeholder"
id="react-select-14-placeholder" id="react-select-10-placeholder"
> >
Download mirror for kubectl Download mirror for kubectl
</div> </div>
@ -685,7 +685,7 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
> >
<input <input
aria-autocomplete="list" aria-autocomplete="list"
aria-describedby="react-select-14-placeholder" aria-describedby="react-select-10-placeholder"
aria-expanded="false" aria-expanded="false"
aria-haspopup="true" aria-haspopup="true"
autocapitalize="none" autocapitalize="none"
@ -735,7 +735,7 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
class="SubTitle" class="SubTitle"
> >
Directory for binaries Directory for binaries
</div> </div>
<div <div
class="Input theme round black disabled" class="Input theme round black disabled"
@ -767,7 +767,7 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
class="SubTitle" class="SubTitle"
> >
Path to kubectl binary Path to kubectl binary
</div> </div>
<div <div
class="Input theme round black" class="Input theme round black"
@ -812,7 +812,7 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
class="SubTitle pt-5" class="SubTitle pt-5"
> >
Synced Items Synced Items
</div> </div>
<div <div
class="notice mt-3" class="notice mt-3"
@ -840,7 +840,7 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
> >
<span <span
class="css-1f43avz-a11yText-A11yText" class="css-1f43avz-a11yText-A11yText"
id="react-select-15-live-region" id="react-select-11-live-region"
/> />
<span <span
aria-atomic="false" aria-atomic="false"
@ -856,7 +856,7 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
> >
<div <div
class="Select__placeholder css-14el2xx-placeholder" class="Select__placeholder css-14el2xx-placeholder"
id="react-select-15-placeholder" id="react-select-11-placeholder"
> >
Repositories Repositories
</div> </div>
@ -866,7 +866,7 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
> >
<input <input
aria-autocomplete="list" aria-autocomplete="list"
aria-describedby="react-select-15-placeholder" aria-describedby="react-select-11-placeholder"
aria-expanded="false" aria-expanded="false"
aria-haspopup="true" aria-haspopup="true"
autocapitalize="none" autocapitalize="none"

View File

@ -105,7 +105,7 @@ exports[`preferences - navigation to proxy preferences given in preferences, whe
class="SubTitle" class="SubTitle"
> >
Theme Theme
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
@ -190,7 +190,7 @@ exports[`preferences - navigation to proxy preferences given in preferences, whe
class="SubTitle" class="SubTitle"
> >
Extension Install Registry Extension Install Registry
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
@ -269,8 +269,8 @@ exports[`preferences - navigation to proxy preferences given in preferences, whe
<p <p
class="mt-4 mb-5 leading-relaxed" class="mt-4 mb-5 leading-relaxed"
> >
This setting is to change the registry URL for installing extensions by name. 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 If you are unable to access the default registry (https://registry.npmjs.org) you can change it in your
<b> <b>
.npmrc .npmrc
</b> </b>
@ -304,7 +304,7 @@ exports[`preferences - navigation to proxy preferences given in preferences, whe
class="SubTitle" class="SubTitle"
> >
Start-up Start-up
</div> </div>
<label <label
class="Switch" class="Switch"
@ -325,7 +325,7 @@ exports[`preferences - navigation to proxy preferences given in preferences, whe
class="SubTitle" class="SubTitle"
> >
Update Channel Update Channel
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
@ -410,7 +410,7 @@ exports[`preferences - navigation to proxy preferences given in preferences, whe
class="SubTitle" class="SubTitle"
> >
Locale Timezone Locale Timezone
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
@ -631,7 +631,7 @@ exports[`preferences - navigation to proxy preferences given in preferences, whe
class="SubTitle" class="SubTitle"
> >
HTTP Proxy HTTP Proxy
</div> </div>
<div <div
class="Input theme round black" class="Input theme round black"
@ -667,7 +667,7 @@ exports[`preferences - navigation to proxy preferences given in preferences, whe
class="SubTitle" class="SubTitle"
> >
Certificate Trust Certificate Trust
</div> </div>
<label <label
class="Switch" class="Switch"
@ -683,9 +683,9 @@ exports[`preferences - navigation to proxy preferences given in preferences, whe
class="hint" class="hint"
> >
This will make Lens to trust ANY certificate authority without any validations. This will make Lens to trust ANY certificate authority without any validations.
Needed with some corporate proxies that do certificate re-writing. Needed with some corporate proxies that do certificate re-writing.
Does not affect cluster communications! Does not affect cluster communications!
</small> </small>
</section> </section>

View File

@ -119,7 +119,7 @@ exports[`preferences - navigation to telemetry preferences given URL for Sentry
class="SubTitle" class="SubTitle"
> >
Automatic Error Reporting Automatic Error Reporting
</div> </div>
<label <label
class="Checkbox flex align-center" class="Checkbox flex align-center"
@ -293,7 +293,7 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
class="SubTitle" class="SubTitle"
> >
Theme Theme
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
@ -378,7 +378,7 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
class="SubTitle" class="SubTitle"
> >
Extension Install Registry Extension Install Registry
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
@ -457,8 +457,8 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
<p <p
class="mt-4 mb-5 leading-relaxed" class="mt-4 mb-5 leading-relaxed"
> >
This setting is to change the registry URL for installing extensions by name. 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 If you are unable to access the default registry (https://registry.npmjs.org) you can change it in your
<b> <b>
.npmrc .npmrc
</b> </b>
@ -492,7 +492,7 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
class="SubTitle" class="SubTitle"
> >
Start-up Start-up
</div> </div>
<label <label
class="Switch" class="Switch"
@ -513,7 +513,7 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
class="SubTitle" class="SubTitle"
> >
Update Channel Update Channel
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
@ -598,7 +598,7 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
class="SubTitle" class="SubTitle"
> >
Locale Timezone Locale Timezone
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
@ -833,14 +833,14 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
class="SubTitle" class="SubTitle"
> >
Theme Theme
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
> >
<span <span
class="css-1f43avz-a11yText-A11yText" class="css-1f43avz-a11yText-A11yText"
id="react-select-14-live-region" id="react-select-6-live-region"
/> />
<span <span
aria-atomic="false" aria-atomic="false"
@ -856,7 +856,7 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
> >
<div <div
class="Select__placeholder css-14el2xx-placeholder" class="Select__placeholder css-14el2xx-placeholder"
id="react-select-14-placeholder" id="react-select-6-placeholder"
> >
Select... Select...
</div> </div>
@ -866,7 +866,7 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
> >
<input <input
aria-autocomplete="list" aria-autocomplete="list"
aria-describedby="react-select-14-placeholder" aria-describedby="react-select-6-placeholder"
aria-expanded="false" aria-expanded="false"
aria-haspopup="true" aria-haspopup="true"
autocapitalize="none" autocapitalize="none"
@ -918,14 +918,14 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
class="SubTitle" class="SubTitle"
> >
Extension Install Registry Extension Install Registry
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
> >
<span <span
class="css-1f43avz-a11yText-A11yText" class="css-1f43avz-a11yText-A11yText"
id="react-select-15-live-region" id="react-select-7-live-region"
/> />
<span <span
aria-atomic="false" aria-atomic="false"
@ -941,7 +941,7 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
> >
<div <div
class="Select__placeholder css-14el2xx-placeholder" class="Select__placeholder css-14el2xx-placeholder"
id="react-select-15-placeholder" id="react-select-7-placeholder"
> >
Select... Select...
</div> </div>
@ -951,7 +951,7 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
> >
<input <input
aria-autocomplete="list" aria-autocomplete="list"
aria-describedby="react-select-15-placeholder" aria-describedby="react-select-7-placeholder"
aria-expanded="false" aria-expanded="false"
aria-haspopup="true" aria-haspopup="true"
autocapitalize="none" autocapitalize="none"
@ -997,8 +997,8 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
<p <p
class="mt-4 mb-5 leading-relaxed" class="mt-4 mb-5 leading-relaxed"
> >
This setting is to change the registry URL for installing extensions by name. 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 If you are unable to access the default registry (https://registry.npmjs.org) you can change it in your
<b> <b>
.npmrc .npmrc
</b> </b>
@ -1032,7 +1032,7 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
class="SubTitle" class="SubTitle"
> >
Start-up Start-up
</div> </div>
<label <label
class="Switch" class="Switch"
@ -1053,14 +1053,14 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
class="SubTitle" class="SubTitle"
> >
Update Channel Update Channel
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
> >
<span <span
class="css-1f43avz-a11yText-A11yText" class="css-1f43avz-a11yText-A11yText"
id="react-select-16-live-region" id="react-select-8-live-region"
/> />
<span <span
aria-atomic="false" aria-atomic="false"
@ -1076,7 +1076,7 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
> >
<div <div
class="Select__placeholder css-14el2xx-placeholder" class="Select__placeholder css-14el2xx-placeholder"
id="react-select-16-placeholder" id="react-select-8-placeholder"
> >
Select... Select...
</div> </div>
@ -1086,7 +1086,7 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
> >
<input <input
aria-autocomplete="list" aria-autocomplete="list"
aria-describedby="react-select-16-placeholder" aria-describedby="react-select-8-placeholder"
aria-expanded="false" aria-expanded="false"
aria-haspopup="true" aria-haspopup="true"
autocapitalize="none" autocapitalize="none"
@ -1138,14 +1138,14 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
class="SubTitle" class="SubTitle"
> >
Locale Timezone Locale Timezone
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
> >
<span <span
class="css-1f43avz-a11yText-A11yText" class="css-1f43avz-a11yText-A11yText"
id="react-select-17-live-region" id="react-select-9-live-region"
/> />
<span <span
aria-atomic="false" aria-atomic="false"
@ -1161,7 +1161,7 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
> >
<div <div
class="Select__placeholder css-14el2xx-placeholder" class="Select__placeholder css-14el2xx-placeholder"
id="react-select-17-placeholder" id="react-select-9-placeholder"
> >
Select... Select...
</div> </div>
@ -1171,7 +1171,7 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
> >
<input <input
aria-autocomplete="list" aria-autocomplete="list"
aria-describedby="react-select-17-placeholder" aria-describedby="react-select-9-placeholder"
aria-expanded="false" aria-expanded="false"
aria-haspopup="true" aria-haspopup="true"
autocapitalize="none" autocapitalize="none"
@ -1375,7 +1375,7 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
class="SubTitle" class="SubTitle"
> >
Some telemetry-preference item Some telemetry-preference item
</div> </div>
<div <div
data-testid="some-preference-item-input" data-testid="some-preference-item-input"

View File

@ -105,7 +105,7 @@ exports[`preferences - navigation to terminal preferences given in preferences,
class="SubTitle" class="SubTitle"
> >
Theme Theme
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
@ -190,7 +190,7 @@ exports[`preferences - navigation to terminal preferences given in preferences,
class="SubTitle" class="SubTitle"
> >
Extension Install Registry Extension Install Registry
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
@ -269,8 +269,8 @@ exports[`preferences - navigation to terminal preferences given in preferences,
<p <p
class="mt-4 mb-5 leading-relaxed" class="mt-4 mb-5 leading-relaxed"
> >
This setting is to change the registry URL for installing extensions by name. 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 If you are unable to access the default registry (https://registry.npmjs.org) you can change it in your
<b> <b>
.npmrc .npmrc
</b> </b>
@ -304,7 +304,7 @@ exports[`preferences - navigation to terminal preferences given in preferences,
class="SubTitle" class="SubTitle"
> >
Start-up Start-up
</div> </div>
<label <label
class="Switch" class="Switch"
@ -325,7 +325,7 @@ exports[`preferences - navigation to terminal preferences given in preferences,
class="SubTitle" class="SubTitle"
> >
Update Channel Update Channel
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
@ -410,7 +410,7 @@ exports[`preferences - navigation to terminal preferences given in preferences,
class="SubTitle" class="SubTitle"
> >
Locale Timezone Locale Timezone
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
@ -629,7 +629,7 @@ exports[`preferences - navigation to terminal preferences given in preferences,
class="SubTitle" class="SubTitle"
> >
Terminal Shell Path Terminal Shell Path
</div> </div>
<div <div
class="Input theme round black" class="Input theme round black"
@ -657,7 +657,7 @@ exports[`preferences - navigation to terminal preferences given in preferences,
class="SubTitle" class="SubTitle"
> >
Terminal copy & paste Terminal copy & paste
</div> </div>
<label <label
class="Switch" class="Switch"
@ -677,14 +677,14 @@ exports[`preferences - navigation to terminal preferences given in preferences,
class="SubTitle" class="SubTitle"
> >
Terminal theme Terminal theme
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
> >
<span <span
class="css-1f43avz-a11yText-A11yText" class="css-1f43avz-a11yText-A11yText"
id="react-select-14-live-region" id="react-select-10-live-region"
/> />
<span <span
aria-atomic="false" aria-atomic="false"
@ -700,7 +700,7 @@ exports[`preferences - navigation to terminal preferences given in preferences,
> >
<div <div
class="Select__placeholder css-14el2xx-placeholder" class="Select__placeholder css-14el2xx-placeholder"
id="react-select-14-placeholder" id="react-select-10-placeholder"
> >
Select... Select...
</div> </div>
@ -710,7 +710,7 @@ exports[`preferences - navigation to terminal preferences given in preferences,
> >
<input <input
aria-autocomplete="list" aria-autocomplete="list"
aria-describedby="react-select-14-placeholder" aria-describedby="react-select-10-placeholder"
aria-expanded="false" aria-expanded="false"
aria-haspopup="true" aria-haspopup="true"
autocapitalize="none" autocapitalize="none"
@ -759,7 +759,7 @@ exports[`preferences - navigation to terminal preferences given in preferences,
class="SubTitle" class="SubTitle"
> >
Font size Font size
</div> </div>
<div <div
class="Input theme round black" class="Input theme round black"
@ -786,7 +786,7 @@ exports[`preferences - navigation to terminal preferences given in preferences,
class="SubTitle" class="SubTitle"
> >
Font family Font family
</div> </div>
<div <div
class="Input theme round black" class="Input theme round black"

View File

@ -107,7 +107,7 @@ exports[`preferences - navigation using application menu when navigating to pref
class="SubTitle" class="SubTitle"
> >
Theme Theme
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
@ -192,7 +192,7 @@ exports[`preferences - navigation using application menu when navigating to pref
class="SubTitle" class="SubTitle"
> >
Extension Install Registry Extension Install Registry
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
@ -271,8 +271,8 @@ exports[`preferences - navigation using application menu when navigating to pref
<p <p
class="mt-4 mb-5 leading-relaxed" class="mt-4 mb-5 leading-relaxed"
> >
This setting is to change the registry URL for installing extensions by name. 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 If you are unable to access the default registry (https://registry.npmjs.org) you can change it in your
<b> <b>
.npmrc .npmrc
</b> </b>
@ -306,7 +306,7 @@ exports[`preferences - navigation using application menu when navigating to pref
class="SubTitle" class="SubTitle"
> >
Start-up Start-up
</div> </div>
<label <label
class="Switch" class="Switch"
@ -327,7 +327,7 @@ exports[`preferences - navigation using application menu when navigating to pref
class="SubTitle" class="SubTitle"
> >
Update Channel Update Channel
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"
@ -412,7 +412,7 @@ exports[`preferences - navigation using application menu when navigating to pref
class="SubTitle" class="SubTitle"
> >
Locale Timezone Locale Timezone
</div> </div>
<div <div
class="Select theme-lens css-b62m3t-container" class="Select theme-lens css-b62m3t-container"

View File

@ -7,9 +7,9 @@ import type { ApplicationBuilder } from "../../renderer/components/test-utils/ge
import { getApplicationBuilder } 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 userStoreInjectable from "../../common/user-store/user-store.injectable";
import type { UserStore } from "../../common/user-store"; import type { UserStore } from "../../common/user-store";
import { LensRendererExtension } from "../../extensions/lens-renderer-extension";
import React from "react"; import React from "react";
import { getRendererExtensionFake } from "../../renderer/components/test-utils/get-renderer-extension-fake"; import type { FakeExtensionData } from "../../renderer/components/test-utils/get-renderer-extension-fake";
import { getRendererExtensionFakeFor } from "../../renderer/components/test-utils/get-renderer-extension-fake";
import ipcRendererInjectable from "../../renderer/app-paths/get-value-from-registered-channel/ipc-renderer/ipc-renderer.injectable"; import ipcRendererInjectable from "../../renderer/app-paths/get-value-from-registered-channel/ipc-renderer/ipc-renderer.injectable";
describe("preferences - navigation to extension specific preferences", () => { describe("preferences - navigation to extension specific preferences", () => {
@ -60,6 +60,7 @@ describe("preferences - navigation to extension specific preferences", () => {
describe("when extension with specific preferences is enabled", () => { describe("when extension with specific preferences is enabled", () => {
beforeEach(() => { beforeEach(() => {
const getRendererExtensionFake = getRendererExtensionFakeFor(applicationBuilder);
const testExtension = getRendererExtensionFake(extensionStubWithExtensionSpecificPreferenceItems); const testExtension = getRendererExtensionFake(extensionStubWithExtensionSpecificPreferenceItems);
applicationBuilder.addExtensions(testExtension); applicationBuilder.addExtensions(testExtension);
@ -106,8 +107,10 @@ describe("preferences - navigation to extension specific preferences", () => {
}); });
}); });
const extensionStubWithExtensionSpecificPreferenceItems = new (class extends LensRendererExtension{ const extensionStubWithExtensionSpecificPreferenceItems: FakeExtensionData = {
appPreferences = [ id: "some-extension-id",
name: "some-extension-name",
appPreferences: [
{ {
title: "Some preference item", title: "Some preference item",
id: "some-preference-item-id", id: "some-preference-item-id",
@ -128,17 +131,6 @@ const extensionStubWithExtensionSpecificPreferenceItems = new (class extends Len
Input: () => <div />, Input: () => <div />,
}, },
}, },
]; ],
})({ };
absolutePath: "/some/absolute/path",
id: "some-extension-id",
isBundled: true,
isCompatible: true,
isEnabled: true,
manifest: {
name: "some-extension-name",
version: "1.0.0",
},
manifestPath: "/some/manifest/path",
});

View File

@ -6,7 +6,8 @@ import type { RenderResult } from "@testing-library/react";
import React from "react"; import React from "react";
import type { ApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder"; import type { ApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
import { getApplicationBuilder } 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 { FakeExtensionData } from "../../renderer/components/test-utils/get-renderer-extension-fake";
import { getRendererExtensionFakeFor } from "../../renderer/components/test-utils/get-renderer-extension-fake";
import type { UserStore } from "../../common/user-store"; import type { UserStore } from "../../common/user-store";
import userStoreInjectable from "../../common/user-store/user-store.injectable"; import userStoreInjectable from "../../common/user-store/user-store.injectable";
import navigateToTelemetryPreferencesInjectable from "../../common/front-end-routing/routes/preferences/telemetry/navigate-to-telemetry-preferences.injectable"; import navigateToTelemetryPreferencesInjectable from "../../common/front-end-routing/routes/preferences/telemetry/navigate-to-telemetry-preferences.injectable";
@ -61,8 +62,8 @@ describe("preferences - navigation to telemetry preferences", () => {
describe("when extension with telemetry preference items gets enabled", () => { describe("when extension with telemetry preference items gets enabled", () => {
beforeEach(() => { beforeEach(() => {
const testExtensionWithTelemetryPreferenceItems = const getRendererExtensionFake = getRendererExtensionFakeFor(applicationBuilder);
getRendererExtensionFake(extensionStubWithTelemetryPreferenceItems); const testExtensionWithTelemetryPreferenceItems = getRendererExtensionFake(extensionStubWithTelemetryPreferenceItems);
applicationBuilder.addExtensions( applicationBuilder.addExtensions(
testExtensionWithTelemetryPreferenceItems, testExtensionWithTelemetryPreferenceItems,
@ -105,18 +106,19 @@ describe("preferences - navigation to telemetry preferences", () => {
}); });
it("given extensions but no telemetry preference items, does not show link for telemetry preferences", () => { it("given extensions but no telemetry preference items, does not show link for telemetry preferences", () => {
const testExtensionWithTelemetryPreferenceItems = const getRendererExtensionFake = getRendererExtensionFakeFor(applicationBuilder);
getRendererExtensionFake({ const testExtensionWithTelemetryPreferenceItems = getRendererExtensionFake({
id: "some-test-extension-id", id: "some-test-extension-id",
appPreferences: [ name: "some-test-extension-name",
{ appPreferences: [
title: "irrelevant", {
id: "irrelevant", title: "irrelevant",
showInPreferencesTab: "not-telemetry", id: "irrelevant",
components: { Hint: () => <div />, Input: () => <div /> }, showInPreferencesTab: "not-telemetry",
}, components: { Hint: () => <div />, Input: () => <div /> },
], },
}); ],
});
applicationBuilder.addExtensions( applicationBuilder.addExtensions(
testExtensionWithTelemetryPreferenceItems, testExtensionWithTelemetryPreferenceItems,
@ -185,8 +187,9 @@ describe("preferences - navigation to telemetry preferences", () => {
}); });
}); });
const extensionStubWithTelemetryPreferenceItems = { const extensionStubWithTelemetryPreferenceItems: FakeExtensionData = {
id: "some-test-extension-id", id: "some-test-extension-id",
name: "some-test-extension-name",
appPreferences: [ appPreferences: [
{ {
title: "Some telemetry-preference item", title: "Some telemetry-preference item",

View File

@ -14,6 +14,7 @@ import type { FetchMock } from "jest-fetch-mock/types";
import { DeploymentApi, Ingress, IngressApi, Pod, PodApi } from "../endpoints"; import { DeploymentApi, Ingress, IngressApi, Pod, PodApi } from "../endpoints";
import { getDiForUnitTesting } from "../../../main/getDiForUnitTesting"; import { getDiForUnitTesting } from "../../../main/getDiForUnitTesting";
import apiManagerInjectable from "../api-manager/manager.injectable"; import apiManagerInjectable from "../api-manager/manager.injectable";
import autoRegistrationInjectable from "../api-manager/auto-registration.injectable";
jest.mock("../api-manager"); jest.mock("../api-manager");
@ -98,6 +99,7 @@ describe("KubeApi", () => {
apiManager = new ApiManager() as jest.Mocked<ApiManager>; apiManager = new ApiManager() as jest.Mocked<ApiManager>;
di.override(apiManagerInjectable, () => apiManager); di.override(apiManagerInjectable, () => apiManager);
di.inject(autoRegistrationInjectable);
}); });
it("uses url from apiBase if apiBase contains the resource", async () => { it("uses url from apiBase if apiBase contains the resource", async () => {
@ -227,7 +229,7 @@ describe("KubeApi", () => {
await (api as any).checkPreferredVersion(); await (api as any).checkPreferredVersion();
expect(api.apiVersionPreferred).toBe("v1beta1"); expect(api.apiVersionPreferred).toBe("v1beta1");
expect(apiManager.registerApi).toBeCalledWith("/apis/extensions/v1beta1/ingresses", expect.anything()); expect(apiManager.registerApi).toBeCalledWith(api);
}); });
it("registers with apiManager if checkPreferredVersion changes apiVersionPreferred with non-grouped apis", async () => { it("registers with apiManager if checkPreferredVersion changes apiVersionPreferred with non-grouped apis", async () => {
@ -267,7 +269,7 @@ describe("KubeApi", () => {
await (api as any).checkPreferredVersion(); await (api as any).checkPreferredVersion();
expect(api.apiVersionPreferred).toBe("v1beta1"); expect(api.apiVersionPreferred).toBe("v1beta1");
expect(apiManager.registerApi).toBeCalledWith("/api/v1beta1/pods", expect.anything()); expect(apiManager.registerApi).toBeCalledWith(api);
}); });
}); });

View File

@ -3,7 +3,7 @@
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import { reduce } from "../iter"; import { join, nth, reduce } from "../iter";
describe("iter", () => { describe("iter", () => {
describe("reduce", () => { describe("reduce", () => {
@ -15,4 +15,28 @@ describe("iter", () => {
expect(reduce([], (acc: number[], current: number) => [acc[0] + current], [])).toEqual([]); expect(reduce([], (acc: number[], current: number) => [acc[0] + current], [])).toEqual([]);
}); });
}); });
describe("join", () => {
it("should not prefix the output by the seperator", () => {
expect(join(["a", "b", "c"].values(), " ")).toBe("a b c");
});
it("should return empty string if iterator is empty", () => {
expect(join([].values(), " ")).toBe("");
});
it("should return just first entry if iterator is of size 1", () => {
expect(join(["d"].values(), " ")).toBe("d");
});
});
describe("nth", () => {
it("should return undefined past the end of the iterator", () => {
expect(nth(["a"], 123)).toBeUndefined();
});
it("should by 0-indexing the index", () => {
expect(nth(["a", "b"], 0)).toBe("a");
});
});
}); });

View File

@ -5,64 +5,24 @@
export type Falsey = false | 0 | "" | null | undefined; export type Falsey = false | 0 | "" | null | undefined;
export function pipeline<T>(src: Iterable<T>) { interface Iterator<T> {
return Iterator[createPipeline](src); filter(fn: (val: T) => unknown): Iterator<T>;
filterMap<U>(fn: (val: T) => Falsey | U): Iterator<U>;
find(fn: (val: T) => unknown): T | undefined;
collect<U>(fn: (values: Iterable<T>) => U): U;
map<U>(fn: (val: T) => U): Iterator<U>;
join(sep?: string): string;
} }
const createPipeline = Symbol("create-pipeline"); export function pipeline<T>(src: IterableIterator<T>): Iterator<T> {
return {
export class Iterator<T> { filter: (fn) => pipeline(filter(src, fn)),
#inner: Iterable<any>; filterMap: (fn) => pipeline(filterMap(src, fn)),
map: (fn) => pipeline(map(src, fn)),
static [createPipeline]<T>(inner: Iterable<T>) { find: (fn) => find(src, fn),
return new Iterator(inner); join: (sep) => join(src, sep),
} collect: (fn) => fn(src),
};
private constructor(inner: Iterable<T>) {
this.#inner = inner;
}
/**
* Wrap the interior iterator with an filter
*/
public filter(fn: (val: T) => any): Iterator<T> {
this.#inner = filter(this.#inner, fn);
return this;
}
/**
* Wrap the interior iterator with an filterMap
*/
public filterMap<U>(fn: (val: T) => Falsey | U): Iterator<U> {
this.#inner = filterMap(this.#inner, fn);
return this as never;
}
/**
* Consume the interior iterator until an element matches the callback and return that
*/
public find(fn: (val: T) => any): T | undefined {
return find(this.#inner, fn);
}
/**
* Consume the interior iterator and produce a new type
*/
public collect<U>(fn: (values: Iterable<T>) => U): U {
return fn(this.#inner);
}
public map<U>(fn: (val: T) => U): Iterator<U> {
this.#inner = map(this.#inner, fn);
return this as never;
}
public join(sep?: string): string {
return join(this.#inner, sep);
}
} }
/** /**
@ -224,8 +184,15 @@ export function reduce<T, R = T>(src: Iterable<T>, reducer: (acc: R, cur: T) =>
* @param connector The string value to intersperse between the yielded values * @param connector The string value to intersperse between the yielded values
* @returns The concatenated entries of `src` interspersed with copies of `connector` * @returns The concatenated entries of `src` interspersed with copies of `connector`
*/ */
export function join(src: Iterable<unknown>, connector = ","): string { export function join(src: IterableIterator<unknown>, connector = ","): string {
return reduce(src, (acc, cur) => `${acc}${connector}${cur}`, ""); const iterSrc = src[Symbol.iterator]();
const first = iterSrc.next();
if (first.done === true) {
return "";
}
return reduce(iterSrc, (acc, cur) => `${acc}${connector}${cur}`, `${first.value}`);
} }
/** /**

View File

@ -22,7 +22,8 @@ export interface LensExtensionManifest extends PackageJson {
renderer?: string; // path to %ext/dist/renderer.js renderer?: string; // path to %ext/dist/renderer.js
} }
export const Disposers = Symbol(); export const lensExtensionDependencies = Symbol("lens-extension-dependencies");
export const Disposers = Symbol("disposers");
export class LensExtension<Dependencies extends LensExtensionDependencies = LensExtensionDependencies> { export class LensExtension<Dependencies extends LensExtensionDependencies = LensExtensionDependencies> {
readonly id: LensExtensionId; readonly id: LensExtensionId;
@ -64,7 +65,7 @@ export class LensExtension<Dependencies extends LensExtensionDependencies = Lens
return this.manifest.description; return this.manifest.description;
} }
protected readonly dependencies!: Dependencies; readonly [lensExtensionDependencies]!: Dependencies;
/** /**
* getExtensionFileFolder returns the path to an already created folder. This * getExtensionFileFolder returns the path to an already created folder. This
@ -74,7 +75,7 @@ export class LensExtension<Dependencies extends LensExtensionDependencies = Lens
* folder name. * folder name.
*/ */
async getExtensionFileFolder(): Promise<string> { async getExtensionFileFolder(): Promise<string> {
return this.dependencies.fileSystemProvisionerStore.requestDirectory(this.id); return this[lensExtensionDependencies].fileSystemProvisionerStore.requestDirectory(this.id);
} }
@action @action

View File

@ -3,7 +3,7 @@
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import { LensExtension } from "./lens-extension"; import { LensExtension, lensExtensionDependencies } from "./lens-extension";
import { WindowManager } from "../main/window-manager"; import { WindowManager } from "../main/window-manager";
import type { CatalogEntity } from "../common/catalog"; import type { CatalogEntity } from "../common/catalog";
import type { IObservableArray } from "mobx"; import type { IObservableArray } from "mobx";
@ -36,10 +36,10 @@ export class LensMainExtension extends LensExtension<LensMainExtensionDependenci
} }
addCatalogSource(id: string, source: IObservableArray<CatalogEntity>) { addCatalogSource(id: string, source: IObservableArray<CatalogEntity>) {
this.dependencies.entityRegistry.addObservableSource(`${this.name}:${id}`, source); this[lensExtensionDependencies].entityRegistry.addObservableSource(`${this.name}:${id}`, source);
} }
removeCatalogSource(id: string) { removeCatalogSource(id: string) {
this.dependencies.entityRegistry.removeSource(`${this.name}:${id}`); this[lensExtensionDependencies].entityRegistry.removeSource(`${this.name}:${id}`);
} }
} }

View File

@ -4,7 +4,7 @@
*/ */
import type * as registries from "./registries"; import type * as registries from "./registries";
import { Disposers, LensExtension } from "./lens-extension"; import { Disposers, LensExtension, lensExtensionDependencies } from "./lens-extension";
import type { CatalogEntity } from "../common/catalog"; import type { CatalogEntity } from "../common/catalog";
import type { Disposer } from "../common/utils"; import type { Disposer } from "../common/utils";
import type { EntityFilter } from "../renderer/api/catalog/entity/registry"; import type { EntityFilter } from "../renderer/api/catalog/entity/registry";
@ -46,7 +46,7 @@ export class LensRendererExtension extends LensExtension<LensRendererExtensionDe
customCategoryViews: CustomCategoryViewRegistration[] = []; customCategoryViews: CustomCategoryViewRegistration[] = [];
async navigate(pageId?: string, params: object = {}) { async navigate(pageId?: string, params: object = {}) {
const routes = this.dependencies.routes.get(); const routes = this[lensExtensionDependencies].routes.get();
const targetRegistration = [...this.globalPages, ...this.clusterPages] const targetRegistration = [...this.globalPages, ...this.clusterPages]
.find(registration => registration.id === (pageId || undefined)); .find(registration => registration.id === (pageId || undefined));
@ -61,7 +61,7 @@ export class LensRendererExtension extends LensExtension<LensRendererExtensionDe
return; return;
} }
const normalizedParams = this.dependencies.getExtensionPageParameters({ const normalizedParams = this[lensExtensionDependencies].getExtensionPageParameters({
extension: this, extension: this,
registration: targetRegistration, registration: targetRegistration,
}); });
@ -75,7 +75,7 @@ export class LensRendererExtension extends LensExtension<LensRendererExtensionDe
fromPairs, fromPairs,
); );
this.dependencies.navigateToRoute(targetRoute, { this[lensExtensionDependencies].navigateToRoute(targetRoute, {
query, query,
}); });
} }
@ -96,7 +96,7 @@ export class LensRendererExtension extends LensExtension<LensRendererExtensionDe
* @returns A function to clean up the filter * @returns A function to clean up the filter
*/ */
addCatalogFilter(fn: EntityFilter): Disposer { addCatalogFilter(fn: EntityFilter): Disposer {
const dispose = this.dependencies.entityRegistry.addCatalogFilter(fn); const dispose = this[lensExtensionDependencies].entityRegistry.addCatalogFilter(fn);
this[Disposers].push(dispose); this[Disposers].push(dispose);
@ -109,7 +109,7 @@ export class LensRendererExtension extends LensExtension<LensRendererExtensionDe
* @returns A function to clean up the filter * @returns A function to clean up the filter
*/ */
addCatalogCategoryFilter(fn: CategoryFilter): Disposer { addCatalogCategoryFilter(fn: CategoryFilter): Disposer {
const dispose = this.dependencies.categoryRegistry.addCatalogCategoryFilter(fn); const dispose = this[lensExtensionDependencies].categoryRegistry.addCatalogCategoryFilter(fn);
this[Disposers].push(dispose); this[Disposers].push(dispose);

View File

@ -8,16 +8,18 @@ import * as uuid from "uuid";
import { broadcastMessage } from "../../../common/ipc"; import { broadcastMessage } from "../../../common/ipc";
import { ProtocolHandlerExtension, ProtocolHandlerInternal } from "../../../common/protocol-handler"; import { ProtocolHandlerExtension, ProtocolHandlerInternal } from "../../../common/protocol-handler";
import { delay, noop } from "../../../common/utils"; import { delay, noop } from "../../../common/utils";
import { LensExtension } from "../../../extensions/main-api";
import { ExtensionsStore } from "../../../extensions/extensions-store/extensions-store"; import { ExtensionsStore } from "../../../extensions/extensions-store/extensions-store";
import type { LensProtocolRouterMain } from "../lens-protocol-router-main/lens-protocol-router-main"; import type { LensProtocolRouterMain } from "../lens-protocol-router-main/lens-protocol-router-main";
import mockFs from "mock-fs"; import mockFs from "mock-fs";
import { getDiForUnitTesting } from "../../getDiForUnitTesting"; import { getDiForUnitTesting } from "../../getDiForUnitTesting";
import extensionLoaderInjectable from "../../../extensions/extension-loader/extension-loader.injectable";
import lensProtocolRouterMainInjectable from "../lens-protocol-router-main/lens-protocol-router-main.injectable"; import lensProtocolRouterMainInjectable from "../lens-protocol-router-main/lens-protocol-router-main.injectable";
import extensionsStoreInjectable from "../../../extensions/extensions-store/extensions-store.injectable"; import extensionsStoreInjectable from "../../../extensions/extensions-store/extensions-store.injectable";
import getConfigurationFileModelInjectable from "../../../common/get-configuration-file-model/get-configuration-file-model.injectable"; import getConfigurationFileModelInjectable from "../../../common/get-configuration-file-model/get-configuration-file-model.injectable";
import appVersionInjectable from "../../../common/get-configuration-file-model/app-version/app-version.injectable"; import appVersionInjectable from "../../../common/get-configuration-file-model/app-version/app-version.injectable";
import { LensExtension } from "../../../extensions/lens-extension";
import type { LensExtensionId } from "../../../extensions/lens-extension";
import type { ObservableMap } from "mobx";
import extensionInstancesInjectable from "../../../extensions/extension-loader/extension-instances.injectable";
jest.mock("../../../common/ipc"); jest.mock("../../../common/ipc");
@ -28,9 +30,7 @@ function throwIfDefined(val: any): void {
} }
describe("protocol router tests", () => { describe("protocol router tests", () => {
// TODO: This test suite is using any to access protected property. let extensionInstances: ObservableMap<LensExtensionId, LensExtension>;
// Unit tests are allowed to only public interfaces.
let extensionLoader: any;
let lpr: LensProtocolRouterMain; let lpr: LensProtocolRouterMain;
let extensionsStore: ExtensionsStore; let extensionsStore: ExtensionsStore;
@ -48,10 +48,8 @@ describe("protocol router tests", () => {
await di.runSetups(); await di.runSetups();
extensionLoader = di.inject(extensionLoaderInjectable); extensionInstances = di.inject(extensionInstancesInjectable);
extensionsStore = di.inject(extensionsStoreInjectable); extensionsStore = di.inject(extensionsStoreInjectable);
lpr = di.inject(lensProtocolRouterMainInjectable); lpr = di.inject(lensProtocolRouterMainInjectable);
lpr.rendererLoaded = true; lpr.rendererLoaded = true;
@ -99,7 +97,7 @@ describe("protocol router tests", () => {
handler: noop, handler: noop,
}); });
extensionLoader.instances.set(extId, ext); extensionInstances.set(extId, ext);
extensionsStore.mergeState([[extId, { enabled: true, name: "@mirantis/minikube" }]]); extensionsStore.mergeState([[extId, { enabled: true, name: "@mirantis/minikube" }]]);
lpr.addInternalHandler("/", noop); lpr.addInternalHandler("/", noop);
@ -178,7 +176,7 @@ describe("protocol router tests", () => {
handler: params => { called = params.pathname.id; }, handler: params => { called = params.pathname.id; },
}); });
extensionLoader.instances.set(extId, ext); extensionInstances.set(extId, ext);
extensionsStore.mergeState([[extId, { enabled: true, name: "@foobar/icecream" }]]); extensionsStore.mergeState([[extId, { enabled: true, name: "@foobar/icecream" }]]);
try { try {
@ -216,7 +214,7 @@ describe("protocol router tests", () => {
handler: params => { called = params.pathname.id; }, handler: params => { called = params.pathname.id; },
}); });
extensionLoader.instances.set(extId, ext); extensionInstances.set(extId, ext);
extensionsStore.mergeState([[extId, { enabled: true, name: "@foobar/icecream" }]]); extensionsStore.mergeState([[extId, { enabled: true, name: "@foobar/icecream" }]]);
} }
@ -241,7 +239,7 @@ describe("protocol router tests", () => {
handler: () => { called = 1; }, handler: () => { called = 1; },
}); });
extensionLoader.instances.set(extId, ext); extensionInstances.set(extId, ext);
extensionsStore.mergeState([[extId, { enabled: true, name: "icecream" }]]); extensionsStore.mergeState([[extId, { enabled: true, name: "icecream" }]]);
} }

View File

@ -86,7 +86,7 @@ export class AddSecretDialog extends React.Component<AddSecretDialogProps> {
}; };
private getDataFromFields = (fields: SecretTemplateField[] = [], processValue: (val: string) => string = (val => val)) => { private getDataFromFields = (fields: SecretTemplateField[] = [], processValue: (val: string) => string = (val => val)) => {
return iter.pipeline(fields) return iter.pipeline(fields.values())
.filterMap(({ key, value }) => ( .filterMap(({ key, value }) => (
value value
? [key, processValue(value)] as const ? [key, processValue(value)] as const

View File

@ -137,10 +137,8 @@ class NonInjectedDeploymentDetails extends React.Component<DeploymentDetailsProp
labelsOnly labelsOnly
> >
{ {
deployment.getConditions().map(condition => { deployment.getConditions()
const { type, message, lastTransitionTime, status } = condition; .map(({ type, message, lastTransitionTime, status }) => (
return (
<Badge <Badge
key={type} key={type}
label={type} label={type}
@ -153,10 +151,8 @@ class NonInjectedDeploymentDetails extends React.Component<DeploymentDetailsProp
{`Last transition time: ${lastTransitionTime}`} {`Last transition time: ${lastTransitionTime}`}
</p> </p>
</> </>
)} )} />
/> ))
);
})
} }
</DrawerItem> </DrawerItem>
<PodDetailsTolerations workload={deployment}/> <PodDetailsTolerations workload={deployment}/>

View File

@ -30,104 +30,108 @@ export interface IconProps extends React.HTMLAttributes<any> {
disabled?: boolean; disabled?: boolean;
} }
export const Icon = Object.assign( export function isSvg(content: string): boolean {
withTooltip((props: IconProps) => { // data-url for raw svg-icon
const ref = createRef<HTMLAnchorElement>(); return String(content).includes("svg+xml");
}
const { const RawIcon = withTooltip((props: IconProps) => {
// skip passing props to icon's html element const ref = createRef<HTMLAnchorElement>();
className, href, link, material, svg, size, smallest, small, big,
disabled, sticker, active, focusable, children,
interactive, onClick, onKeyDown,
...elemProps
} = props;
const isInteractive = interactive ?? !!(onClick || href || link);
const boundOnClick = (event: React.MouseEvent) => { const {
if (!disabled) { // skip passing props to icon's html element
onClick?.(event); className, href, link, material, svg, size, smallest, small, big,
disabled, sticker, active,
focusable = true,
children,
interactive, onClick, onKeyDown,
...elemProps
} = props;
const isInteractive = interactive ?? !!(onClick || href || link);
const boundOnClick = (event: React.MouseEvent) => {
if (!disabled) {
onClick?.(event);
}
};
const boundOnKeyDown = (event: React.KeyboardEvent<any>) => {
switch (event.nativeEvent.code) {
case "Space":
// fallthrough
case "Enter": {
ref.current?.click();
event.preventDefault();
break;
} }
};
const boundOnKeyDown = (event: React.KeyboardEvent<any>) => {
switch (event.nativeEvent.code) {
case "Space":
// fallthrough
case "Enter": {
ref.current?.click();
event.preventDefault();
break;
}
}
onKeyDown?.(event);
};
let iconContent: ReactNode;
const iconProps: Partial<IconProps> = {
className: cssNames("Icon", className,
{ svg, material, interactive: isInteractive, disabled, sticker, active, focusable },
!size ? { smallest, small, big } : {},
),
onClick: isInteractive ? boundOnClick : undefined,
onKeyDown: isInteractive ? boundOnKeyDown : undefined,
tabIndex: isInteractive && focusable && !disabled ? 0 : undefined,
style: size ? { "--size": size + (isNumber(size) ? "px" : "") } as React.CSSProperties : undefined,
...elemProps,
};
// render as inline svg-icon
if (typeof svg === "string") {
const dataUrlPrefix = "data:image/svg+xml;base64,";
const svgIconDataUrl = svg.startsWith(dataUrlPrefix) ? svg : require(`./${svg}.svg`);
const svgIconText = typeof svgIconDataUrl == "string" // decode xml from data-url
? decode(svgIconDataUrl.replace(dataUrlPrefix, "")) : "";
iconContent = <span className="icon" dangerouslySetInnerHTML={{ __html: svgIconText }} />;
} }
// render as material-icon onKeyDown?.(event);
if (typeof material === "string") { };
iconContent = <span className="icon" data-icon-name={material}>{material}</span>;
}
// wrap icon's content passed from decorator let iconContent: ReactNode;
iconProps.children = ( const iconProps: Partial<IconProps> = {
<> className: cssNames("Icon", className,
{iconContent} { svg, material, interactive: isInteractive, disabled, sticker, active, focusable },
!size ? { smallest, small, big } : {},
),
onClick: isInteractive ? boundOnClick : undefined,
onKeyDown: isInteractive ? boundOnKeyDown : undefined,
tabIndex: isInteractive && focusable && !disabled ? 0 : undefined,
style: size ? { "--size": size + (isNumber(size) ? "px" : "") } as React.CSSProperties : undefined,
...elemProps,
};
// render as inline svg-icon
if (typeof svg === "string") {
const dataUrlPrefix = "data:image/svg+xml;base64,";
const svgIconDataUrl = svg.startsWith(dataUrlPrefix) ? svg : require(`./${svg}.svg`);
const svgIconText = typeof svgIconDataUrl == "string" // decode xml from data-url
? decode(svgIconDataUrl.replace(dataUrlPrefix, ""))
: "";
iconContent = <span className="icon" dangerouslySetInnerHTML={{ __html: svgIconText }} />;
}
// render as material-icon
if (typeof material === "string") {
iconContent = <span className="icon" data-icon-name={material}>{material}</span>;
}
// wrap icon's content passed from decorator
iconProps.children = (
<>
{iconContent}
{children}
</>
);
// render icon type
if (link) {
const { className, children } = iconProps;
return (
<NavLink
className={className}
to={link}
ref={ref}
>
{children} {children}
</> </NavLink>
); );
}
// render icon type if (href) {
if (link) { return (
const { className, children } = iconProps; <a
{...iconProps}
href={href}
ref={ref}
/>
);
}
return ( return <i {...iconProps} ref={ref} />;
<NavLink });
className={className}
to={link}
ref={ref}
>
{children}
</NavLink>
);
}
if (href) { export const Icon = Object.assign(RawIcon, { isSvg });
return (
<a
{...iconProps}
href={href}
ref={ref}
/>
);
}
return <i {...iconProps} ref={ref} />;
}),
{
// data-url for raw svg-icon
isSvg: (content: string) => String(content).includes("svg+xml"),
},
);

View File

@ -28,7 +28,10 @@ import createEditResourceTabInjectable from "../dock/edit-resource/edit-resource
import hideDetailsInjectable from "../kube-detail-params/hide-details.injectable"; import hideDetailsInjectable from "../kube-detail-params/hide-details.injectable";
// TODO: Make tooltips free of side effects by making it deterministic // TODO: Make tooltips free of side effects by making it deterministic
jest.mock("../tooltip"); jest.mock("../tooltip/tooltip");
jest.mock("../tooltip/withTooltip", () => ({
withTooltip: (target: any) => target,
}));
class SomeTestExtension extends LensRendererExtension { class SomeTestExtension extends LensRendererExtension {
constructor( constructor(

View File

@ -104,18 +104,14 @@ const NonInjectedKubeObjectMeta = observer(({
{ownerRefs?.length > 0 && ( {ownerRefs?.length > 0 && (
<DrawerItem name="Controlled By" hidden={isHidden("ownerReferences")}> <DrawerItem name="Controlled By" hidden={isHidden("ownerReferences")}>
{ {
ownerRefs.map(ref => { ownerRefs.map(ref => (
const { name, kind } = ref; <p key={ref.name}>
const ownerDetailsUrl = getDetailsUrl(apiManager.lookupApiLink(ref, object)); {`${ref.kind} `}
<Link to={getDetailsUrl(apiManager.lookupApiLink(ref, object))}>
return ( {ref.name}
<p key={name}> </Link>
{kind} </p>
{" "} ))
<Link to={ownerDetailsUrl}>{name}</Link>
</p>
);
})
} }
</DrawerItem> </DrawerItem>
)} )}

View File

@ -164,6 +164,7 @@ class NonInjectedSelect<
value = null, value = null,
options, options,
isMulti, isMulti,
id: inputId,
onChange, onChange,
...props ...props
} = this.props; } = this.props;
@ -192,6 +193,7 @@ class NonInjectedSelect<
}), }),
...styles, ...styles,
}} }}
inputId={inputId}
filterOption={defaultFilter} // This is done because the default filter crashes on symbols filterOption={defaultFilter} // This is done because the default filter crashes on symbols
isMulti={isMulti} isMulti={isMulti}
options={convertedOptions} options={convertedOptions}

View File

@ -9,11 +9,12 @@ import React from "react";
import { cssNames } from "../../utils"; import { cssNames } from "../../utils";
import { withTooltip } from "../tooltip"; import { withTooltip } from "../tooltip";
export interface StatusBrickProps extends React.HTMLAttributes<any> { export interface StatusBrickProps extends React.HTMLAttributes<HTMLDivElement> {
} }
export const StatusBrick = withTooltip(({ className, ...elemProps }: StatusBrickProps) => ( export const StatusBrick = withTooltip(({ className, ...elemProps }: StatusBrickProps) => (
<div <div
className={cssNames("StatusBrick", className)} className={cssNames("StatusBrick", className)}
{...elemProps} /> {...elemProps}
/>
)); ));

View File

@ -2,23 +2,48 @@
* Copyright (c) OpenLens Authors. All rights reserved. * Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import type { SetRequired } from "type-fest"; import type { Mutable, SetRequired } from "type-fest";
import catalogCategoryRegistryInjectable from "../../../common/catalog/category-registry.injectable";
import fileSystemProvisionerStoreInjectable from "../../../extensions/extension-loader/file-system-provisioner-store/file-system-provisioner-store.injectable";
import { lensExtensionDependencies } from "../../../extensions/lens-extension";
import { LensRendererExtension } from "../../../extensions/lens-renderer-extension"; import { LensRendererExtension } from "../../../extensions/lens-renderer-extension";
import catalogEntityRegistryInjectable from "../../api/catalog/entity/registry.injectable";
import getExtensionPageParametersInjectable from "../../routes/get-extension-page-parameters.injectable";
import navigateToRouteInjectable from "../../routes/navigate-to-route.injectable";
import routesInjectable from "../../routes/routes.injectable";
import type { ApplicationBuilder } from "./get-application-builder";
export class TestExtension extends LensRendererExtension {} export class TestExtension extends LensRendererExtension {}
export const getRendererExtensionFake = ({ id, ...rest }: SetRequired<Partial<LensRendererExtension>, "id">) => { export type FakeExtensionData = SetRequired<Partial<LensRendererExtension>, "id" | "name">;
const instance = new TestExtension({
id,
absolutePath: "irrelevant",
isBundled: false,
isCompatible: false,
isEnabled: false,
manifest: { name: id, version: "some-version" },
manifestPath: "irrelevant",
});
Object.assign(instance, rest); export const getRendererExtensionFakeFor = (builder: ApplicationBuilder) => (
function getRendererExtensionFake({ id, name, ...rest }: FakeExtensionData) {
const instance = new TestExtension({
id,
absolutePath: "irrelevant",
isBundled: false,
isCompatible: false,
isEnabled: false,
manifest: {
name,
version: "1.0.0",
},
manifestPath: "irrelevant",
});
Object.assign(instance, rest);
(instance as Mutable<LensRendererExtension>)[lensExtensionDependencies] = {
categoryRegistry: builder.dis.rendererDi.inject(catalogCategoryRegistryInjectable),
entityRegistry: builder.dis.rendererDi.inject(catalogEntityRegistryInjectable),
fileSystemProvisionerStore: builder.dis.rendererDi.inject(fileSystemProvisionerStoreInjectable),
getExtensionPageParameters: builder.dis.rendererDi.inject(getExtensionPageParametersInjectable),
navigateToRoute: builder.dis.rendererDi.inject(navigateToRouteInjectable),
routes: builder.dis.rendererDi.inject(routesInjectable),
};
return instance;
}
);
return instance;
};

View File

@ -7,7 +7,6 @@
import type { ReactNode } from "react"; import type { ReactNode } from "react";
import React, { useState } from "react"; import React, { useState } from "react";
import hoistNonReactStatics from "hoist-non-react-statics";
import type { TooltipProps } from "./tooltip"; import type { TooltipProps } from "./tooltip";
import { Tooltip } from "./tooltip"; import { Tooltip } from "./tooltip";
import { isReactNode } from "../../utils/isReactNode"; import { isReactNode } from "../../utils/isReactNode";
@ -21,11 +20,15 @@ export interface TooltipDecoratorProps {
* useful for displaying tooltips even when the target is "disabled" * useful for displaying tooltips even when the target is "disabled"
*/ */
tooltipOverrideDisabled?: boolean; tooltipOverrideDisabled?: boolean;
id?: string | undefined; id?: string;
children?: SingleOrMany<React.ReactNode>; children?: SingleOrMany<React.ReactNode>;
} }
export function withTooltip<TargetProps extends Pick<TooltipDecoratorProps, "id" | "children">>(Target: React.FunctionComponent<TargetProps>): React.FunctionComponent<TargetProps & TooltipDecoratorProps> { export function withTooltip<TargetProps>(
Target: TargetProps extends Pick<TooltipDecoratorProps, "id" | "children">
? React.FunctionComponent<TargetProps>
: never,
): React.FunctionComponent<TargetProps & TooltipDecoratorProps> {
const DecoratedComponent = (props: TargetProps & TooltipDecoratorProps) => { const DecoratedComponent = (props: TargetProps & TooltipDecoratorProps) => {
// TODO: Remove side-effect to allow deterministic unit testing // TODO: Remove side-effect to allow deterministic unit testing
const [defaultTooltipId] = useState(uniqueId("tooltip_target_")); const [defaultTooltipId] = useState(uniqueId("tooltip_target_"));
@ -62,7 +65,7 @@ export function withTooltip<TargetProps extends Pick<TooltipDecoratorProps, "id"
} }
return ( return (
<Target id={targetId} {...targetProps as TargetProps}> <Target id={targetId} {...targetProps as any}>
{targetChildren} {targetChildren}
</Target> </Target>
); );
@ -70,5 +73,5 @@ export function withTooltip<TargetProps extends Pick<TooltipDecoratorProps, "id"
DecoratedComponent.displayName = `withTooltip(${Target.displayName || Target.name})`; DecoratedComponent.displayName = `withTooltip(${Target.displayName || Target.name})`;
return hoistNonReactStatics(DecoratedComponent, Target); return DecoratedComponent;
} }

View File

@ -27,8 +27,8 @@ export function cssNames(...classNames: IClassName[]): string {
} }
} }
return iter.pipeline(classNamesEnabled) return iter.pipeline(classNamesEnabled.entries())
.filter(([, isActive]) => !!isActive) .filter(([, isActive]) => !!isActive)
.map(([className]) => className.trim()) .filterMap(([className]) => className.trim())
.join(" "); .join(" ");
} }