diff --git a/src/common/__tests__/kube-helpers.test.ts b/src/common/__tests__/kube-helpers.test.ts index ddecc6bde8..2a346bfef5 100644 --- a/src/common/__tests__/kube-helpers.test.ts +++ b/src/common/__tests__/kube-helpers.test.ts @@ -1,5 +1,5 @@ import { KubeConfig } from "@kubernetes/client-node"; -import { validateKubeConfig, loadConfig } from "../kube-helpers"; +import { validateKubeConfig, loadConfig, getNodeWarningConditions } from "../kube-helpers"; const kubeconfig = ` apiVersion: v1 @@ -251,4 +251,43 @@ describe("kube helpers", () => { }); }); }); + + describe("getNodeWarningConditions", () => { + it("should return an empty array if no status or no conditions", () => { + expect(getNodeWarningConditions({}).length).toBe(0); + }); + + it("should return an empty array if all conditions are good", () => { + expect(getNodeWarningConditions({ + status: { + conditions: [ + { + type: "Ready", + status: "foobar" + } + ] + } + }).length).toBe(0); + }); + + it("should all not ready conditions", () => { + const conds = getNodeWarningConditions({ + status: { + conditions: [ + { + type: "Ready", + status: "foobar" + }, + { + type: "NotReady", + status: "true" + }, + ] + } + }); + + expect(conds.length).toBe(1); + expect(conds[0].type).toBe("NotReady"); + }); + }); }); diff --git a/src/common/hotbar-store.ts b/src/common/hotbar-store.ts index 6a01b3101e..fa0116937b 100644 --- a/src/common/hotbar-store.ts +++ b/src/common/hotbar-store.ts @@ -158,18 +158,6 @@ export class HotbarStore extends BaseStore { hotbar.items[index] = null; } - addEmptyCell() { - const hotbar = this.getActive(); - - hotbar.items.push(null); - } - - removeEmptyCell(index: number) { - const hotbar = this.getActive(); - - hotbar.items.splice(index, 1); - } - switchToPrevious() { const hotbarStore = HotbarStore.getInstance(); let index = hotbarStore.activeHotbarIndex - 1; diff --git a/src/common/kube-helpers.ts b/src/common/kube-helpers.ts index fb4691fedb..e4a1168699 100644 --- a/src/common/kube-helpers.ts +++ b/src/common/kube-helpers.ts @@ -174,9 +174,9 @@ export function podHasIssues(pod: V1Pod) { } export function getNodeWarningConditions(node: V1Node) { - return node.status.conditions.filter(c => + return node.status?.conditions?.filter(c => c.status.toLowerCase() === "true" && c.type !== "Ready" && c.type !== "HostUpgrades" - ); + ) ?? []; } /** diff --git a/src/renderer/components/hotbar/hotbar-icon.scss b/src/renderer/components/hotbar/hotbar-icon.scss index f75867d96c..1da432d568 100644 --- a/src/renderer/components/hotbar/hotbar-icon.scss +++ b/src/renderer/components/hotbar/hotbar-icon.scss @@ -48,7 +48,7 @@ margin: -8px; font-size: var(--font-size-small); background: var(--clusterMenuBackground); - color: white; + color: var(--textColorAccent); padding: 0px; border-radius: 50%; border: 2px solid var(--clusterMenuBackground); diff --git a/src/renderer/components/hotbar/hotbar-icon.tsx b/src/renderer/components/hotbar/hotbar-icon.tsx index 87699d2cfc..5bc6489c8c 100644 --- a/src/renderer/components/hotbar/hotbar-icon.tsx +++ b/src/renderer/components/hotbar/hotbar-icon.tsx @@ -116,7 +116,7 @@ export class HotbarIcon extends React.Component { generateAvatarStyle(entity: CatalogEntity): React.CSSProperties { return { - "backgroundColor": randomColor({ seed: entity.metadata.name, luminosity: "dark" }) + "backgroundColor": randomColor({ seed: `${entity.metadata.name}-${entity.metadata.source}`, luminosity: "dark" }) }; } @@ -138,7 +138,7 @@ export class HotbarIcon extends React.Component { return (
- {entity.metadata.name} + {entity.metadata.name} ({entity.metadata.source || "local"}) { }); } - renderAddCellButton() { - return ( - - ); - } - render() { const { className } = this.props; const hotbarStore = HotbarStore.getInstance(); @@ -98,7 +89,6 @@ export class HotbarMenu extends React.Component { {this.renderGrid()} - {this.hotbar.items.length != defaultHotbarCells && this.renderAddCellButton()}
@@ -116,23 +106,14 @@ function HotbarCell(props: HotbarCellProps) { const [animating, setAnimating] = useState(false); const onAnimationEnd = () => { setAnimating(false); }; const onClick = () => { setAnimating(true); }; - const onDeleteClick = (evt: Event | React.SyntheticEvent) => { - evt.stopPropagation(); - HotbarStore.getInstance().removeEmptyCell(props.index); - }; return (
{props.children} - {!props.children && ( -
- -
- )}
); }