Browse Source

[jobsub] Job history should link back to design

- Also show external id in oozie workflow action table
bc Wong 13 years ago
parent
commit
8a6c9ce4ee
2 changed files with 20 additions and 1 deletions
  1. 6 0
      apps/jobsub/src/jobsub/templates/workflow.mako
  2. 14 1
      apps/jobsub/src/jobsub/views.py

+ 6 - 0
apps/jobsub/src/jobsub/templates/workflow.mako

@@ -69,7 +69,11 @@ ${layout.menubar(section='history')}
 </%def>
 
 <div class="container-fluid">
+    %if design_link is not None:
+    <h1><a title="Edit design" href="${design_link}">${workflow.appName}</a> (${workflow.id})</h1>
+    %else:
     <h1>${workflow.appName} (${workflow.id})</h1>
+    %endif
 
     ## Tab headers
     <ul class="tabs" data-tabs="tabs">
@@ -88,6 +92,7 @@ ${layout.menubar(section='history')}
               <th>Name</th>
               <th>Type</th>
               <th>Status</th>
+              <th>External Id</th>
 
               <th>Start Time</th>
               <th>End Time</th>
@@ -113,6 +118,7 @@ ${layout.menubar(section='history')}
                 </td>
                 <td>${action.type}</td>
                 <td>${action.status}</td>
+                <td>${action.externalId}</td>
 
                 <td>${format_time(action.startTime)}</td>
                 <td>${format_time(action.endTime)}</td>

+ 14 - 1
apps/jobsub/src/jobsub/views.py

@@ -49,10 +49,23 @@ def oozie_job(request, jobid):
   """View the details about this job."""
   workflow = get_oozie().get_job(jobid)
   _check_permission(request, workflow.user,
-                    "Access denied: view job %s" % (jobid,))
+                    "Access denied: view job %s" % (jobid,),
+                    allow_root=True)
+
+  # Cross reference the submission history (if any)
+  design_link = None
+  try:
+    history_record = models.JobHistory.objects.get(job_id=jobid)
+    design = history_record.workflow
+    if design.owner == request.user:
+      design_link = urlresolvers.reverse(jobsub.views.edit_design,
+                                         kwargs={'wf_id': design.id})
+  except models.JobHistory.DoesNotExist, ex:
+    pass
 
   return render('workflow.mako', request, {
     'workflow': workflow,
+    'design_link': design_link,
   })