mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-11-19 07:16:09 +08:00
Add a StorageClass selector to online and air-gapped upgrade pages when the repositoryStorageClass feature is enabled (v1.10+). - Online: stores selection in harvesterhci.io/upgrade-storage-class annotation - Air-gapped: stores selection in image spec.targetStorageClassName - Selector locked while uploaded image exists; unlocked on switch to URL - Hidden on pre-v1.10 clusters Signed-off-by: pohanhuang <pohan.huang@suse.com>
41 lines
1.3 KiB
JavaScript
41 lines
1.3 KiB
JavaScript
import UpgradeRepositoryStorageClass, { getUpgradeRepositoryStorageClassDefault } from '../UpgradeRepositoryStorageClass.vue';
|
|
|
|
const storageClasses = [
|
|
{ name: 'fast', isDefault: true },
|
|
{ name: 'image-cache', parameters: { backingImage: 'image' } },
|
|
{ name: 'lvm-local', provisioner: 'lvm.driver.harvesterhci.io' },
|
|
{ name: 'longhorn-static' },
|
|
{ name: 'slow' }
|
|
];
|
|
|
|
describe('component: UpgradeRepositoryStorageClass', () => {
|
|
it('omits backing-image and LVM StorageClasses while disabling internal classes', () => {
|
|
const form = {
|
|
storageClasses,
|
|
$store: { getters: { 'i18n/t': (key) => key } }
|
|
};
|
|
|
|
expect(UpgradeRepositoryStorageClass.computed.storageClassOptions.call(form)).toStrictEqual([
|
|
{
|
|
label: 'fast (generic.default)', value: 'fast', disabled: false
|
|
},
|
|
{
|
|
label: 'longhorn-static (harvester.storage.internal.label)', value: 'longhorn-static', disabled: true
|
|
},
|
|
{
|
|
label: 'slow', value: 'slow', disabled: false
|
|
},
|
|
]);
|
|
});
|
|
|
|
it('does not use an unavailable StorageClass as the default', () => {
|
|
expect(getUpgradeRepositoryStorageClassDefault([
|
|
{
|
|
name: 'lvm-local', isDefault: true, provisioner: 'lvm.driver.harvesterhci.io'
|
|
},
|
|
{ name: 'longhorn-static' },
|
|
{ name: 'fast' }
|
|
])).toBe('');
|
|
});
|
|
});
|