mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
fix navigation-to-proxy-preferences.test.ts
- Fix other type errors too Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
230e28d53c
commit
06cfc3e96b
@ -10,6 +10,7 @@ import currentPathInjectable from "../renderer/routes/current-path.injectable";
|
|||||||
import type { LensRendererExtension } from "../extensions/lens-renderer-extension";
|
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;
|
||||||
@ -49,7 +50,7 @@ describe("extension special characters in page registrations", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
const extensionWithPagesHavingSpecialCharacters: Partial<LensRendererExtension> = {
|
const extensionWithPagesHavingSpecialCharacters: SetRequired<Partial<LensRendererExtension>, "id"> = {
|
||||||
id: "@some-extension-id/",
|
id: "@some-extension-id/",
|
||||||
|
|
||||||
globalPages: [
|
globalPages: [
|
||||||
|
|||||||
@ -13,6 +13,7 @@ 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 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;
|
||||||
@ -125,7 +126,7 @@ describe("navigate to extension page", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
const extensionWithPagesHavingParameters: Partial<LensRendererExtension> = {
|
const extensionWithPagesHavingParameters: SetRequired<Partial<LensRendererExtension>, "id"> = {
|
||||||
id: "some-extension-id",
|
id: "some-extension-id",
|
||||||
|
|
||||||
globalPages: [
|
globalPages: [
|
||||||
|
|||||||
@ -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"
|
||||||
@ -270,16 +270,11 @@ exports[`preferences - navigation to proxy preferences given in preferences, whe
|
|||||||
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>
|
||||||
file or in the input below.
|
file or in the input below.
|
||||||
</p>
|
</p>
|
||||||
<div
|
<div
|
||||||
class="Input theme round black disabled invalid"
|
class="Input theme round black disabled invalid"
|
||||||
@ -309,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"
|
||||||
@ -330,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"
|
||||||
@ -415,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"
|
||||||
@ -636,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"
|
||||||
@ -672,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"
|
||||||
@ -688,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>
|
||||||
|
|||||||
@ -59,6 +59,10 @@ export class Iterator<T> {
|
|||||||
|
|
||||||
return this as never;
|
return this as never;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public join(sep?: string): string {
|
||||||
|
return join(this.#inner, sep);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -108,6 +108,7 @@ export class CustomResourceDefinitions extends React.Component {
|
|||||||
<>
|
<>
|
||||||
{filters}
|
{filters}
|
||||||
<Select
|
<Select
|
||||||
|
id="crd-input"
|
||||||
className="group-select"
|
className="group-select"
|
||||||
placeholder={this.getPlaceholder()}
|
placeholder={this.getPlaceholder()}
|
||||||
options={this.groupSelectOptions}
|
options={this.groupSelectOptions}
|
||||||
|
|||||||
@ -83,6 +83,7 @@ class NonInjectedReleaseRollbackDialog extends React.Component<ReleaseRollbackDi
|
|||||||
<div className="flex gaps align-center">
|
<div className="flex gaps align-center">
|
||||||
<b>Revision</b>
|
<b>Revision</b>
|
||||||
<Select
|
<Select
|
||||||
|
id="revision-input"
|
||||||
themeName="light"
|
themeName="light"
|
||||||
value={revision}
|
value={revision}
|
||||||
options={this.revisionOptions.get()}
|
options={this.revisionOptions.get()}
|
||||||
|
|||||||
@ -77,6 +77,7 @@ const NonInjectedApplication: React.FC<Dependencies> = ({ appPreferenceItems, us
|
|||||||
<section id="appearance">
|
<section id="appearance">
|
||||||
<SubTitle title="Theme" />
|
<SubTitle title="Theme" />
|
||||||
<Select
|
<Select
|
||||||
|
id="theme-input"
|
||||||
options={themeOptions}
|
options={themeOptions}
|
||||||
value={userStore.colorTheme}
|
value={userStore.colorTheme}
|
||||||
onChange={value => userStore.colorTheme = value?.value ?? defaultThemeId}
|
onChange={value => userStore.colorTheme = value?.value ?? defaultThemeId}
|
||||||
@ -89,6 +90,7 @@ const NonInjectedApplication: React.FC<Dependencies> = ({ appPreferenceItems, us
|
|||||||
<section id="extensionRegistryUrl">
|
<section id="extensionRegistryUrl">
|
||||||
<SubTitle title="Extension Install Registry" />
|
<SubTitle title="Extension Install Registry" />
|
||||||
<Select
|
<Select
|
||||||
|
id="extension-install-registry-input"
|
||||||
options={extensionInstallRegistryOptions}
|
options={extensionInstallRegistryOptions}
|
||||||
value={userStore.extensionRegistryUrl.location}
|
value={userStore.extensionRegistryUrl.location}
|
||||||
onChange={value => runInAction(() => {
|
onChange={value => runInAction(() => {
|
||||||
@ -140,6 +142,7 @@ const NonInjectedApplication: React.FC<Dependencies> = ({ appPreferenceItems, us
|
|||||||
<section id="update-channel">
|
<section id="update-channel">
|
||||||
<SubTitle title="Update Channel" />
|
<SubTitle title="Update Channel" />
|
||||||
<Select
|
<Select
|
||||||
|
id="update-channel-input"
|
||||||
options={updateChannelOptions}
|
options={updateChannelOptions}
|
||||||
value={userStore.updateChannel}
|
value={userStore.updateChannel}
|
||||||
onChange={value => userStore.updateChannel = value?.value ?? defaultUpdateChannel}
|
onChange={value => userStore.updateChannel = value?.value ?? defaultUpdateChannel}
|
||||||
@ -152,6 +155,7 @@ const NonInjectedApplication: React.FC<Dependencies> = ({ appPreferenceItems, us
|
|||||||
<section id="locale">
|
<section id="locale">
|
||||||
<SubTitle title="Locale Timezone" />
|
<SubTitle title="Locale Timezone" />
|
||||||
<Select
|
<Select
|
||||||
|
id="timezone-input"
|
||||||
options={timezoneOptions}
|
options={timezoneOptions}
|
||||||
value={userStore.localeTimezone}
|
value={userStore.localeTimezone}
|
||||||
onChange={value => userStore.localeTimezone = value?.value ?? defaultLocaleTimezone}
|
onChange={value => userStore.localeTimezone = value?.value ?? defaultLocaleTimezone}
|
||||||
|
|||||||
@ -57,6 +57,7 @@ const NonInjectedEditor = observer(({ userStore }: Dependencies) => {
|
|||||||
<div className="flex gaps align-center">
|
<div className="flex gaps align-center">
|
||||||
<SubHeader compact>Position</SubHeader>
|
<SubHeader compact>Position</SubHeader>
|
||||||
<Select
|
<Select
|
||||||
|
id="minimap-input"
|
||||||
themeName="lens"
|
themeName="lens"
|
||||||
options={minimapPositionOptions}
|
options={minimapPositionOptions}
|
||||||
value={editorConfiguration.minimap.side}
|
value={editorConfiguration.minimap.side}
|
||||||
@ -69,6 +70,7 @@ const NonInjectedEditor = observer(({ userStore }: Dependencies) => {
|
|||||||
<section>
|
<section>
|
||||||
<SubTitle title="Line numbers"/>
|
<SubTitle title="Line numbers"/>
|
||||||
<Select
|
<Select
|
||||||
|
id="editor-line-numbers-input"
|
||||||
options={lineNumberOptions}
|
options={lineNumberOptions}
|
||||||
value={editorConfiguration.lineNumbers}
|
value={editorConfiguration.lineNumbers}
|
||||||
onChange={option => editorConfiguration.lineNumbers = option?.value ?? defaultEditorConfig.lineNumbers}
|
onChange={option => editorConfiguration.lineNumbers = option?.value ?? defaultEditorConfig.lineNumbers}
|
||||||
|
|||||||
@ -56,6 +56,7 @@ const NonInjectedKubectlBinaries= observer(({
|
|||||||
<section>
|
<section>
|
||||||
<SubTitle title="Download mirror" />
|
<SubTitle title="Download mirror" />
|
||||||
<Select
|
<Select
|
||||||
|
id="download-mirror-input"
|
||||||
placeholder="Download mirror for kubectl"
|
placeholder="Download mirror for kubectl"
|
||||||
options={downloadMirrorOptions}
|
options={downloadMirrorOptions}
|
||||||
value={userStore.downloadMirror}
|
value={userStore.downloadMirror}
|
||||||
|
|||||||
@ -67,6 +67,7 @@ const NonInjectedTerminal = observer(({
|
|||||||
<section id="terminalTheme">
|
<section id="terminalTheme">
|
||||||
<SubTitle title="Terminal theme" />
|
<SubTitle title="Terminal theme" />
|
||||||
<Select
|
<Select
|
||||||
|
id="terminal-theme-input"
|
||||||
themeName="lens"
|
themeName="lens"
|
||||||
options={themeOptions}
|
options={themeOptions}
|
||||||
value={userStore.terminalTheme}
|
value={userStore.terminalTheme}
|
||||||
|
|||||||
@ -21,9 +21,10 @@ import { setEntityOnRouteMatch } from "../../api/helpers/general-active-sync";
|
|||||||
import { navigation } from "../../navigation";
|
import { navigation } from "../../navigation";
|
||||||
import welcomeRouteInjectable from "../../../common/front-end-routing/routes/welcome/welcome-route.injectable";
|
import welcomeRouteInjectable from "../../../common/front-end-routing/routes/welcome/welcome-route.injectable";
|
||||||
import { buildURL } from "../../../common/utils/buildUrl";
|
import { buildURL } from "../../../common/utils/buildUrl";
|
||||||
|
import type { StorageLayer } from "../../utils";
|
||||||
|
|
||||||
interface Dependencies {
|
interface Dependencies {
|
||||||
catalogPreviousActiveTabStorage: { get: () => string };
|
catalogPreviousActiveTabStorage: StorageLayer<string | null>;
|
||||||
currentRouteComponent: IComputedValue<React.ElementType | undefined>;
|
currentRouteComponent: IComputedValue<React.ElementType | undefined>;
|
||||||
welcomeUrl: string;
|
welcomeUrl: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -42,7 +42,7 @@ export interface SelectProps<
|
|||||||
IsMulti extends boolean,
|
IsMulti extends boolean,
|
||||||
Group extends GroupBase<Option> = GroupBase<Option>,
|
Group extends GroupBase<Option> = GroupBase<Option>,
|
||||||
> extends SetRequired<Omit<ReactSelectProps<Option, IsMulti, Group>, "value">, "options"> {
|
> extends SetRequired<Omit<ReactSelectProps<Option, IsMulti, Group>, "value">, "options"> {
|
||||||
id?: string; // Optional only because of Extension API. Required to make Select deterministic in unit tests
|
id: string; // Optional only because of Extension API. Required to make Select deterministic in unit tests
|
||||||
themeName?: "dark" | "light" | "outlined" | "lens";
|
themeName?: "dark" | "light" | "outlined" | "lens";
|
||||||
menuClass?: string;
|
menuClass?: string;
|
||||||
value?: PropsValue<Value>;
|
value?: PropsValue<Value>;
|
||||||
|
|||||||
@ -3,29 +3,31 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Helper for combining css classes inside components
|
import { iter } from "../../common/utils";
|
||||||
|
|
||||||
export type IgnoredClassNames = number | symbol | Function;
|
export type IgnoredClassNames = number | symbol | Function;
|
||||||
|
|
||||||
export type IClassName = string | string[] | IClassNameMap | undefined | null | false | IgnoredClassNames;
|
export type IClassName = string | string[] | IClassNameMap | undefined | null | false | IgnoredClassNames;
|
||||||
export type IClassNameMap = Record<string, unknown>;
|
export type IClassNameMap = object;
|
||||||
|
|
||||||
export function cssNames(...classNames: IClassName[]): string {
|
export function cssNames(...classNames: IClassName[]): string {
|
||||||
const classNamesEnabled: IClassNameMap = {};
|
const classNamesEnabled = new Map<string, boolean>();
|
||||||
|
|
||||||
for (const className of classNames) {
|
for (const className of classNames) {
|
||||||
if (typeof className === "string") {
|
if (typeof className === "string") {
|
||||||
classNamesEnabled[className] = true;
|
classNamesEnabled.set(className, true);
|
||||||
} else if (Array.isArray(className)) {
|
} else if (Array.isArray(className)) {
|
||||||
for (const name of className) {
|
for (const name of className) {
|
||||||
classNamesEnabled[name] = true;
|
classNamesEnabled.set(name, true);
|
||||||
}
|
}
|
||||||
} else if (className && typeof className === "object") {
|
} else if (className && typeof className === "object") {
|
||||||
Object.assign(classNamesEnabled, className);
|
for (const [name, value] of Object.entries(className)) {
|
||||||
|
classNamesEnabled.set(name, Boolean(value));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Object.entries(classNamesEnabled)
|
return iter.pipeline(classNamesEnabled)
|
||||||
.filter(([, isActive]) => !!isActive)
|
.filter(([, isActive]) => !!isActive)
|
||||||
.map(([className]) => className.trim())
|
.map(([className]) => className.trim())
|
||||||
.join(" ");
|
.join(" ");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user