in js gui, show template yaml also for blueprints with yaml in a service

Project: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/commit/2a8f40cd
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/tree/2a8f40cd
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/diff/2a8f40cd

Branch: refs/heads/0.7.0-incubating
Commit: 2a8f40cd43a9dc01f54c243e289508bf33672179
Parents: dd37fee
Author: Alex Heneveld <[email protected]>
Authored: Wed Apr 8 10:10:09 2015 +0100
Committer: Alex Heneveld <[email protected]>
Committed: Wed Apr 8 10:10:47 2015 +0100

----------------------------------------------------------------------
 .../assets/js/view/application-add-wizard.js       | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/2a8f40cd/usage/jsgui/src/main/webapp/assets/js/view/application-add-wizard.js
----------------------------------------------------------------------
diff --git 
a/usage/jsgui/src/main/webapp/assets/js/view/application-add-wizard.js 
b/usage/jsgui/src/main/webapp/assets/js/view/application-add-wizard.js
index 5c8ffc8..e9427dd 100644
--- a/usage/jsgui/src/main/webapp/assets/js/view/application-add-wizard.js
+++ b/usage/jsgui/src/main/webapp/assets/js/view/application-add-wizard.js
@@ -257,8 +257,23 @@ define([
                     if (yaml) {
                         try {
                             yaml = JsYaml.safeLoad(yaml);
-                            yaml = (yaml.location || yaml.locations ? true : 
false);
+                            hasLocation = yaml.location || yaml.locations;
+                            if (!hasLocation) {
+                              // look for locations defined in locations
+                              svcs = yaml.services;
+                              if (svcs) {
+                                for (svcI in svcs) {
+                                  if (svcs[svcI].location || 
svcs[svcI].locations) {
+                                    hasLocation = true;
+                                    break;
+                                  }
+                                }
+                              }
+                            }
+                            yaml = (hasLocation ? true : false);
                         } catch (e) {
+                            log("Warning: could not parse yaml template")
+                            log(yaml);
                             yaml = false;
                         }
                     }

Reply via email to