You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2014/07/29 21:32:01 UTC

[06/31] git commit: improve display of task results, catch NPE when switching task contexts, and ensure data is cleared (nulled) for old map entries due to backbone bug (without this, sometimes blockingTask might show up as `TYPEOF undefined` when you in

improve display of task results, catch NPE when switching task contexts, and ensure data is cleared (nulled) for old map entries due to backbone bug (without this, sometimes blockingTask might show up as `TYPEOF undefined` when you inspect its JSON)


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

Branch: refs/heads/master
Commit: bbfbd37608bc76ceb00db96f83168b65a9973ca0
Parents: 931d397
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Mon Jul 21 20:37:23 2014 -0400
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Tue Jul 29 10:41:11 2014 -0400

----------------------------------------------------------------------
 .../src/main/webapp/assets/js/model/task-summary.js     |  2 +-
 .../src/main/webapp/assets/js/view/activity-details.js  | 12 ++++++++----
 2 files changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/bbfbd376/usage/jsgui/src/main/webapp/assets/js/model/task-summary.js
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/webapp/assets/js/model/task-summary.js b/usage/jsgui/src/main/webapp/assets/js/model/task-summary.js
index 23014d7..afc3549 100644
--- a/usage/jsgui/src/main/webapp/assets/js/model/task-summary.js
+++ b/usage/jsgui/src/main/webapp/assets/js/model/task-summary.js
@@ -65,7 +65,7 @@ define([
         parse: function(resp) {
             _.keys(this.attributes).forEach(function(key) {
               if (resp[key] === undefined) {
-                resp[key] = undefined;
+                resp[key] = null;
               }
             });
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/bbfbd376/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 989b531..df98a77 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
@@ -146,10 +146,14 @@ define([
                         that.displayTextForLinkedTask(v)+"</a>" })
             this.updateFieldWith('result',
                 function(v) {
-                    if (v.toString().length<20 &&  !/\r|\n/.exec(v)) {
-                        return " with result: <span class='result-literal'>"+_.escape(v)+"</span>";
+                    // use display string (JSON.stringify(_.escape(v)) because otherwise list of [null,null] is just ","  
+                    var vs = Util.toDisplayString(v);
+                    if (vs.trim().length==0) {
+                        return " (empty result)";
+                    } else if (vs.length<20 &&  !/\r|\n/.exec(v)) {
+                        return " with result: <span class='result-literal'>"+vs+"</span>";
                     } else {
-                        return "<div class='result-literal'>"+_.escape(v).replace(/\n+/g,"<br>")+"</div>"
+                        return "<div class='result-literal'>"+vs.replace(/\n+/g,"<br>")+"</div>"
                     }
                  })
             this.updateFieldWith('tags', function(tags) {
@@ -276,7 +280,7 @@ define([
             }
             ViewUtils.updateMyDataTable(this.subtasksTable, subtasks, function(task, index) {
                 return [ task.get("id"),
-                         (task.get("entityId") && task.get("entityId")!=that.task.get("entityId") ? task.get("entityDisplayName") + ": " : "") + 
+                         (task.get("entityId") && (!that.task || task.get("entityId")!=that.task.get("entityId")) ? task.get("entityDisplayName") + ": " : "") + 
                          task.get("displayName"),
                          task.get("submitTimeUtc") <= 0 ? "-" : moment(task.get("submitTimeUtc")).calendar(),
                          task.get("currentStatus")