diff --git a/api/src/Downstream/DownstreamProcessing.php b/api/src/Downstream/DownstreamProcessing.php index ca271d91b..a27c73b57 100644 --- a/api/src/Downstream/DownstreamProcessing.php +++ b/api/src/Downstream/DownstreamProcessing.php @@ -113,7 +113,7 @@ function _get_attachments( } $rows = $this->db->pq( - "SELECT appa.filename, appa.filepath, appa.filetype, CONCAT(appa.filepath, '/', appa.filename) as file + "SELECT appa.autoprocprogramattachmentid, appa.filename, appa.filepath, appa.filetype, CONCAT(appa.filepath, '/', appa.filename) as file FROM autoprocprogramattachment appa WHERE appa.autoprocprogramid = :1 $where ORDER BY appa.importancerank,appa.filename", diff --git a/api/src/Downstream/Type/Dimple.php b/api/src/Downstream/Type/Dimple.php index b23330703..814e18b78 100644 --- a/api/src/Downstream/Type/Dimple.php +++ b/api/src/Downstream/Type/Dimple.php @@ -121,6 +121,7 @@ function results() { } $dat['ANODE_PEAKS'] = $this->_get_anode_peaks($this->process['PARAMETERS']['scaling_id']); + $dat['ANODE_MODEL'] = $this->_get_anode_model(); $results = new DownstreamResult($this); $results->data = $dat; @@ -199,4 +200,12 @@ function _get_anode_peaks($scaling_id) { } return array('TABLE' => $peaks, 'PLOT' => $plot); } + + function _get_anode_model() { + $model = $this->_get_attachments('anode.html'); + if ($model) { + return $model['AUTOPROCPROGRAMATTACHMENTID']; + } + return; + } } diff --git a/client/src/js/modules/dc/views/dimple.js b/client/src/js/modules/dc/views/dimple.js index 0c156229a..8056eda72 100644 --- a/client/src/js/modules/dc/views/dimple.js +++ b/client/src/js/modules/dc/views/dimple.js @@ -13,6 +13,7 @@ define([ rstats_div: '.rstats_div', blob: '.blobs img', blobs: '.blobs', + viewer: '.viewer', }, showBlob: function() { @@ -31,6 +32,12 @@ define([ this.ui.blob.hide() + if (this.model.get('ANODE_MODEL')) { + this.ui.viewer.attr('href', app.apiurl+'/download/ap/attachments/' + this.model.get('ANODE_MODEL') + '/dl/2'); + } else { + this.ui.viewer.hide() + } + if (this.model.get('BLOBS') > 0) { this.blob = new XHRImage() this.blob.onload = this.showBlob.bind(this) @@ -44,10 +51,10 @@ define([ this.ui.rstats.width(0.25*(this.options.holderWidth-14)) this.ui.plot.width(0.42*(this.options.holderWidth-14)) this.ui.plot.height(this.ui.plot.width()*0.41-80) - this.ui.rstats_div.height(this.ui.plot.width()*0.41-80) + this.ui.rstats_div.height(this.ui.plot.height()) } - this.ui.blobs.css('min-height', this.ui.plot.width()*0.41-80) + this.ui.blobs.css('min-height', this.ui.plot.height()) var data = [{ data: this.model.get('PLOTS').FVC, label: 'Rfree vs. Cycle' }, { data: this.model.get('PLOTS').RVC, label: 'R vs. Cycle' }] @@ -56,8 +63,9 @@ define([ const anodePeaks = this.model.get('ANODE_PEAKS'); if (anodePeaks && anodePeaks.TABLE && anodePeaks.TABLE.length > 0) { - this.ui.plot_anode.width(0.42 * (this.options.holderWidth - 14)) - this.ui.plot_anode.height(this.ui.plot.width() * 0.41 - 80) + this.ui.plot_anode.width(this.ui.plot.width()) + this.ui.plot_anode.height(this.ui.plot.height()) + this.ui.blobs.css('min-height', this.ui.plot.height() + this.ui.plot_anode.height()) var anode_data = [{ data: anodePeaks.PLOT, label: 'Peak Height (sig)' }] var anode_pl = $.extend({}, utils.default_plot, { series: { lines: { show: true }}}); diff --git a/client/src/js/templates/dc/dc_dimple.html b/client/src/js/templates/dc/dc_dimple.html index 1fd80df41..44dfe4f22 100644 --- a/client/src/js/templates/dc/dc_dimple.html +++ b/client/src/js/templates/dc/dc_dimple.html @@ -37,7 +37,7 @@
| X |