/** * Copyright (c) 2021 OpenLens Authors * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of * the Software, and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ import "./preferences.scss"; import { makeObservable, observable } from "mobx"; import { observer } from "mobx-react"; import React from "react"; import { matchPath, Redirect, Route, RouteProps, Switch } from "react-router"; import { appRoute, appURL, editorURL, extensionRoute, extensionURL, kubernetesRoute, kubernetesURL, preferencesURL, proxyRoute, proxyURL, editorRoute, telemetryRoute, telemetryURL, } from "../../../common/routes"; import { AppPreferenceRegistry, RegisteredAppPreference } from "../../../extensions/registries/app-preference-registry"; import { navigateWithoutHistoryChange, navigation } from "../../navigation"; import { SettingLayout } from "../layout/setting-layout"; import { SubTitle } from "../layout/sub-title"; import { Tab, Tabs } from "../tabs"; import { Application } from "./application"; import { Kubernetes } from "./kubernetes"; import { Editor } from "./editor"; import { LensProxy } from "./proxy"; import { Telemetry } from "./telemetry"; import { Extensions } from "./extensions"; import { sentryDsn } from "../../../common/vars"; @observer export class Preferences extends React.Component { @observable historyLength: number | undefined; constructor(props: {}) { super(props); makeObservable(this); } renderNavigation() { const extensions = AppPreferenceRegistry.getInstance().getItems(); const telemetryExtensions = extensions.filter(e => e.showInPreferencesTab == "telemetry"); const currentLocation = navigation.location.pathname; const isActive = (route: RouteProps) => !!matchPath(currentLocation, { path: route.path, exact: route.exact }); return ( navigateWithoutHistoryChange({ pathname: url })}>
Preferences
{telemetryExtensions.length > 0 || !!sentryDsn && } {extensions.filter(e => !e.showInPreferencesTab).length > 0 && }
); } render() { return ( ); } } export function ExtensionSettings({ title, id, components: { Hint, Input } }: RegisteredAppPreference) { return (

); }