mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
- replacing mobx.toJS()-calls to common/utils/toJS
- adding missing makeObservable(this) - fix docs Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
1 parent
575becfdaa
commit
3323c25be3
28 files changed
+108
-91
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import { autorun, toJS } from "mobx";
|
||||
import { autorun } from "mobx";
|
||||
import { toJS } from "../common/utils";
|
||||
import { broadcastMessage, subscribeToBroadcast, unsubscribeFromBroadcast } from "../common/ipc";
|
||||
import { CatalogEntityRegistry} from "../common/catalog";
|
||||
import { CatalogEntityRegistry } from "../common/catalog";
|
||||
import "../common/catalog-entities/kubernetes-cluster";
|
||||
|
||||
export class CatalogPusher {
|
||||
@@ -8,7 +9,8 @@ export class CatalogPusher {
|
||||
new CatalogPusher(catalog).init();
|
||||
}
|
||||
|
||||
private constructor(private catalog: CatalogEntityRegistry) {}
|
||||
private constructor(private catalog: CatalogEntityRegistry) {
|
||||
}
|
||||
|
||||
init() {
|
||||
const disposers: { (): void; }[] = [];
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import "../common/cluster-ipc";
|
||||
import type http from "http";
|
||||
import { ipcMain } from "electron";
|
||||
import { action, autorun, makeObservable, observable, reaction, toJS } from "mobx";
|
||||
import { action, autorun, makeObservable, observable, reaction } from "mobx";
|
||||
import { ClusterStore, getClusterIdFromHost } from "../common/cluster-store";
|
||||
import { Cluster } from "./cluster";
|
||||
import logger from "./logger";
|
||||
import { apiKubePrefix } from "../common/vars";
|
||||
import { CatalogEntity, catalogEntityRegistry, CatalogEntityData } from "../common/catalog";
|
||||
import { cloneJson, Singleton } from "../common/utils";
|
||||
import { CatalogEntity, CatalogEntityData, catalogEntityRegistry } from "../common/catalog";
|
||||
import { Singleton, toJS } from "../common/utils";
|
||||
import { KubernetesCluster } from "../common/catalog-entities/kubernetes-cluster";
|
||||
|
||||
const clusterOwnerRef = "ClusterManager";
|
||||
@@ -124,7 +124,7 @@ export class ClusterManager extends Singleton {
|
||||
}
|
||||
|
||||
protected catalogEntityFromCluster(cluster: Cluster) {
|
||||
const data: CatalogEntityData = cloneJson({
|
||||
const data: CatalogEntityData = toJS({
|
||||
apiVersion: "entity.k8slens.dev/v1alpha1",
|
||||
kind: "KubernetesCluster",
|
||||
metadata: {
|
||||
|
||||
+4
-4
@@ -15,7 +15,7 @@ import logger from "./logger";
|
||||
import { VersionDetector } from "./cluster-detectors/version-detector";
|
||||
import { detectorRegistry } from "./cluster-detectors/detector-registry";
|
||||
import plimit from "p-limit";
|
||||
import { cloneJson } from "../common/utils";
|
||||
import { toJS } from "../common/utils";
|
||||
|
||||
export enum ClusterStatus {
|
||||
AccessGranted = 2,
|
||||
@@ -241,7 +241,7 @@ export class Cluster implements ClusterModel, ClusterState {
|
||||
@computed get prometheusPreferences(): ClusterPrometheusPreferences {
|
||||
const { prometheus, prometheusProvider } = this.preferences;
|
||||
|
||||
return cloneJson({ prometheus, prometheusProvider });
|
||||
return toJS({ prometheus, prometheusProvider });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -605,7 +605,7 @@ export class Cluster implements ClusterModel, ClusterState {
|
||||
}
|
||||
|
||||
toJSON(): ClusterModel {
|
||||
return cloneJson({
|
||||
return toJS({
|
||||
id: this.id,
|
||||
contextName: this.contextName,
|
||||
kubeConfigPath: this.kubeConfigPath,
|
||||
@@ -621,7 +621,7 @@ export class Cluster implements ClusterModel, ClusterState {
|
||||
* Serializable cluster-state used for sync btw main <-> renderer
|
||||
*/
|
||||
getState(): ClusterState {
|
||||
return cloneJson({
|
||||
return toJS({
|
||||
initialized: this.initialized,
|
||||
enabled: this.enabled,
|
||||
apiUrl: this.apiUrl,
|
||||
|
||||
@@ -6,7 +6,7 @@ import { action, makeObservable, observable } from "mobx";
|
||||
import path from "path";
|
||||
import { BaseStore } from "../common/base-store";
|
||||
import { LensExtensionId } from "../extensions/lens-extension";
|
||||
import { cloneJson } from "../common/utils";
|
||||
import { toJS } from "../common/utils";
|
||||
|
||||
interface FSProvisionModel {
|
||||
extensions: Record<string, string>; // extension names to paths
|
||||
@@ -51,7 +51,7 @@ export class FilesystemProvisionerStore extends BaseStore<FSProvisionModel> {
|
||||
}
|
||||
|
||||
toJSON(): FSProvisionModel {
|
||||
return cloneJson({
|
||||
return toJS({
|
||||
extensions: Object.fromEntries(this.registeredExtensions),
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user