Skip to content

Commit

Permalink
Merge pre-release/2024-R3.1 into master (#797)
Browse files Browse the repository at this point in the history
* LIMS-595: Change Sample Changers/Containers/Stage to Pucks for i15/i15-1 (xpdf) (#579)

* LIMS-67: Fix 2 slow queries on imaging admin dashboard (#751)

* LIMS-1334: Allow selection of plate samples already in a group (#778)

* LIMS-1246: Allow users with all_dewars permission to view all shipments (#752)

* LIMS-1351: Switch to simpler arrows (#787)

* LIMS-1343: Interface changes based on reviewer suggestions from Conexs paper (#783)

* LIMS-1170: Dont use thumbnails for crystal snapshots (#784)
  • Loading branch information
ndg63276 authored Jul 3, 2024
1 parent a968b04 commit da53c52
Show file tree
Hide file tree
Showing 42 changed files with 181 additions and 151 deletions.
3 changes: 3 additions & 0 deletions api/src/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,9 @@ function auth($require_staff)
{
if (sizeof(array_intersect($vis, $this->visits)))
$auth = True;
if ($this->user->hasPermission('all_dewars'))
// allow to see anything without an id or a visit
$auth = True;
}

// No id or visit, anyone ok to view
Expand Down
10 changes: 2 additions & 8 deletions api/src/Page/DC.php
Original file line number Diff line number Diff line change
Expand Up @@ -1082,14 +1082,8 @@ function _chk_image()
$images = array();
foreach (array('X1', 'X2', 'X3', 'X4') as $j => $im) {
array_push($images, file_exists($dc[$im]) ? 1 : 0);
if ($im == 'X1') {
$ext = pathinfo($dc[$im], PATHINFO_EXTENSION);
$thumb = str_replace('.' . $ext, 't.' . $ext, $dc[$im]);
if ($this->staff && $this->has_arg('debug'))
$debug['snapshot_thumb'] = array('file' => $thumb, 'exists' => file_exists($thumb) ? 1 : 0);
if (file_exists($thumb))
$sn = 1;
}
if ($im == 'X1' && file_exists($dc[$im]))
$sn = 1;
unset($dc[$im]);
}

Expand Down
16 changes: 6 additions & 10 deletions api/src/Page/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ class Image extends Page
'thresh' => '\d',
);

public static $dispatch = array(array('/id/:id(/f/:f)(/n/:n)', 'get', '_xtal_image'),
public static $dispatch = array(array('/id/:id(/n/:n)', 'get', '_xtal_image'),
array('/diff/id/:id(/f/:f)(/n/:n)', 'get', '_diffraction_image'),
array('/di/id/:id(/thresh/:thresh)(/n/:n)', 'get', '_diffraction_viewer'),
array('/cam/bl/:bl(/n/:n)', 'get', '_forward_webcam'),
array('/oav/bl/:bl(/n/:n)', 'get', '_forward_oav'),
array('/fa/fid/:id', 'get', '_fault_attachment'),
array('/ai/visit/:visit/aid/:aid(/n/:n)(/f/:f)', 'get', '_action_image'),
array('/ai/visit/:visit/aid/:aid(/n/:n)', 'get', '_action_image'),
array('/dr/:drid', 'get', '_dewar_report_image'),
array('/cr/:crid', 'get', '_container_report_image'),
);
Expand Down Expand Up @@ -121,8 +121,6 @@ function _action_image() {
INNER JOIN proposal p ON s.proposalid = p.proposalid
WHERE r.robotactionid=:1 AND CONCAT(p.proposalcode, p.proposalnumber, '-', s.visit_number) LIKE :2", array($this->arg('aid'), $this->arg('visit')));

//print_r($image);

if (!sizeof($image)) return;
else $image = $image[0];

Expand All @@ -133,10 +131,9 @@ function _action_image() {
if ($n < sizeof($images)) {
$this->_browser_cache();
$ext = pathinfo($images[$n], PATHINFO_EXTENSION);
$file = $this->has_arg('f') ? $images[$n] : str_replace('.'.$ext, 't.'.$ext, $images[$n]);
if (file_exists($file)) {
if (file_exists($images[$n])) {
$this->app->contentType('image/'.$ext);
readfile($file);
readfile($images[$n]);
} else {
$this->_error('Not found', 'That image is no longer available');
}
Expand All @@ -161,11 +158,10 @@ function _xtal_image() {
if ($n < sizeof($images)) {
$ext = pathinfo($images[$n], PATHINFO_EXTENSION);

$file = $this->has_arg('f') ? $images[$n] : str_replace('.'.$ext, 't.'.$ext, $images[$n]);
if (file_exists($file)) {
if (file_exists($images[$n])) {
$this->_browser_cache();
$this->app->contentType('image/'.$ext);
readfile($file);
readfile($images[$n]);

} else {
$this->_error('Not found', 'That image is no longer available');
Expand Down
41 changes: 37 additions & 4 deletions api/src/Page/Imaging.php
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,15 @@ function _get_inspections()
'STATE' => 'i.state',
'SCHEDULECOMPONENTID' => 'i.schedulecomponentid',
'MANUAL' => 'i.manual',
'IMAGESSCORED' => 'imagesscored',
'CONTAINER' => 'c.code',
'CONTAINERID' => 'i.containerid',
'PROP' => 'prop',
'VISIT_NUMBER' => 'ses.visit_number',
'CONTAINERINSPECTIONID' => 'i.containerinspectionid',
'INSPECTIONTYPE' => 'inspectiontype',
'DURATION' => 'duration',
'DWELL' => 'dwell',
'AGE' => 'age',
);
$dir = $this->has_arg('order') ? ($this->arg('order') == 'asc' ? 'ASC' : 'DESC') : 'ASC';
if (array_key_exists($this->arg('sort_by'), $cols))
Expand Down Expand Up @@ -439,11 +446,30 @@ function _get_inspections()
$extc = ", ROUND(TIMESTAMPDIFF('MINUTE', min(i2.bltimestamp), i.bltimestamp)/(60*24),1) as delta, CONCAT(CONCAT(CONCAT(CONCAT(TO_CHAR(i.bltimestamp, 'HH24:MI DD-MM-YYYY'), ' (+'), ROUND(TIMESTAMPDIFF('HOUR', case when min(i2.bltimestamp) is not null then min(i2.bltimestamp) else i.bltimestamp end, i.bltimestamp)/24,1)), 'd) '), (case when i.manual=1 then '[Manual]' else (case when i.schedulecomponentid is null then '[Adhoc]' else '' end) end)) as title";
}

$inspections = $this->db->paginate("SELECT ROUND(TIMESTAMPDIFF('HOUR', i.bltimestamp, CURRENT_TIMESTAMP)/24,1) as age, ROUND(TIMESTAMPDIFF('MINUTE', i.scheduledtimestamp, i.bltimestamp)/(24*60),2) as dwell, c.code as container, CONCAT(p.proposalcode, p.proposalnumber) as prop, TO_CHAR(min(im.modifiedtimestamp), 'DD-MM-YYYY HH24:MI') as imagesscoredtimestamp, case when count(im.blsampleimageid) > 0 then 1 else 0 end as imagesscored,
TO_CHAR(i.scheduledtimestamp, 'DD-MM-YYYY HH24:MI') as scheduledtimestamp, sc.offset_hours, i.priority, i.state, i.schedulecomponentid, i.manual, img.name as imager, it.name as inspectiontype, i.containerinspectionid, i.containerid, i.inspectiontypeid, i.temperature, TO_CHAR(i.bltimestamp, 'DD-MM-YYYY HH24:MI') as bltimestamp, i.imagerid, CONCAT(p.proposalcode, p.proposalnumber, '-', ses.visit_number) as visit, ses.visit_number, TIMESTAMPDIFF('MINUTE', i.bltimestamp, i.completedtimestamp) as duration $extc
$inspections = $this->db->paginate("SELECT ROUND(TIMESTAMPDIFF('HOUR', i.bltimestamp, CURRENT_TIMESTAMP)/24,1) as age,
ROUND(TIMESTAMPDIFF('MINUTE', i.scheduledtimestamp, i.bltimestamp)/(24*60),2) as dwell,
c.code as container,
CONCAT(p.proposalcode, p.proposalnumber) as prop,
TO_CHAR(i.scheduledtimestamp, 'DD-MM-YYYY HH24:MI') as scheduledtimestamp,
sc.offset_hours,
i.priority,
i.state,
i.schedulecomponentid,
i.manual,
img.name as imager,
it.name as inspectiontype,
i.containerinspectionid,
i.containerid,
i.inspectiontypeid,
i.temperature,
TO_CHAR(i.bltimestamp, 'DD-MM-YYYY HH24:MI') as bltimestamp,
i.imagerid,
CONCAT(p.proposalcode, p.proposalnumber, '-', ses.visit_number) as visit,
ses.visit_number,
TIMESTAMPDIFF('MINUTE', i.bltimestamp, i.completedtimestamp) as duration
$extc
FROM containerinspection i
LEFT OUTER JOIN schedulecomponent sc ON sc.schedulecomponentid = i.schedulecomponentid
LEFT OUTER JOIN blsampleimage im ON im.containerinspectionid = i.containerinspectionid AND im.blsampleimagescoreid IS NOT NULL
INNER JOIN inspectiontype it ON it.inspectiontypeid = i.inspectiontypeid
INNER JOIN container c ON c.containerid = i.containerid
LEFT OUTER JOIN imager img ON img.imagerid = i.imagerid
Expand All @@ -456,6 +482,13 @@ function _get_inspections()
GROUP BY i.containerinspectionid
ORDER BY $order", $args);

foreach ($inspections as &$i) {
$args = array($i['CONTAINERINSPECTIONID']);
$scored = $this->db->pq("SELECT case when count(im.blsampleimageid) > 0 then 1 else 0 end as imagesscored
FROM blsampleimage im
WHERE im.containerinspectionid=:1 AND im.blsampleimagescoreid IS NOT NULL", $args);
$i['IMAGESSCORED'] = $scored[0]['IMAGESSCORED'];
}

if ($this->has_arg('iid')) {
if (!sizeof($inspections))
Expand Down
4 changes: 4 additions & 0 deletions api/src/Page/Proposal.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ function _get_proposals($id = null)
$where .= " AND (shp.personid=:" . (sizeof($args) + 1) . " OR s.beamlinename in ('" . implode("','", $bls) . "'))";
array_push($args, $this->user->personId);
}
} else if ($this->user->hasPermission('all_dewars')) {
// allow to see shipments on all proposals
} else {
$where = " INNER JOIN session_has_person shp ON shp.sessionid = s.sessionid " . $where;
$where .= " AND shp.personid=:" . (sizeof($args) + 1);
Expand Down Expand Up @@ -921,6 +923,8 @@ function _lookup()

$where .= " AND ses.beamlinename in ('" . implode("','", $bls) . "')";
}
} else if ($field == 'SHIPPINGID' && $this->user->hasPermission('all_dewars')) {
// allow to see shipments
} else {
$where = " INNER JOIN session_has_person shp ON shp.sessionid = ses.sessionid " . $where;
$where .= " AND shp.personid=:" . (sizeof($args) + 1);
Expand Down
2 changes: 1 addition & 1 deletion api/src/Page/Shipment.php
Original file line number Diff line number Diff line change
Expand Up @@ -1973,7 +1973,7 @@ function _get_all_containers()
array_push($args, $start);
array_push($args, $end);

$order = 'c.bltimestamp DESC';
$order = 'c.containerid DESC';

if ($this->has_arg('ty')) {
if ($this->arg('ty') == 'todispose') {
Expand Down
1 change: 0 additions & 1 deletion client/src/js/app/components/header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
</router-link>
</div>
<div
v-if="isStaff"
class="tw-flex"
>
<!-- Only show those links with correct permission -->
Expand Down
1 change: 1 addition & 0 deletions client/src/js/modules/assign/views/assign.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ define(['marionette', 'backbone', 'views/pages',
templateHelpers: function() {
return {
VISIT: this.getOption('visit').toJSON(),
APP_TYPE: app.type,
}
},

Expand Down
8 changes: 7 additions & 1 deletion client/src/js/modules/assign/views/selectvisit.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@ define(['marionette', 'templates/assign/selectvisit.html'], function(Marionette,
className: 'content',
childView: VisitView,
childViewContainer: 'ul.visits',
emptyView: EmptyView
emptyView: EmptyView,

templateHelpers: function() {
return {
APP_TYPE: app.type,
}
},

})

Expand Down
8 changes: 4 additions & 4 deletions client/src/js/modules/dc/views/gridplot.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ define(['jquery', 'marionette',
opts.push('<option value='+i+'>Image '+i+'</option>')
if (i === 1) {
// show button to view image full size
this.ui.sns.append('<a class="button" href="'+app.apiurl+'/image/id/'+this.getOption('ID')+'/f/1/n/'+i+'"><i class="fa fa-arrows"></a>')
this.ui.sns.append('<a class="button" href="'+app.apiurl+'/image/id/'+this.getOption('ID')+'/n/'+i+'"><i class="fa fa-arrows"></a>')
} else {
this.ui.sns.append('<a class="hidden" href="'+app.apiurl+'/image/id/'+this.getOption('ID')+'/f/1/n/'+i+'"></a>')
this.ui.sns.append('<a class="hidden" href="'+app.apiurl+'/image/id/'+this.getOption('ID')+'/n/'+i+'"></a>')
}
}
}
Expand All @@ -171,7 +171,7 @@ define(['jquery', 'marionette',

loadImage: function() {
var n = this.ui.ty3.val()
this.snapshot.load(app.apiurl+'/image/id/'+this.getOption('ID')+'/f/1/n/'+n)
this.snapshot.load(app.apiurl+'/image/id/'+this.getOption('ID')+'/n/'+n)
},

toggleFluo: function() {
Expand Down Expand Up @@ -270,7 +270,7 @@ define(['jquery', 'marionette',
if (m.get('SNS')[this.getOption('snapshotId')] && !this.hasSnapshot) {
this.snapshotLoading = true
this.$el.addClass('loading')
this.snapshot.load(app.apiurl+'/image/id/'+this.getOption('ID')+'/f/1')
this.snapshot.load(app.apiurl+'/image/id/'+this.getOption('ID'))
}
}
},
Expand Down
4 changes: 2 additions & 2 deletions client/src/js/modules/dc/views/imagestatusitem.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ define(['marionette',
var sns = ''
for (var i = 1; i < this.model.get('SNS').length; i++) {
if (this.model.get('SNS')[i]) {
sns += ('<a href="'+app.apiurl+'/image/id/'+id+'/f/1/n/'+(i+1)+'" title="Crystal Snapshot '+(i+1)+'"></a>')
sns += ('<a href="'+app.apiurl+'/image/id/'+id+'/n/'+(i+1)+'" title="Crystal Snapshot '+(i+1)+'"></a>')
}
}

Expand All @@ -91,4 +91,4 @@ define(['marionette',
},
})

})
})
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
v-else-if="selectedContainerType.NAME && selectedContainerType.NAME.toLowerCase() !== 'puck'"
:container-type="selectedContainerType"
:valid-samples="validSamples"
:manually-selected-samples="manuallySelectedSamples"
:container-identifier="selectedContainerName"
color-attribute="VALID"
added-color-attribute="ADDED"
Expand Down Expand Up @@ -218,11 +219,14 @@ export default {
validSamples() {
if (this.selectedContainerId) {
const selectedContainer = this.selectedSamplesInGroups[this.selectedContainerId] || []
const difference = differenceBy(selectedContainer, this.selectedContainerAddedSamples, 'BLSAMPLEID')
return [...this.selectedContainerAddedSamples, ...difference]
const uniqueSelectedContainer = uniqBy(selectedContainer.concat(this.selectedContainerAddedSamples), 'BLSAMPLEID')
return uniqueSelectedContainer
}
return []
},
manuallySelectedSamples() {
return this.selectedSamplesInGroups[this.selectedContainerId] || []
}
},
created: function () {
Expand Down
8 changes: 6 additions & 2 deletions client/src/js/modules/shipment/components/plate-view.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ export default {
type: Array,
default: () => ([])
},
manuallySelectedSamples: {
type: Array,
default: () => ([])
},
addedColorAttribute: {
type: String,
default: ''
Expand Down Expand Up @@ -425,7 +429,7 @@ export default {
}
}
else {
if (this.selectedDrops.includes(itemsWithSample[0])) {
if (this.manuallySelectedSamples.some(e => Number(e.LOCATION) === itemsWithSample[0])) {
this.$emit('unselect-cell', itemsWithSample)
this.currentSelectedDropIndex = -1
}
Expand Down Expand Up @@ -625,4 +629,4 @@ export default {
.pointer {
cursor: pointer
}
</style>
</style>
16 changes: 11 additions & 5 deletions client/src/js/modules/shipment/views/shipment.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,26 +146,32 @@ define(['marionette',

showDewar: function(did, force) {
if (did == this.lastDewarID && !force) return

this.$el.find('.dewar_name').text(this.dewars.findWhere({ DEWARID: did }).get('CODE'))
if (app.proposal && app.proposal.get('ACTIVE') == '1') this.$el.find('.add_container').html('<a class="button" data-testid="shipment-add-container" href="/containers/add/did/'+did+'"><i class="fa fa-plus"></i> Add Container</a>')
if (app.proposal && app.proposal.get('ACTIVE') == '1') {
if (app.type == "xpdf"){
this.$el.find('.add_container').html('<a class="button" data-testid="shipment-add-container" href="/containers/add/did/'+did+'"><i class="fa fa-plus"></i> Add Puck</a>')
this.$el.find('.add-container-small').prop('title', 'Click to add a puck')
this.$el.find('.add-container-text').text('Add Puck')
} else {
this.$el.find('.add_container').html('<a class="button" data-testid="shipment-add-container" href="/containers/add/did/'+did+'"><i class="fa fa-plus"></i> Add Container</a>')
}
}
this.dewarcontent.dewarID = did
this.dewarcontent.fetch()
this.dewarhistory.id = did
this.dewarhistory.fetch()

var d = this.dewars.findWhere({ DEWARID: did })
if (d && (d.get('TRACKINGNUMBERTOSYNCHROTRON') || d.get('TRACKINGNUMBERTOSYNCHROTRON'))) {
if (d && (d.get('TRACKINGNUMBERTOSYNCHROTRON') || d.get('TRACKINGNUMBERFROMSYNCHROTRON'))) {
this.dewartracking.queryParams.DEWARID = did
this.dewartracking.fetch()

} else {
this.dewartracking.ORIGIN = 'N/A'
this.dewartracking.DESTINATION = 'N/A'
this.dewartracking.reset()

this.lastDewarID = did
}
this.lastDewarID = did
},

refreshDewar: function() {
Expand Down
Loading

0 comments on commit da53c52

Please sign in to comment.