mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix: display of entity name while connecting (#4415)
This commit is contained in:
parent
93a60caf40
commit
44f1f38a75
@ -25,7 +25,6 @@ import { computed, observable, makeObservable } from "mobx";
|
|||||||
import { disposeOnUnmount, observer } from "mobx-react";
|
import { disposeOnUnmount, observer } from "mobx-react";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { clusterActivateHandler } from "../../../common/cluster-ipc";
|
import { clusterActivateHandler } from "../../../common/cluster-ipc";
|
||||||
import { ClusterStore } from "../../../common/cluster-store";
|
|
||||||
import { ipcRendererOn, requestMain } from "../../../common/ipc";
|
import { ipcRendererOn, requestMain } from "../../../common/ipc";
|
||||||
import type { Cluster } from "../../../main/cluster";
|
import type { Cluster } from "../../../main/cluster";
|
||||||
import { cssNames, IClassName } from "../../utils";
|
import { cssNames, IClassName } from "../../utils";
|
||||||
@ -34,11 +33,12 @@ import { Icon } from "../icon";
|
|||||||
import { Spinner } from "../spinner";
|
import { Spinner } from "../spinner";
|
||||||
import { navigate } from "../../navigation";
|
import { navigate } from "../../navigation";
|
||||||
import { entitySettingsURL } from "../../../common/routes";
|
import { entitySettingsURL } from "../../../common/routes";
|
||||||
import type { ClusterId, KubeAuthUpdate } from "../../../common/cluster-types";
|
import type { KubeAuthUpdate } from "../../../common/cluster-types";
|
||||||
|
import { catalogEntityRegistry } from "../../api/catalog-entity-registry";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
className?: IClassName;
|
className?: IClassName;
|
||||||
clusterId: ClusterId;
|
cluster: Cluster;
|
||||||
}
|
}
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
@ -52,7 +52,11 @@ export class ClusterStatus extends React.Component<Props> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get cluster(): Cluster {
|
get cluster(): Cluster {
|
||||||
return ClusterStore.getInstance().getById(this.props.clusterId);
|
return this.props.cluster;
|
||||||
|
}
|
||||||
|
|
||||||
|
@computed get entity() {
|
||||||
|
return catalogEntityRegistry.getById(this.cluster.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@computed get hasErrors(): boolean {
|
@computed get hasErrors(): boolean {
|
||||||
@ -72,7 +76,7 @@ export class ClusterStatus extends React.Component<Props> {
|
|||||||
this.isReconnecting = true;
|
this.isReconnecting = true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await requestMain(clusterActivateHandler, this.props.clusterId, true);
|
await requestMain(clusterActivateHandler, this.cluster.id, true);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.authOutput.push({
|
this.authOutput.push({
|
||||||
message: error.toString(),
|
message: error.toString(),
|
||||||
@ -86,7 +90,7 @@ export class ClusterStatus extends React.Component<Props> {
|
|||||||
manageProxySettings = () => {
|
manageProxySettings = () => {
|
||||||
navigate(entitySettingsURL({
|
navigate(entitySettingsURL({
|
||||||
params: {
|
params: {
|
||||||
entityId: this.props.clusterId,
|
entityId: this.cluster.id,
|
||||||
},
|
},
|
||||||
fragment: "proxy",
|
fragment: "proxy",
|
||||||
}));
|
}));
|
||||||
@ -149,7 +153,7 @@ export class ClusterStatus extends React.Component<Props> {
|
|||||||
return (
|
return (
|
||||||
<div className={cssNames(styles.status, "flex column box center align-center justify-center", this.props.className)}>
|
<div className={cssNames(styles.status, "flex column box center align-center justify-center", this.props.className)}>
|
||||||
<div className="flex items-center column gaps">
|
<div className="flex items-center column gaps">
|
||||||
<h2>{this.cluster.preferences.clusterName}</h2>
|
<h2>{this.entity.getName()}</h2>
|
||||||
{this.renderStatusIcon()}
|
{this.renderStatusIcon()}
|
||||||
{this.renderAuthenticationOutput()}
|
{this.renderAuthenticationOutput()}
|
||||||
{this.renderReconnectionHelp()}
|
{this.renderReconnectionHelp()}
|
||||||
|
|||||||
@ -89,10 +89,10 @@ export class ClusterView extends React.Component<Props> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderStatus(): React.ReactNode {
|
renderStatus(): React.ReactNode {
|
||||||
const { clusterId, cluster, isReady } = this;
|
const { cluster, isReady } = this;
|
||||||
|
|
||||||
if (cluster && !isReady) {
|
if (cluster && !isReady) {
|
||||||
return <ClusterStatus key={clusterId} clusterId={clusterId} className="box center"/>;
|
return <ClusterStatus cluster={cluster} className="box center"/>;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user