Browse Source

HUE-8283 [oozie] Show image from Oozie instead of not displaying Graph for big workflows

Roohi 7 years ago
parent
commit
0567ba0c6e

+ 9 - 0
apps/oozie/src/oozie/templates/dashboard/list_oozie_workflow_graph.mako

@@ -145,6 +145,15 @@ ${ dashboard.import_layout() }
       });
 
     %endif
+    % if layout_json == '':
+      $.ajax({
+        'url': "${oozie_workflow.get_absolute_url()}?format=svg",
+        'type': 'GET',
+        success: function (svgData) {
+          $("#workflow_graph").append(svgData);
+        }
+        });
+    % endif
 
     $(document).ready(function () {
       % if layout_json != '':

+ 5 - 6
apps/oozie/src/oozie/templates/editor2/common_workflow.mako

@@ -42,17 +42,16 @@
 </script>
 
 <div data-bind="css: {'dashboard': true, 'readonly': ! isEditing()}">
-  <!-- ko if: $root.workflow.properties.imported -->
-    <div class="alert alert-warn" style="margin-top: 93px; margin-bottom: 0; border: none; text-align: center">
-      ${ _('This workflow was imported from an old Hue version, save it to create a copy in the new format or') }
-      <a data-bind="attr: { href: '/oozie/edit_workflow/' + $root.workflow.properties.wf1_id() }">${ _('open it in the old editor.') }</a>
-    </div>
-  <!-- /ko -->
+  % if layout_json != '':
   <div class="container-fluid">
     <div class="row-fluid" data-bind="template: { name: 'column-template', foreach: oozieColumns}">
     </div>
     <div class="clearfix"></div>
   </div>
+  %endif
+  % if layout_json == '':
+   <div class="container-fluid" id="workflow_graph"/>
+  %endif
 </div>
 
 

+ 5 - 0
apps/oozie/src/oozie/views/dashboard.py

@@ -395,6 +395,11 @@ def list_oozie_workflow(request, job_id):
     }
     return JsonResponse(return_obj, encoder=JSONEncoderForHTML)
 
+  if request.GET.get('format') == 'svg':
+    oozie_api = get_oozie(request.user, api_version="v2")
+    svg_data = oozie_api.get_job_graph(job_id)
+    return HttpResponse(svg_data)
+
   if request.GET.get('graph'):
     return render('dashboard/list_oozie_workflow_graph.mako', request, {
       'oozie_workflow': oozie_workflow,

+ 9 - 0
desktop/libs/liboozie/src/liboozie/oozie_api.py

@@ -196,6 +196,15 @@ class OozieApi(object):
     return self._root.get('job/%s' % (jobid,), params)
 
 
+  def get_job_graph(self, jobid, format='svg'):
+    params = self._get_params()
+    params['show'] = 'graph'
+    params['show-kill'] = 'true'
+    params['format'] = format
+    svg_data = self._root.get('job/%s' % (jobid,), params)
+    return svg_data
+
+
   def get_job_status(self, jobid):
     params = self._get_params()
     params['show'] = 'status'