mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Add some debug logging to help debug LED issue
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
d1ae30a562
commit
223c1f81bf
@ -5,7 +5,7 @@
|
||||
|
||||
import "../common/ipc/cluster";
|
||||
import type http from "http";
|
||||
import { action, makeObservable, observable, observe, reaction, toJS } from "mobx";
|
||||
import { action, makeObservable, observable, observe, reaction, runInAction, toJS } from "mobx";
|
||||
import type { Cluster } from "../common/cluster/cluster";
|
||||
import logger from "./logger";
|
||||
import { apiKubePrefix } from "../common/vars";
|
||||
@ -68,7 +68,12 @@ export class ClusterManager extends Singleton {
|
||||
|
||||
observe(this.deleting, change => {
|
||||
if (change.type === "add") {
|
||||
this.updateEntityStatus(catalogEntityRegistry.getById(change.newValue));
|
||||
runInAction(() => {
|
||||
const entity = catalogEntityRegistry.getById(change.newValue);
|
||||
|
||||
entity.status.phase = LensKubernetesClusterStatus.DELETING;
|
||||
entity.status.enabled = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@ -137,34 +142,39 @@ export class ClusterManager extends Singleton {
|
||||
}
|
||||
|
||||
@action
|
||||
protected updateEntityStatus(entity: KubernetesCluster, cluster?: Cluster) {
|
||||
if (this.deleting.has(entity.getId())) {
|
||||
entity.status.phase = LensKubernetesClusterStatus.DELETING;
|
||||
entity.status.enabled = false;
|
||||
} else {
|
||||
entity.status.phase = (() => {
|
||||
if (!cluster) {
|
||||
return LensKubernetesClusterStatus.DISCONNECTED;
|
||||
}
|
||||
|
||||
if (cluster.accessible) {
|
||||
return LensKubernetesClusterStatus.CONNECTED;
|
||||
}
|
||||
|
||||
if (!cluster.disconnected) {
|
||||
return LensKubernetesClusterStatus.CONNECTING;
|
||||
}
|
||||
|
||||
// Extensions are not allowed to use the Lens specific status phases
|
||||
if (!lensSpecificClusterStatuses.has(entity?.status?.phase)) {
|
||||
return entity.status.phase;
|
||||
}
|
||||
protected updateEntityStatus(entity: KubernetesCluster, cluster: Cluster) {
|
||||
entity.status.phase = (() => {
|
||||
if (!cluster) {
|
||||
logger.debug(`${logPrefix} setting entity ${entity.getName()} to DISCONNECTED, reason="no cluster"`);
|
||||
|
||||
return LensKubernetesClusterStatus.DISCONNECTED;
|
||||
})();
|
||||
}
|
||||
|
||||
entity.status.enabled = true;
|
||||
}
|
||||
if (cluster.accessible) {
|
||||
logger.debug(`${logPrefix} setting entity ${entity.getName()} to CONNECTED, reason="cluster is accessible"`);
|
||||
|
||||
return LensKubernetesClusterStatus.CONNECTED;
|
||||
}
|
||||
|
||||
if (!cluster.disconnected) {
|
||||
logger.debug(`${logPrefix} setting entity ${entity.getName()} to CONNECTING, reason="cluster is not disconnected"`);
|
||||
|
||||
return LensKubernetesClusterStatus.CONNECTING;
|
||||
}
|
||||
|
||||
// Extensions are not allowed to use the Lens specific status phases
|
||||
if (!lensSpecificClusterStatuses.has(entity?.status?.phase)) {
|
||||
logger.debug(`${logPrefix} not clearing entity ${entity.getName()} status, reason="custom string"`);
|
||||
|
||||
return entity.status.phase;
|
||||
}
|
||||
|
||||
logger.debug(`${logPrefix} not clearing entity ${entity.getName()} DISCONNECTED, reason=""`);
|
||||
|
||||
return LensKubernetesClusterStatus.DISCONNECTED;
|
||||
})();
|
||||
|
||||
entity.status.enabled = true;
|
||||
}
|
||||
|
||||
@action
|
||||
|
||||
Loading…
Reference in New Issue
Block a user