DaanHoogland commented on code in PR #11164:
URL: https://github.com/apache/cloudstack/pull/11164#discussion_r2239269318


##########
ui/src/views/compute/DeployVM.vue:
##########
@@ -1996,6 +2016,46 @@ export default {
           this.updateTemplateLinkedUserData(this.iso.userdataid)
           this.userdataDefaultOverridePolicy = this.iso.userdatapolicy
         }
+      } else if (name === 'volumeid') {
+        this.imageType = 'volumeid'
+        this.resetTemplateAssociatedResources()
+        this.resetFromTemplateConfiguration()
+        this.form.templateid = null
+        this.form.isoid = null
+        this.form.volumeid = value
+        this.form.snapshotid = null
+        let volume = null
+        for (const entry of Object.values(this.options.volumes)) {
+          volume = entry?.volume.find(option => option.id === value)
+          if (volume) {
+            this.volume = volume
+            break
+          }
+        }
+        if (volume) {
+          this.updateTemplateLinkedUserData(this.volume.userdataid)
+          this.userdataDefaultOverridePolicy = this.volume.userdatapolicy
+        }
+      } else if (name === 'snapshotid') {
+        this.imageType = 'snapshotid'
+        this.resetTemplateAssociatedResources()
+        this.resetFromTemplateConfiguration()
+        this.form.templateid = null
+        this.form.isoid = null
+        this.form.volumeid = null
+        this.form.snapshotid = value
+        let snapshot = null
+        for (const entry of Object.values(this.options.snapshots)) {
+          snapshot = entry?.snapshot.find(option => option.id === value)
+          if (snapshot) {
+            this.snapshot = snapshot
+            break
+          }
+        }
+        if (snapshot) {
+          this.updateTemplateLinkedUserData(this.snapshot.userdataid)
+          this.userdataDefaultOverridePolicy = this.snapshot.userdatapolicy
+        }

Review Comment:
   I would personally extract these two blocks in speparate methods, but ...



-- 
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: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to