Files
harvester-ui-extension/pkg/harvester/utils/prime-brand.js
marcelofukumoto 6e0e0237ef feat: use the SUSE Virtualization product name on Prime (#1202)
* feat: switch the product name with Rancher Prime

Use a [[Harvester]] token for the product name in the translations, so
Rancher 2.16 fills it from the l10n global that harvester-manager
registers: SUSE Virtualization on Rancher Prime, Harvester otherwise.

Rancher before 2.16 shows the tokens as written, so on those hosts (and
standalone) the extension resolves them to Harvester itself.

Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com>

* feat: switch the standalone product name with the server flavor

Standalone has no Rancher Prime, so register the [[Harvester]] l10n
global from the server-flavor setting instead: SUSE Virtualization on
prime, Harvester otherwise.

Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com>

* fix: point the network policy banner to the documentation

Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com>

* feat: use the SUSE theme in standalone Prime

Standalone Prime kept the harvester brand and only overrode the primary
colour, so the rest of the palette and the fonts didn't match Rancher
Prime. Switch the ui-brand setting to suse in the store when the server
flavor is prime, which makes the shell load the SUSE theme.

Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com>

* fix: keep the SUSE theme after a brand setting change event

The watcher also reads the setting's value, so a change from the server
loaded into the same object switches the brand back to suse.

Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com>

---------

Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com>
2026-10-26 17:28:50 +01:00

27 lines
784 B
JavaScript

import { BRAND } from '@shell/config/types';
/**
* Standalone Prime takes the SUSE theme of Rancher Prime: the `ui-brand` setting decides the stylesheet the shell
* loads, and only the `suse` brand has one. Returns an updater that switches the copy of the setting in the store,
* the server keeps its value, and puts the server's brand back when the flavor stops being Prime.
*/
export function primeBrandUpdater() {
let serverBrand;
return (brandSetting, isPrime) => {
if (!brandSetting) {
return;
}
if (brandSetting.value !== BRAND.SUSE) {
serverBrand = brandSetting.value;
}
const brand = isPrime ? BRAND.SUSE : (serverBrand ?? brandSetting.value);
if (brandSetting.value !== brand) {
brandSetting.value = brand;
}
};
}