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

Check cluster connected status from cluster.status.phase property (#3078)

Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com>
This commit is contained in:
Lauri Nevala 2021-06-17 07:45:46 +03:00 committed by GitHub
parent 5f6abe3496
commit dc2d7a08d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -81,7 +81,7 @@ export class MetricsSettings extends React.Component<Props> {
@computed get isTogglable() { @computed get isTogglable() {
if (this.inProgress) return false; if (this.inProgress) return false;
if (!this.props.cluster.status.active) return false; if (this.props.cluster.status.phase !== "connected") return false;
if (this.canUpgrade) return false; if (this.canUpgrade) return false;
if (!this.isActiveMetricsProvider) return false; if (!this.isActiveMetricsProvider) return false;
@ -205,7 +205,7 @@ export class MetricsSettings extends React.Component<Props> {
render() { render() {
return ( return (
<> <>
{ !this.props.cluster.status.active && ( { this.props.cluster.status.phase !== "connected" && (
<section> <section>
<p style={ {color: "var(--colorError)"} }> <p style={ {color: "var(--colorError)"} }>
Lens Metrics settings requires established connection to the cluster. Lens Metrics settings requires established connection to the cluster.
@ -225,7 +225,7 @@ export class MetricsSettings extends React.Component<Props> {
control={ control={
<Switcher <Switcher
disabled={this.featureStates.kubeStateMetrics === undefined || !this.isTogglable} disabled={this.featureStates.kubeStateMetrics === undefined || !this.isTogglable}
checked={!!this.featureStates.prometheus && this.props.cluster.status.active} checked={!!this.featureStates.prometheus && this.props.cluster.status.phase == "connected"}
onChange={v => this.togglePrometheus(v.target.checked)} onChange={v => this.togglePrometheus(v.target.checked)}
name="prometheus" name="prometheus"
/> />
@ -243,7 +243,7 @@ export class MetricsSettings extends React.Component<Props> {
control={ control={
<Switcher <Switcher
disabled={this.featureStates.kubeStateMetrics === undefined || !this.isTogglable} disabled={this.featureStates.kubeStateMetrics === undefined || !this.isTogglable}
checked={!!this.featureStates.kubeStateMetrics && this.props.cluster.status.active} checked={!!this.featureStates.kubeStateMetrics && this.props.cluster.status.phase == "connected"}
onChange={v => this.toggleKubeStateMetrics(v.target.checked)} onChange={v => this.toggleKubeStateMetrics(v.target.checked)}
name="node-exporter" name="node-exporter"
/> />
@ -262,7 +262,7 @@ export class MetricsSettings extends React.Component<Props> {
control={ control={
<Switcher <Switcher
disabled={this.featureStates.nodeExporter === undefined || !this.isTogglable} disabled={this.featureStates.nodeExporter === undefined || !this.isTogglable}
checked={!!this.featureStates.nodeExporter && this.props.cluster.status.active} checked={!!this.featureStates.nodeExporter && this.props.cluster.status.phase == "connected"}
onChange={v => this.toggleNodeExporter(v.target.checked)} onChange={v => this.toggleNodeExporter(v.target.checked)}
name="node-exporter" name="node-exporter"
/> />