abh1sar commented on code in PR #12296:
URL: https://github.com/apache/cloudstack/pull/12296#discussion_r2650238116
##########
ui/src/views/infra/AddSecondaryStorage.vue:
##########
@@ -229,16 +247,57 @@ export default {
closeModal () {
this.$emit('close-action')
},
+ fetchCopyTemplatesConfig () {
+ if (!this.form.zone) {
+ return
+ }
+
+ api('listConfigurations', {
+ name: 'copy.templates.from.other.secondary.storages',
+ zoneid: this.form.zone
+ }).then(json => {
+ const items =
+ json?.listconfigurationsresponse?.configuration || []
+
+ items.forEach(item => {
+ if (item.name === 'copy.templates.from.other.secondary.storages') {
+ this.form.copyTemplatesFromOtherSecondaryStorages =
+ item.value === 'true'
+ }
+ })
+ })
+ },
listZones () {
api('listZones', { showicon: true }).then(json => {
- if (json && json.listzonesresponse && json.listzonesresponse.zone) {
+ if (json?.listzonesresponse?.zone) {
this.zones = json.listzonesresponse.zone
+
if (this.zones.length > 0) {
this.form.zone = this.zones[0].id || ''
+ this.fetchCopyTemplatesConfig()
+ this.checkOtherSecondaryStorages()
}
}
})
},
+ checkOtherSecondaryStorages () {
+ api('listImageStores', {
+ listall: true
+ }).then(json => {
+ const stores = json?.listimagestoresresponse?.imagestore || []
+
+ this.showCopyTemplatesToggle = stores.some(store => {
+ if (store.providername !== 'NFS') {
+ return false
+ }
+
+ return store.zoneid !== this.form.zone || store.zoneid ===
this.form.zone
Review Comment:
what is this condition checking?
##########
ui/src/views/infra/AddSecondaryStorage.vue:
##########
@@ -159,6 +163,17 @@
<a-input v-model:value="form.secondaryStorageNFSPath"/>
</a-form-item>
</div>
+ <div v-if="form.provider === 'NFS' && showCopyTemplatesToggle">
+ <a-form-item
+ name="copyTemplatesFromOtherSecondaryStorages"
+ ref="copyTemplatesFromOtherSecondaryStorages"
+ :label="$t('label.copy.templates.from.other.secondary.storages')">
+ <a-switch
Review Comment:
Should we have similar switch while adding a secondary storage through the
zone creation wizard?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]