add a "priority" option to @CatalogConfig and use it to order config keys in 
the catalog creation dialog


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

Branch: refs/heads/0.5.0
Commit: 1b12e3df754507833bd884038857bd008f5ae444
Parents: e08847e
Author: Alex Heneveld <[email protected]>
Authored: Fri Mar 22 15:45:35 2013 +0000
Committer: Alex Heneveld <[email protected]>
Committed: Fri Mar 22 15:45:35 2013 +0000

----------------------------------------------------------------------
 .../webapp/assets/js/view/application-add-wizard.js     | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/1b12e3df/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 01c3579..2aa39b6 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
@@ -459,18 +459,24 @@ define([
             if (catalogEntryItem=="LOADING") {
                 this.$('.required-config-loading').show()
             } else {
+                var configs = []
                 this.$('.required-config-loading').hide()
                 if (catalogEntryItem!=null && catalogEntryItem.config!=null) {
                     var that = this
                     _.each(catalogEntryItem.config, function (cfg) {
-                        if (cfg.label)
+                        if (cfg.label) {
+                            configs.push( { priority: cfg.priority, html: 
_.template(RequiredConfigEntryHtml, {data:cfg}) } )
                             // only include items with labels
-                            
that.$('.config-table').append(_.template(RequiredConfigEntryHtml, {data:cfg}))
+                        }
                         // (others might be included in future with an 
"expand" option, or priority option)
                     })
                 }
+                configs = configs.sort( function(a,b) { return b.priority - 
a.priority } )
+                for (c in configs) {
+                    that.$('.config-table').append(configs[c].html)
+                }
+                // TODO add any manual config supplied by user (in previous 
turn visiting this tab)
             }
-            // TODO add any manually added config
         },
         getConfigMap:function() {
             var map = {}

Reply via email to