mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Cleaning up
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
0824121234
commit
df38165ce6
@ -24,7 +24,7 @@ import React from "react";
|
|||||||
import { AppPreferenceRegistry } from "../../../extensions/registries";
|
import { AppPreferenceRegistry } from "../../../extensions/registries";
|
||||||
import { ExtensionSettings } from "./preferences";
|
import { ExtensionSettings } from "./preferences";
|
||||||
|
|
||||||
export const Telemetry = observer(() => {
|
export const Extensions = observer(() => {
|
||||||
const extensions = AppPreferenceRegistry.getInstance().getItems();
|
const extensions = AppPreferenceRegistry.getInstance().getItems();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -47,6 +47,8 @@ import { Application } from "./application";
|
|||||||
import { Kubernetes } from "./kubernetes";
|
import { Kubernetes } from "./kubernetes";
|
||||||
import { LensProxy } from "./proxy";
|
import { LensProxy } from "./proxy";
|
||||||
import { Telemetry } from "./telemetry";
|
import { Telemetry } from "./telemetry";
|
||||||
|
import { Extensions } from "./extensions";
|
||||||
|
import { sentryDsn } from "../../../common/vars";
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
export class Preferences extends React.Component {
|
export class Preferences extends React.Component {
|
||||||
@ -58,7 +60,8 @@ export class Preferences extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderNavigation() {
|
renderNavigation() {
|
||||||
const extensions = AppPreferenceRegistry.getInstance().getItems().filter(e => !e.showInPreferencesTab);
|
const extensions = AppPreferenceRegistry.getInstance().getItems();
|
||||||
|
const telemetryExtensions = extensions.filter(e => e.showInPreferencesTab == "telemetry");
|
||||||
const currentLocation = navigation.location.pathname;
|
const currentLocation = navigation.location.pathname;
|
||||||
const isActive = (route: RouteProps) => !!matchPath(currentLocation, { path: route.path, exact: route.exact });
|
const isActive = (route: RouteProps) => !!matchPath(currentLocation, { path: route.path, exact: route.exact });
|
||||||
|
|
||||||
@ -68,8 +71,10 @@ export class Preferences extends React.Component {
|
|||||||
<Tab value={appURL()} label="Application" data-testid="application-tab" active={isActive(appRoute)}/>
|
<Tab value={appURL()} label="Application" data-testid="application-tab" active={isActive(appRoute)}/>
|
||||||
<Tab value={proxyURL()} label="Proxy" data-testid="proxy-tab" active={isActive(proxyRoute)}/>
|
<Tab value={proxyURL()} label="Proxy" data-testid="proxy-tab" active={isActive(proxyRoute)}/>
|
||||||
<Tab value={kubernetesURL()} label="Kubernetes" data-testid="kube-tab" active={isActive(kubernetesRoute)}/>
|
<Tab value={kubernetesURL()} label="Kubernetes" data-testid="kube-tab" active={isActive(kubernetesRoute)}/>
|
||||||
<Tab value={telemetryURL()} label="Telemetry" data-testid="telemetry-tab" active={isActive(telemetryRoute)}/>
|
{telemetryExtensions.length > 0 || !!sentryDsn &&
|
||||||
{extensions.length > 0 &&
|
<Tab value={telemetryURL()} label="Telemetry" data-testid="telemetry-tab" active={isActive(telemetryRoute)}/>
|
||||||
|
}
|
||||||
|
{extensions.filter(e => !e.showInPreferencesTab).length > 0 &&
|
||||||
<Tab value={extensionURL()} label="Extensions" data-testid="extensions-tab" active={isActive(extensionRoute)}/>
|
<Tab value={extensionURL()} label="Extensions" data-testid="extensions-tab" active={isActive(extensionRoute)}/>
|
||||||
}
|
}
|
||||||
</Tabs>
|
</Tabs>
|
||||||
@ -88,7 +93,7 @@ export class Preferences extends React.Component {
|
|||||||
<Route path={proxyURL()} component={LensProxy}/>
|
<Route path={proxyURL()} component={LensProxy}/>
|
||||||
<Route path={kubernetesURL()} component={Kubernetes}/>
|
<Route path={kubernetesURL()} component={Kubernetes}/>
|
||||||
<Route path={telemetryURL()} component={Telemetry}/>
|
<Route path={telemetryURL()} component={Telemetry}/>
|
||||||
<Route path={extensionURL()} component={Telemetry}/>
|
<Route path={extensionURL()} component={Extensions}/>
|
||||||
<Redirect exact from={`${preferencesURL()}/`} to={appURL()}/>
|
<Redirect exact from={`${preferencesURL()}/`} to={appURL()}/>
|
||||||
</Switch>
|
</Switch>
|
||||||
</SettingLayout>
|
</SettingLayout>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user