Github user rodrigo93 commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/1320#discussion_r52106924 --- Diff: ui/scripts/instanceWizard.js --- @@ -294,53 +295,67 @@ // Step 3: Service offering function(args) { - selectedTemplateObj = null; //reset - if (args.currentData["select-template"] == "select-template") { - if (featuredTemplateObjs != null && featuredTemplateObjs.length > 0) { - for (var i = 0; i < featuredTemplateObjs.length; i++) { - if (featuredTemplateObjs[i].id == args.currentData.templateid) { - selectedTemplateObj = featuredTemplateObjs[i]; - break; + snapshotObjs = null; + selectedSnapshotObj = null; + + if (args.moreArgs && args.moreArgs.snapshot) + { + zoneObjs = args.moreArgs.zone; + selectedZoneObj = zoneObjs[0]; + hypervisorObjs = args.moreArgs.hypervisor; + selectedHypervisor = hypervisorObjs[0].name; + snapshotObjs = args.moreArgs.snapshot; + selectedSnapshotObj = snapshotObjs[0]; + } + else { + selectedTemplateObj = null; //reset + if (args.currentData["select-template"] == "select-template") { + if (featuredTemplateObjs != null && featuredTemplateObjs.length > 0) { + for (var i = 0; i < featuredTemplateObjs.length; i++) { + if (featuredTemplateObjs[i].id == args.currentData.templateid) { + selectedTemplateObj = featuredTemplateObjs[i]; + break; + } } } - } - if (selectedTemplateObj == null) { - if (communityTemplateObjs != null && communityTemplateObjs.length > 0) { - for (var i = 0; i < communityTemplateObjs.length; i++) { - if (communityTemplateObjs[i].id == args.currentData.templateid) { - selectedTemplateObj = communityTemplateObjs[i]; - break; + if (selectedTemplateObj == null) { --- End diff -- Hi @nitin-maharana Couldn't this _if_ and the following _ifs_ be merged into one? Like: > if ( selectedTemplateObj == null && communityTemplateObjs != null && communityTemplateObjs.length > 0)
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---