minor tidies, nicer toggler header region and fix bugs where groovy script output wasn't expanding, and where click on tab of removed node caused undefined creeping in to url
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/commit/a60c8eb5 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/tree/a60c8eb5 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/diff/a60c8eb5 Branch: refs/heads/0.6.0 Commit: a60c8eb5e2d475b79936e1ce7fcbf363241b70ac Parents: 6228a42 Author: Alex Heneveld <[email protected]> Authored: Mon Sep 16 15:21:25 2013 +0100 Committer: Alex Heneveld <[email protected]> Committed: Wed Sep 18 09:30:06 2013 +0100 ---------------------------------------------------------------------- usage/jsgui/src/main/webapp/assets/css/base.css | 23 +++++++++++--------- .../webapp/assets/js/view/activity-details.js | 4 ++-- .../webapp/assets/js/view/entity-details.js | 10 ++++++--- .../webapp/assets/js/view/entity-summary.js | 8 ++++--- .../main/webapp/assets/js/view/script-groovy.js | 8 +++---- .../src/main/webapp/assets/js/view/viewutils.js | 6 ++--- .../main/webapp/assets/tpl/script/groovy.html | 13 +++++++---- 7 files changed, 43 insertions(+), 29 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/a60c8eb5/usage/jsgui/src/main/webapp/assets/css/base.css ---------------------------------------------------------------------- diff --git a/usage/jsgui/src/main/webapp/assets/css/base.css b/usage/jsgui/src/main/webapp/assets/css/base.css index b1f6791..5a55f55 100644 --- a/usage/jsgui/src/main/webapp/assets/css/base.css +++ b/usage/jsgui/src/main/webapp/assets/css/base.css @@ -932,7 +932,6 @@ tr.app-add-wizard-config-entry { width: 100%; cursor: auto; margin-bottom: 2px; - min-height: 500px; } /* catalog */ @@ -1034,9 +1033,16 @@ swagger-ui-container{ } /** groovy script */ +#groovy-ui-container .hide { + display: none !important; +} +#groovy-ui-container .throbber { + padding-top: 8px; +} #groovy-ui-container textarea { width: 100%; height: 8em; + margin-right: 4px; font-family: Consolas, Lucida Console, Monaco, monospace; white-space: pre; word-wrap: normal; @@ -1080,7 +1086,8 @@ swagger-ui-container{ /** trick for making textareas with width 100% line up (silly width 100% excludes padding) */ div.for-textarea { - padding-left: 0.6em; + padding-left: 0.8em; + padding-right: 0.4em; } div.for-textarea > textarea { padding-left: 0.3em; @@ -1145,20 +1152,16 @@ input[type="file"] { font-size: 120%; } +.toggler-header { + background-color: #D8DCD8; + padding: 2px 6px 2px 6px; +} .activity-detail-panel .subpanel-header-row { margin-bottom: 12px; } .activity-detail-panel .toggler-region { margin-bottom: 12px; } -.activity-detail-panel .toggler-header { - background-color: #D8DCD8; - padding: 2px 6px 2px 6px; -} -.activity-detail-panel .toggler-header { - background-color: #D8DCD8; - padding: 2px 6px 2px 6px; -} .activity-detail-panel .toggler-region .activity-details-section { margin: 4px 6px 0px 6px; } http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/a60c8eb5/usage/jsgui/src/main/webapp/assets/js/view/activity-details.js ---------------------------------------------------------------------- diff --git a/usage/jsgui/src/main/webapp/assets/js/view/activity-details.js b/usage/jsgui/src/main/webapp/assets/js/view/activity-details.js index 45de74d..c8079fd 100644 --- a/usage/jsgui/src/main/webapp/assets/js/view/activity-details.js +++ b/usage/jsgui/src/main/webapp/assets/js/view/activity-details.js @@ -122,10 +122,10 @@ define([ function(v) { return v <= 0 ? "-" : moment(v).format('D MMM YYYY H:mm:ss.SSS')+" <i>"+moment(v).from(startTimeUtc, true)+" later</i>" }) ViewUtils.updateTextareaWithData($(".task-json .for-textarea", this.$el), - FormatJSON(this.task.toJSON()), false, 150, 400) + FormatJSON(this.task.toJSON()), false, false, 150, 400) ViewUtils.updateTextareaWithData($(".task-detail .for-textarea", this.$el), - this.task.get('detailedStatus'), false, 30, 100) + this.task.get('detailedStatus'), false, false, 30, 100) this.updateFieldWith('streams', function(v) { http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/a60c8eb5/usage/jsgui/src/main/webapp/assets/js/view/entity-details.js ---------------------------------------------------------------------- diff --git a/usage/jsgui/src/main/webapp/assets/js/view/entity-details.js b/usage/jsgui/src/main/webapp/assets/js/view/entity-details.js index 8f3313c..11aa62e 100644 --- a/usage/jsgui/src/main/webapp/assets/js/view/entity-details.js +++ b/usage/jsgui/src/main/webapp/assets/js/view/entity-details.js @@ -61,10 +61,14 @@ define([ }, tabSelected: function(event) { var tabName = $(event.currentTarget).attr("href").slice(1) - var entityId = $(".applications span.active").attr("id") - var entityHref = $(".applications span.active a").attr("href") - window.history.pushState(entityId+"/"+tabName, "", + var entityId = $("#app-tree span.active").attr("id") + var entityHref = $("#app-tree span.active a").attr("href") + if (entityId && entityHref) { + window.history.pushState(entityId+"/"+tabName, "", entityHref+"/"+tabName); + } else { + window.history.pushState("notfound", "", "#/v1/applications") + } } }); return EntityDetailsView; http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/a60c8eb5/usage/jsgui/src/main/webapp/assets/js/view/entity-summary.js ---------------------------------------------------------------------- diff --git a/usage/jsgui/src/main/webapp/assets/js/view/entity-summary.js b/usage/jsgui/src/main/webapp/assets/js/view/entity-summary.js index 132210c..e189489 100644 --- a/usage/jsgui/src/main/webapp/assets/js/view/entity-summary.js +++ b/usage/jsgui/src/main/webapp/assets/js/view/entity-summary.js @@ -18,7 +18,7 @@ define([ entityJson:ej, applicationJson:FormatJSON(this.options.application.toJSON()) })) - ViewUtils.updateTextareaWithData($(".for-textarea", this.$el), ej, true, 150, 400) + ViewUtils.updateTextareaWithData($(".for-textarea", this.$el), ej, true, false, 150, 400) ViewUtils.attachToggler(this.$el) that.callPeriodically("entity-summary-sensors", function() { that.updateSensorsNow(that) }, 3000) @@ -32,8 +32,10 @@ define([ url: that.model.getLinkByName("sensors")+"/"+sensor, contentType:"application/json", success:function (data) { - $(".value", $div).html(_.escape(data)) - $div.show() + if (data || data===false) { + $(".value", $div).html(_.escape(data)) + $div.show() + } }}) }, updateSensorsNow: function(that) { http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/a60c8eb5/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 index 5dcbe6e..2c79f5a 100644 --- a/usage/jsgui/src/main/webapp/assets/js/view/script-groovy.js +++ b/usage/jsgui/src/main/webapp/assets/js/view/script-groovy.js @@ -61,10 +61,10 @@ define([ contentType:"application/text", success:function (data) { $(".output .throbber", that.$el).hide() - that.updateTextareaWithData($(".output .result"), data.result, true); - that.updateTextareaWithData($(".output .error"), data.problem, false); - that.updateTextareaWithData($(".output .stdout"), data.stdout, false); - that.updateTextareaWithData($(".output .stderr"), data.stderr, false); + that.updateTextareaWithData($(".output .result"), data.result, true, true); + that.updateTextareaWithData($(".output .error"), data.problem, false, true); + that.updateTextareaWithData($(".output .stdout"), data.stdout, false, true); + that.updateTextareaWithData($(".output .stderr"), data.stderr, false, true); }, error: function(data) { $(".output .throbber", that.$el).hide() http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/a60c8eb5/usage/jsgui/src/main/webapp/assets/js/view/viewutils.js ---------------------------------------------------------------------- diff --git a/usage/jsgui/src/main/webapp/assets/js/view/viewutils.js b/usage/jsgui/src/main/webapp/assets/js/view/viewutils.js index 3559839..0e2669e 100644 --- a/usage/jsgui/src/main/webapp/assets/js/view/viewutils.js +++ b/usage/jsgui/src/main/webapp/assets/js/view/viewutils.js @@ -182,9 +182,9 @@ define([ next.slideDown('fast'); } }, - updateTextareaWithData: function($div, data, alwaysShow, minPx, maxPx) { + updateTextareaWithData: function($div, data, showIfEmpty, doSlideDown, minPx, maxPx) { var $ta = $("textarea", $div); - var show = alwaysShow; + var show = showIfEmpty; if (data !== undefined) { $ta.val(data); show = true; @@ -193,7 +193,7 @@ define([ } if (show) { ViewUtils.setHeightAutomatically($ta, minPx, maxPx, false) - if (alwaysShow) { $div.show(100); } + if (doSlideDown) { $div.slideDown(100); } } else { $div.hide(); } http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/a60c8eb5/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 index ebfb221..47195cc 100644 --- a/usage/jsgui/src/main/webapp/assets/tpl/script/groovy.html +++ b/usage/jsgui/src/main/webapp/assets/tpl/script/groovy.html @@ -1,7 +1,12 @@ -<div id="message-bar" class="label-important hide"> -</div> - <div id="groovy-ui-container"> + + <div style="padding-bottom: 12px;"> + <div><h3>Groovy Scripting</h3></div> + </div> + + <div id="message-bar" class="label-important hide style="padding-bottom: 12px;"> + </div> + <div class="output"> <div class="throbber"><img src="/assets/images/throbber.gif"/></div> @@ -43,7 +48,7 @@ <div class="toggler-region"> <div class="toggler-header"> <div class="toggler-icon icon-chevron-down"></div> - <div><h3>Groovy Scripting</h3></div> + <div><b>Instructions</b></div> </div> <div class="groovy-scripting-text">
