Skip to content

Commit 2e7a75d

Browse files
authored
Merge pre-release/2025-R2.5 into master (#940)
* LIMS-1648: Only display auto proc program attachment files where deleted column is 0 (#921) * LIMS-1400: Remove logon stats page (#916) * LIMS-1702: Rename Archive button to Download Zip (#930) * LIMS-1719: Fix data collection comments button (#931) * LIMS-1694: Allow beamlines to disable user assignment of pucks (#925) * LIMS-1687: Remove references to GridInfo.pixelsPerMicronX/Y (#926)
1 parent 34039a2 commit 2e7a75d

File tree

24 files changed

+239
-214
lines changed

24 files changed

+239
-214
lines changed

api/config_sample.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@
142142

143143
# Visit directory on disk
144144
$visit_directory = '/dls/<%=BEAMLINENAME%>/data/<%=YEAR%>/<%=VISIT%>';
145+
# If found ANYWHERE in a visit filePath the system will assume that any files there exist indefinitely
146+
$visit_persist_storage_dir_segment = 'persistent/dir/name';
145147

146148
# Diffraction image snapshots
147149
$jpeg_location = '<%=VISITDIR%>/jpegs/<%=IMDIRECTORY%>/<%=IMFILE%>.jpeg';
@@ -220,6 +222,8 @@
220222
$facility_contact = "A person";
221223
$facility_phone = "01234 567890";
222224
$facility_email = "stores@facility.co.uk";
225+
# Append to find logs/files etc once they have been moved to cold storage
226+
$icat_base_url = "https://icat.yourFacility.ac.uk";
223227

224228
// List of domestic free countries
225229
$facility_courier_countries = array('United Kingdom');
@@ -375,6 +379,11 @@
375379
'i03' => "BL03I-MO-ROBOT-01:PUCK_%02d_NAME"
376380
);
377381

382+
$only_staff_can_assign = array(
383+
'i03' => False,
384+
'i04' => False,
385+
);
386+
378387
# Dials server values
379388
$dials_rest_url = "";
380389
$dials_rest_jwt = "";

api/docs/db/DataCollections.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ steps_x | int | Number of steps in x in the grid scan
8989
steps_y | int | Number of steps in y in the grid scan
9090
snapshot_offsetxpixel | int | Number of pixels from top left of the snapshot image in x to where the top left of the grid starts
9191
snapshot_offsetypixel | int | Number of pixels from top left of the snapshot image in y to where the top left of the grid starts
92-
pixelspermicronx | float | Confusingly, microns per pixel. Physical size of the pixel in x in microns
93-
pixelspermicrony | float | Confusingly, microns per pixel. Physical size of the pixel in y in microns
92+
micronsperpixelx | float | Physical size of the pixel in x in microns
93+
micronsperpixely | float | Physical size of the pixel in y in microns
9494

9595
This allows the snapshot to be cropped to the correct location and the grid to be navigatable by click to show an resulting diffraction image. The results from Per Image Analysis are then merged on top as a heatmap.
9696

api/docs/definitions/gridinfo.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ properties:
4040
type: string
4141
description: Number of steps in x
4242
example: 10
43-
PIXELSPERMICRONX:
43+
MICRONSPERPIXELX:
4444
type: string
45-
description: Pixels per micron in x for snapshot
45+
description: Microns per pixel in x for snapshot
4646
example: 1.2200000286102
47-
PIXELSPERMICRONY:
47+
MICRONSPERPIXELX:
4848
type: string
49-
description: Pixels per micron in y for snapshot
49+
description: Microns per pixel in y for snapshot
5050
example: 1.1900000572205
5151
SNAPSHOT_OFFSETXPIXEL:
5252
type: string
@@ -62,4 +62,4 @@ properties:
6262
example: horizontal
6363
enum:
6464
- horizontal
65-
- vertical
65+
- vertical

api/docs/dist/spec.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5947,14 +5947,14 @@
59475947
"description": "Number of steps in x",
59485948
"example": 10
59495949
},
5950-
"PIXELSPERMICRONX": {
5950+
"MICRONSPERPIXELX": {
59515951
"type": "string",
5952-
"description": "Pixels per micron in x for snapshot",
5952+
"description": "Microns per pixel in x for snapshot",
59535953
"example": 1.2200000286102
59545954
},
5955-
"PIXELSPERMICRONY": {
5955+
"MICRONSPERPIXELY": {
59565956
"type": "string",
5957-
"description": "Pixels per micron in y for snapshot",
5957+
"description": "Microns per pixel in y for snapshot",
59585958
"example": 1.1900000572205
59595959
},
59605960
"SNAPSHOT_OFFSETXPIXEL": {

api/index.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,12 @@ function setupApplication($mode): Slim
6868

6969
$app->get('/options', function () use ($app) {
7070
global $motd, $authentication_type, $cas_url, $cas_sso, $sso_url, $package_description,
71-
$facility_courier_countries, $facility_courier_countries_nde, $facility_courier_countries_link,
72-
$dhl_enable, $scale_grid, $scale_grid_end_date, $preset_proposal, $timezone,
71+
$facility_courier_countries, $facility_courier_countries_nde, $facility_courier_countries_link, $icat_base_url,
72+
$visit_persist_storage_dir_segment, $dhl_enable, $scale_grid, $scale_grid_end_date, $preset_proposal, $timezone,
7373
$valid_components, $enabled_container_types, $synchweb_version, $redirects,
7474
$shipping_service_app_url, $use_shipping_service_redirect, $use_shipping_service_redirect_incoming_shipments,
75-
$dials_rest_url_rings, $closed_proposal_link, $ccp4_cloud_upload_url;
75+
$dials_rest_url_rings, $closed_proposal_link, $ccp4_cloud_upload_url,
76+
$only_staff_can_assign;
7677
$app->contentType('application/json');
7778
$options = $app->container['options'];
7879
$app->response()->body(json_encode(array(
@@ -85,6 +86,8 @@ function setupApplication($mode): Slim
8586
'facility_courier_countries' => $facility_courier_countries,
8687
'facility_courier_countries_nde' => $facility_courier_countries_nde,
8788
'facility_courier_countries_link' => $facility_courier_countries_link,
89+
'icat_base_url' => $icat_base_url,
90+
'visit_persist_storage_dir_segment' => $visit_persist_storage_dir_segment,
8891
'dhl_enable' => $dhl_enable,
8992
'scale_grid' => $scale_grid,
9093
'scale_grid_end_date' => $scale_grid_end_date,
@@ -98,7 +101,8 @@ function setupApplication($mode): Slim
98101
'closed_proposal_link' => $closed_proposal_link,
99102
'dials_rest_url_rings' => $dials_rest_url_rings,
100103
'ccp4_cloud_upload_url' => $ccp4_cloud_upload_url,
101-
'redirects' => $redirects
104+
'redirects' => $redirects,
105+
'only_staff_can_assign' => $only_staff_can_assign
102106
)));
103107
});
104108
return $app;

api/src/Controllers/AssignController.php

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,17 @@ function __construct(Slim $app, $db, $user, AssignData $assignData)
3131

3232
function assignContainer()
3333
{
34+
global $only_staff_can_assign;
3435
$cs = $this->assignData->getContainer($this->arg('visit'), $this->arg('cid'));
35-
3636
if (sizeof($cs) > 0)
3737
{
38-
$this->assignData->assignContainer($cs[0], $this->arg('pos'));
39-
$this->_output(1);
38+
$bl = $cs[0]['BEAMLINENAME'];
39+
if (is_array($only_staff_can_assign) && array_key_exists($bl, $only_staff_can_assign) && $only_staff_can_assign[$bl] == true && !$this->staff) {
40+
$this->_error("Only staff can assign containers on this beamline");
41+
} else {
42+
$this->assignData->assignContainer($cs[0], $this->arg('pos'));
43+
$this->_output(1);
44+
}
4045
}
4146
else
4247
{
@@ -46,12 +51,18 @@ function assignContainer()
4651

4752
function unassignContainer()
4853
{
54+
global $only_staff_can_assign;
4955
$cs = $this->assignData->getContainer($this->arg('visit'), $this->arg('cid'));
5056

5157
if (sizeof($cs) > 0)
5258
{
53-
$this->assignData->unassignContainer($cs[0]);
54-
$this->_output(1);
59+
$bl = $cs[0]['BEAMLINENAME'];
60+
if (is_array($only_staff_can_assign) && array_key_exists($bl, $only_staff_can_assign) && $only_staff_can_assign[$bl] == true && !$this->staff) {
61+
$this->_error("Only staff can unassign containers on this beamline");
62+
} else {
63+
$this->assignData->unassignContainer($cs[0]);
64+
$this->_output(1);
65+
}
5566
}
5667
else
5768
{

api/src/Database/Type/MySQL.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,6 @@ class MySQL extends DatabaseParent {
8080
'Protein_has_PDB',
8181
'ExperimentType',
8282

83-
// Stat Views
84-
'v_logonByHour',
85-
'v_logonByMonthDay',
86-
'v_logonByWeek',
87-
'v_logonByWeekDay',
88-
'v_logonByHour2',
89-
'v_logonByMonthDay2',
90-
'v_logonByWeek2',
91-
'v_logonByWeekDay2',
92-
9383
// Projects
9484
'Project',
9585
'Project_has_User',

api/src/Page/DC.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,7 @@ function _data_collections($single = null)
474474
d.numberofpixelsx as detectornumberofpixelsx,
475475
d.numberofpixelsy as detectornumberofpixelsy,
476476
ses.archived,
477+
ses.purgedProcessedData,
477478
IFNULL(dc.rotationaxis, 'Omega') as rotationaxis,
478479
dc.detector2theta";
479480
$groupby = 'GROUP BY smp.name,
@@ -611,6 +612,7 @@ function _data_collections($single = null)
611612
max(d.numberofpixelsx) as detectornumberofpixelsx,
612613
max(d.numberofpixelsy) as detectornumberofpixelsy,
613614
max(ses.archived) as archived,
615+
max(ses.purgedProcessedData) as purgedProcessedData,
614616
IFNULL(max(dc.rotationaxis), 'Omega') as rotationaxis,
615617
dc.detector2theta";
616618
$groupby = "GROUP BY dc.datacollectiongroupid";
@@ -771,6 +773,7 @@ function _data_collections($single = null)
771773
'',
772774
'',
773775
ses.archived,
776+
ses.purgedProcessedData,
774777
'',
775778
''
776779
FROM energyscan es
@@ -867,6 +870,7 @@ function _data_collections($single = null)
867870
'',
868871
'',
869872
ses.archived,
873+
ses.purgedProcessedData,
870874
'',
871875
''
872876
FROM xfefluorescencespectrum xrf
@@ -963,6 +967,7 @@ function _data_collections($single = null)
963967
'',
964968
'',
965969
ses.archived,
970+
ses.purgedProcessedData,
966971
'',
967972
''
968973
FROM robotaction r
@@ -1461,7 +1466,7 @@ function _null_or($field, $conversion)
14611466
# Grid Scan Info
14621467
function _grid_info()
14631468
{
1464-
$info = $this->db->pq("SELECT dc.datacollectiongroupid, dc.datacollectionid, dc.axisstart, p.posx as x, p.posy as y, p.posz as z, g.dx_mm, g.dy_mm, g.steps_x, g.steps_y, g2.steps_y as steps_z, IFNULL(g.micronsperpixelx,g.pixelspermicronx) as micronsperpixelx, IFNULL(g.micronsperpixely,g.pixelspermicrony) as micronsperpixely, g.snapshot_offsetxpixel, g.snapshot_offsetypixel, g.orientation, g.snaked, DATE_FORMAT(dc.starttime, '%Y%m%d') as startdate, xrc.status as xrcstatus, xrcr.xraycentringresultid
1469+
$info = $this->db->pq("SELECT dc.datacollectiongroupid, dc.datacollectionid, dc.axisstart, p.posx as x, p.posy as y, p.posz as z, g.dx_mm, g.dy_mm, g.steps_x, g.steps_y, g2.steps_y as steps_z, g.micronsperpixelx, g.micronsperpixely, g.snapshot_offsetxpixel, g.snapshot_offsetypixel, g.orientation, g.snaked, DATE_FORMAT(dc.starttime, '%Y%m%d') as startdate, xrc.status as xrcstatus, xrcr.xraycentringresultid
14651470
FROM gridinfo g
14661471
INNER JOIN datacollection dc on (dc.datacollectionid = g.datacollectionid) or (dc.datacollectiongroupid = g.datacollectiongroupid)
14671472
LEFT OUTER JOIN position p ON dc.positionid = p.positionid

api/src/Page/Stats.php

Lines changed: 2 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ class Stats extends Page
1616

1717
public static $dispatch = array(array('/online', 'get', '_online_users'),
1818
array('/last', 'get', '_last_actions'),
19-
array('/logon(/:t)', 'get', '_logons'),
2019
array('/bl(/:t)', 'get', '_beamline'),
2120
array('/pl(/:t)', 'get', '_pipelines'),
2221
array('/pc', 'get', '_processing'),
@@ -45,46 +44,8 @@ function _last_actions() {
4544

4645
$this->_output($rows);
4746
}
48-
49-
50-
function _logons() {
51-
$days = array('Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun');
52-
53-
$ty = $this->has_arg('t') ? $this->arg('t') : 'hour';
54-
55-
$types = array('hour' => array('hour', 'hour'), 'wd' => array('day', 'weekday'), 'week' => array('week', 'week'), 'md' => array('day', 'monthday'));
56-
57-
$k = array_key_exists($ty, $types) ? $ty : 'hour';
58-
$t = $types[$k];
59-
60-
$rows = $this->db->pq("SELECT $t[0] as k, \"Total logins\" as t, \"Distinct logins\" as d FROM v_logonby${t[1]}2");
61-
62-
$out = array(array('label' => 'Total (ISPyB)', 'color' => 'red', 'data' => array()), array('label' => 'Unique (ISPyB)', 'color' => 'orange', 'data' => array()),
63-
array('label' => 'Total (ISPyB2)', 'color' => 'blue', 'data' => array()), array('label' => 'Unique (ISPyB2)', 'color' => 'cyan', 'data' => array())
64-
);
65-
66-
foreach ($rows as $r) {
67-
if ($k == 'wd') $r['K'] = array_search($r['K'], $days);
68-
69-
array_push($out[2]['data'], array(intval($r['K']), intval($r['T'])));
70-
array_push($out[3]['data'], array(intval($r['K']), intval($r['D'])));
71-
}
72-
73-
// $rows = $this->db->pq("SELECT $t[0] as k, \"Total logins\" as t, \"Distinct logins\" as d FROM v_logonby${t[1]}");
74-
// foreach ($rows as $r) {
75-
// if ($k == 'wd') $r['K'] = array_search($r['K'], $days);
76-
77-
// array_push($out[0]['data'], array(intval($r['K']), intval($r['T'])));
78-
// array_push($out[1]['data'], array(intval($r['K']), intval($r['D'])));
79-
// }
80-
81-
$this->_output($out);
82-
83-
}
84-
85-
86-
87-
47+
48+
8849
// Dispatch to beamline stats
8950
function _beamline() {
9051
$types = array('dc' => '_all_dcs',

api/tests/Controllers/AssignControllerTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ protected function setUp(): void
5151
);
5252
global $bl_pv_env;
5353
$bl_pv_env = 'EPICS_CA_ADDR_LIST_TEST=666.45.678.9';
54+
global $only_staff_can_assign;
55+
$only_staff_can_assign = array();
5456
}
5557

5658
protected function tearDown(): void

0 commit comments

Comments
 (0)