mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-11-15 21:36:16 +08:00
* 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>
55 lines
1.5 KiB
JavaScript
55 lines
1.5 KiB
JavaScript
import { primeBrandUpdater } from '../prime-brand';
|
|
|
|
describe('primeBrandUpdater', () => {
|
|
it('should switch the brand to suse on Prime', () => {
|
|
const setting = { value: 'harvester' };
|
|
|
|
primeBrandUpdater()(setting, true);
|
|
|
|
expect(setting.value).toBe('suse');
|
|
});
|
|
|
|
it('should keep the brand of the server when not on Prime', () => {
|
|
const setting = { value: 'harvester' };
|
|
|
|
primeBrandUpdater()(setting, false);
|
|
|
|
expect(setting.value).toBe('harvester');
|
|
});
|
|
|
|
it('should put the brand of the server back when the flavor stops being Prime', () => {
|
|
const setting = { value: 'harvester' };
|
|
const update = primeBrandUpdater();
|
|
|
|
update(setting, true);
|
|
update(setting, false);
|
|
|
|
expect(setting.value).toBe('harvester');
|
|
});
|
|
|
|
it('should switch the brand to suse again when the server sends its brand back on Prime', () => {
|
|
const setting = { value: 'harvester' };
|
|
const update = primeBrandUpdater();
|
|
|
|
update(setting, true);
|
|
setting.value = 'harvester';
|
|
update(setting, true);
|
|
|
|
expect(setting.value).toBe('suse');
|
|
});
|
|
|
|
it('should keep an empty brand of the server when not on Prime', () => {
|
|
const setting = { value: '' };
|
|
const update = primeBrandUpdater();
|
|
|
|
update(setting, true);
|
|
update(setting, false);
|
|
|
|
expect(setting.value).toBe('');
|
|
});
|
|
|
|
it('should do nothing before the setting is loaded', () => {
|
|
expect(() => primeBrandUpdater()(undefined, true)).not.toThrow();
|
|
});
|
|
});
|