Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
2080109
allow container assigment by staff from prop + beamline as well as visit
stufisher Aug 22, 2020
970b402
allow filtering containers by shipment, and by registry
stufisher Aug 22, 2020
f58e11e
add diffractionplan columns to sample, get samples by shipment
stufisher Aug 22, 2020
f9f8b40
add new diffraction plan columns and container view toggle
stufisher Aug 22, 2020
80e18cb
add csv importer
stufisher Aug 22, 2020
80708bd
add barcode scan container assign page
stufisher Aug 22, 2020
3d64911
add new config.json option
stufisher Aug 23, 2020
f123ba1
count distinct rather than groupby
stufisher Aug 23, 2020
9a44717
dont fetch if val empty, debounce right function
stufisher Aug 29, 2020
387f20d
update breadcrumbs
stufisher Aug 31, 2020
4c6c614
punctuation
stufisher Aug 31, 2020
c0acf24
use concat_ws incase some values are null
stufisher Sep 1, 2020
3bfa5a4
add collectionmode and priority
stufisher Sep 14, 2020
f4d07e5
add other csv mime types
stufisher Sep 16, 2020
2f4e62b
mime type is not sent on windows :|
stufisher Sep 17, 2020
c534cf4
increase page size for sample
stufisher Sep 22, 2020
9cc0d66
validate barcode on scan assign page
stufisher Dec 23, 2020
6936828
wip: mailin enhancements
stufisher Apr 10, 2021
aca1db8
make possible to disable diff plan columns for containers
stufisher Apr 26, 2021
35f1d48
rename csv button
stufisher Apr 26, 2021
5554832
add mark shipment returned button and api, add mark queue completed a…
stufisher Apr 30, 2021
7544d8a
document disabling exp_plan fields
stufisher Apr 30, 2021
2a14dcd
add initial queued containers view
stufisher Apr 30, 2021
548c8f8
update container review page, link from container
stufisher Apr 30, 2021
94c266f
separate spacegroups
stufisher Apr 30, 2021
86fb5c6
add additional filters to queue view
stufisher May 22, 2021
3fe0a46
add queue button to admin menu
stufisher May 22, 2021
0263e95
allow customising auto collect label
stufisher May 22, 2021
6fd7c79
remove debug
stufisher May 22, 2021
b5b5ba7
add link back to container
stufisher May 22, 2021
60b03e4
allow staff to queue entire shipment
stufisher May 22, 2021
a4393c0
remove debug
stufisher May 22, 2021
5ad92d8
stop shipment return if there are still outstanding queued containers
stufisher May 24, 2021
2796146
allow anyone to use queue shipment button if enabled
stufisher May 29, 2021
27112d6
add samples to containerqueue for pucks and allow editing their statu…
stufisher May 29, 2021
2fdd64b
correct where option comes from...
stufisher May 31, 2021
edf5155
increase number of containers when queuing a shipment
stufisher Jun 5, 2021
168330a
Enable UAS API to set delivered time on close
Jul 26, 2021
38d4361
Add hooks for determining delivered time on session close api call
Jul 26, 2021
f1d61b9
Add missing import in shipment routes file
Jul 29, 2021
5d868a1
Update comments to describe custom site logo
Jul 29, 2021
3c09b29
Added missing route for import csv
Jul 29, 2021
252811f
Make clear csv_profile in config.json does not need file extension
Jul 29, 2021
bf67b48
Prevent sample patch failing because no container id
Jul 29, 2021
35dfcb9
Revert "Enable UAS API to set delivered time on close"
Jul 26, 2021
d6be16e
Revert "Add hooks for determining delivered time on session close api…
Jul 26, 2021
d20a907
add missing routes
stufisher Sep 13, 2021
5e48332
fix no images in review page
stufisher Jan 7, 2022
9dea442
correct permission for queued containers
stufisher Jan 7, 2022
55cc148
allow searching containers by owner(person).login
stufisher Jan 7, 2022
c2438fd
preserve search term in url (ty always first on queued containers)
stufisher Jan 7, 2022
a487761
apply search params to count query
stufisher Jan 7, 2022
4904a8c
make sure currentPage is int
stufisher Jan 7, 2022
4927bbb
add staffcomments to swagger api
stufisher Jan 7, 2022
94a2e08
received typo
stufisher Jan 7, 2022
24c5e79
prevent container / sample duplication for csv import
stufisher Jan 7, 2022
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
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ $ git clone https://github.com/DiamondLightSource/SynchWeb
### Customise front end - config.json
An example configuration is provided in client/src/js/config_sample.json
This file should be copied to create a client/src/js/config.json file and edited to customise the application for your site.
To create your own logo at the top of the page, update the tailwind.config.js header-site-logo.
The footer logo (ispyb logo image) can also be customised by setting the tailwind.config.js footer-site-logo before building the client.

| Parameter | Description |
| ------ | ------ |
Expand All @@ -35,9 +37,11 @@ This file should be copied to create a client/src/js/config.json file and edited
| maintenance_message | Can be used so app serves static page under maintenance periods |
| maintenance | Flag to indicate if client is in maintenance mode|
| ga_ident | Google Analytics id|
| site_name | Site Name to display in footer |
| site_link | URL to site home page |
| data_catalogue | Object that includes name and url property for a link to a data catalogue - displayed on the landing page |
| csv_profile | The csv profile for importing shipments, currently only imca, see src/js/csv/imca.js |
| enable_exp_plan | Whether to enable editing of experimental plan fields when creating samples |
| auto_collect_label | Customise the auto collect label from the default 'Automated' |
| queue_shipment | Allow entire shipment to be queued for automated / mail-in collection |

Site Image can be customised via the tailwind.config.js header-site-logo and footer-site-logo values.

Expand Down
5 changes: 5 additions & 0 deletions api/docs/definitions/sample-new.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ properties:
description: Sample comments
example: in 25% PEG4000 50um

STAFFCOMMENTS:
type: string
description: Sample staff comments
example: no crystal in loop

SPACEGROUP:
type: string
description: Spacegroup
Expand Down
10 changes: 10 additions & 0 deletions api/docs/dist/spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -3714,6 +3714,11 @@
"description": "Sample comments",
"example": "in 25% PEG4000 50um"
},
"STAFFCOMMENTS": {
"type": "string",
"description": "Sample staff comments",
"example": "no crystal in loop"
},
"SPACEGROUP": {
"type": "string",
"description": "Spacegroup",
Expand Down Expand Up @@ -4018,6 +4023,11 @@
"description": "Sample comments",
"example": "in 25% PEG4000 50um"
},
"STAFFCOMMENTS": {
"type": "string",
"description": "Sample staff comments",
"example": "no crystal in loop"
},
"SPACEGROUP": {
"type": "string",
"description": "Spacegroup",
Expand Down
87 changes: 70 additions & 17 deletions api/src/Page/Assign.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class Assign extends Page
{

public static $arg_list = array('visit' => '\w+\d+-\d+', 'cid' => '\d+', 'did' => '\d+', 'pos' => '\d+', 'bl' => '[\w-]+');
public static $arg_list = array('visit' => '\w+\d+-\d+', 'cid' => '\d+', 'did' => '\d+', 'pos' => '\d+', 'bl' => '[\w-]+', 'nodup' => '\d');

public static $dispatch = array(array('/visits(/:visit)', 'get', '_blsr_visits'),
array('/assign', 'get', '_assign'),
Expand All @@ -23,54 +23,107 @@ class Assign extends Page
# ------------------------------------------------------------------------
# Assign a container
function _assign() {
if (!$this->has_arg('visit')) $this->_error('No visit specified');
if (!$this->has_arg('visit') && !$this->has_arg('prop')) $this->_error('No visit or prop specified');
if (!$this->has_arg('cid')) $this->_error('No container id specified');
if (!$this->has_arg('pos')) $this->_error('No position specified');


$where = 'c.containerid=:1';
$args = array($this->arg('cid'));

if ($this->has_arg('visit')) {
$where .= " AND CONCAT(p.proposalcode, p.proposalnumber, '-', bl.visit_number) LIKE :".(sizeof($args)+1);
array_push($args, $this->arg('visit'));
} else {
$where .= " AND CONCAT(p.proposalcode, p.proposalnumber) LIKE :".(sizeof($args)+1);
array_push($args, $this->arg('prop'));
}

$cs = $this->db->pq("SELECT d.dewarid,bl.beamlinename,c.containerid,c.code FROM container c
INNER JOIN dewar d ON d.dewarid = c.dewarid
INNER JOIN shipping s ON s.shippingid = d.shippingid
INNER JOIN blsession bl ON bl.proposalid = s.proposalid
INNER JOIN proposal p ON s.proposalid = p.proposalid
WHERE CONCAT(CONCAT(CONCAT(p.proposalcode, p.proposalnumber), '-'), bl.visit_number) LIKE :1 AND c.containerid=:2", array($this->arg('visit'), $this->arg('cid')));
WHERE $where", $args);

if (sizeof($cs) > 0) {
$c = $cs[0];

$bl = $c['BEAMLINENAME'];
if ($this->staff) {
if ($this->has_arg('bl')) {
$bl = $this->arg('bl');
}
}

if ($this->has_arg(('nodup'))) {
$existing = $this->db->pq("SELECT c.containerid, c.name, CONCAT(p.proposalcode, p.proposalnumber) as prop
FROM container c
INNER JOIN dewar d ON d.dewarid = c.dewarid
INNER JOIN shipping s ON s.shippingid = d.shippingid
INNER JOIN proposal p ON s.proposalid = s.proposalid
WHERE beamlinelocation=1 AND samplechangerlocation:2", array($bl, $this->arg('pos')));

if (sizeof($existing)) {
$ex = $existing[0];
return $this->_error('A container is already a assigned that position: '+$ex[0]['NAME'] + '('+$ex['PROP']+')');
}
}


$this->db->pq("UPDATE dewar SET dewarstatus='processing' WHERE dewarid=:1", array($c['DEWARID']));

$this->db->pq("UPDATE container SET beamlinelocation=:1,samplechangerlocation=:2,containerstatus='processing' WHERE containerid=:3", array($c['BEAMLINENAME'], $this->arg('pos'), $c['CONTAINERID']));
$this->db->pq("INSERT INTO containerhistory (containerid,status,location,beamlinename) VALUES (:1,:2,:3,:4)", array($c['CONTAINERID'], 'processing', $this->arg('pos'), $c['BEAMLINENAME']));
$this->_update_history($c['DEWARID'], 'processing', $c['BEAMLINENAME'], $c['CODE'].' => '.$this->arg('pos'));
$this->db->pq("UPDATE container SET beamlinelocation=:1,samplechangerlocation=:2,containerstatus='processing' WHERE containerid=:3", array($bl, $this->arg('pos'), $c['CONTAINERID']));
$this->db->pq("INSERT INTO containerhistory (containerid,status,location,beamlinename) VALUES (:1,:2,:3,:4)", array($c['CONTAINERID'], 'processing', $this->arg('pos'), $bl));
$this->_update_history($c['DEWARID'], 'processing', $bl, $c['CODE'].' => '.$this->arg('pos'));

$this->_output(1);
} else {
$this->_error('No such container');
}

$this->_output(0);
}

# ------------------------------------------------------------------------
# Unassign a container
function _unassign() {
if (!$this->has_arg('visit')) $this->_error('No visit specified');
if (!$this->has_arg('visit') && !$this->has_arg('prop')) $this->_error('No visit or prop specified');
if (!$this->has_arg('cid')) $this->_error('No container id specified');


$where = 'c.containerid=:1';
$args = array($this->arg('cid'));

if ($this->has_arg('visit')) {
$where .= " AND CONCAT(p.proposalcode, p.proposalnumber, '-', bl.visit_number) LIKE :".(sizeof($args)+1);
array_push($args, $this->arg('visit'));
} else {
$where .= " AND CONCAT(p.proposalcode, p.proposalnumber) LIKE :".(sizeof($args)+1);
array_push($args, $this->arg('prop'));
}

$cs = $this->db->pq("SELECT d.dewarid,bl.beamlinename,c.containerid FROM container c
INNER JOIN dewar d ON d.dewarid = c.dewarid
INNER JOIN shipping s ON s.shippingid = d.shippingid
INNER JOIN blsession bl ON bl.proposalid = s.proposalid
INNER JOIN proposal p ON s.proposalid = p.proposalid
WHERE CONCAT(CONCAT(CONCAT(p.proposalcode, p.proposalnumber), '-'), bl.visit_number) LIKE :1 AND c.containerid=:2", array($this->arg('visit'), $this->arg('cid')));
WHERE $where", $args);

if (sizeof($cs) > 0) {
$c = $cs[0];

$bl = $c['BEAMLINENAME'];
if ($this->staff) {
if ($this->has_arg('bl')) {
$bl = $this->arg('bl');
}
}

$this->db->pq("UPDATE container SET samplechangerlocation='',beamlinelocation='',containerstatus='at facility' WHERE containerid=:1",array($c['CONTAINERID']));
$this->db->pq("INSERT INTO containerhistory (containerid,status,beamlinename) VALUES (:1,:2,:3)", array($c['CONTAINERID'], 'at facility', $c['BEAMLINENAME']));
$this->db->pq("INSERT INTO containerhistory (containerid,status,beamlinename) VALUES (:1,:2,:3)", array($c['CONTAINERID'], 'at facility', $bl));
//$this->_update_history($c['DEWARID'], 'unprocessing');

$this->_output(1);
} else {
$this->_error('No such container');
}
$this->_output(0);
}


Expand Down Expand Up @@ -102,10 +155,10 @@ function _deactivate() {
$this->db->pq("UPDATE container SET containerstatus='at facility', samplechangerlocation='', beamlinelocation='' WHERE containerid=:1", array($c['ID']));
$this->db->pq("INSERT INTO containerhistory (containerid,status) VALUES (:1,:2)", array($c['ID'], 'at facility'));
}
$this->_output(1);

$this->_output(1);
} else {
$this->_error('No such dewar');
}
$this->_output(0);
}


Expand Down
Loading