brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sjcorb...@apache.org
Subject [2/3] incubator-brooklyn git commit: Revert "wip: none location in add app wizard"
Date Thu, 15 Jan 2015 15:19:25 GMT
Revert "wip: none location in add app wizard"

This reverts commit 359bd1c146f57a6c222458ff8bb1aab36d9791ed.


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

Branch: refs/heads/master
Commit: 2b146b48ffe9e15195c562cffc97b3bd243f3579
Parents: dd5c05a
Author: Sam Corbett <sam.corbett@cloudsoftcorp.com>
Authored: Thu Jan 15 14:56:36 2015 +0000
Committer: Sam Corbett <sam.corbett@cloudsoftcorp.com>
Committed: Thu Jan 15 14:58:15 2015 +0000

----------------------------------------------------------------------
 .../assets/js/view/application-add-wizard.js    | 46 ++++++++++----------
 1 file changed, 24 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/2b146b48/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 a763c86..833a5ff 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
@@ -557,31 +557,33 @@ define([
         },
         renderAddedLocations:function () {
             // renders the locations added to the model
-            var rowTemplate = this.locationRowTemplate,
-                optionTemplate = this.locationOptionTemplate,
-                container = this.$("#selector-container");
-            container.empty();
+            var that = this;
+            var container = this.$("#selector-container")
+            container.empty()
             for (var li = 0; li < this.model.spec.get("locations").length; li++) {
                 var chosenLocation = this.model.spec.get("locations")[li];
-                container.append(rowTemplate({
-                    initialValue: chosenLocation,
-                    rowId: li
-                }));
+                container.append(that.locationRowTemplate({
+                        initialValue: chosenLocation,
+                        rowId: li
+                    }))
             }
-            var $locationOptions = container.find('.select-location');
-            var templated = this.locations.map(function(aLocation) {
-                return optionTemplate({
-                    id: aLocation.id || "",
-                    name: aLocation.getPrettyName()
-                });
-            });
-            // insert "none" location
-            templated.push(optionTemplate({ id: "", name: '&lt;none&gt;' }));
-            $locationOptions.append(templated.join(""));
+            var $locationOptions = container.find('.select-location')
+            this.locations.each(function(aLocation) {
+                    if (!aLocation.id) {
+                        log("missing id for location:");
+                        log(aLocation);
+                    } else {
+                        var $option = that.locationOptionTemplate({
+                            id:aLocation.id,
+                            name:aLocation.getPrettyName()
+                        })
+                        $locationOptions.append($option)
+                    }
+                })
             $locationOptions.each(function(i) {
-                var option = $($locationOptions[i]);
-                option.val(option.parent().attr('initialValue'));
-            });
+                var w = $($locationOptions[i]);
+                w.val( w.parent().attr('initialValue') );
+            })
         },
         render:function () {
             this.delegateEvents()
@@ -669,7 +671,7 @@ define([
             var loc_id = $(event.currentTarget).val();
             var loc = this.locations.find(function (candidate) {
                 return candidate.get("id")==loc_id;
-            });
+            })
             if (!loc) {
                 log("invalid location "+loc_id);
                 this.showFailure("Invalid location "+loc_id);


Mime
View raw message