mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-10-01 03:36:04 +08:00
Add HarvesterImageDownloader
Signed-off-by: Andy Lee <andy.lee@suse.com>
This commit is contained in:
@@ -73,7 +73,7 @@ export default class HciVmImage extends HarvesterResource {
|
||||
disabled: !this.isReady,
|
||||
},
|
||||
{
|
||||
action: 'download',
|
||||
action: 'imageDownload',
|
||||
enabled: this.links?.download,
|
||||
icon: 'icon icon-download',
|
||||
label: this.t('asyncButton.download.action'),
|
||||
@@ -394,7 +394,19 @@ export default class HciVmImage extends HarvesterResource {
|
||||
return this.$rootGetters['harvester-common/getFeatureEnabled']('thirdPartyStorage');
|
||||
}
|
||||
|
||||
download() {
|
||||
imageDownload(resources = this) {
|
||||
// spec.backend is introduced in v1.5.0. If it's not set, it's an old image can be downloaded via link
|
||||
if (this.spec?.backend === 'cdi') {
|
||||
this.$dispatch('promptModal', {
|
||||
resources,
|
||||
component: 'HarvesterImageDownloader'
|
||||
});
|
||||
} else {
|
||||
this.downloadViaLink();
|
||||
}
|
||||
}
|
||||
|
||||
downloadViaLink() {
|
||||
window.location.href = this.links.download;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user