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

Merge branch 'master' into turn-on-strict

This commit is contained in:
Sebastian Malton 2022-05-12 08:36:43 -04:00
commit 59b58c17a3
3 changed files with 26 additions and 6 deletions

View File

@ -521,7 +521,9 @@ export class Cluster implements ClusterModel, ClusterState {
return ClusterStatus.AccessDenied;
}
this.broadcastConnectUpdate(error.error || error.message, true);
const message = String(error.error || error.message) || String(error);
this.broadcastConnectUpdate(message, true);
return ClusterStatus.Offline;
}
@ -538,7 +540,9 @@ export class Cluster implements ClusterModel, ClusterState {
return ClusterStatus.AccessDenied;
}
this.broadcastConnectUpdate(error.message, true);
const message = String(error.error || error.message) || String(error);
this.broadcastConnectUpdate(message, true);
} else {
this.broadcastConnectUpdate("Unknown error has occurred", true);
}

View File

@ -27,7 +27,15 @@ export interface CustomResourceDetailsProps extends KubeObjectDetailsProps<KubeO
function convertSpecValue(value: any): any {
if (Array.isArray(value)) {
return value.map(convertSpecValue);
return (
<ul>
{value.map((value, index) => (
<li key={index}>
{convertSpecValue(value)}
</li>
))}
</ul>
);
}
if (typeof value === "object") {

View File

@ -11,7 +11,7 @@ import React from "react";
import { ipcRendererOn } from "../../../common/ipc";
import type { Cluster } from "../../../common/cluster/cluster";
import type { IClassName } from "../../utils";
import { cssNames } from "../../utils";
import { isBoolean, hasTypedProperty, isObject, isString, cssNames } from "../../utils";
import { Button } from "../button";
import { Icon } from "../icon";
import { Spinner } from "../spinner";
@ -57,8 +57,16 @@ class NonInjectedClusterStatus extends React.Component<ClusterStatusProps & Depe
componentDidMount() {
disposeOnUnmount(this, [
ipcRendererOn(`cluster:${this.cluster.id}:connection-update`, (evt, res: KubeAuthUpdate) => {
this.authOutput.push(res);
ipcRendererOn(`cluster:${this.cluster.id}:connection-update`, (evt, res: unknown) => {
if (
isObject(res)
&& hasTypedProperty(res, "message", isString)
&& hasTypedProperty(res, "isError", isBoolean)
) {
this.authOutput.push(res);
} else {
console.warn(`Got invalid connection update for ${this.cluster.id}`, { update: res });
}
}),
]);
}