From f9f83576f76105b173b75117ccbee0518d979d6b Mon Sep 17 00:00:00 2001 From: Alex Andreev Date: Thu, 16 Mar 2023 17:09:27 +0300 Subject: [PATCH] Use single icon prop Signed-off-by: Alex Andreev --- packages/core/src/common/cluster-types.ts | 1 - .../main/cluster/update-entity-spec.injectable.ts | 12 ++++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/packages/core/src/common/cluster-types.ts b/packages/core/src/common/cluster-types.ts index da5d9f5079..ba01489152 100644 --- a/packages/core/src/common/cluster-types.ts +++ b/packages/core/src/common/cluster-types.ts @@ -105,7 +105,6 @@ export interface ClusterPreferences extends ClusterPrometheusPreferences { * cleared by preferences. */ icon?: string | null; - iconBackgroundColor?: string; httpsProxy?: string; hiddenMetrics?: string[]; nodeShellImage?: string; diff --git a/packages/core/src/main/cluster/update-entity-spec.injectable.ts b/packages/core/src/main/cluster/update-entity-spec.injectable.ts index bdb8a1491a..9942c4061a 100644 --- a/packages/core/src/main/cluster/update-entity-spec.injectable.ts +++ b/packages/core/src/main/cluster/update-entity-spec.injectable.ts @@ -23,15 +23,11 @@ const updateEntitySpecInjectable = getInjectable({ entity.spec.metrics.prometheus = prometheus; } - entity.spec.icon ??= {}; - - if (cluster.preferences.iconBackgroundColor) { - entity.spec.icon.background = cluster.preferences.iconBackgroundColor; - } - if (cluster.preferences.icon) { - entity.spec.icon.src = cluster.preferences.icon; - entity.spec.icon.background = cluster.preferences.iconBackgroundColor; + const source = cluster.preferences.icon.startsWith("data:") ? "src" : "background"; + + entity.spec.icon ??= {}; + entity.spec.icon[source] = cluster.preferences.icon; } else if (cluster.preferences.icon === null) { /** * NOTE: only clear the icon if set to `null` by ClusterIconSettings.