Skip to content

Commit

Permalink
Show badge color for local cluster (rancher#13077)
Browse files Browse the repository at this point in the history
  • Loading branch information
nwmac authored Jan 13, 2025
1 parent fea429e commit 3ff358c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion shell/components/ClusterIconMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default {
},
customColor() {
return !this.cluster.removePreviewColor && this.cluster.badge?.iconText ? this.cluster.badge?.color : '';
return this.cluster.iconColor || '';
},
},
Expand Down
2 changes: 2 additions & 0 deletions shell/components/nav/TopLevelMenu.helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ interface TopLevelMenuCluster {
ready: boolean
providerNavLogo: string,
badge: string,
iconColor: string,
isLocal: boolean,
pinned: boolean,
description: string,
Expand Down Expand Up @@ -143,6 +144,7 @@ export abstract class BaseTopLevelMenuHelper {
ready: mgmtCluster.isReady, // && !provCluster?.hasError,
providerNavLogo: mgmtCluster.providerMenuLogo,
badge: mgmtCluster.badge,
iconColor: mgmtCluster.iconColor,
isLocal: mgmtCluster.isLocal,
pinned: mgmtCluster.pinned,
description: provCluster?.description || mgmtCluster.description,
Expand Down
7 changes: 6 additions & 1 deletion shell/models/management.cattle.io.cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,11 @@ export default class MgmtCluster extends SteveModel {
return this.providerLogo;
}

// Color to use as the underline for the icon in the app bar
get iconColor() {
return this.metadata?.annotations[CLUSTER_BADGE.COLOR];
}

// Custom badge to show for the Cluster (if the appropriate annotations are set)
get badge() {
const icon = this.metadata?.annotations?.[CLUSTER_BADGE.ICON_TEXT];
Expand All @@ -305,7 +310,7 @@ export default class MgmtCluster extends SteveModel {
return undefined;
}

let color = this.metadata?.annotations[CLUSTER_BADGE.COLOR] || DEFAULT_BADGE_COLOR;
let color = this.iconColor || DEFAULT_BADGE_COLOR;
const iconText = this.metadata?.annotations[CLUSTER_BADGE.ICON_TEXT] || '';
let foregroundColor;

Expand Down

0 comments on commit 3ff358c

Please sign in to comment.