mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2025-12-13 21:21:44 +00:00
Filter export SC for non-longhorn V1 volume
Signed-off-by: Andy Lee <andy.lee@suse.com> (cherry picked from commit 104e98e3904cf62c9073dd4982db7a4810833ae2)
This commit is contained in:
parent
b3dbc2f0d3
commit
af36163b29
@ -34,9 +34,14 @@ export default {
|
||||
|
||||
await allHash(hash);
|
||||
|
||||
const defaultStorage = this.$store.getters[`${ inStore }/all`](STORAGE_CLASS).find((s) => s.isDefault);
|
||||
const allStorages = this.allStorageClasses;
|
||||
const defaultStorage = allStorages.find((s) => s.isDefault);
|
||||
|
||||
if (this.isLonghornV1Volume) {
|
||||
this['storageClassName'] = defaultStorage?.metadata?.name || 'longhorn';
|
||||
} else {
|
||||
this['storageClassName'] = this.nonLonghornV1StorageClasses[0]?.metadata?.name || '';
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
@ -54,7 +59,7 @@ export default {
|
||||
...mapGetters({ t: 'i18n/t' }),
|
||||
|
||||
actionResource() {
|
||||
return this.resources[0];
|
||||
return this.resources[0] || {};
|
||||
},
|
||||
|
||||
namespaces() {
|
||||
@ -73,15 +78,33 @@ export default {
|
||||
return out;
|
||||
},
|
||||
|
||||
isLonghornV1Volume() {
|
||||
return this.actionResource?.isLonghornV1 === true;
|
||||
},
|
||||
|
||||
disableSave() {
|
||||
return !(this.name && this.namespace && this.storageClassName);
|
||||
},
|
||||
|
||||
storageClassOptions() {
|
||||
allStorageClasses() {
|
||||
const inStore = this.$store.getters['currentProduct'].inStore;
|
||||
const storages = this.$store.getters[`${ inStore }/all`](STORAGE_CLASS);
|
||||
|
||||
const out = storages.filter((s) => !s.parameters?.backingImage).map((s) => {
|
||||
return this.$store.getters[`${ inStore }/all`](STORAGE_CLASS) || [];
|
||||
},
|
||||
|
||||
nonLonghornV1StorageClasses() {
|
||||
return this.allStorageClasses.filter((s) => s.isLonghornV1 === false) || [];
|
||||
},
|
||||
|
||||
storageClassOptions() {
|
||||
let storages = this.allStorageClasses;
|
||||
|
||||
// Volume with non-longhorn v1 sc can't be exported to longhorn v1 sc image
|
||||
if (!this.isLonghornV1Volume) {
|
||||
storages = this.allStorageClasses.filter((s) => s.isLonghornV1 === false);
|
||||
}
|
||||
|
||||
const options = storages.filter((s) => !s.parameters?.backingImage).map((s) => {
|
||||
const label = s.isDefault ? `${ s.name } (${ this.t('generic.default') })` : s.name;
|
||||
|
||||
return {
|
||||
@ -90,7 +113,7 @@ export default {
|
||||
};
|
||||
}) || [];
|
||||
|
||||
return out;
|
||||
return options;
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
@ -336,6 +336,10 @@ export default class HciPv extends HarvesterResource {
|
||||
return this.volumeProvider === LONGHORN_DRIVER;
|
||||
}
|
||||
|
||||
get isLonghornV1() {
|
||||
return this.isLonghorn && !this.isLonghornV2;
|
||||
}
|
||||
|
||||
get isLonghornV2() {
|
||||
return this.dataEngine === DATA_ENGINE_V2;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user