Skip to content

Commit

Permalink
LIMS-14: Show a direct link to the autoprocessing log (#805)
Browse files Browse the repository at this point in the history
Co-authored-by: Mark Williams <[email protected]>
  • Loading branch information
ndg63276 and Mark Williams authored Sep 17, 2024
1 parent f58aef5 commit 34022a3
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
45 changes: 44 additions & 1 deletion api/src/Page/Download.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class Download extends Page

array('/ap/attachments(/:AUTOPROCPROGRAMATTACHMENTID)(/dl/:download)', 'get', '_get_autoproc_attachments'),
array('/ap/archive/:AUTOPROCPROGRAMID', 'get', '_get_autoproc_archive'),
array('/ap/log/:AUTOPROCPROGRAMID', 'get', '_get_autoproc_log'),
);


Expand Down Expand Up @@ -220,7 +221,7 @@ function __get_autoproc_attachments()
INNER JOIN datacollectiongroup dcg ON dcg.datacollectiongroupid = dc.datacollectiongroupid
INNER JOIN blsession s ON s.sessionid = dcg.sessionid
WHERE s.proposalid=:1 $where
ORDER BY importancerank"
ORDER BY importancerank, filename"
), $args);

return $rows;
Expand Down Expand Up @@ -413,6 +414,48 @@ function _get_attachment()
}
}

# ------------------------------------------------------------------------
# Get the most important log of an autoprocessing job
function _get_autoproc_log()
{

if (!$this->has_arg('prop')) {
$this->_error('No proposal specified');
}
$args = array($this->proposalid, $this->arg('AUTOPROCPROGRAMID'));

$rows = $this->db->union(array(
"SELECT app.autoprocprogramid, appa.filename, appa.filepath
FROM autoprocintegration api
INNER JOIN autoprocprogram app ON api.autoprocprogramid = app.autoprocprogramid
INNER JOIN autoprocprogramattachment appa ON appa.autoprocprogramid = app.autoprocprogramid
INNER JOIN datacollection dc ON dc.datacollectionid = api.datacollectionid
INNER JOIN datacollectiongroup dcg ON dcg.datacollectiongroupid = dc.datacollectiongroupid
INNER JOIN blsession s ON s.sessionid = dcg.sessionid
WHERE s.proposalid=:1
AND app.autoprocprogramid=:2
AND appa.importancerank=1
AND appa.filetype='Log'",
"SELECT app.autoprocprogramid, appa.filename, appa.filepath
FROM autoprocprogram app
INNER JOIN processingjob pj on pj.processingjobid = app.processingjobid
INNER JOIN autoprocprogramattachment appa ON appa.autoprocprogramid = app.autoprocprogramid
INNER JOIN datacollection dc ON dc.datacollectionid = pj.datacollectionid
INNER JOIN datacollectiongroup dcg ON dcg.datacollectiongroupid = dc.datacollectiongroupid
INNER JOIN blsession s ON s.sessionid = dcg.sessionid
WHERE s.proposalid=:1
AND app.autoprocprogramid=:2
AND appa.importancerank=1
AND appa.filetype='Log'"
), $args);

if (!sizeof($rows)) {
return $this->_error('No log file found');
}
$this->_get_file($rows[0]['AUTOPROCPROGRAMID'], $rows[0]);

}


# ------------------------------------------------------------------------
# Get an archive of an autoproc
Expand Down
1 change: 1 addition & 0 deletions client/src/js/templates/dc/dc_autoproc.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
</a>
<% } %>

<a class="mainlog button dll" href="<%-APIURL%>/download/ap/log/<%-AID%>"><i class="fa fa-file"></i> Processing Log</a>
<a class="plot button" href="#"><i class="fa fa-line-chart"></i> Plots</a>
<a class="view button dll" href="<%-APIURL%>/download/ap/archive/<%-AID%>"><i class="fa fa-archive"></i> Archive</a>
<a class="apattach button" href="#"><i class="fa fa-files-o"></i> Logs &amp; Files</a>
Expand Down

0 comments on commit 34022a3

Please sign in to comment.