You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by sj...@apache.org on 2015/04/08 11:40:15 UTC

[09/10] incubator-brooklyn git commit: in js gui, show template yaml also for blueprints with yaml in a service

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


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/3077197e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/3077197e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/3077197e

Branch: refs/heads/master
Commit: 3077197ee7e79746c72b9ec8e8fab8fbfcf68ae2
Parents: a67d4e6
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Wed Apr 8 10:10:09 2015 +0100
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
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/incubator-brooklyn/blob/3077197e/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;
                         }
                     }