Browse Source

HUE-2653 [oozie] Display sub-Wf submitted by coordinator in Submitted by coordinator filter

krish 10 years ago
parent
commit
f40008c509

+ 3 - 3
apps/oozie/src/oozie/static/oozie/js/dashboard-utils.js

@@ -84,12 +84,12 @@ var PersistedButtonsFilters = function (oSettings, aData, iDataIndex) {
       statuses.push($(this).attr("data-value"));
       statuses.push($(this).attr("data-value"));
     });
     });
 
 
-    var _parentUrlColumn = aData[aData.length - 1];
+    var _submittedManually = aData[aData.length - 1];
     if (statuses.length == 1) {
     if (statuses.length == 1) {
       if (statuses[0] == 'COORDINATOR') {
       if (statuses[0] == 'COORDINATOR') {
-        submittedByFilter = _parentUrlColumn.indexOf('icon_oozie_coordinator') > -1;
+        submittedByFilter = !_submittedManually;
       } else {
       } else {
-        submittedByFilter = _parentUrlColumn.indexOf('icon_oozie_coordinator') == -1;
+        submittedByFilter = _submittedManually;
       }
       }
     }
     }
   }
   }

+ 13 - 4
apps/oozie/src/oozie/templates/dashboard/list_oozie_workflows.mako

@@ -80,6 +80,7 @@ ${ layout.menubar(section='workflows', dashboard=True) }
           <th width="7%">${ _('Last Modified') }</th>
           <th width="7%">${ _('Last Modified') }</th>
           <th width="23%">${ _('Id') }</th>
           <th width="23%">${ _('Id') }</th>
           <th width="5%">${ _('Parent') }</th>
           <th width="5%">${ _('Parent') }</th>
+          <th width="0%">${ _('Submitted Manually') }</th>
         </tr>
         </tr>
       </thead>
       </thead>
       <tbody>
       <tbody>
@@ -93,6 +94,7 @@ ${ layout.menubar(section='workflows', dashboard=True) }
           <td></td>
           <td></td>
           <td></td>
           <td></td>
           <td></td>
           <td></td>
+          <td></td>
         </tr>
         </tr>
       </tbody>
       </tbody>
     </table>
     </table>
@@ -111,6 +113,7 @@ ${ layout.menubar(section='workflows', dashboard=True) }
           <th width="10%">${ _('Submitter') }</th>
           <th width="10%">${ _('Submitter') }</th>
           <th width="25%">${ _('Id') }</th>
           <th width="25%">${ _('Id') }</th>
           <th width="5%">${ _('Parent') }</th>
           <th width="5%">${ _('Parent') }</th>
+          <th width="0%">${ _('Submitted Manually') }</th>
         </tr>
         </tr>
       </thead>
       </thead>
       <tbody>
       <tbody>
@@ -122,6 +125,7 @@ ${ layout.menubar(section='workflows', dashboard=True) }
           <td></td>
           <td></td>
           <td></td>
           <td></td>
           <td></td>
           <td></td>
+          <td></td>
         </tr>
         </tr>
       </tbody>
       </tbody>
      </table>
      </table>
@@ -187,6 +191,7 @@ ${ layout.menubar(section='workflows', dashboard=True) }
       createdInMillis: wf.createdInMillis,
       createdInMillis: wf.createdInMillis,
       run: wf.run,
       run: wf.run,
       parentUrl: wf.parentUrl,
       parentUrl: wf.parentUrl,
+      submittedManually: wf.submittedManually,
     }
     }
   }
   }
 
 
@@ -207,7 +212,8 @@ ${ layout.menubar(section='workflows', dashboard=True) }
         null,
         null,
         { "sSortDataType":"dom-sort-value", "sType":"numeric" },
         { "sSortDataType":"dom-sort-value", "sType":"numeric" },
         null,
         null,
-        null
+        null,
+        { "bVisible": false }
       ],
       ],
       "aaSorting":[
       "aaSorting":[
         [ 0, "desc" ]
         [ 0, "desc" ]
@@ -242,7 +248,8 @@ ${ layout.menubar(section='workflows', dashboard=True) }
         { "sSortDataType":"dom-sort-value", "sType":"numeric" },
         { "sSortDataType":"dom-sort-value", "sType":"numeric" },
         null,
         null,
         null,
         null,
-        null
+        null,
+        { "bVisible": false }
       ],
       ],
       "aaSorting":[
       "aaSorting":[
         [ 0, "desc" ]
         [ 0, "desc" ]
@@ -383,7 +390,8 @@ ${ layout.menubar(section='workflows', dashboard=True) }
                     wf.user,
                     wf.user,
                     '<span data-sort-value="'+ wf.lastModTimeInMillis +'">' + emptyStringIfNull(wf.lastModTimeFormatted) + '</span>',
                     '<span data-sort-value="'+ wf.lastModTimeInMillis +'">' + emptyStringIfNull(wf.lastModTimeFormatted) + '</span>',
                     '<a href="' + wf.absoluteUrl + '" data-row-selector="true">' + wf.id + '</a>',
                     '<a href="' + wf.absoluteUrl + '" data-row-selector="true">' + wf.id + '</a>',
-                    wf.parentUrl == '' ? '' : '<div style="text-align:center"><a href="' + wf.parentUrl + '" style="text-align:center"><img src="' + getParentImage(wf.parentUrl) + '" class="app-icon"/></a></div>'
+                    wf.parentUrl == '' ? '' : '<div style="text-align:center"><a href="' + wf.parentUrl + '" style="text-align:center"><img src="' + getParentImage(wf.parentUrl) + '" class="app-icon"/></a></div>',
+                    wf.submittedManually
                   ]);
                   ]);
                 }
                 }
                 catch (error) {
                 catch (error) {
@@ -438,7 +446,8 @@ ${ layout.menubar(section='workflows', dashboard=True) }
                   '<span data-sort-value="' + wf.durationInMillis + '">' + emptyStringIfNull(wf.duration) + '</span>',
                   '<span data-sort-value="' + wf.durationInMillis + '">' + emptyStringIfNull(wf.duration) + '</span>',
               wf.user,
               wf.user,
                   '<a href="' + wf.absoluteUrl + '" data-row-selector="true">' + wf.id + '</a>',
                   '<a href="' + wf.absoluteUrl + '" data-row-selector="true">' + wf.id + '</a>',
-                  wf.parentUrl == '' ? '' : '<div style="text-align:center"><a href="' + wf.parentUrl + '" style="text-align:center"><img src="' + getParentImage(wf.parentUrl) + '" class="app-icon"/></a></div>'
+                  wf.parentUrl == '' ? '' : '<div style="text-align:center"><a href="' + wf.parentUrl + '" style="text-align:center"><img src="' + getParentImage(wf.parentUrl) + '" class="app-icon"/></a></div>',
+              wf.submittedManually
             ], false);
             ], false);
           }
           }
           catch (error) {
           catch (error) {

+ 25 - 1
apps/oozie/src/oozie/views/dashboard.py

@@ -943,7 +943,8 @@ def massaged_oozie_jobs_for_json(oozie_jobs, user, just_sla=False):
         'run': hasattr(job, 'run') and job.run or 0,
         'run': hasattr(job, 'run') and job.run or 0,
         'frequency': hasattr(job, 'frequency') and Coordinator.CRON_MAPPING.get(job.frequency, job.frequency) or None,
         'frequency': hasattr(job, 'frequency') and Coordinator.CRON_MAPPING.get(job.frequency, job.frequency) or None,
         'timeUnit': hasattr(job, 'timeUnit') and job.timeUnit or None,
         'timeUnit': hasattr(job, 'timeUnit') and job.timeUnit or None,
-        'parentUrl': hasattr(job, 'parentId') and job.parentId and get_link(job.parentId) or ''
+        'parentUrl': hasattr(job, 'parentId') and job.parentId and get_link(job.parentId) or '',
+        'submittedManually': hasattr(job, 'parentId') and _submitted_manually(job, user)
       }
       }
       jobs.append(massaged_job)
       jobs.append(massaged_job)
 
 
@@ -1003,3 +1004,26 @@ def has_job_edition_permission(oozie_job, user):
 
 
 def has_dashboard_jobs_access(user):
 def has_dashboard_jobs_access(user):
   return user.is_superuser or user.has_hue_permission(action="dashboard_jobs_access", app=DJANGO_APPS[0])
   return user.is_superuser or user.has_hue_permission(action="dashboard_jobs_access", app=DJANGO_APPS[0])
+
+
+def _submitted_manually(job, user):
+  parent_id = job.parentId
+  if not parent_id:
+    return True
+  if 'C@' in parent_id:
+    return False
+
+  oozie_api = get_oozie(user)
+  if parent_id.endswith('W'):
+    get_job = oozie_api.get_job
+  elif parent_id.endswith('C'):
+    get_job = oozie_api.get_coordinator
+  else:
+    get_job = oozie_api.get_bundle
+
+  try:
+    job = get_job(parent_id)
+  except:
+    return True
+
+  return _submitted_manually(job, user)