import "./cluster-status.scss" import React from "react"; import type { KubeAuthProxyResponse } from "../../../main/kube-auth-proxy"; import { clusterStore } from "../../../common/cluster-store"; import { ipcRenderer } from "electron"; import { observable } from "mobx"; import { observer } from "mobx-react"; import { Icon } from "../icon"; import { Button } from "../button"; import { cssNames } from "../../utils"; import { clusterIpc } from "../../../common/cluster-ipc"; @observer export class ClusterStatus extends React.Component { @observable authOutput: string[] = []; get cluster() { return clusterStore.activeCluster; } get clusterId() { return clusterStore.activeClusterId; } componentDidMount() { this.authOutput = ["Connecting ...\n"]; ipcRenderer.on(`kube-auth:${this.clusterId}`, (evt, { data, stream }: KubeAuthProxyResponse) => { this.authOutput.push(`[${stream}]: ${data}`); }) } componentWillUnmount() { ipcRenderer.removeAllListeners(`kube-auth:${this.clusterId}`); } reconnect = () => { this.authOutput = ["Reconnecting ...\n"]; clusterIpc.reconnect.invokeFromRenderer(this.clusterId); } render() { const { authOutput, cluster } = this; const isError = cluster?.accessible === false; return (
{!isError && } {isError && }

{cluster?.contextName}

          {authOutput.map((data, index) => {
            const error = data.startsWith("[stderr]");
            return 

{data}

})}
{isError && (
) } }