diff --git a/ui/src/config/section/storage.js b/ui/src/config/section/storage.js
index 9100104e7f4..9f73f8c5f3f 100644
--- a/ui/src/config/section/storage.js
+++ b/ui/src/config/section/storage.js
@@ -98,12 +98,8 @@ export default {
docHelp: 'adminguide/storage.html#uploading-an-existing-volume-to-a-virtual-machine',
label: 'label.upload.volume.from.url',
listView: true,
- args: ['url', 'name', 'zoneid', 'format', 'diskofferingid', 'checksum'],
- mapping: {
- format: {
- options: ['RAW', 'VHD', 'VHDX', 'OVA', 'QCOW2']
- }
- }
+ popup: true,
+ component: () => import('@/views/storage/UploadVolume.vue')
},
{
api: 'attachVolume',
diff --git a/ui/src/views/storage/UploadLocalVolume.vue b/ui/src/views/storage/UploadLocalVolume.vue
index 0e5df836fcc..dc13a6070ef 100644
--- a/ui/src/views/storage/UploadLocalVolume.vue
+++ b/ui/src/views/storage/UploadLocalVolume.vue
@@ -125,6 +125,39 @@
:placeholder="$t('label.volumechecksum.description')"
/>
+
+
+ { this.handleDomainChange(this.domainList[val].id) }">
+
+ {{ opt.path || opt.name || opt.description }}
+
+
+
+
+
+ { this.handleAccountChange(val) }">
+
+ {{ acc.name }}
+
+
+
{{ this.$t('label.cancel') }}
{{ this.$t('label.ok') }}
@@ -150,11 +183,16 @@ export default {
return {
fileList: [],
zones: [],
+ domainList: [],
+ accountList: [],
offerings: [],
offeringLoading: false,
formats: ['RAW', 'VHD', 'VHDX', 'OVA', 'QCOW2'],
zoneSelected: '',
+ domainId: null,
+ account: null,
uploadParams: null,
+ domainLoading: false,
loading: false,
uploadPercentage: 0
}
@@ -164,7 +202,7 @@ export default {
this.apiParams = this.$getApiParams('getUploadParamsForVolume')
},
created () {
- this.listZones()
+ this.fetchData()
},
methods: {
listZones () {
@@ -210,6 +248,54 @@ export default {
this.fileList = [...this.fileList, file]
return false
},
+ handleDomainChange (domain) {
+ this.domainId = domain
+ if ('listAccounts' in this.$store.getters.apis) {
+ this.fetchAccounts()
+ }
+ },
+ handleAccountChange (acc) {
+ if (acc) {
+ this.account = acc.name
+ } else {
+ this.account = acc
+ }
+ },
+ fetchData () {
+ this.listZones()
+ if ('listDomains' in this.$store.getters.apis) {
+ this.fetchDomains()
+ }
+ },
+ fetchDomains () {
+ this.domainLoading = true
+ api('listDomains', {
+ listAll: true,
+ details: 'min'
+ }).then(response => {
+ this.domainList = response.listdomainsresponse.domain
+
+ if (this.domainList[0]) {
+ this.handleDomainChange(null)
+ }
+ }).catch(error => {
+ this.$notifyError(error)
+ }).finally(() => {
+ this.domainLoading = false
+ })
+ },
+ fetchAccounts () {
+ api('listAccounts', {
+ domainid: this.domainId
+ }).then(response => {
+ this.accountList = response.listaccountsresponse.account || []
+ if (this.accountList && this.accountList.length === 0) {
+ this.handleAccountChange(null)
+ }
+ }).catch(error => {
+ this.$notifyError(error)
+ })
+ },
handleSubmit (e) {
e.preventDefault()
if (this.loading) return
@@ -228,6 +314,7 @@ export default {
}
params[key] = input
}
+ params.domainId = this.domainId
this.loading = true
api('getUploadParamsForVolume', params).then(json => {
this.uploadParams = json.postuploadvolumeresponse?.getuploadparams || ''
diff --git a/ui/src/views/storage/UploadVolume.vue b/ui/src/views/storage/UploadVolume.vue
new file mode 100644
index 00000000000..79fbe0d2726
--- /dev/null
+++ b/ui/src/views/storage/UploadVolume.vue
@@ -0,0 +1,318 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+
+
+
+
+
+
+