mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Remove unnecessary code style changes
Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
19 files changed
+88
-203
No files matched your search
@@ -13,7 +13,6 @@ import { observer } from "mobx-react";
|
||||
import path from "path";
|
||||
import React from "react";
|
||||
import * as uuid from "uuid";
|
||||
|
||||
import { appEventBus } from "../../../common/app-event-bus/event-bus";
|
||||
import { loadConfigFromString, splitConfig } from "../../../common/kube-helpers";
|
||||
import { docsUrl } from "../../../common/vars";
|
||||
@@ -24,9 +23,7 @@ import { SettingLayout } from "../layout/setting-layout";
|
||||
import { MonacoEditor } from "../monaco-editor";
|
||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||
import getCustomKubeConfigDirectoryInjectable from "../../../common/app-paths/get-custom-kube-config-directory/get-custom-kube-config-directory.injectable";
|
||||
import navigateToCatalogInjectable, {
|
||||
NavigateToCatalog,
|
||||
} from "../../../common/front-end-routing/routes/catalog/navigate-to-catalog.injectable";
|
||||
import navigateToCatalogInjectable, { NavigateToCatalog } from "../../../common/front-end-routing/routes/catalog/navigate-to-catalog.injectable";
|
||||
|
||||
interface Option {
|
||||
config: KubeConfig;
|
||||
|
||||
@@ -15,19 +15,15 @@ import type { CatalogEntityStore } from "./catalog-entity-store/catalog-entity.s
|
||||
import { getDiForUnitTesting } from "../../getDiForUnitTesting";
|
||||
import type { DiContainer } from "@ogre-tools/injectable";
|
||||
import catalogEntityStoreInjectable from "./catalog-entity-store/catalog-entity-store.injectable";
|
||||
import catalogEntityRegistryInjectable
|
||||
from "../../api/catalog-entity-registry/catalog-entity-registry.injectable";
|
||||
import catalogEntityRegistryInjectable from "../../api/catalog-entity-registry/catalog-entity-registry.injectable";
|
||||
import type { DiRender } from "../test-utils/renderFor";
|
||||
import { renderFor } from "../test-utils/renderFor";
|
||||
import { ThemeStore } from "../../theme.store";
|
||||
import { UserStore } from "../../../common/user-store";
|
||||
import mockFs from "mock-fs";
|
||||
import directoryForUserDataInjectable
|
||||
from "../../../common/app-paths/directory-for-user-data/directory-for-user-data.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 directoryForUserDataInjectable from "../../../common/app-paths/directory-for-user-data/directory-for-user-data.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 type { AppEvent } from "../../../common/app-event-bus/event-bus";
|
||||
import appEventBusInjectable from "../../../common/app-event-bus/app-event-bus.injectable";
|
||||
|
||||
|
||||
@@ -8,16 +8,7 @@ import styles from "./catalog.module.scss";
|
||||
import React from "react";
|
||||
import { disposeOnUnmount, observer } from "mobx-react";
|
||||
import { ItemListLayout } from "../item-object-list";
|
||||
import {
|
||||
action,
|
||||
computed,
|
||||
IComputedValue,
|
||||
makeObservable,
|
||||
observable,
|
||||
reaction,
|
||||
runInAction,
|
||||
when,
|
||||
} from "mobx";
|
||||
import { action, computed, IComputedValue, makeObservable, observable, reaction, runInAction, when } from "mobx";
|
||||
import type { CatalogEntityStore } from "./catalog-entity-store/catalog-entity.store";
|
||||
import { navigate } from "../../navigation";
|
||||
import { MenuItem, MenuActions } from "../menu";
|
||||
@@ -43,9 +34,7 @@ import getCategoryColumnsInjectable from "./get-category-columns.injectable";
|
||||
import type { RegisteredCustomCategoryViewDecl } from "./custom-views.injectable";
|
||||
import customCategoryViewsInjectable from "./custom-views.injectable";
|
||||
import type { CustomCategoryViewComponents } from "./custom-views";
|
||||
import navigateToCatalogInjectable, {
|
||||
NavigateToCatalog,
|
||||
} from "../../../common/front-end-routing/routes/catalog/navigate-to-catalog.injectable";
|
||||
import navigateToCatalogInjectable, { NavigateToCatalog } from "../../../common/front-end-routing/routes/catalog/navigate-to-catalog.injectable";
|
||||
import catalogRouteParametersInjectable from "./catalog-route-parameters.injectable";
|
||||
import { browseCatalogTab } from "./catalog-browse-tab";
|
||||
import type { AppEvent } from "../../../common/app-event-bus/event-bus";
|
||||
|
||||
@@ -56,11 +56,7 @@ class NonInjectedEntitySettings extends React.Component<Dependencies> {
|
||||
get menuItems() {
|
||||
if (!this.entity) return [];
|
||||
|
||||
return EntitySettingRegistry.getInstance().getItemsForKind(
|
||||
this.entity.kind,
|
||||
this.entity.apiVersion,
|
||||
this.entity.metadata.source,
|
||||
);
|
||||
return EntitySettingRegistry.getInstance().getItemsForKind(this.entity.kind, this.entity.apiVersion, this.entity.metadata.source);
|
||||
}
|
||||
|
||||
get activeSetting() {
|
||||
@@ -74,9 +70,7 @@ class NonInjectedEntitySettings extends React.Component<Dependencies> {
|
||||
};
|
||||
|
||||
renderNavigation() {
|
||||
const groups = Object.entries(
|
||||
groupBy(this.menuItems, (item) => item.group || "Extensions"),
|
||||
);
|
||||
const groups = Object.entries(groupBy(this.menuItems, (item) => item.group || "Extensions"));
|
||||
|
||||
groups.sort((a, b) => {
|
||||
if (a[0] === "Settings") return -1;
|
||||
@@ -90,26 +84,21 @@ class NonInjectedEntitySettings extends React.Component<Dependencies> {
|
||||
<div className="flex items-center pb-8">
|
||||
<Avatar
|
||||
title={this.entity.getName()}
|
||||
colorHash={`${this.entity.getName()}-${
|
||||
this.entity.metadata.source
|
||||
}`}
|
||||
colorHash={`${this.entity.getName()}-${this.entity.metadata.source}`}
|
||||
src={this.entity.spec.icon?.src}
|
||||
className={styles.settingsAvatar}
|
||||
size={40}
|
||||
/>
|
||||
<div className={styles.entityName}>{this.entity.getName()}</div>
|
||||
<div className={styles.entityName}>
|
||||
{this.entity.getName()}
|
||||
</div>
|
||||
</div>
|
||||
<Tabs
|
||||
className="flex column"
|
||||
scrollable={false}
|
||||
onChange={this.onTabChange}
|
||||
value={this.activeTab}
|
||||
>
|
||||
{groups.map((group, groupIndex) => (
|
||||
<Tabs className="flex column" scrollable={false} onChange={this.onTabChange} value={this.activeTab}>
|
||||
{ groups.map((group, groupIndex) => (
|
||||
<React.Fragment key={`group-${groupIndex}`}>
|
||||
<hr />
|
||||
<hr/>
|
||||
<div className="header">{group[0]}</div>
|
||||
{group[1].map((setting, index) => (
|
||||
{ group[1].map((setting, index) => (
|
||||
<Tab
|
||||
key={index}
|
||||
value={setting.id}
|
||||
@@ -134,20 +123,20 @@ class NonInjectedEntitySettings extends React.Component<Dependencies> {
|
||||
const { activeSetting } = this;
|
||||
|
||||
return (
|
||||
<SettingLayout navigation={this.renderNavigation()} contentGaps={false}>
|
||||
{activeSetting && (
|
||||
<section>
|
||||
<h2 data-testid={`${activeSetting.id}-header`}>
|
||||
{activeSetting.title}
|
||||
</h2>
|
||||
<SettingLayout
|
||||
navigation={this.renderNavigation()}
|
||||
contentGaps={false}
|
||||
>
|
||||
{
|
||||
activeSetting && (
|
||||
<section>
|
||||
<activeSetting.components.View
|
||||
entity={this.entity}
|
||||
key={activeSetting.title}
|
||||
/>
|
||||
<h2 data-testid={`${activeSetting.id}-header`}>{activeSetting.title}</h2>
|
||||
<section>
|
||||
<activeSetting.components.View entity={this.entity} key={activeSetting.title} />
|
||||
</section>
|
||||
</section>
|
||||
</section>
|
||||
)}
|
||||
)
|
||||
}
|
||||
</SettingLayout>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ import { PortForwardDetails } from "./port-forward-details";
|
||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||
import portForwardStoreInjectable from "../../port-forward/port-forward-store/port-forward-store.injectable";
|
||||
import { SiblingsInTabLayout } from "../layout/siblings-in-tab-layout";
|
||||
|
||||
import { computed, IComputedValue, makeObservable } from "mobx";
|
||||
import portForwardsRouteParametersInjectable from "./port-forwards-route-parameters.injectable";
|
||||
import navigateToPortForwardsInjectable, { NavigateToPortForwards } from "../../../common/front-end-routing/routes/cluster/network/port-forwards/navigate-to-port-forwards.injectable";
|
||||
|
||||
@@ -18,8 +18,7 @@ import { IComputedValue, reaction } from "mobx";
|
||||
import currentRouteComponentInjectable from "../../routes/current-route-component.injectable";
|
||||
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 welcomeRouteInjectable from "../../../common/front-end-routing/routes/welcome/welcome-route.injectable";
|
||||
import { buildURL } from "../../../common/utils/buildUrl";
|
||||
|
||||
interface Dependencies {
|
||||
|
||||
@@ -14,9 +14,7 @@ import { ClusterStore } from "../../../common/cluster-store/cluster-store";
|
||||
import { catalogEntityRegistry } from "../../api/catalog-entity-registry";
|
||||
import { requestClusterActivation } from "../../ipc";
|
||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||
import navigateToCatalogInjectable, {
|
||||
NavigateToCatalog,
|
||||
} from "../../../common/front-end-routing/routes/catalog/navigate-to-catalog.injectable";
|
||||
import navigateToCatalogInjectable, { NavigateToCatalog } from "../../../common/front-end-routing/routes/catalog/navigate-to-catalog.injectable";
|
||||
import clusterViewRouteParametersInjectable from "./cluster-view-route-parameters.injectable";
|
||||
|
||||
interface Dependencies {
|
||||
|
||||
@@ -6,11 +6,7 @@
|
||||
import React from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import { Select } from "../select";
|
||||
|
||||
import hotbarStoreInjectable, {
|
||||
HotbarStore,
|
||||
} from "../../../common/hotbar-store.injectable";
|
||||
|
||||
import hotbarStoreInjectable, { HotbarStore } from "../../../common/hotbar-store.injectable";
|
||||
import type { CommandOverlay } from "../command-palette";
|
||||
import { HotbarAddCommand } from "./hotbar-add-command";
|
||||
import { HotbarRemoveCommand } from "./hotbar-remove-command";
|
||||
|
||||
@@ -24,13 +24,9 @@ import clusterFrameContextInjectable from "../../cluster-frame-context/cluster-f
|
||||
import kubeWatchApiInjectable from "../../kube-watch-api/kube-watch-api.injectable";
|
||||
import type { KubeWatchSubscribeStoreOptions } from "../../kube-watch-api/kube-watch-api";
|
||||
|
||||
type ItemListLayoutPropsWithoutGetItems<K extends KubeObject> = Omit<
|
||||
ItemListLayoutProps<K>,
|
||||
"getItems"
|
||||
>;
|
||||
type ItemListLayoutPropsWithoutGetItems<K extends KubeObject> = Omit<ItemListLayoutProps<K>, "getItems">;
|
||||
|
||||
export interface KubeObjectListLayoutProps<K extends KubeObject>
|
||||
extends ItemListLayoutPropsWithoutGetItems<K> {
|
||||
export interface KubeObjectListLayoutProps<K extends KubeObject> extends ItemListLayoutPropsWithoutGetItems<K> {
|
||||
items?: K[];
|
||||
getItems?: () => K[];
|
||||
store: KubeObjectStore<K>;
|
||||
@@ -45,10 +41,7 @@ const defaultProps: Partial<KubeObjectListLayoutProps<KubeObject>> = {
|
||||
|
||||
interface Dependencies {
|
||||
clusterFrameContext: ClusterFrameContext;
|
||||
subscribeToStores: (
|
||||
stores: KubeObjectStore<KubeObject>[],
|
||||
options: KubeWatchSubscribeStoreOptions
|
||||
) => Disposer;
|
||||
subscribeToStores: (stores: KubeObjectStore<KubeObject>[], options: KubeWatchSubscribeStoreOptions) => Disposer;
|
||||
}
|
||||
|
||||
@observer
|
||||
@@ -70,12 +63,10 @@ class NonInjectedKubeObjectListLayout<K extends KubeObject> extends React.Compon
|
||||
const { store, dependentStores = [], subscribeStores } = this.props;
|
||||
const stores = Array.from(new Set([store, ...dependentStores]));
|
||||
const reactions: Disposer[] = [
|
||||
reaction(
|
||||
() => this.props.clusterFrameContext.contextNamespaces.slice(),
|
||||
() => {
|
||||
// clear load errors
|
||||
this.loadErrors.length = 0;
|
||||
}),
|
||||
reaction(() => this.props.clusterFrameContext.contextNamespaces.slice(), () => {
|
||||
// clear load errors
|
||||
this.loadErrors.length = 0;
|
||||
}),
|
||||
];
|
||||
|
||||
if (subscribeStores) {
|
||||
@@ -111,10 +102,8 @@ class NonInjectedKubeObjectListLayout<K extends KubeObject> extends React.Compon
|
||||
}
|
||||
|
||||
render() {
|
||||
const { className, customizeHeader, store, items, ...layoutProps } =
|
||||
this.props;
|
||||
const placeholderString =
|
||||
ResourceNames[ResourceKindMap[store.api.kind]] || store.api.kind;
|
||||
const { className, customizeHeader, store, items, ...layoutProps } = this.props;
|
||||
const placeholderString = ResourceNames[ResourceKindMap[store.api.kind]] || store.api.kind;
|
||||
|
||||
return (
|
||||
<ItemListLayout
|
||||
@@ -152,10 +141,7 @@ class NonInjectedKubeObjectListLayout<K extends KubeObject> extends React.Compon
|
||||
}
|
||||
}
|
||||
|
||||
const InjectedKubeObjectListLayout = withInjectables<
|
||||
Dependencies,
|
||||
KubeObjectListLayoutProps<KubeObject>
|
||||
>(NonInjectedKubeObjectListLayout, {
|
||||
const InjectedKubeObjectListLayout = withInjectables<Dependencies, KubeObjectListLayoutProps<KubeObject>>(NonInjectedKubeObjectListLayout, {
|
||||
getProps: (di, props) => ({
|
||||
clusterFrameContext: di.inject(clusterFrameContextInjectable),
|
||||
subscribeToStores: di.inject(kubeWatchApiInjectable).subscribeStores,
|
||||
|
||||
@@ -11,15 +11,12 @@ import { getDiForUnitTesting } from "../../getDiForUnitTesting";
|
||||
import type { DiContainer } from "@ogre-tools/injectable";
|
||||
import { DiRender, renderFor } from "../test-utils/renderFor";
|
||||
import mockFs from "mock-fs";
|
||||
import directoryForUserDataInjectable
|
||||
from "../../../common/app-paths/directory-for-user-data/directory-for-user-data.injectable";
|
||||
import directoryForUserDataInjectable from "../../../common/app-paths/directory-for-user-data/directory-for-user-data.injectable";
|
||||
import rendererExtensionsInjectable from "../../../extensions/renderer-extensions.injectable";
|
||||
import { computed } from "mobx";
|
||||
import type { LensRendererExtension } from "../../../extensions/lens-renderer-extension";
|
||||
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 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";
|
||||
|
||||
jest.mock("electron", () => ({
|
||||
ipcRenderer: {
|
||||
|
||||
@@ -30,9 +30,7 @@ export interface SelectOption<T = any> {
|
||||
label?: React.ReactNode;
|
||||
}
|
||||
|
||||
export interface SelectProps<T = any>
|
||||
extends ReactSelectProps<T, boolean>,
|
||||
CreatableProps<T, boolean> {
|
||||
export interface SelectProps<T = any> extends ReactSelectProps<T, boolean>, CreatableProps<T, boolean> {
|
||||
id: string;
|
||||
value?: T;
|
||||
themeName?: "dark" | "light" | "outlined" | "lens";
|
||||
|
||||
@@ -25,6 +25,7 @@ import { StorageClassDetails } from "../components/+storage-classes";
|
||||
import { PersistentVolumeClaimDetails } from "../components/+storage-volume-claims";
|
||||
import { PersistentVolumeDetails } from "../components/+storage-volumes";
|
||||
import { ClusterRoleDetails } from "../components/+user-management/+cluster-roles";
|
||||
import { ClusterRoleBindingDetails } from "../components/+user-management/+cluster-role-bindings";
|
||||
import { RoleDetails } from "../components/+user-management/+roles";
|
||||
import { RoleBindingDetails } from "../components/+user-management/+role-bindings";
|
||||
import { ServiceAccountsDetails } from "../components/+user-management/+service-accounts";
|
||||
@@ -36,7 +37,6 @@ import { PodDetails } from "../components/+workloads-pods";
|
||||
import { ReplicaSetDetails } from "../components/+workloads-replicasets";
|
||||
import { StatefulSetDetails } from "../components/+workloads-statefulsets";
|
||||
import type { KubeObjectDetailsProps } from "../components/kube-object-details";
|
||||
import { ClusterRoleBindingDetails } from "../components/+user-management/+cluster-role-bindings";
|
||||
|
||||
export function initKubeObjectDetailRegistry() {
|
||||
KubeObjectDetailRegistry.getInstance()
|
||||
|
||||
Reference in new issue
Block a user