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

Fix set of cluster entity icon src (#3134)

Co-authored-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Jari Kolehmainen 2021-06-21 18:09:21 +03:00 committed by GitHub
parent 20d6e50cb7
commit 31b48fe245
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 6 deletions

View File

@ -38,9 +38,6 @@ export interface KubernetesClusterPrometheusMetrics {
prefix: string; prefix: string;
}; };
type?: string; type?: string;
icon?: {
src?: string;
};
} }
export interface KubernetesClusterSpec extends CatalogEntitySpec { export interface KubernetesClusterSpec extends CatalogEntitySpec {
@ -49,7 +46,13 @@ export interface KubernetesClusterSpec extends CatalogEntitySpec {
metrics?: { metrics?: {
source: string; source: string;
prometheus?: KubernetesClusterPrometheusMetrics; prometheus?: KubernetesClusterPrometheusMetrics;
} };
icon?: {
// TODO: move to CatalogEntitySpec once any-entity icons are supported
src?: string;
material?: string;
background?: string;
};
} }
export interface KubernetesClusterStatus extends CatalogEntityStatus { export interface KubernetesClusterStatus extends CatalogEntityStatus {

View File

@ -102,7 +102,7 @@ export class ClusterManager extends Singleton {
const entity = catalogEntityRegistry.items[index] as KubernetesCluster; const entity = catalogEntityRegistry.items[index] as KubernetesCluster;
this.updateEntityStatus(entity, cluster); this.updateEntityStatus(entity, cluster);
entity.metadata.labels = Object.assign({}, cluster.labels, entity.metadata.labels); entity.metadata.labels = Object.assign({}, cluster.labels, entity.metadata.labels);
if (cluster.preferences?.clusterName) { if (cluster.preferences?.clusterName) {
@ -119,7 +119,12 @@ export class ClusterManager extends Singleton {
entity.spec.metrics.prometheus = prometheus; entity.spec.metrics.prometheus = prometheus;
} }
entity.spec.icon.src = cluster.preferences.icon; if (cluster.preferences.icon) {
entity.spec.icon ??= {};
entity.spec.icon.src = cluster.preferences.icon;
} else {
entity.spec.icon = null;
}
catalogEntityRegistry.items.splice(index, 1, entity); catalogEntityRegistry.items.splice(index, 1, entity);
} }