brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [06/50] [abbrv] brooklyn-ui git commit: gui ability to run groovy script, with rest support, and util classes to intercept stdout/stderr; plus style tidies
Date Mon, 01 Feb 2016 17:51:39 GMT
gui ability to run groovy script, with rest support, and util classes to intercept stdout/stderr;
plus style tidies


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

Branch: refs/heads/0.5.0
Commit: bb4a30366ae45c35aa5f5230e8194d0980838909
Parents: 375df6b
Author: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Authored: Sun Nov 18 23:14:13 2012 +0000
Committer: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Committed: Mon Nov 19 00:30:38 2012 +0000

----------------------------------------------------------------------
 .../src/main/webapp/assets/css/prettybrook.css  | 142 ++++++++++++++++++-
 usage/jsgui/src/main/webapp/assets/js/router.js |  28 +++-
 .../src/main/webapp/assets/js/view/apidoc.js    |  61 ++++++++
 .../assets/js/view/application-explorer.js      |   2 +-
 .../src/main/webapp/assets/js/view/hack.js      |  77 ----------
 .../main/webapp/assets/js/view/script-groovy.js | 114 +++++++++++++++
 .../main/webapp/assets/tpl/apps/config-row.html |   5 +-
 .../src/main/webapp/assets/tpl/apps/config.html |   1 -
 .../main/webapp/assets/tpl/apps/sensor-row.html |   4 +-
 .../main/webapp/assets/tpl/hack/swagger.html    |   8 --
 .../main/webapp/assets/tpl/script/groovy.html   |  68 +++++++++
 .../main/webapp/assets/tpl/script/swagger.html  |   8 ++
 usage/jsgui/src/main/webapp/index.html          |   9 +-
 13 files changed, 425 insertions(+), 102 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/bb4a3036/usage/jsgui/src/main/webapp/assets/css/prettybrook.css
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/webapp/assets/css/prettybrook.css b/usage/jsgui/src/main/webapp/assets/css/prettybrook.css
index e4e3fca..73a1433 100644
--- a/usage/jsgui/src/main/webapp/assets/css/prettybrook.css
+++ b/usage/jsgui/src/main/webapp/assets/css/prettybrook.css
@@ -50,6 +50,10 @@
 	background-color: #492;
 }
 
+ul.dropdown-menu {
+    text-align: left;
+}
+
 /* tabs eg catalog page */
 .nav-tabs>li,.nav-pills>li {
 	float: left;
@@ -71,6 +75,77 @@
 	border-radius: 5px 5px 0 0;
 }
 
+/* bootstrap overrides */
+a {
+    color: #075;
+}
+code {
+    color: #273;
+}
+/* buttons (override bootstrap) */
+.btn-info {
+  background-color: #49cdaf;
+  *background-color: #2fb496;
+  background-image: -ms-linear-gradient(top, #5bdec0, #2fb496);
+  background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#5bdec0), to(#2fb496));
+  background-image: -webkit-linear-gradient(top, #5bdec0, #2fb496);
+  background-image: -o-linear-gradient(top, #5bdec0, #2fb496);
+  background-image: -moz-linear-gradient(top, #5bdec0, #2fb496);
+  background-image: linear-gradient(top, #5bdec0, #2fb496);
+  background-repeat: repeat-x;
+  border-color: #2fb496 #2fb496 #1f7763;
+  border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
+  filter: progid:dximagetransform.microsoft.gradient(startColorstr='#5bdec0', endColorstr='#2fb496',
GradientType=0);
+  filter: progid:dximagetransform.microsoft.gradient(enabled=false);
+}
+
+.btn-info:hover,
+.btn-info:active,
+.btn-info.active,
+.btn-info.disabled,
+.btn-info[disabled] {
+  background-color: #2fb496;
+  *background-color: #2aa085;
+}
+
+.btn-info:active,
+.btn-info.active {
+  background-color: #248c74 \9;
+}
+
+/* unchanged from bootstrap
+.btn-inverse {
+  background-color: #414141;
+  *background-color: #222222;
+  background-image: -ms-linear-gradient(top, #555555, #222222);
+  background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#555555), to(#222222));
+  background-image: -webkit-linear-gradient(top, #555555, #222222);
+  background-image: -o-linear-gradient(top, #555555, #222222);
+  background-image: -moz-linear-gradient(top, #555555, #222222);
+  background-image: linear-gradient(top, #555555, #222222);
+  background-repeat: repeat-x;
+  border-color: #222222 #222222 #000000;
+  border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
+  filter: progid:dximagetransform.microsoft.gradient(startColorstr='#555555', endColorstr='#222222',
GradientType=0);
+  filter: progid:dximagetransform.microsoft.gradient(enabled=false);
+}
+
+.btn-inverse:hover,
+.btn-inverse:active,
+.btn-inverse.active,
+.btn-inverse.disabled,
+.btn-inverse[disabled] {
+  background-color: #222222;
+  *background-color: #151515;
+}
+
+.btn-inverse:active,
+.btn-inverse.active {
+  background-color: #080808 \9;
+}
+*/
+
+
 /* home page squares */
 .home-summaries-row {
 	text-align: center;
@@ -525,4 +600,69 @@ div.for-empty-table {
 
 .message-fail {
 	color: #cc0000;
-}
\ No newline at end of file
+}
+
+/** groovy script */
+#groovy-ui-container textarea {
+	width: 100%;
+	height: 8em;
+	font-family: Consolas, Lucida Console, Monaco, monospace;
+	white-space: pre;
+	word-wrap: normal; 
+	overflow-x: scroll;
+	overflow-y: scroll;
+}
+#groovy-ui-container .input textarea {
+    height: 16em;
+}
+#groovy-ui-container .toggler-region {
+	margin-top: 0.5em;
+	margin-bottom: 1em;
+}
+#groovy-ui-container .groovy-scripting-text {
+	margin-top: 0.5em;
+}
+#groovy-ui-container div.submit {
+   float: "right";
+}
+
+#groovy-ui-container .input {
+    width: 48%;
+}
+#groovy-ui-container div.submit {
+    text-align: right;
+}
+
+#groovy-ui-container .output {
+	width: 48%;
+    float: right;
+}
+.toggler-header {
+	cursor: hand; cursor: pointer;
+	margin-bottom: 3px;
+}
+.toggler-icon {
+	float: right;
+}
+.user-hidden .toggler-icon {
+}
+
+/** trick for making textareas with width 100% line up (silly width 100% excludes padding)
*/
+div.for-textarea {
+	padding-left: 0.6em;
+}
+div.for-textarea > textarea {
+	padding-left: 0.3em;
+	padding-right: 0.3em;
+	margin-left: -0.6em;
+}
+#groovy-ui-container p {
+	margin-top: 4px;
+}
+#groovy-ui-container a {
+    color: inherit;
+}
+#groovy-ui-container a:hover {
+    text-decoration: underline;
+    cursor: hand; cursor: pointer;
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/bb4a3036/usage/jsgui/src/main/webapp/assets/js/router.js
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/webapp/assets/js/router.js b/usage/jsgui/src/main/webapp/assets/js/router.js
index 4ac65b3..a763d72 100644
--- a/usage/jsgui/src/main/webapp/assets/js/router.js
+++ b/usage/jsgui/src/main/webapp/assets/js/router.js
@@ -1,7 +1,10 @@
 define([
     'underscore', 'jquery', 'backbone', "model/application", "model/app-tree", "model/location",
-    "view/home", "view/application-explorer", "view/catalog", "view/hack", "text!tpl/help/page.html"
-], function (_, $, Backbone, Application, AppTree, Location, HomeView, ExplorerView, CatalogView,
HackView, HelpHtml) {
+    "view/home", "view/application-explorer", "view/catalog", "view/apidoc", "view/script-groovy",

+    "text!tpl/help/page.html"
+], function (_, $, Backbone, Application, AppTree, Location, 
+        HomeView, ExplorerView, CatalogView, ApidocView, ScriptGroovyView, 
+        HelpHtml) {
 
     // add close method to all views for clean-up
 	// (NB we have to update the prototype _here_ before any views are instantiated;
@@ -35,7 +38,8 @@ define([
             'v1/applications':'applicationsPage',
             'v1/locations':'catalogPage',
             'v1/catalog':'catalogPage',
-            'v1/hack':'hackPage',
+            'v1/apidoc':'apidocPage',
+            'v1/script/groovy':'scriptGroovyPage',
             'v1/help':'helpPage',
             '*path':'defaultRoute'
         },
@@ -91,11 +95,21 @@ define([
                 that.showView("#application-content", catalogResource)
             }})
         },
-        hackPage:function () {
-            var hackResource = new HackView({})
-            this.showView("#application-content", hackResource)
+        apidocPage:function () {
+            var apidocResource = new ApidocView({})
+            this.showView("#application-content", apidocResource)
             $(".nav1").removeClass("active")
-            $(".nav1_hack").addClass("active")
+            $(".nav1_script").addClass("active")
+            $(".nav1_apidoc").addClass("active")
+        },
+        scriptGroovyPage:function () {
+            console.log(this.scriptGroovyResource)
+            if (this.scriptGroovyResource === undefined)
+                this.scriptGroovyResource = new ScriptGroovyView({})
+            this.showView("#application-content", this.scriptGroovyResource)
+            $(".nav1").removeClass("active")
+            $(".nav1_script").addClass("active")
+            $(".nav1_script_groovy").addClass("active")
         },
         helpPage:function () {
             var that = this

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/bb4a3036/usage/jsgui/src/main/webapp/assets/js/view/apidoc.js
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/webapp/assets/js/view/apidoc.js b/usage/jsgui/src/main/webapp/assets/js/view/apidoc.js
new file mode 100644
index 0000000..b6b3fe5
--- /dev/null
+++ b/usage/jsgui/src/main/webapp/assets/js/view/apidoc.js
@@ -0,0 +1,61 @@
+define([
+    "underscore", "jquery", "backbone",
+    "text!tpl/script/swagger.html", 
+    
+    "jquery-slideto",
+    "jquery-wiggle",
+    "jquery-ba-bbq",
+    "handlebars",
+    "bootstrap"
+], function (_, $, Backbone, SwaggerHtml) {
+
+    var ApidocView = Backbone.View.extend({
+        tagName:"div",
+        className:"container container-fluid",
+        swaggerTemplate:_.template(SwaggerHtml),
+
+        initialize:function () {
+        },
+        render:function (eventName) {
+            this.$el.html(_.template(SwaggerHtml, {}))
+            this.loadSwagger()
+            return this
+        },
+        
+        loadSwagger: function() {
+            require( [
+                    "/assets/js/libs/swagger.js",
+                    "/assets/js/libs/swagger-ui.js" ],
+                    function() {
+                        
+            var swaggerUi = new SwaggerUi({
+                basePath:"",
+                discoveryUrl:"/v1/apidoc",
+                dom_id:"swagger-ui-container",
+                supportHeaderParams: false,
+                supportedSubmitMethods: ['get', 'post', 'put'],
+                onComplete: function(swaggerApi, swaggerUi){
+                    if(console) {
+                        console.log("Loaded SwaggerUI")
+                        console.log(swaggerApi);
+                        console.log(swaggerUi);
+                    }
+                },
+                onFailure: function(data) {
+                    if(console) {
+                        console.log("Unable to Load SwaggerUI");
+                        console.log(data);
+                    }
+                },
+                docExpansion: "none"
+            });
+
+            swaggerUi.load();
+            })
+            
+        }
+
+    })
+    
+    return ApidocView
+})
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/bb4a3036/usage/jsgui/src/main/webapp/assets/js/view/application-explorer.js
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/webapp/assets/js/view/application-explorer.js b/usage/jsgui/src/main/webapp/assets/js/view/application-explorer.js
index 03e0b45..4c7ff02 100644
--- a/usage/jsgui/src/main/webapp/assets/js/view/application-explorer.js
+++ b/usage/jsgui/src/main/webapp/assets/js/view/application-explorer.js
@@ -29,13 +29,13 @@ define([
                 collection:this.collection
             })
             this.$('div#tree-list').html(this.treeView.render().el)
+            this.treeView.render()
         },
         beforeClose:function () {
             this.collection.off("reset", this.render)
             this.treeView.close()
         },
         render:function () {
-            this.treeView.render()
             return this
         },
         

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/bb4a3036/usage/jsgui/src/main/webapp/assets/js/view/hack.js
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/webapp/assets/js/view/hack.js b/usage/jsgui/src/main/webapp/assets/js/view/hack.js
deleted file mode 100644
index 55d9f74..0000000
--- a/usage/jsgui/src/main/webapp/assets/js/view/hack.js
+++ /dev/null
@@ -1,77 +0,0 @@
-define([
-    "underscore", "jquery", "backbone",
-    "text!tpl/hack/swagger.html", 
-    
-    "jquery-slideto",
-    "jquery-wiggle",
-    "jquery-ba-bbq",
-    "handlebars",
-    "bootstrap"
-], function (_, $, Backbone, SwaggerHtml) {
-
-//    <link href='http://fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet'
type='text/css'/>
-//    <link href='css/screen.css' media='screen' rel='stylesheet' type='text/css'/>
-    
-//    <script src='/assets/js/libs/jquery.js' type='text/javascript'></script>
-    
-//    <script src='lib/jquery.slideto.min.js' type='text/javascript'></script>
-//    <script src='lib/jquery.wiggle.min.js' type='text/javascript'></script>
-//    <script src='lib/jquery.ba-bbq.min.js' type='text/javascript'></script>
-//    <script src='lib/handlebars-1.0.rc.1.js' type='text/javascript'></script>
-//    <script src='lib/swagger.js' type='text/javascript'></script>
-//    <script src='swagger-ui.js' type='text/javascript'></script>
-    
-    
-//    <script src='/assets/js/libs/underscore.js' type='text/javascript'></script>
-//    <script src='/assets/js/libs/backbone.js' type='text/javascript'></script>
-
-    var HackView = Backbone.View.extend({
-        tagName:"div",
-        className:"container container-fluid",
-        swaggerTemplate:_.template(SwaggerHtml),
-
-        initialize:function () {
-        },
-        render:function (eventName) {
-            this.$el.html(_.template(SwaggerHtml, {}))
-            this.loadSwagger()
-            return this
-        },
-        
-        loadSwagger: function() {
-            require( [
-                    "/assets/js/libs/swagger.js",
-                    "/assets/js/libs/swagger-ui.js" ],
-                    function() {
-                        
-            var swaggerUi = new SwaggerUi({
-                basePath:"",
-                discoveryUrl:"/v1/apidoc",
-                dom_id:"swagger-ui-container",
-                supportHeaderParams: false,
-                supportedSubmitMethods: ['get', 'post', 'put'],
-                onComplete: function(swaggerApi, swaggerUi){
-                    if(console) {
-                        console.log("Loaded SwaggerUI")
-                        console.log(swaggerApi);
-                        console.log(swaggerUi);
-                    }
-                },
-                onFailure: function(data) {
-                    if(console) {
-                        console.log("Unable to Load SwaggerUI");
-                        console.log(data);
-                    }
-                },
-                docExpansion: "none"
-            });
-
-            swaggerUi.load();
-            })
-            
-        }
-
-    })
-    
-    return HackView
-})
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/bb4a3036/usage/jsgui/src/main/webapp/assets/js/view/script-groovy.js
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/webapp/assets/js/view/script-groovy.js b/usage/jsgui/src/main/webapp/assets/js/view/script-groovy.js
new file mode 100644
index 0000000..b0a1e12
--- /dev/null
+++ b/usage/jsgui/src/main/webapp/assets/js/view/script-groovy.js
@@ -0,0 +1,114 @@
+define([
+    "underscore", "jquery", "backbone",
+    "text!tpl/script/groovy.html", 
+    
+    "jquery-slideto",
+    "jquery-wiggle",
+    "jquery-ba-bbq",
+    "handlebars",
+    "bootstrap"
+], function (_, $, Backbone, GroovyHtml) {
+
+    var ScriptGroovyView = Backbone.View.extend({
+        tagName:"div",
+        events:{
+            "click #groovy-ui-container #submit":"submitScript",
+            "click #load-example":"loadExample"
+        },
+        className:"container container-fluid",
+        groovyTemplate:_.template(GroovyHtml),
+
+        initialize:function () {
+            this.reset();
+        },
+        reset: function() {
+            this.$el.html(_.template(GroovyHtml, {}))
+            $(".output", this.$el).hide()
+            $(".output .toggler-region", this.$el).hide()
+            $(".toggler-header", this.$el).click(this.toggleNext)
+        },
+        render:function (eventName) {
+            return this
+        },
+        toggleNext: function(event) {
+            var root = $(event.currentTarget).closest(".toggler-header");
+            root.toggleClass("user-hidden");
+            $(".toggler-icon", root).
+                toggleClass("icon-chevron-left").
+                toggleClass("icon-chevron-down");
+                
+            var next = root.next();
+            if (root.hasClass("user-hidden")) 
+                next.hide('fast');
+            else 
+                next.show('fast')
+        },
+        loadExample: function() {
+            $(".input textarea").val(
+                    'import static brooklyn.entity.basic.Entities.*\n'+
+                    '\n'+
+                    'println "Last result: "+last\n'+
+                    'data.exampleRunCount = (data.exampleRunCount ?: 0) + 1\n'+
+                    'println "Example run count: ${data.exampleRunCount}"\n'+
+                    '\n'+
+                    'println "Application count: ${mgmt.applications.size()}\\n"\n'+
+                    '\n'+
+                    'mgmt.applications.each { dumpInfo(it) }\n'+
+                    '\n'+
+                    'return mgmt.applications\n')
+        },
+        submitScript: function() {
+            var script = $("#groovy-ui-container #script").val()
+            $(".output .toggler-region", this.$el).hide()
+            $(".output .throbber", this.$el).show()
+            $(".output", this.$el).show()
+            $.ajax({
+                type:"POST",
+                url:"/v1/script/groovy",
+                data:script,
+                contentType:"application/text",
+                success:function (data) {
+                    $(".output .throbber", this.$el).hide()
+                    
+                    if (data.result !== undefined)
+                        $(".output .result textarea").val(data.result)
+                    else
+                        $(".output .result textarea").val("")
+                    $(".output .result").show()
+                    
+                    if (data.problem !== undefined) {
+                        $(".output .error textarea").val(data.problem)
+                        $(".output .error").show()
+                    } else {
+                        $(".output .error").hide()
+                    }
+
+                    if (data.stdout !== undefined) {
+                        $(".output .stdout textarea").val(data.stdout)
+                        $(".output .stdout").show()
+                    } else {
+                        $(".output .stdout").hide()
+                    }
+
+                    if (data.stderr !== undefined) {
+                        $(".output .stderr textarea").val(data.stderr)
+                        $(".output .stderr").show()
+                    } else {
+                        $(".output .stderr").hide()
+                    }
+                },
+                error: function(data) {
+                    $(".output .throbber", this.$el).hide()
+                    $("#groovy-ui-container div.error").val("ERROR: "+data)
+                    $(".output .error").show()
+                    
+                    // console.log might cause errors in some browsers but that's fine here
(already an error)
+                    console.log("ERROR submitting script")
+                    console.log(data)
+                }})
+        }
+        
+    })
+    
+    return ScriptGroovyView
+})
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/bb4a3036/usage/jsgui/src/main/webapp/assets/tpl/apps/config-row.html
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/webapp/assets/tpl/apps/config-row.html b/usage/jsgui/src/main/webapp/assets/tpl/apps/config-row.html
index c6ab948..8ee0624 100644
--- a/usage/jsgui/src/main/webapp/assets/tpl/apps/config-row.html
+++ b/usage/jsgui/src/main/webapp/assets/tpl/apps/config-row.html
@@ -3,7 +3,4 @@
         rel="tooltip" title="<b><%= description %></b><br/>(<%=
type %>)" data-placement="left"
         ><%= name %></span></td>
     <td class="config-value"><%= (value === undefined ? "" : value) %></td>
-    <td class="config-actions">
-        <!-- TODO link to html --> 
-    </td>
-</tr>
\ No newline at end of file
+</tr>

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/bb4a3036/usage/jsgui/src/main/webapp/assets/tpl/apps/config.html
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/webapp/assets/tpl/apps/config.html b/usage/jsgui/src/main/webapp/assets/tpl/apps/config.html
index 8484a9e..be79099 100644
--- a/usage/jsgui/src/main/webapp/assets/tpl/apps/config.html
+++ b/usage/jsgui/src/main/webapp/assets/tpl/apps/config.html
@@ -3,7 +3,6 @@
     <tr>
         <th>Name</th>
         <th>Value</th>
-        <th>Actions</th>
     </tr>
     </thead>
     <tbody></tbody>

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/bb4a3036/usage/jsgui/src/main/webapp/assets/tpl/apps/sensor-row.html
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/webapp/assets/tpl/apps/sensor-row.html b/usage/jsgui/src/main/webapp/assets/tpl/apps/sensor-row.html
index 403993e..0ff2ca7 100644
--- a/usage/jsgui/src/main/webapp/assets/tpl/apps/sensor-row.html
+++ b/usage/jsgui/src/main/webapp/assets/tpl/apps/sensor-row.html
@@ -4,6 +4,6 @@
         ><%= name %></span></td>
     <td class="sensor-value"><%= value %></td>
     <td class="sensor-actions">
-        <!-- TODO link to html --> 
+        <!-- TODO return available actions e.g. open, jmx, etc (todo in REST api) -->
     </td>
-</tr>
\ No newline at end of file
+</tr>

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/bb4a3036/usage/jsgui/src/main/webapp/assets/tpl/hack/swagger.html
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/webapp/assets/tpl/hack/swagger.html b/usage/jsgui/src/main/webapp/assets/tpl/hack/swagger.html
deleted file mode 100644
index f60d6cb..0000000
--- a/usage/jsgui/src/main/webapp/assets/tpl/hack/swagger.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<link rel="stylesheet" href="/assets/css/swagger.css">
-
-<div id="message-bar" class="swagger-ui-wrap">
-    &nbsp;
-</div>
-
-<div id="swagger-ui-container" class="swagger-ui-wrap">
-</div>

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/bb4a3036/usage/jsgui/src/main/webapp/assets/tpl/script/groovy.html
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/webapp/assets/tpl/script/groovy.html b/usage/jsgui/src/main/webapp/assets/tpl/script/groovy.html
new file mode 100644
index 0000000..ebfb221
--- /dev/null
+++ b/usage/jsgui/src/main/webapp/assets/tpl/script/groovy.html
@@ -0,0 +1,68 @@
+<div id="message-bar" class="label-important hide">
+</div>
+
+<div id="groovy-ui-container">
+    
+    <div class="output">
+        <div class="throbber"><img src="/assets/images/throbber.gif"/></div>
+        
+        <div class="toggler-region error">
+            <div class="toggler-header">
+                <div class="toggler-icon icon-chevron-down"></div>
+                <div><b>Error</b></div>
+            </div>
+            <div class="for-textarea"><textarea readonly="readonly" placeholder="no
error"></textarea></div>
+        </div>
+            
+        <div class="toggler-region result">
+            <div class="toggler-header">
+                <div class="toggler-icon icon-chevron-down"></div>
+                <div><b>Result</b></div>
+            </div>
+            <div class="for-textarea"><textarea readonly="readonly" placeholder="no
result"></textarea></div>
+        </div>
+
+        <div class="toggler-region stdout">
+            <div class="toggler-header">
+                <div class="toggler-icon icon-chevron-down"></div>
+                <div><b>Output (stdout)</b></div>
+            </div>
+            <div class="for-textarea"><textarea readonly="readonly"></textarea></div>
+        </div>
+
+        <div class="toggler-region stderr">
+            <div class="toggler-header">
+                <div class="toggler-icon icon-chevron-down"></div>
+                <div><b>Output (stderr)</b></div>
+            </div>
+            <div class="for-textarea"><textarea readonly="readonly"></textarea></div>
+        </div>
+    </div>
+
+    <div class="input">
+        <div class="toggler-region">
+            <div class="toggler-header">
+                <div class="toggler-icon icon-chevron-down"></div>
+                <div><h3>Groovy Scripting</h3></div>
+            </div>
+            
+            <div class="groovy-scripting-text">
+                Enter code to run on the Brooklyn Server.
+                <p><ul>
+                <li><code>mgmt</code> is the management context</li>
+                <li><code>last</code> is the result of your last successful
script</li>
+                <li><code>data</code> is user-session map for storing your
data</li>
+                </ul><p>
+                <a id="load-example">Click to load an example.</a>
+            </div>
+        </div>
+        
+        <div class="toggler-region for-textarea">
+            <textarea id="script" placeholder="Enter script here"></textarea>
+        </div>
+        <div class="submit">
+            <button id="submit" class="btn btn-info btn-mini">Submit</button>
+        </div>
+    </div>
+
+</div>

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/bb4a3036/usage/jsgui/src/main/webapp/assets/tpl/script/swagger.html
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/webapp/assets/tpl/script/swagger.html b/usage/jsgui/src/main/webapp/assets/tpl/script/swagger.html
new file mode 100644
index 0000000..f60d6cb
--- /dev/null
+++ b/usage/jsgui/src/main/webapp/assets/tpl/script/swagger.html
@@ -0,0 +1,8 @@
+<link rel="stylesheet" href="/assets/css/swagger.css">
+
+<div id="message-bar" class="swagger-ui-wrap">
+    &nbsp;
+</div>
+
+<div id="swagger-ui-container" class="swagger-ui-wrap">
+</div>

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/bb4a3036/usage/jsgui/src/main/webapp/index.html
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/webapp/index.html b/usage/jsgui/src/main/webapp/index.html
index 04d00f1..c12acb0 100644
--- a/usage/jsgui/src/main/webapp/index.html
+++ b/usage/jsgui/src/main/webapp/index.html
@@ -50,7 +50,13 @@
                     <li><a href="#/v1/home" class="nav1 nav1_home">Home</a></li>
                     <li><a href="#/v1/applications" class="nav1 nav1_apps">Applications</a></li>
                     <li><a href="#/v1/catalog" class="nav1 nav1_catalog">Catalog</a></li>
-                    <li><a href="#/v1/hack" class="nav1 nav1_hack">REST API</a></li>
+                    <li class="dropdown">
+                        <a href="#" class="nav1 nav1_script dropdown-toggle" data-toggle="dropdown">Script</a>
+                        <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
+                        <li><a href="#/v1/apidoc" class="nav1 nav1_apidoc">REST
API</a></li>
+                        <li><a href="#/v1/script/groovy" class="nav1 nav1_groovy">Groovy</a></li>
+                        </ul>
+                    </li>
                     <li><a href="#/v1/help" class="nav1 nav1_help"><b>?</b></a></li>
                 </ul>
             </div>
@@ -60,6 +66,7 @@
 </div>
 
 <div id="application-content"></div>
+
 <!-- load our code with require.js -->
 <script type="text/javascript" data-main="assets/js/config.js" src="assets/js/libs/require.js"></script>
 


Mime
View raw message