From c057f3fc20dba712b0afc956623985a90d731b36 Mon Sep 17 00:00:00 2001 From: Jari Kolehmainen Date: Thu, 29 Apr 2021 12:12:33 +0300 Subject: [PATCH 1/4] Show entity source on tooltip + use it for color (#2669) Signed-off-by: Jari Kolehmainen --- src/renderer/components/hotbar/hotbar-icon.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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"}) Date: Thu, 29 Apr 2021 12:21:47 +0300 Subject: [PATCH 2/4] Removing add/delete empty cells feature (#2667) Signed-off-by: Alex Andreev --- src/common/hotbar-store.ts | 12 ---- .../components/hotbar/hotbar-menu.scss | 68 +------------------ .../components/hotbar/hotbar-menu.tsx | 22 +----- 3 files changed, 5 insertions(+), 97 deletions(-) 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/renderer/components/hotbar/hotbar-menu.scss b/src/renderer/components/hotbar/hotbar-menu.scss index af41e1b95b..6c8559fbd9 100644 --- a/src/renderer/components/hotbar/hotbar-menu.scss +++ b/src/renderer/components/hotbar/hotbar-menu.scss @@ -12,12 +12,6 @@ height: 4px; // extra spacing for mac-os "traffic-light" buttons } - &:hover { - .AddCellButton { - opacity: 1; - } - } - .HotbarItems { --cellWidth: 40px; --cellHeight: 40px; @@ -53,55 +47,23 @@ transform: translateZ(0); // Remove flickering artifacts &:hover { - .cellDeleteButton { - opacity: 1; - transition: opacity 0.1s 0.2s; - } - - &:not(.empty) { + &:not(:empty) { box-shadow: 0 0 0px 3px #ffffff1a; } } &.animating { - &.empty { + &:empty { animation: shake .6s cubic-bezier(.36,.07,.19,.97) both; transform: translate3d(0, 0, 0); backface-visibility: hidden; perspective: 1000px; } - &:not(.empty) { + &:not(:empty) { animation: outline 0.8s cubic-bezier(0.19, 1, 0.22, 1); } } - - .cellDeleteButton { - width: 2rem; - height: 2rem; - border-radius: 50%; - background-color: var(--textColorDimmed); - position: absolute; - top: -7px; - right: -7px; - color: var(--secondaryBackground); - opacity: 0; - border: 3px solid var(--clusterMenuBackground); - box-sizing: border-box; - - &:hover { - background-color: white; - transition: all 0.2s; - } - - .Icon { - --smallest-size: 12px; - font-weight: bold; - position: relative; - top: -2px; - left: .5px; - } - } } } @@ -141,30 +103,6 @@ } } } - - .AddCellButton { - width: 40px; - height: 40px; - min-height: 40px; - margin: 12px auto 8px; - background-color: transparent; - color: var(--textColorDimmed); - border-radius: 6px; - transition: all 0.2s; - cursor: pointer; - z-index: 1; - opacity: 0; - transition: all 0.2s; - - &:hover { - background-color: var(--sidebarBackground); - } - - .Icon { - --size: 24px; - margin-left: 2px; - } - } } @keyframes shake { diff --git a/src/renderer/components/hotbar/hotbar-menu.tsx b/src/renderer/components/hotbar/hotbar-menu.tsx index 29c44fc81e..168f630327 100644 --- a/src/renderer/components/hotbar/hotbar-menu.tsx +++ b/src/renderer/components/hotbar/hotbar-menu.tsx @@ -6,7 +6,7 @@ import { observer } from "mobx-react"; import { HotbarIcon } from "./hotbar-icon"; import { cssNames, IClassName } from "../../utils"; import { catalogEntityRegistry } from "../../api/catalog-entity-registry"; -import { defaultHotbarCells, HotbarItem, HotbarStore } from "../../../common/hotbar-store"; +import { HotbarItem, HotbarStore } from "../../../common/hotbar-store"; import { CatalogEntity, catalogEntityRunContext } from "../../api/catalog-entity"; import { Icon } from "../icon"; import { Badge } from "../badge"; @@ -72,14 +72,6 @@ export class HotbarMenu extends React.Component { }); } - renderAddCellButton() { - return ( - - ); - } - render() { const { className } = this.props; const hotbarStore = HotbarStore.getInstance(); @@ -90,7 +82,6 @@ export class HotbarMenu extends React.Component {
{this.renderGrid()} - {this.hotbar.items.length != defaultHotbarCells && this.renderAddCellButton()}
this.previous()} /> @@ -119,23 +110,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 && ( -
- -
- )}
); } From 0a604201d4761797130a7db1b8ab87493e2f821d Mon Sep 17 00:00:00 2001 From: Jari Kolehmainen Date: Thu, 29 Apr 2021 12:24:48 +0300 Subject: [PATCH 3/4] Fix hotbar icon kind light theme (#2668) Signed-off-by: Jari Kolehmainen --- src/renderer/components/hotbar/hotbar-icon.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); From f61f768fc79b01283574de8da0513c7403207c08 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Thu, 29 Apr 2021 05:25:44 -0400 Subject: [PATCH 4/4] fix getNodeWarningConditions (#2644) Signed-off-by: Sebastian Malton --- src/common/__tests__/kube-helpers.test.ts | 41 ++++++++++++++++++++++- src/common/kube-helpers.ts | 4 +-- 2 files changed, 42 insertions(+), 3 deletions(-) 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/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" - ); + ) ?? []; } /**