Ver código fonte

Added job details to the bulk loader node and added percentage complete to the job listing

Lacey Sanderson 12 anos atrás
pai
commit
f8519776e2

+ 5 - 2
tripal_bulk_loader/tripal_bulk_loader.admin.inc

@@ -130,11 +130,13 @@ function tripal_bulk_loader_admin_jobs() {
     array('data' => 'Name', 'field' => 'loader_name'),
     array('data' =>  'Template', 'field' => 'template_name'),
     array('data' =>  'Status', 'field' => 'job_status'),
+    array('data' => 'Progress', 'field' => 'progress'),
     '');
   $rows = array();
-  $resource = pager_query("SELECT n.*, t.name as template_name
+  $resource = pager_query("SELECT n.*, t.name as template_name, j.progress
     FROM {tripal_bulk_loader} n
-    LEFT JOIN {tripal_bulk_loader_template} t ON cast(n.template_id as integer)=t.template_id"
+    LEFT JOIN {tripal_bulk_loader_template} t ON cast(n.template_id as integer) = t.template_id
+    LEFT JOIN {tripal_jobs} j ON n.job_id = j.job_id"
     . tablesort_sql($header),
     $num_jobs_per_page);
   while ($n = db_fetch_object($resource)) {
@@ -143,6 +145,7 @@ function tripal_bulk_loader_admin_jobs() {
       l($n->loader_name, 'node/' . $n->nid),
       l($n->template_name, 'admin/tripal/tripal_bulk_loader_template/manage_templates/edit', array('query' => 'template_id=' . $n->template_id)),
       $n->job_status,
+      ($n->progress) ? $n->progress . '%' : '',
       l('View', 'node/' . $n->nid) . ' | ' .  l('Edit', 'node/' . $n->nid . '/edit')
     );
   }

+ 4 - 0
tripal_bulk_loader/tripal_bulk_loader.module

@@ -327,6 +327,10 @@ function tripal_bulk_loader_load($node) {
 
   $node->title = 'Bulk Loading Job: ' . $node->loader_name;
 
+  // Add job details
+  $sql = "SELECT * FROM {tripal_jobs} WHERE job_id=%d";
+  $node->job = db_fetch_object(db_query($sql, $node->job_id));
+
   // Add the loader template
   $sql = "SELECT * FROM {tripal_bulk_loader_template} WHERE template_id=%d";
   $results = db_fetch_object(db_query($sql, $node->template_id));