CLOUDSTACK-8075: UI > Instances menu > Add Instance > Select template/ISO > 
"shared" tab > select a shared template, click Next button => fix error "unable 
to find matched template object".


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/11fa4810
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/11fa4810
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/11fa4810

Branch: refs/heads/master
Commit: 11fa48108ffc5ef7b276f7261b29eaca406105b8
Parents: ed5bc1c
Author: Jessica Wang <[email protected]>
Authored: Wed Dec 17 10:58:43 2014 -0800
Committer: Jessica Wang <[email protected]>
Committed: Wed Dec 17 10:58:43 2014 -0800

----------------------------------------------------------------------
 ui/scripts/instanceWizard.js | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/11fa4810/ui/scripts/instanceWizard.js
----------------------------------------------------------------------
diff --git a/ui/scripts/instanceWizard.js b/ui/scripts/instanceWizard.js
index a067d7d..984c6e3 100644
--- a/ui/scripts/instanceWizard.js
+++ b/ui/scripts/instanceWizard.js
@@ -323,11 +323,22 @@
                                 }
                             }
                         }
-                    }
-                    if (selectedTemplateObj == null)
+                    }                    
+                    if (selectedTemplateObj == null) {
+                        if (sharedTemplateObjs != null && 
sharedTemplateObjs.length > 0) {
+                            for (var i = 0; i < sharedTemplateObjs.length; 
i++) {
+                                if (sharedTemplateObjs[i].id == 
args.currentData.templateid) {
+                                    selectedTemplateObj = 
sharedTemplateObjs[i];
+                                    break;
+                                }
+                            }
+                        }
+                    }                    
+                    if (selectedTemplateObj == null) {
                         alert("unable to find matched template object");
-                    else
+                    } else {
                         selectedHypervisor = selectedTemplateObj.hypervisor;
+                    }
                 } else { //(args.currentData["select-template"] == "select-iso"
                     selectedHypervisor = args.currentData.hypervisorid;
                 }

Reply via email to