brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [07/50] [abbrv] brooklyn-ui git commit: LocationRegistry expanded to be stateful, holding the named locations defined in location.properties, and much nicer about how it resolves stuff
Date Mon, 01 Feb 2016 17:51:40 GMT
LocationRegistry expanded to be stateful, holding the named locations defined in location.properties,
and much nicer about how it resolves stuff


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

Branch: refs/heads/0.5.0
Commit: 7b3fa7d9b3ee7c74cb112b886cd055761a196fbc
Parents: b041205
Author: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Authored: Mon Nov 19 23:55:56 2012 +0000
Committer: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Committed: Tue Nov 27 15:46:47 2012 -0800

----------------------------------------------------------------------
 .../src/main/webapp/assets/js/model/location.js | 37 ++++++++++++--------
 .../assets/js/view/catalog-details-location.js  |  2 ++
 .../assets/tpl/catalog/details-location.html    |  7 ++++
 .../javascript/specs/model/location-spec.js     |  6 ++--
 .../specs/view/application-add-wizard-spec.js   | 19 +++++-----
 5 files changed, 46 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/7b3fa7d9/usage/jsgui/src/main/webapp/assets/js/model/location.js
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/webapp/assets/js/model/location.js b/usage/jsgui/src/main/webapp/assets/js/model/location.js
index bdf481b..554fb16 100644
--- a/usage/jsgui/src/main/webapp/assets/js/model/location.js
+++ b/usage/jsgui/src/main/webapp/assets/js/model/location.js
@@ -6,7 +6,9 @@ define(["underscore", "backbone"], function (_, Backbone) {
         urlRoot:'/v1/locations',
         defaults:function () {
             return {
-                provider:'',
+                id:'',
+                name:'',
+                spec:'',
                 config:{},
                 links:{
                     self:''
@@ -14,18 +16,20 @@ define(["underscore", "backbone"], function (_, Backbone) {
             }
         },
         idFromSelfLink:function () {
-            if (this.has('links')) {
-                var links = this.get('links')
-                if (links['self'] && links['self'] != '') {
-                    var s = links['self']
-                    var id = s.substring(s.lastIndexOf('/') + 1)
-                    if (_.isEqual(s, this.urlRoot + '/' + id)) return id
-                }
-            }
-            return void 0
+            // TODO replace with get('id')
+            return this.get('id');
+//            if (this.has('links')) {
+//                var links = this.get('links')
+//                if (links['self'] && links['self'] != '') {
+//                    var s = links['self']
+//                    var id = s.substring(s.lastIndexOf('/') + 1)
+//                    if (_.isEqual(s, this.urlRoot + '/' + id)) return id
+//                }
+//            }
+//            return void 0
         },
         initialize:function () {
-            this.set({'id':this.idFromSelfLink()})
+//            this.set({'id':this.idFromSelfLink()})
         },
         addConfig:function (key, value) {
             if (key) {
@@ -55,10 +59,13 @@ define(["underscore", "backbone"], function (_, Backbone) {
             return (this.getLinkByName("self") === url)
         },
         getPrettyName: function() {
-            var suffix=this.getConfigByName("location");
-            if (suffix==null) suffix=this.getConfigByName("endpoint")
-            if (suffix!=null) suffix=":"+suffix; else suffix="";
-            return this.get("provider")+suffix
+            var name = this.get('name')
+            if (name!=null && name.length>0) return name
+            return this.get('spec')
+//            var suffix=this.getConfigByName("location");
+//            if (suffix==null) suffix=this.getConfigByName("endpoint")
+//            if (suffix!=null) suffix=":"+suffix; else suffix="";
+//            return this.get("provider")+suffix
         }
 
     })

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/7b3fa7d9/usage/jsgui/src/main/webapp/assets/js/view/catalog-details-location.js
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/webapp/assets/js/view/catalog-details-location.js b/usage/jsgui/src/main/webapp/assets/js/view/catalog-details-location.js
index c5bbba4..aff9efc 100644
--- a/usage/jsgui/src/main/webapp/assets/js/view/catalog-details-location.js
+++ b/usage/jsgui/src/main/webapp/assets/js/view/catalog-details-location.js
@@ -16,6 +16,8 @@ define([
             this.$el.html(this.template({
                 title: this.model.getPrettyName(),
                 id: this.model.id,
+                name: this.model.get('name'),
+                spec: this.model.get('spec'),
                 config: this.model.get("config")
             }))
             if (_.size(this.model.get("config"))==0) {

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/7b3fa7d9/usage/jsgui/src/main/webapp/assets/tpl/catalog/details-location.html
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/webapp/assets/tpl/catalog/details-location.html b/usage/jsgui/src/main/webapp/assets/tpl/catalog/details-location.html
index b997e79..f655748 100644
--- a/usage/jsgui/src/main/webapp/assets/tpl/catalog/details-location.html
+++ b/usage/jsgui/src/main/webapp/assets/tpl/catalog/details-location.html
@@ -11,6 +11,13 @@
 <% } else { %>
 
     <br/>
+    <table>
+        <tr><td><b>ID:</b>&nbsp;&nbsp;</td><td><%=
id %></td></tr>
+        <tr><td><b>Name:</b>&nbsp;&nbsp;</td><td><%=
name !== undefined ? name : "" %></td></tr>
+        <tr><td><b>Spec:</b>&nbsp;&nbsp;</td><td><%=
spec !== undefined ? spec : "" %></td></tr>
+    </table>
+    
+    <br/>
     <table class="table table-striped table-condensed nonDatatables">
         <thead><tr>
             <th>Configuration Key</th>

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/7b3fa7d9/usage/jsgui/src/test/javascript/specs/model/location-spec.js
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/test/javascript/specs/model/location-spec.js b/usage/jsgui/src/test/javascript/specs/model/location-spec.js
index 94ae4c4..ecd35f0 100644
--- a/usage/jsgui/src/test/javascript/specs/model/location-spec.js
+++ b/usage/jsgui/src/test/javascript/specs/model/location-spec.js
@@ -8,7 +8,7 @@ define([
 
     describe('model/location', function () {
         it("loads data from fixture file", function () {
-            expect(location.get("provider")).toBe("localhost")
+            expect(location.get("spec")).toBe("localhost")
             expect(location.getLinkByName("self")).toBe("/v1/locations/123")
         })
     })
@@ -21,7 +21,9 @@ define([
         it('loads all model properties defined in fixtures/location-list.json', function
() {
             expect(locationFixtures.length).toEqual(1)
             var spec = locationFixtures.at(0)
-            expect(spec.get("provider")).toEqual('localhost')
+            expect(spec.get("id")).toEqual('123')
+            expect(spec.get("name")).toEqual('localhost')
+            expect(spec.get("spec")).toEqual('localhost')
             expect(spec.get("config")).toEqual({})
             expect(spec.hasSelfUrl('/v1/locations/123')).toBeTruthy()
             expect(spec.getLinkByName("self")).toEqual('/v1/locations/123')

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/7b3fa7d9/usage/jsgui/src/test/javascript/specs/view/application-add-wizard-spec.js
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/test/javascript/specs/view/application-add-wizard-spec.js b/usage/jsgui/src/test/javascript/specs/view/application-add-wizard-spec.js
index adae3d9..8e8ac80 100644
--- a/usage/jsgui/src/test/javascript/specs/view/application-add-wizard-spec.js
+++ b/usage/jsgui/src/test/javascript/specs/view/application-add-wizard-spec.js
@@ -2,14 +2,17 @@
  * Test the ModalWizard can build a modal to view, edit and submit an application.
  */
 define([
-    "underscore", "jquery", "backbone", "view/application-add-wizard", "model/application",
"model/location",
-    "text!tpl/home/step1.html", "text!tpl/home/step2.html", "text!tpl/home/step3.html",
-    "text!tpl/home/step1-location-row.html", "text!tpl/home/step1-location-option.html",
-    "text!tpl/home/step2-entity-entry.html", "text!tpl/home/step2-config-entry.html"
-], function (_, $, Backbone, AppAddWizard, Application, Locations, Entities,
-		Step1Html, Step2Html, Step3Html,
-		Step1LocationRowHtml, LocationOptionHtml,  
-		Step2EntityEntryHtml, Step2ConfigEntryHtml) {
+    "underscore", "jquery", "backbone", "view/application-add-wizard", "model/application",
"model/location"
+//    "text!tpl/home/step1.html", "text!tpl/home/step2.html", "text!tpl/home/step3.html",
+//    "text!tpl/home/step1-location-row.html", "text!tpl/home/step1-location-option.html",
+//    "text!tpl/home/step2-entity-entry.html", "text!tpl/home/step2-config-entry.html"
+], function (_, $, Backbone, AppAddWizard, Application, Locations
+//        , 
+//        Entities,
+//		Step1Html, Step2Html, Step3Html,
+//		Step1LocationRowHtml, LocationOptionHtml,  
+//		Step2EntityEntryHtml, Step2ConfigEntryHtml
+		) {
 
 	/* TEST disabled until we can more cleanly supply javascript.
 	 * should probably move to have one big model,


Mime
View raw message