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 { ApplicationBuilder } 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", () => {
|
||||
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/",
|
||||
|
||||
globalPages: [
|
||||
|
||||
@ -13,6 +13,7 @@ import currentPathInjectable from "../renderer/routes/current-path.injectable";
|
||||
import type { IComputedValue } from "mobx";
|
||||
import type { LensRendererExtension } from "../extensions/lens-renderer-extension";
|
||||
import { getApplicationBuilder } from "../renderer/components/test-utils/get-application-builder";
|
||||
import type { SetRequired } from "type-fest";
|
||||
|
||||
describe("navigate to extension page", () => {
|
||||
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",
|
||||
|
||||
globalPages: [
|
||||
|
||||
@ -105,7 +105,7 @@ exports[`preferences - navigation to proxy preferences given in preferences, whe
|
||||
class="SubTitle"
|
||||
>
|
||||
Theme
|
||||
|
||||
|
||||
</div>
|
||||
<div
|
||||
class="Select theme-lens css-b62m3t-container"
|
||||
@ -190,7 +190,7 @@ exports[`preferences - navigation to proxy preferences given in preferences, whe
|
||||
class="SubTitle"
|
||||
>
|
||||
Extension Install Registry
|
||||
|
||||
|
||||
</div>
|
||||
<div
|
||||
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"
|
||||
>
|
||||
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>
|
||||
.npmrc
|
||||
</b>
|
||||
file or in the input below.
|
||||
file or in the input below.
|
||||
</p>
|
||||
<div
|
||||
class="Input theme round black disabled invalid"
|
||||
@ -309,7 +304,7 @@ exports[`preferences - navigation to proxy preferences given in preferences, whe
|
||||
class="SubTitle"
|
||||
>
|
||||
Start-up
|
||||
|
||||
|
||||
</div>
|
||||
<label
|
||||
class="Switch"
|
||||
@ -330,7 +325,7 @@ exports[`preferences - navigation to proxy preferences given in preferences, whe
|
||||
class="SubTitle"
|
||||
>
|
||||
Update Channel
|
||||
|
||||
|
||||
</div>
|
||||
<div
|
||||
class="Select theme-lens css-b62m3t-container"
|
||||
@ -415,7 +410,7 @@ exports[`preferences - navigation to proxy preferences given in preferences, whe
|
||||
class="SubTitle"
|
||||
>
|
||||
Locale Timezone
|
||||
|
||||
|
||||
</div>
|
||||
<div
|
||||
class="Select theme-lens css-b62m3t-container"
|
||||
@ -636,7 +631,7 @@ exports[`preferences - navigation to proxy preferences given in preferences, whe
|
||||
class="SubTitle"
|
||||
>
|
||||
HTTP Proxy
|
||||
|
||||
|
||||
</div>
|
||||
<div
|
||||
class="Input theme round black"
|
||||
@ -672,7 +667,7 @@ exports[`preferences - navigation to proxy preferences given in preferences, whe
|
||||
class="SubTitle"
|
||||
>
|
||||
Certificate Trust
|
||||
|
||||
|
||||
</div>
|
||||
<label
|
||||
class="Switch"
|
||||
@ -688,9 +683,9 @@ exports[`preferences - navigation to proxy preferences given in preferences, whe
|
||||
class="hint"
|
||||
>
|
||||
This will make Lens to trust ANY certificate authority without any validations.
|
||||
|
||||
|
||||
Needed with some corporate proxies that do certificate re-writing.
|
||||
|
||||
|
||||
Does not affect cluster communications!
|
||||
</small>
|
||||
</section>
|
||||
|
||||
@ -59,6 +59,10 @@ export class Iterator<T> {
|
||||
|
||||
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}
|
||||
<Select
|
||||
id="crd-input"
|
||||
className="group-select"
|
||||
placeholder={this.getPlaceholder()}
|
||||
options={this.groupSelectOptions}
|
||||
|
||||
@ -83,6 +83,7 @@ class NonInjectedReleaseRollbackDialog extends React.Component<ReleaseRollbackDi
|
||||
<div className="flex gaps align-center">
|
||||
<b>Revision</b>
|
||||
<Select
|
||||
id="revision-input"
|
||||
themeName="light"
|
||||
value={revision}
|
||||
options={this.revisionOptions.get()}
|
||||
|
||||
@ -77,6 +77,7 @@ const NonInjectedApplication: React.FC<Dependencies> = ({ appPreferenceItems, us
|
||||
<section id="appearance">
|
||||
<SubTitle title="Theme" />
|
||||
<Select
|
||||
id="theme-input"
|
||||
options={themeOptions}
|
||||
value={userStore.colorTheme}
|
||||
onChange={value => userStore.colorTheme = value?.value ?? defaultThemeId}
|
||||
@ -89,6 +90,7 @@ const NonInjectedApplication: React.FC<Dependencies> = ({ appPreferenceItems, us
|
||||
<section id="extensionRegistryUrl">
|
||||
<SubTitle title="Extension Install Registry" />
|
||||
<Select
|
||||
id="extension-install-registry-input"
|
||||
options={extensionInstallRegistryOptions}
|
||||
value={userStore.extensionRegistryUrl.location}
|
||||
onChange={value => runInAction(() => {
|
||||
@ -140,6 +142,7 @@ const NonInjectedApplication: React.FC<Dependencies> = ({ appPreferenceItems, us
|
||||
<section id="update-channel">
|
||||
<SubTitle title="Update Channel" />
|
||||
<Select
|
||||
id="update-channel-input"
|
||||
options={updateChannelOptions}
|
||||
value={userStore.updateChannel}
|
||||
onChange={value => userStore.updateChannel = value?.value ?? defaultUpdateChannel}
|
||||
@ -152,6 +155,7 @@ const NonInjectedApplication: React.FC<Dependencies> = ({ appPreferenceItems, us
|
||||
<section id="locale">
|
||||
<SubTitle title="Locale Timezone" />
|
||||
<Select
|
||||
id="timezone-input"
|
||||
options={timezoneOptions}
|
||||
value={userStore.localeTimezone}
|
||||
onChange={value => userStore.localeTimezone = value?.value ?? defaultLocaleTimezone}
|
||||
|
||||
@ -57,6 +57,7 @@ const NonInjectedEditor = observer(({ userStore }: Dependencies) => {
|
||||
<div className="flex gaps align-center">
|
||||
<SubHeader compact>Position</SubHeader>
|
||||
<Select
|
||||
id="minimap-input"
|
||||
themeName="lens"
|
||||
options={minimapPositionOptions}
|
||||
value={editorConfiguration.minimap.side}
|
||||
@ -69,6 +70,7 @@ const NonInjectedEditor = observer(({ userStore }: Dependencies) => {
|
||||
<section>
|
||||
<SubTitle title="Line numbers"/>
|
||||
<Select
|
||||
id="editor-line-numbers-input"
|
||||
options={lineNumberOptions}
|
||||
value={editorConfiguration.lineNumbers}
|
||||
onChange={option => editorConfiguration.lineNumbers = option?.value ?? defaultEditorConfig.lineNumbers}
|
||||
|
||||
@ -56,6 +56,7 @@ const NonInjectedKubectlBinaries= observer(({
|
||||
<section>
|
||||
<SubTitle title="Download mirror" />
|
||||
<Select
|
||||
id="download-mirror-input"
|
||||
placeholder="Download mirror for kubectl"
|
||||
options={downloadMirrorOptions}
|
||||
value={userStore.downloadMirror}
|
||||
|
||||
@ -67,6 +67,7 @@ const NonInjectedTerminal = observer(({
|
||||
<section id="terminalTheme">
|
||||
<SubTitle title="Terminal theme" />
|
||||
<Select
|
||||
id="terminal-theme-input"
|
||||
themeName="lens"
|
||||
options={themeOptions}
|
||||
value={userStore.terminalTheme}
|
||||
|
||||
@ -21,9 +21,10 @@ import { setEntityOnRouteMatch } from "../../api/helpers/general-active-sync";
|
||||
import { navigation } from "../../navigation";
|
||||
import welcomeRouteInjectable from "../../../common/front-end-routing/routes/welcome/welcome-route.injectable";
|
||||
import { buildURL } from "../../../common/utils/buildUrl";
|
||||
import type { StorageLayer } from "../../utils";
|
||||
|
||||
interface Dependencies {
|
||||
catalogPreviousActiveTabStorage: { get: () => string };
|
||||
catalogPreviousActiveTabStorage: StorageLayer<string | null>;
|
||||
currentRouteComponent: IComputedValue<React.ElementType | undefined>;
|
||||
welcomeUrl: string;
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ export interface SelectProps<
|
||||
IsMulti extends boolean,
|
||||
Group extends GroupBase<Option> = GroupBase<Option>,
|
||||
> 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";
|
||||
menuClass?: string;
|
||||
value?: PropsValue<Value>;
|
||||
|
||||
@ -3,29 +3,31 @@
|
||||
* 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 IClassName = string | string[] | IClassNameMap | undefined | null | false | IgnoredClassNames;
|
||||
export type IClassNameMap = Record<string, unknown>;
|
||||
export type IClassNameMap = object;
|
||||
|
||||
export function cssNames(...classNames: IClassName[]): string {
|
||||
const classNamesEnabled: IClassNameMap = {};
|
||||
const classNamesEnabled = new Map<string, boolean>();
|
||||
|
||||
for (const className of classNames) {
|
||||
if (typeof className === "string") {
|
||||
classNamesEnabled[className] = true;
|
||||
classNamesEnabled.set(className, true);
|
||||
} else if (Array.isArray(className)) {
|
||||
for (const name of className) {
|
||||
classNamesEnabled[name] = true;
|
||||
classNamesEnabled.set(name, true);
|
||||
}
|
||||
} 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)
|
||||
.map(([className]) => className.trim())
|
||||
.join(" ");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user