mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-10-03 20:56:06 +08:00
add third party storage UI change
Signed-off-by: andy.lee <andy.lee@suse.com>
This commit is contained in:
@@ -109,6 +109,10 @@ export default {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pvc.metadata?.annotations?.[HCI_ANNOTATIONS.GOLDEN_IMAGE] === 'true') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pvc.attachVM && isAvailable && pvc.attachVM?.id === this.vm?.id && this.isEdit) {
|
||||
isBeingUsed = false;
|
||||
} else if (pvc.attachVM) {
|
||||
|
||||
+33
-1
@@ -90,7 +90,7 @@ export default {
|
||||
imagesOption() {
|
||||
return this.images.filter((c) => c.isReady).sort((a, b) => a.creationTimestamp > b.creationTimestamp ? -1 : 1).map( (I) => {
|
||||
return {
|
||||
label: `${ I.metadata.namespace }/${ I.spec.displayName }`,
|
||||
label: `${ I.metadata.namespace }/${ I.spec.displayName } (${ I.imageStorageClass } / ${ I.virtualSize })`,
|
||||
value: I.id
|
||||
};
|
||||
});
|
||||
@@ -118,6 +118,32 @@ export default {
|
||||
|
||||
isLonghornV2() {
|
||||
return this.value.pvc?.isLonghornV2 || this.value.pvc?.storageClass?.isLonghornV2;
|
||||
},
|
||||
|
||||
selectedImage() {
|
||||
return this.$store.getters['harvester/all'](HCI.IMAGE)?.find( (I) => this.value.image === I.id);
|
||||
},
|
||||
|
||||
imageVirtualSize() {
|
||||
return this.selectedImage?.virtualSize;
|
||||
},
|
||||
|
||||
diskSize() {
|
||||
const size = this.value?.size || '0';
|
||||
|
||||
return `${ size.replace('Gi', '') } GiB`;
|
||||
},
|
||||
|
||||
imageVirtualSizeInByte() {
|
||||
return Math.max(this.selectedImage?.status?.size, this.selectedImage?.status?.virtualSize);
|
||||
},
|
||||
|
||||
diskSizeInByte() {
|
||||
return parseSi(this.value?.size || '0');
|
||||
},
|
||||
|
||||
showDiskTooSmallError() {
|
||||
return this.imageVirtualSizeInByte > this.diskSizeInByte;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -159,6 +185,7 @@ export default {
|
||||
|
||||
methods: {
|
||||
update() {
|
||||
this.value.hasDiskError = this.showDiskTooSmallError;
|
||||
this.$emit('update');
|
||||
},
|
||||
|
||||
@@ -341,5 +368,10 @@ export default {
|
||||
class="mb-20"
|
||||
:label="value.volumeBackups.error.message"
|
||||
/>
|
||||
<Banner
|
||||
v-if="!isView && showDiskTooSmallError"
|
||||
color="error"
|
||||
:label="t('harvester.virtualMachine.volume.vmImageVolumeTip', {diskSize: diskSize, imageVirtualSize: imageVirtualSize})"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -195,7 +195,12 @@ export default {
|
||||
|
||||
return true;
|
||||
},
|
||||
isValidationPassed() {
|
||||
// check if any disk hasDiskError is true
|
||||
const hasError = this.diskRows.some((disk) => disk.hasDiskError === true);
|
||||
|
||||
return !hasError;
|
||||
},
|
||||
showCpuPinningBanner() {
|
||||
if (!this.value.cpuPinningFeatureEnabled) {
|
||||
return false;
|
||||
@@ -489,6 +494,7 @@ export default {
|
||||
:resource="value"
|
||||
:cancel-event="true"
|
||||
:mode="mode"
|
||||
:validation-passed="isValidationPassed"
|
||||
:can-yaml="isSingle ? true : false"
|
||||
:errors="errors"
|
||||
:generate-yaml="generateYaml"
|
||||
|
||||
Reference in New Issue
Block a user