Author: kamrul
Date: Fri Nov  2 01:43:08 2012
New Revision: 1404850

URL: http://svn.apache.org/viewvc?rev=1404850&view=rev
Log:
OOZIE-959  Use API from OOZIE-906 in console (Ashish via Mohammad)

Modified:
    oozie/branches/hcat-intre/webapp/src/main/webapp/oozie-console.js

Modified: oozie/branches/hcat-intre/webapp/src/main/webapp/oozie-console.js
URL: 
http://svn.apache.org/viewvc/oozie/branches/hcat-intre/webapp/src/main/webapp/oozie-console.js?rev=1404850&r1=1404849&r2=1404850&view=diff
==============================================================================
--- oozie/branches/hcat-intre/webapp/src/main/webapp/oozie-console.js (original)
+++ oozie/branches/hcat-intre/webapp/src/main/webapp/oozie-console.js Fri Nov  
2 01:43:08 2012
@@ -169,6 +169,40 @@ function getPagingBar(dataStore) {
     return pagingBar;
 }
 
+// Image object display
+Ext.ux.Image = Ext.extend(Ext.BoxComponent, {
+
+    url: Ext.BLANK_IMAGE_URL,  //for initial src value
+
+    autoEl: {
+        tag: 'img',
+        src: Ext.BLANK_IMAGE_URL,
+    },
+
+    initComponent: function() {
+         Ext.ux.Image.superclass.initComponent.call(this);
+         this.addEvents('load');
+   },
+
+//  Add our custom processing to the onRender phase.
+//  We add a ‘load’ listener to our element.
+    onRender: function() {
+        Ext.ux.Image.superclass.onRender.apply(this, arguments);
+        this.el.on('load', this.onLoad, this);
+        if(this.url){
+            this.setSrc(this.url);
+        }
+    },
+
+    onLoad: function() {
+        this.fireEvent('load', this);
+    },
+
+    setSrc: function(src) {
+        this.el.dom.src = src;
+    }
+});
+
 // stuff to show details of a job
 function jobDetailsPopup(response, request) {
     var jobDefinitionArea = new Ext.form.TextArea({
@@ -498,6 +532,18 @@ function jobDetailsPopup(response, reque
             win.show();
         }
     }
+    var dagImg = new Ext.ux.Image({
+                id: 'dagImage',
+                url: getOozieBase() + 'job/' + workflowId + "?show=graph",
+                readOnly: true,
+                editable: false,
+                autoScroll: true
+    });
+
+    function fetchDAG(workflowId) {
+        dagImg.setSrc(getOozieBase() + 'job/' + workflowId + 
'?show=graph&token=' + Math.random());
+    }
+
     var jobDetailsTab = new Ext.TabPanel({
         activeTab: 0,
         autoHeight: true,
@@ -532,6 +578,16 @@ function jobDetailsPopup(response, reque
                 }
             }]
 
+        }, {
+            title: 'Job DAG',
+            items: dagImg,
+            tbar: [{
+                text: "   ",
+                icon: 'ext-2.2/resources/images/default/grid/refresh.gif',
+                handler: function() {
+                    fetchDAG(workflowId);
+                }
+            }]
         }]
     });
     jobDetailsTab.addListener("tabchange", function(panel, selectedTab) {
@@ -544,6 +600,8 @@ function jobDetailsPopup(response, reque
         }
         else if (selectedTab.title == 'Job Definition') {
             fetchDefinition(workflowId);
+        } else if(selectedTab.title == 'Job DAG') {
+            fetchDAG(workflowId);
         }
         jobs_grid.setVisible(false);
     });
@@ -958,8 +1016,8 @@ function coordJobDetailsPopup(response, 
           items: [jobLogArea, actionsTextBox, getLogButton],
            tbar: [ {
                 text: "   ",
-                icon: 'ext-2.2/resources/images/default/grid/refresh.gif',
-                 }],
+                icon: 'ext-2.2/resources/images/default/grid/refresh.gif'
+                 }]
           }]
 });
 
@@ -1540,11 +1598,9 @@ var checkStatus = new Ext.Action({
                 else {
                     checkStatus.setText("<font color='007000' size='2> Status 
- Normal</font>");
                 }
-            },
-
+            }
         });
-    },
-
+    }
 });
 
 
@@ -1656,17 +1712,14 @@ var viewOSDetails = new Ext.Action({
             success: function(response, request) {
                 var configData = getConfigObject(response.responseText);
                 configGridData.loadData(configData);
-            },
-
+            }
         });
-    },
-
+    }
 });
 
 var treeRoot = new Ext.tree.TreeNode({
     text: "Instrumentation",
-    expanded: true,
-
+    expanded: true
 });
 
 var timeZones_store = new Ext.data.JsonStore({
@@ -1777,8 +1830,7 @@ function initConsole() {
             cellclick: {
                 fn: showJobContextMenu
             }
-        },
-
+        }
     });
     var expander = new Ext.grid.RowExpander({
         tpl: new Ext.Template('<br><p><b>Name:</b> {name}</p>', 
'<p><b>Value:</b> {value}</p>')
@@ -1905,7 +1957,7 @@ function initConsole() {
             cellclick: {
                 fn: showCoordJobContextMenu
             }
-        },
+        }
     });
     var bundleJobArea = new Ext.grid.GridPanel({
         store: bundle_jobs_store,
@@ -2025,4 +2077,4 @@ function initConsole() {
 // now the on ready function
 Ext.onReady(function() {
     getSupportedVersions.execute();
-});
\ No newline at end of file
+});


Reply via email to