Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LIMS-14: Show a direct link to the autoprocessing log #805

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading