1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Cleaning up ClusteStatus render() method

Signed-off-by: alexfront <alex.andreev.email@gmail.com>
This commit is contained in:
alexfront 2020-08-14 09:25:17 +03:00
parent 76ef892a3a
commit 2b89239baf

View File

@ -57,12 +57,12 @@ export class ClusterStatus extends React.Component<Props> {
this.isReconnecting = false; this.isReconnecting = false;
} }
render() { renderContent() {
const { authOutput, cluster, hasErrors } = this; const { authOutput, cluster, hasErrors } = this;
const failureReason = cluster.failureReason; const failureReason = cluster.failureReason;
if (!hasErrors || this.isReconnecting) { if (!hasErrors || this.isReconnecting) {
return ( return (
<div className="ClusterStatus flex column align-center justify-center"> <>
<CubeSpinner /> <CubeSpinner />
<pre className="kube-auth-out"> <pre className="kube-auth-out">
<p>{this.isReconnecting ? "Reconnecting..." : "Connecting..."}</p> <p>{this.isReconnecting ? "Reconnecting..." : "Connecting..."}</p>
@ -70,11 +70,11 @@ export class ClusterStatus extends React.Component<Props> {
return <p key={index} className={cssNames({ error })}>{data}</p> return <p key={index} className={cssNames({ error })}>{data}</p>
})} })}
</pre> </pre>
</div> </>
); );
} }
return ( return (
<div className={cssNames("ClusterStatus flex column gaps box center", this.props.className)}> <>
<Icon material="cloud_off" className="error" /> <Icon material="cloud_off" className="error" />
<h2> <h2>
{cluster.preferences.clusterName} {cluster.preferences.clusterName}
@ -94,7 +94,15 @@ export class ClusterStatus extends React.Component<Props> {
onClick={this.reconnect} onClick={this.reconnect}
waiting={this.isReconnecting} waiting={this.isReconnecting}
/> />
</>
);
}
render() {
return (
<div className={cssNames("ClusterStatus flex column gaps box center align-center justify-center", this.props.className)}>
{this.renderContent()}
</div> </div>
) );
} }
} }