Skip to content
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
2 changes: 1 addition & 1 deletion api/src/Downstream/BigEPPhasing.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class BigEPPhasing extends DownstreamPlugin {
function results() {
$dat = array();

if (array_key_exists('program_id', $this->process['PARAMETERS'])) {
if (array_key_exists('scaling_id', $this->process['PARAMETERS'])) {
$parent = $this->_lookup_parent_autoproc();
if ($parent) {
$dat['PARENTAUTOPROCPROGRAM'] = $parent['PROCESSINGPROGRAMS'];
Expand Down
1 change: 1 addition & 0 deletions api/src/Downstream/DownstreamProcessing.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ function legacy() {
$resp['TYPE'] = $this->friendlyname;
$resp['PROCESS'] = $this->process;
$resp['MESSAGES'] = $this->process['MESSAGES'];
$resp['DCID'] = $this->process['DCID'];
$resp['FEATURES'] = array(
'MAPMODEL' => $this->has_mapmodel,
'IMAGES' => $this->has_images,
Expand Down
24 changes: 19 additions & 5 deletions api/src/Page/Exp.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class Exp extends Page
array('/plans/detectors/:DATACOLLECTIONPLANHASDETECTORID', 'patch', '_dp_update_detector'),
array('/plans/detectors/:DATACOLLECTIONPLANHASDETECTORID', 'delete', '_dp_remove_detector'),

array('/setup', 'get', '_get_beamline_setups'),
array('/setup(/:BEAMLINESETUPID)', 'get', '_get_beamline_setups'),
array('/setup', 'post', '_add_beamline_setup'),
array('/setup/:BEAMLINESETUPID', 'patch', '_update_beamline_setup'),

Expand All @@ -164,7 +164,7 @@ function _detectors()
array_push($args, $this->arg('BEAMLINENAME'));
}

$tot = $this->db->pq("SELECT count(d.detectorid) as tot
$tot = $this->db->pq("SELECT count(distinct d.detectorid) as tot
FROM detector d
LEFT OUTER JOIN beamlinesetup bls ON bls.detectorid = d.detectorid
WHERE $where", $args);
Expand All @@ -177,10 +177,24 @@ function _detectors()
'd.detectorid ASC'
);

$rows = $this->db->paginate("SELECT d.detectorid, d.detectortype, d.detectormanufacturer, d.detectorserialnumber, d.sensorthickness, d.detectormodel, d.detectorpixelsizehorizontal, d.detectorpixelsizevertical, d.detectordistancemin, d.detectordistancemax, d.density, d.composition, concat(d.detectormanufacturer,' ',d.detectormodel, ' (',d.detectortype,')') as description, d.detectormaxresolution, d.detectorminresolution, count(distinct dc.datacollectionid) as dcs, count(distinct bls.beamlinesetupid) as blsetups, (SELECT count(distinct dphd.detectorid) FROM DataCollectionPlan_has_Detector dphd WHERE dphd.detectorid = d.detectorid) as dps, GROUP_CONCAT(distinct bls.beamlinename) as beamlines, d.numberofpixelsx, d.numberofpixelsy, d.detectorrollmin, d.detectorrollmax
$rows = $this->db->paginate("SELECT d.detectorid, d.detectortype, d.detectormanufacturer, d.detectorserialnumber, d.sensorthickness, d.detectormodel, d.detectorpixelsizehorizontal, d.detectorpixelsizevertical, d.detectordistancemin, d.detectordistancemax, d.density, d.composition, d.detectormaxresolution, d.detectorminresolution, d.numberofpixelsx, d.numberofpixelsy, d.detectorrollmin, d.detectorrollmax,
concat(d.detectormanufacturer,' ',d.detectormodel, ' (', ifnull(d.detectortype, ''), ')') as description,
count(distinct bls.beamlinesetupid) as blsetups,
GROUP_CONCAT(distinct bls.beamlinename) as beamlines,
COALESCE(datacollections.dcs, 0) as dcs,
COALESCE(datacollectionplans.dps, 0) as dps
FROM detector d
LEFT OUTER JOIN datacollection dc ON dc.detectorid = d.detectorid
LEFT OUTER JOIN beamlinesetup bls ON bls.detectorid = d.detectorid
LEFT JOIN (
SELECT detectorid, COUNT(datacollectionid) as dcs
FROM datacollection
GROUP BY detectorid
) datacollections ON datacollections.detectorid = d.detectorid
LEFT JOIN (
SELECT detectorid, COUNT(DISTINCT detectorid) as dps
FROM DataCollectionPlan_has_Detector
GROUP BY detectorid
) datacollectionplans ON datacollectionplans.detectorid = d.detectorid
WHERE $where
GROUP BY d.detectorid
ORDER BY $order", $args);
Expand Down Expand Up @@ -925,4 +939,4 @@ function _get_experiment_types()

$this->_output(array('total' => count($rows), 'data' => $rows));
}
}
}
2 changes: 1 addition & 1 deletion api/src/Page/Processing.php
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ function _get_downstreams($dcid = null, $aid = null) {
}

$downstreams = $this->db->pq(
"SELECT app.autoprocprogramid, app.processingprograms, pj.automatic,
"SELECT app.autoprocprogramid, app.processingprograms, pj.automatic, pj.datacollectionid as dcid,
app.processingstatus, app.processingmessage,
app.processingstarttime, app.processingendtime, pj.recipe, pj.comments as processingcomments,
dc.imageprefix as dcimageprefix, dc.imagedirectory as dcimagedirectory,
Expand Down
75 changes: 53 additions & 22 deletions api/src/Page/Sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -1966,15 +1966,19 @@ function _ligands()
array_push($args, $this->arg('lid'));
}

$tot = $this->db->pq("SELECT count(distinct l.ligandid) as tot FROM ligand l INNER JOIN proposal p ON p.proposalid = l.proposalid WHERE $where", $args);
$tot = intval($tot[0]['TOT']);

if ($this->has_arg('s')) {
$st = sizeof($args) + 1;
$where .= " AND l.name LIKE CONCAT('%',:" . $st . ", '%')";
array_push($args, $this->arg('s'));
$where .= " AND (
l.name LIKE CONCAT('%',:" . $st . ", '%')
OR l.libraryname LIKE CONCAT('%',:" . ($st + 1) . ", '%')
OR l.librarybatchnumber LIKE CONCAT('%',:" . ($st + 2) . ", '%')
OR l.platebarcode LIKE CONCAT('%',:" . ($st + 3) . ", '%')
)";
array_push($args, $this->arg('s'), $this->arg('s'), $this->arg('s'), $this->arg('s'));
}

$tot = $this->db->pq("SELECT count(distinct l.ligandid) as tot FROM ligand l WHERE $where", $args);
$tot = intval($tot[0]['TOT']);

$start = 0;
$pp = $this->has_arg('per_page') ? $this->arg('per_page') : 15;
Expand All @@ -1990,12 +1994,18 @@ function _ligands()
array_push($args, $end);

$order = 'l.ligandid DESC';

$group = 'l.ligandid';

if ($this->has_arg('sort_by')) {
$cols = array(
'NAME' => 'l.name',
'SMILES' => 'l.smiles',
'LIBRARYNAME' => 'l.libraryname',
'LIBRARYBATCHNUMBER' => 'l.librarybatchnumber',
'PLATEBARCODE' => 'l.platebarcode',
'SOURCEWELL' => 'l.sourcewell',
'SCOUNT' => 'scount',
'DCOUNT' => 'dcount',
);
$dir = $this->has_arg('order') ? ($this->arg('order') == 'asc' ? 'ASC' : 'DESC') : 'ASC';
if (array_key_exists($this->arg('sort_by'), $cols))
Expand All @@ -2006,7 +2016,6 @@ function _ligands()
COUNT(DISTINCT dc.datacollectionid) AS dcount,
COUNT(DISTINCT b.blsampleid) AS scount
FROM ligand l
INNER JOIN proposal p ON p.proposalid = l.proposalid
LEFT OUTER JOIN ligand_has_pdb lhp ON lhp.ligandid = l.ligandid
LEFT OUTER JOIN blsample_has_ligand bhl ON bhl.ligandid = l.ligandid
LEFT OUTER JOIN blsample b ON b.blsampleid = bhl.blsampleid
Expand Down Expand Up @@ -2081,29 +2090,51 @@ function _add_ligand()
{
if (!$this->has_arg('prop'))
$this->_error('No proposal specified');
if (!$this->has_arg('NAME'))
$this->_error('No ligand name');

$smiles = $this->has_arg('SMILES') ? $this->arg('SMILES') : '';
$ligs = array();
$lids = array();

$libname = $this->has_arg('LIBRARYNAME') ? $this->arg('LIBRARYNAME') : null;
$libbatch = $this->has_arg('LIBRARYBATCHNUMBER') ? $this->arg('LIBRARYBATCHNUMBER') : null;
$barcode = $this->has_arg('PLATEBARCODE') ? $this->arg('PLATEBARCODE') : null;
$well = $this->has_arg('SOURCEWELL') ? $this->arg('SOURCEWELL') : null;

$chk = $this->db->pq("SELECT name FROM ligand
WHERE proposalid=:1 AND name=:2", array($this->proposalid, $this->arg('NAME')));
if (sizeof($chk))
$this->_error('That ligand name already exists in this proposal');
$json = $this->request['json'] ?? null;
if ($json && is_array($json)) {

$this->db->pq(
'INSERT INTO ligand (proposalid,name,smiles,libraryname,librarybatchnumber,platebarcode,sourcewell)
VALUES (:1,:2,:3,:4,:5,:6,:7) RETURNING ligandid INTO :id',
array($this->proposalid, $this->arg('NAME'), $smiles, $libname, $libbatch, $barcode, $well)
);
foreach ($json as $row) {
if (isset($row->NAME)) {
$name = $row->NAME;
$smiles = isset($row->SMILES) ? $row->SMILES : null;
$well = isset($row->SOURCEWELL) ? $row->SOURCEWELL : null;
array_push($ligs, array($this->proposalid, $name, $smiles, $libname, $libbatch, $barcode, $well));
}
}
} else {
if (!$this->has_arg('NAME'))
$this->_error('No ligand name');

$smiles = $this->has_arg('SMILES') ? $this->arg('SMILES') : null;
$well = $this->has_arg('SOURCEWELL') ? $this->arg('SOURCEWELL') : null;

$lid = $this->db->id();
array_push($ligs, array($this->proposalid, $this->arg('NAME'), $smiles, $libname, $libbatch, $barcode, $well));

$chk = $this->db->pq("SELECT name FROM ligand
WHERE proposalid=:1 AND name=:2", array($this->proposalid, $this->arg('NAME')));
if (sizeof($chk))
$this->_error('That ligand name already exists in this proposal');
}

foreach ($ligs as $lig) {
$this->db->pq(
'INSERT INTO ligand (proposalid,name,smiles,libraryname,librarybatchnumber,platebarcode,sourcewell)
VALUES (:1,:2,:3,:4,:5,:6,:7) RETURNING ligandid INTO :id',
$lig
);

array_push($lids, $this->db->id());
}

$this->_output(array('LIGANDID' => $lid));
$this->_output(array('LIGANDIDS' => $lids));
}

# ------------------------------------------------------------------------
Expand Down
5 changes: 3 additions & 2 deletions api/src/Page/Shipment.php
Original file line number Diff line number Diff line change
Expand Up @@ -538,10 +538,11 @@ function _add_history()
$email_location = $dewar_complete_email_locations[$last_location];
$send_return_email = preg_match($email_location, strtolower($this->arg('LOCATION')));
}
// If dewar status is dispatch-requested - don't change it.
// If dewar status is dispatch-requested or dispatch-booked - don't change it.
// This way the dewar can be moved between storage locations and keep the record that a user requested the dispatch
// Default status is 'at-facility'
$dewarstatus = strtolower($dew['DEWARSTATUS']) == 'dispatch-requested' ? 'dispatch-requested' : 'at facility';
$status = strtolower($dew['DEWARSTATUS']);
$dewarstatus = ($status == 'dispatch-requested' || $status == 'dispatch-booked') ? $status : 'at facility';
$dewarlocation = $this->arg('LOCATION');

} else {
Expand Down
4 changes: 3 additions & 1 deletion client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
"jquery.flot.tooltip": "^0.9.0",
"lodash-es": "^4.17.21",
"markdown": "^0.5.0",
"papaparse": "^5.4.1",
"plotly.js": "^1.52.2",
"portal-vue": "2.1.7",
"promise": "^8.0.3",
Expand Down
1 change: 1 addition & 0 deletions client/src/files/ligand_template.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Name,SMILES,Well
2 changes: 1 addition & 1 deletion client/src/js/collections/detectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ define(['backbone.paginator', 'models/detector', 'utils/kvcollection'], function
valueAttribute: 'DETECTORID',

state: {
pageSize: 5,
pageSize: 9999,
},

parseState: function(r, q, state, options) {
Expand Down
2 changes: 1 addition & 1 deletion client/src/js/modules/dc/views/downstreamwrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ define(['backbone', 'marionette',
var mapButton = null
if (this.getOption('links')) {
var links = [
'<a class="view button" href="/dc/map/id/'+this.getOption('DCID')+'/aid/'+this.model.get('AID')+'"><i class="fa fa-search"></i> Map / Model Viewer</a>',
'<a class="view button" href="/dc/map/id/'+this.model.get('DCID')+'/aid/'+this.model.get('AID')+'"><i class="fa fa-search"></i> Map / Model Viewer</a>',
'<a class="pattach button" href="#"><i class="fa fa-files-o"></i> Logs &amp; Files</a>',
'<a class="dll button" href="'+app.apiurl+'/download/ap/archive/'+this.model.get('AID')+'"><i class="fa fa-cloud-download"></i> Download Zip</a>',
]
Expand Down
15 changes: 8 additions & 7 deletions client/src/js/modules/fault/views/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ define(['marionette', 'modules/fault/views/filters', 'views/table', 'utils/table
argument: 'FAULTID',
})


return Marionette.LayoutView.extend({
className: 'content',
template: _.template('<h1>Faults</h1><% if (app.user_can(\'fault_add\')) { %><div class="r"><a class="button add" href="/faults/add"><i class="fa fa-plus"></i> Add Fault Report</a></div><% } %><div class="filters"></div><div class="wrapper"></div>'),
Expand All @@ -14,6 +14,7 @@ define(['marionette', 'modules/fault/views/filters', 'views/table', 'utils/table
search: true,

initialize: function(options) {
const params = this.getOption('params') || {}
var columns = [
{ name: 'TITLE', label: 'Title', cell: table.HTMLCell, editable: false },
{ name: 'STARTTIME', label: 'Time', cell: 'string', editable: false },
Expand All @@ -26,23 +27,23 @@ define(['marionette', 'modules/fault/views/filters', 'views/table', 'utils/table
{ name: 'NAME', label: 'Reporter', cell: 'string', editable: false },

]

if (app.mobile()) {
_.each([3,4,5,6,8], function(v) {
columns[v].renderable = false
})
}

this.table = new TableView({ collection: options.collection, columns: columns, tableClass: 'proposals', filter: 's', search: params.s, loading: true, backgrid: { row: ClickableRow, emptyText: 'No faults found' } })

this.table = new TableView({ collection: options.collection, columns: columns, tableClass: 'proposals', filter: 's', search: options.params.s, loading: true, backgrid: { row: ClickableRow, emptyText: 'No faults found' } })

if (this.getOption('filters')) this.filters = new FilterView({ collection: options.collection, params: this.getOption('params') })
if (this.getOption('filters')) this.filters = new FilterView({ collection: options.collection, params: params })
},

onRender: function() {
this.wrap.show(this.table)
if (this.getOption('filters')) this.flts.show(this.filters)
},

onShow: function() {
this.table.focusSearch()
},
Expand Down
19 changes: 16 additions & 3 deletions client/src/js/modules/imaging/views/admin/params.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,11 @@ define(['marionette',


var DetectorsLimitsCellStatic = Backgrid.Cell.extend({
initialize: function(options) {
Backgrid.Cell.prototype.initialize.apply(this, arguments)
this.listenTo(this.model, 'sync change', this.render)
},

render: function() {
this.$el.empty()
if (!this.model.isNew()) {
Expand Down Expand Up @@ -238,9 +243,17 @@ define(['marionette',
console.log('model changed', arguments)
// Changed Attributes are not being detected correctly.
// Therefore we can crudely set all parameters to enforce a PATCH request
if (!m.isNew()) m.save(_.clone(m.attributes), { patch: true })
},

if (!m.isNew()) {
m.save(_.clone(m.attributes), {
patch: true,
wait: true,
success: function() {
m.fetch()
}
});
}
},


onRender: function() {
Expand Down Expand Up @@ -297,4 +310,4 @@ define(['marionette',
})


})
})
4 changes: 4 additions & 0 deletions client/src/js/modules/samples/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ app.addInitializer(function() {
app.navigate('/ligands/lid/'+lid)
})

app.on('ligands:viewall', function() {
app.navigate('/ligands')
})

app.on('phases:view', function(pid) {
app.navigate('/phases/pid/'+pid)
})
Expand Down
Loading
Loading