display tasks better

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

Branch: refs/heads/0.6.0
Commit: cb1a20318e07a3f44330bb03abf85b95b9d55780
Parents: 987f5d0
Author: Alex Heneveld <[email protected]>
Authored: Wed Aug 14 16:07:26 2013 +0100
Committer: Alex Heneveld <[email protected]>
Committed: Wed Aug 14 16:07:26 2013 +0100

----------------------------------------------------------------------
 .../webapp/assets/js/view/activity-details.js   | 26 +++++++++++---------
 .../assets/tpl/apps/activity-details.html       | 22 ++++++++---------
 2 files changed, 26 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/cb1a2031/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 50658b5..8830561 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
@@ -58,7 +58,8 @@ define([
                      }, { 
                         "bVisible": false, 
                         "aTargets": [ 0 ] 
-                     } ]            
+                     } ],
+                "aaSorting":[]  // default not sorted (server-side order)
             });
 
             
this.$('#activities-submitted-table').html(_.template(ActivityTableHtml))
@@ -76,7 +77,8 @@ define([
                      }, { 
                         "bVisible": false, 
                         "aTargets": [ 0 ] 
-                     } ]            
+                     } ],
+                "aaSorting":[]  // default not sorted (server-side order)
             });
         
             ViewUtils.attachToggler(this.$el)
@@ -119,11 +121,11 @@ define([
             this.updateField('tags')
             
             var submitTimeUtc = this.updateFieldWith('submitTimeUtc',
-                function(v) { return moment(v).format('D MMM YYYY 
H:mm:ss.SSS')+" &nbsp; <i>"+moment(v).fromNow()+"</i>" })
+                function(v) { return v <= 0 ? "-" : moment(v).format('D MMM 
YYYY H:mm:ss.SSS')+" &nbsp; <i>"+moment(v).fromNow()+"</i>" })
             var startTimeUtc = this.updateFieldWith('startTimeUtc',
-                function(v) { return moment(v).format('D MMM YYYY 
H:mm:ss.SSS')+" &nbsp; <i>"+moment(v).fromNow()+"</i>" })
+                function(v) { return v <= 0 ? "-" : moment(v).format('D MMM 
YYYY H:mm:ss.SSS')+" &nbsp; <i>"+moment(v).fromNow()+"</i>" })
             this.updateFieldWith('endTimeUtc',
-                function(v) { return moment(v).format('D MMM YYYY 
H:mm:ss.SSS')+" &nbsp; <i>"+moment(v).from(startTimeUtc, true)+" later</i>" })
+                function(v) { return v <= 0 ? "-" : moment(v).format('D MMM 
YYYY H:mm:ss.SSS')+" &nbsp; <i>"+moment(v).from(startTimeUtc, true)+" 
later</i>" })
 
             ViewUtils.updateTextareaWithData($(".task-json .for-textarea", 
this.$el), 
                 FormatJSON(this.task.toJSON()), false, 150, 400)
@@ -170,9 +172,9 @@ define([
             var children = this.children
             ViewUtils.updateMyDataTable(this.childrenTable, children, 
function(task, index) {
                 return [ task.get("id"),
-                         (task.get("entityId")!=that.task.get("entityId") ? 
task.get("entityDisplayName") + ": " : "") + 
+                         (task.get("entityId") && 
task.get("entityId")!=that.task.get("entityId") ? task.get("entityDisplayName") 
+ ": " : "") + 
                          task.get("displayName"),
-                         moment(task.get("submitTimeUtc")).calendar(),
+                         task.get("submitTimeUtc") <= 0 ? "-" : 
moment(task.get("submitTimeUtc")).calendar(),
                          task.get("currentStatus")
                     ]; 
                 });
@@ -201,9 +203,9 @@ define([
             }
             ViewUtils.updateMyDataTable(this.subtasksTable, subtasks, 
function(task, index) {
                 return [ task.get("id"),
-                         (task.get("entityId")!=that.task.get("entityId") ? 
task.get("entityDisplayName") + ": " : "") + 
+                         (task.get("entityId") && 
task.get("entityId")!=that.task.get("entityId") ? task.get("entityDisplayName") 
+ ": " : "") + 
                          task.get("displayName"),
-                         moment(task.get("submitTimeUtc")).calendar(),
+                         task.get("submitTimeUtc") <= 0 ? "-" : 
moment(task.get("submitTimeUtc")).calendar(),
                          task.get("currentStatus")
                     ]; 
                 });
@@ -226,13 +228,15 @@ define([
         },
         updateFieldWith: function(field, f) {
             var v = this.task.get(field)
-            if (v) {
+            if (v !== undefined && v != null) {
                 $('.updateField-'+field, this.$el).html( f(v) );
                 $('.ifField-'+field, this.$el).show();
-                return v
             } else {
+                // blank if there is no value
+                $('.updateField-'+field, this.$el).html( '' );;
                 $('.ifField-'+field, this.$el).hide();
             }
+            return v
         },
         childrenRowClick:function(evt) {
             var that = this;

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/cb1a2031/usage/jsgui/src/main/webapp/assets/tpl/apps/activity-details.html
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/webapp/assets/tpl/apps/activity-details.html 
b/usage/jsgui/src/main/webapp/assets/tpl/apps/activity-details.html
index 81eafce..e78b31a 100644
--- a/usage/jsgui/src/main/webapp/assets/tpl/apps/activity-details.html
+++ b/usage/jsgui/src/main/webapp/assets/tpl/apps/activity-details.html
@@ -57,26 +57,26 @@
   </div>
     
 
-  <div class="toggler-region task-detail">
+  <div class="toggler-region tasks-children">
     <div class="toggler-header">
       <div class="toggler-icon icon-chevron-down"></div>
-      <div><b>Detailed Status</b></div>
+      <div><b>Children Tasks</b></div>
     </div>
-    <div class="activity-details-section activity-detailStatus">
-     <div class="for-textarea">
-      <textarea id="detailStatus-textrea" readonly="readonly" style="width: 
100%;"></textarea>
-     </div>
+    <div class="activity-details-section activity-tasks-children">
+      <div id="activities-children-table" class="table-scroll-wrapper">
+      </div>
     </div>
   </div>
     
-  <div class="toggler-region tasks-children">
+  <div class="toggler-region task-detail">
     <div class="toggler-header">
       <div class="toggler-icon icon-chevron-down"></div>
-      <div><b>Children Tasks</b></div>
+      <div><b>Detailed Status</b></div>
     </div>
-    <div class="activity-details-section activity-tasks-children">
-      <div id="activities-children-table" class="table-scroll-wrapper">
-      </div>
+    <div class="activity-details-section activity-detailStatus">
+     <div class="for-textarea">
+      <textarea id="detailStatus-textrea" readonly="readonly" style="width: 
100%;"></textarea>
+     </div>
     </div>
   </div>
     

Reply via email to