Author: rohini
Date: Wed Jun 19 19:29:24 2013
New Revision: 1494743

URL: http://svn.apache.org/r1494743
Log:
OOZIE-1426 Fix bugs in SLA UI (rohini)

Modified:
    oozie/trunk/release-log.txt
    oozie/trunk/webapp/src/main/webapp/console/sla/js/oozie-sla-graph.js
    oozie/trunk/webapp/src/main/webapp/console/sla/js/oozie-sla-table.js
    oozie/trunk/webapp/src/main/webapp/console/sla/js/oozie-sla.js
    oozie/trunk/webapp/src/main/webapp/console/sla/oozie-sla.html
    oozie/trunk/webapp/src/main/webapp/oozie-console.js

Modified: oozie/trunk/release-log.txt
URL: 
http://svn.apache.org/viewvc/oozie/trunk/release-log.txt?rev=1494743&r1=1494742&r2=1494743&view=diff
==============================================================================
--- oozie/trunk/release-log.txt (original)
+++ oozie/trunk/release-log.txt Wed Jun 19 19:29:24 2013
@@ -1,5 +1,6 @@
 -- Oozie 4.1.0 release (trunk - unreleased)
 
+OOZIE-1426 Fix bugs in SLA UI (rohini)
 OOZIE-1421 UI for SLA (virag, rohini)
 OOZIE-1422 fix bug in SLARegistrationBean and 
CoordActionsCountForJobIdJPAExecutor (ryota)
 OOZIE-1408 Change column type of "frequency" from int to varchar for 
coordinators (rkanter)

Modified: oozie/trunk/webapp/src/main/webapp/console/sla/js/oozie-sla-graph.js
URL: 
http://svn.apache.org/viewvc/oozie/trunk/webapp/src/main/webapp/console/sla/js/oozie-sla-graph.js?rev=1494743&r1=1494742&r2=1494743&view=diff
==============================================================================
--- oozie/trunk/webapp/src/main/webapp/console/sla/js/oozie-sla-graph.js 
(original)
+++ oozie/trunk/webapp/src/main/webapp/console/sla/js/oozie-sla-graph.js Wed 
Jun 19 19:29:24 2013
@@ -134,7 +134,7 @@ function drawSLAGraph(jsonData, plotValu
     if (drawExpectedStart) {
         datasetsToPlot.push({label: "Expected Start", 
data:plotValues.expectedStart, color: 6});
     }
-    datasetsToPlot.push({label: "Actual Start", data:plotValues.actualStart, 
color: 26});
+    datasetsToPlot.push({label: "Actual Start", data:plotValues.actualStart, 
color: "rgb(0,0,255)"});
     datasetsToPlot.push({label: "Expected End", data:plotValues.expectedEnd, 
color: 5});
     datasetsToPlot.push({label: "Actual End", data:plotValues.actualEnd, 
color: 25});
 
@@ -165,7 +165,7 @@ function drawSLAGraph(jsonData, plotValu
         },
         yaxis : {
             show : true,
-            min : 0,
+            ticks: 14,
             tickFormatter: timeSinceTickFormatter
         },
         grid : {

Modified: oozie/trunk/webapp/src/main/webapp/console/sla/js/oozie-sla-table.js
URL: 
http://svn.apache.org/viewvc/oozie/trunk/webapp/src/main/webapp/console/sla/js/oozie-sla-table.js?rev=1494743&r1=1494742&r2=1494743&view=diff
==============================================================================
--- oozie/trunk/webapp/src/main/webapp/console/sla/js/oozie-sla-table.js 
(original)
+++ oozie/trunk/webapp/src/main/webapp/console/sla/js/oozie-sla-table.js Wed 
Jun 19 19:29:24 2013
@@ -20,7 +20,7 @@ var columnsToShow = [
               { "mData": null,  "bSortable": false, "sWidth":"0.1%", 
"bVisible": true},
               { "mData": "id"},
               { "mData": "slaStatus"},
-              { "mData": "nominalTimeTZ"},
+              { "mData": "nominalTimeTZ", "sDefaultContent": ""},
               { "mData": "expectedStartTZ", "sDefaultContent": ""},
               { "mData": "actualStartTZ", "sDefaultContent": "" },
               { "mData": "startDiff", "sDefaultContent": ""},
@@ -33,7 +33,6 @@ var columnsToShow = [
               { "mData": "slaMisses", "sDefaultContent": ""},
               { "mData": "jobStatus", "sDefaultContent": ""},
               { "mData": "parentId", "sDefaultContent": "", "bVisible": false},
-              { "mData": "user", "bVisible": false},
               { "mData": "appName", "bVisible": false},
              ];
 
@@ -126,50 +125,64 @@ function drawTable(jsonData) {
         }
         if (slaSummary.expectedStart && slaSummary.actualStart) {
             // timeElapsed in oozie-sla.js
-            slaSummary.startDiff = timeElapsed(slaSummary.actualStart - 
slaSummary.expectedStart);
+            slaSummary.startDiff = slaSummary.actualStart - 
slaSummary.expectedStart;
         }
         if (slaSummary.expectedEnd && slaSummary.actualEnd) {
-            slaSummary.endDiff = timeElapsed(slaSummary.actualEnd - 
slaSummary.expectedEnd);
+            slaSummary.endDiff = slaSummary.actualEnd - slaSummary.expectedEnd;
         }
-        if (slaSummary.actualDuration != -1) {
-            slaSummary.durDiff = timeElapsed(slaSummary.actualDuration - 
slaSummary.expectedDuration);
+        if (slaSummary.actualDuration != -1 && slaSummary.expectedDuration != 
-1) {
+            slaSummary.durDiff = slaSummary.actualDuration - 
slaSummary.expectedDuration;
             if (slaSummary.actualDuration > slaSummary.expectedDuration) {
                 slaMisses += "DURATION_MISS, ";
             }
         }
         slaSummary.slaMisses = slaMisses.length > 2 ? slaMisses.substring(0, 
slaMisses.length - 2) : "";
     }
-    oTable = $('#sla_table').dataTable( {
-            "bJQueryUI": true,
-            "sDom": 'CT<"clear"> <"H"lfr>t<"F"ip>',
-               "oColVis": {
-                   "buttonText": "Show/Hide columns",
-                "bRestore": true,
-                "aiExclude": [ 0 ]
-            },
-               "bStateSave": true,
-            "sScrollY": "360px",
-            "sScrollX": "100%",
-            "bPaginate": true,
-            "oTableTools": {
-                    "sSwfPath": "console/sla/js/table/copy_csv_xls_pdf.swf",
-                    "aButtons": [ "copy", "csv" ],
-            },
-            "aaData": jsonData.slaSummaryList,
-            "aoColumns": columnsToShow,
-            "fnRowCallback": function( nRow, aData, iDisplayIndex, 
iDisplayIndexFull ) {
-                var jobId = aData.id;
-                var rowAllColumns = this.fnGetTds(nRow);
-                  $(rowAllColumns[1]).html('<a href="/oozie?job='+jobId+'" 
target="_blank">' +
-                    jobId + '</a>');
-                if (aData.slaStatus == "MISS") {
-                    $(rowAllColumns[2]).css('color', 'red');
-                }
-                $("td:first", nRow).html(iDisplayIndexFull +1);
-                return nRow;
-            },
-            "aaSorting": [[ 1, 'desc' ]],
-            "bDestroy": true
-        } );
+    oTable = $('#sla_table').dataTable(
+            {
+                "bJQueryUI" : true,
+                "sDom" : 'CT<"clear"> <"H"lfr>t<"F"ip>',
+                "oColVis" : {
+                    "buttonText" : "Show/Hide columns",
+                    "bRestore" : true,
+                    "aiExclude" : [ 0 ]
+                },
+                "bStateSave" : true,
+                "sScrollY" : "360px",
+                "sScrollX" : "100%",
+                "bPaginate" : true,
+                "oTableTools" : {
+                    "sSwfPath" : "console/sla/js/table/copy_csv_xls_pdf.swf",
+                    "aButtons" : [ "copy", "csv" ],
+                },
+                "aaData" : jsonData.slaSummaryList,
+                "aoColumns" : columnsToShow,
+                "fnRowCallback" : function(nRow, aData, iDisplayIndex, 
iDisplayIndexFull) {
+                    var rowAllColumns = this.fnGetTds(nRow);
+                    $(rowAllColumns[1]).html(
+                            '<a href="/oozie?job=' + aData.id + '" 
target="_blank">' + aData.id
+                                    + '</a>');
+                    $(rowAllColumns[15]).html(
+                            '<a href="/oozie?job=' + aData.parentId + '" 
target="_blank">'
+                                    + aData.parentId + '</a>');
+                    if (aData.slaStatus == "MISS") {
+                        $(rowAllColumns[2]).css('color', 'red');
+                    }
+                    // Changing only the html with readable text to preserve 
sort order.
+                    if (aData.startDiff || aData.startDiff == 0) {
+                        $(rowAllColumns[6]).html(timeElapsed(aData.startDiff));
+                    }
+                    if (aData.endDiff || aData.endDiff == 0) {
+                        $(rowAllColumns[9]).html(timeElapsed(aData.endDiff));
+                    }
+                    if (aData.durDiff || aData.durDiff == 0) {
+                        $(rowAllColumns[12]).html(timeElapsed(aData.durDiff * 
1000));
+                    }
+                    $("td:first", nRow).html(iDisplayIndexFull + 1);
+                    return nRow;
+                },
+                "aaSorting" : [ [ 1, 'desc' ] ],
+                "bDestroy" : true
+            });
 
 }
\ No newline at end of file

Modified: oozie/trunk/webapp/src/main/webapp/console/sla/js/oozie-sla.js
URL: 
http://svn.apache.org/viewvc/oozie/trunk/webapp/src/main/webapp/console/sla/js/oozie-sla.js?rev=1494743&r1=1494742&r2=1494743&view=diff
==============================================================================
--- oozie/trunk/webapp/src/main/webapp/console/sla/js/oozie-sla.js (original)
+++ oozie/trunk/webapp/src/main/webapp/console/sla/js/oozie-sla.js Wed Jun 19 
19:29:24 2013
@@ -125,46 +125,69 @@ function buildTableAndGraph(jsonData) {
 }
 
 function timeElapsed(timeInMillis) {
+
+    if (!timeInMillis) {
+        if (timeInMillis == 0) {
+            return "00:00:00";
+        }
+        return;
+    }
+
     var timeSince = "";
+    var addHour = true;
+    var addMin = true;
     if (timeInMillis < 0) {
         timeSince = "-";
         timeInMillis = -timeInMillis;
     }
-    var seconds = Math.round(timeInMillis/1000);
+    var seconds = Math.floor(timeInMillis/1000);
     interval = Math.floor(seconds / 31536000);
 
-    if (interval > 1) {
+    if (interval > 0) {
         timeSince += interval + "y ";
         seconds = (seconds %= 31536000);
     }
 
     interval = Math.floor(seconds / 2592000);
-    if (interval > 1) {
+    if (interval > 0) {
         timeSince += interval + "m ";
         seconds = (seconds %= 2592000);
     }
 
     interval = Math.floor(seconds / 86400);
-    if (interval > 1) {
+    if (interval > 0) {
         timeSince += interval + "d ";
         seconds = (seconds %= 86400);
     }
 
     interval = Math.floor(seconds / 3600);
-    if (interval > 1) {
+    if (interval > 0) {
+        if (interval < 10)
+            timeSince += "0";
         timeSince += interval + ":";
         seconds = (seconds %= 3600);
+        addHour = false;
     }
 
     interval = Math.floor(seconds / 60);
-    if (interval > 1) {
+    if (interval > 0) {
+        if (addHour) {
+            timeSince += "00:";
+        }
+        addHour = false;
         if (interval < 10)
             timeSince += "0";
         timeSince += interval + ":";
         seconds = (seconds %= 60);
-        if (seconds < 10)
-            timeSince += "0";
+        addMin = false;
     }
-
+    if (addHour) {
+        timeSince += "00:";
+    }
+    if (addMin) {
+        timeSince += "00:";
+    }
+    if (seconds < 10)
+        timeSince += "0";
     return timeSince + seconds;
 }
\ No newline at end of file

Modified: oozie/trunk/webapp/src/main/webapp/console/sla/oozie-sla.html
URL: 
http://svn.apache.org/viewvc/oozie/trunk/webapp/src/main/webapp/console/sla/oozie-sla.html?rev=1494743&r1=1494742&r2=1494743&view=diff
==============================================================================
--- oozie/trunk/webapp/src/main/webapp/console/sla/oozie-sla.html (original)
+++ oozie/trunk/webapp/src/main/webapp/console/sla/oozie-sla.html Wed Jun 19 
19:29:24 2013
@@ -57,6 +57,7 @@
             $("#search").click(function(){
                 onSearchClick();
             });
+
         });
 
         </script>
@@ -99,7 +100,6 @@
                             <th>SLA Misses</th>
                             <th>Job Status</th>
                             <th>Parent Id</th>
-                            <th>User</th>
                             <th>AppName</th>
                         </tr>
                     </thead>

Modified: oozie/trunk/webapp/src/main/webapp/oozie-console.js
URL: 
http://svn.apache.org/viewvc/oozie/trunk/webapp/src/main/webapp/oozie-console.js?rev=1494743&r1=1494742&r2=1494743&view=diff
==============================================================================
--- oozie/trunk/webapp/src/main/webapp/oozie-console.js (original)
+++ oozie/trunk/webapp/src/main/webapp/oozie-console.js Wed Jun 19 19:29:24 2013
@@ -876,10 +876,11 @@ function coordJobDetailsPopup(response, 
             icon: 'ext-2.2/resources/images/default/grid/refresh.gif',
             handler: function() {
                 Ext.Ajax.request({
-                    url: getOozieBase() + 'job/' + coordJobId + "?timezone=" + 
getTimeZone(),
+                    url: getOozieBase() + 'job/' + coordJobId + "?timezone=" + 
getTimeZone() + "&offset=0&len=0",
                     success: function(response, request) {
                         jobDetails = eval("(" + response.responseText + ")");
                         fs.getForm().setValues(jobDetails);
+                        jobActionStatus.reload();
                     }
 
                 });
@@ -1401,6 +1402,17 @@ function coordJobDetailsGridWindow(coord
     });
 }
 
+function coordActionDetailsGridWindow(coordActionId) {
+    Ext.Ajax.request({
+        url: getOozieBase() + 'job/' + coordActionId + "?timezone=" + 
getTimeZone(),
+        success: function(response, request) {
+            var coordAction = JSON.parse(response.responseText);
+            var workflowId = coordAction.externalId;
+            jobDetailsGridWindow(workflowId);
+        }
+    });
+}
+
 function bundleJobDetailsGridWindow(bundleJobId) {
     Ext.Ajax.request({
         url: getOozieBase() + 'job/' + bundleJobId + "?timezone=" + 
getTimeZone(),
@@ -2227,8 +2239,14 @@ function initConsole() {
         else if (jobId.endsWith("-B")) {
             bundleJobDetailsGridWindow(jobId);
         }
-        else
-        {
+        else if (jobId.endsWith("-W")) {
+            jobDetailsGridWindow(jobId);
+        }
+        else if (jobId.indexOf("-C@") !=-1) {
+            coordActionDetailsGridWindow(jobId);
+        }
+        else if (jobId.endsWith("-W@") !=-1) {
+            jobId = jobId.substring(0, index + 2);
             jobDetailsGridWindow(jobId);
         }
 


Reply via email to