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: 0 additions & 2 deletions api/config_sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,6 @@
$use_shipping_service = null;
$use_shipping_service_nde = False;
$use_shipping_service_incoming_shipments = null;
$use_shipping_service_redirect = null;
$use_shipping_service_redirect_incoming_shipments = null;
$shipping_service_api_user = null;
$shipping_service_api_password = null;
$shipping_service_app_url = null;
Expand Down
6 changes: 3 additions & 3 deletions api/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function setupApplication($mode): Slim
$facility_courier_countries, $facility_courier_countries_nde, $facility_courier_countries_link, $icat_base_url,
$visit_persist_storage_dir_segment, $dhl_enable, $scale_grid, $scale_grid_end_date, $preset_proposal, $timezone,
$valid_components, $enabled_container_types, $synchweb_version, $redirects,
$shipping_service_app_url, $use_shipping_service_redirect, $use_shipping_service_redirect_incoming_shipments,
$shipping_service_app_url, $use_shipping_service, $use_shipping_service_incoming_shipments,
$use_shipping_service_nde,
$dials_rest_url_rings, $closed_proposal_link, $ccp4_cloud_upload_url,
$only_staff_can_assign, $industrial_prop_codes, $upstream_reprocessing_pipelines, $downstream_reprocessing_pipelines,
Expand Down Expand Up @@ -100,8 +100,8 @@ function setupApplication($mode): Slim
'enabled_container_types' => $enabled_container_types,
'synchweb_version' => $synchweb_version,
'redirects' => $redirects,
'shipping_service_app_url' => $use_shipping_service_redirect ? $shipping_service_app_url : null,
'shipping_service_app_url_incoming' => $use_shipping_service_redirect_incoming_shipments ? $shipping_service_app_url : null,
'shipping_service_app_url' => $use_shipping_service ? $shipping_service_app_url : null,
'shipping_service_app_url_incoming' => $use_shipping_service_incoming_shipments ? $shipping_service_app_url : null,
'use_shipping_service_nde' => $use_shipping_service_nde,
'dials_rest_url_rings' => $dials_rest_url_rings,
'closed_proposal_link' => $closed_proposal_link,
Expand Down
2 changes: 1 addition & 1 deletion api/src/Page/Process.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Process extends Page
'PROCESSINGJOBID' => '\d+',
'DATACOLLECTIONID' => '\d+',
'SCALINGID' => '\d+',
'DISPLAYNAME' => '([\w\s\-])+',
'DISPLAYNAME' => '[\w\s\-.\(\)\=]+',
'COMMENTS' => '.*',

'PROCESSINGJOBIMAGESWEEPID' => '\d+',
Expand Down
226 changes: 35 additions & 191 deletions api/src/Page/Shipment.php

Large diffs are not rendered by default.

62 changes: 0 additions & 62 deletions api/src/Shipment/ShippingService.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
class ShippingService
{
private $shipping_api_url;
private $shipping_app_url;
public const JOURNEY_TO_FACILITY = "TO_FACILITY";
public const JOURNEY_FROM_FACILITY = "FROM_FACILITY";

Expand Down Expand Up @@ -41,7 +40,6 @@ function _build_headers()
function __construct()
{
global $shipping_service_app_url;
$this->shipping_app_url = $shipping_service_app_url;
$this->shipping_api_url = $shipping_service_app_url . "/api";
}

Expand Down Expand Up @@ -98,66 +96,6 @@ function _send_request($url, $type, $data, $expected_status_code)
}


function create_shipment($shipment_data)
{
return $this->_send_request(
$this->shipping_api_url . '/shipments/',
"POST",
$shipment_data,
201
);
}


function create_shipment_by_journey_type($shipment_data, $journey_type)
{
return $this->_send_request(
$this->shipping_api_url . '/shipments/' . $journey_type,
"POST",
$shipment_data,
201
);
}


function get_shipment($external_id, $journey_type)
{
return $this->_send_request(
$this->shipping_api_url . '/shipments/external_id/' . $external_id . '?journey_type=' . $journey_type,
"GET",
null,
200
);
}


function update_shipment($external_id, $shipment_data, $journey_type)
{
return $this->_send_request(
$this->shipping_api_url . '/shipments/external_id/' . $external_id . '?journey_type=' . $journey_type,
"PUT",
$shipment_data,
204
);
}


function dispatch_shipment($shipment_id, $pickup_requested)
{
$pickup_requested_str = ($pickup_requested) ? "true" : "false";
return $this->_send_request(
$this->shipping_api_url . '/shipments/' . $shipment_id . '/dispatch?pickup_requested=' . $pickup_requested_str,
"POST",
null,
201
);
}

function get_awb_pdf_url($shipment_id)
{
return $this->shipping_app_url . '/shipments/' . $shipment_id . '/awb';
}

function create_shipment_request($shipment_request_data)
{
return $this->_send_request(
Expand Down
17 changes: 16 additions & 1 deletion client/src/js/modules/dc/views/autointegration.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ define(['marionette',
'modules/dc/views/autoprocattachments',
'modules/dc/views/apmessages',
'modules/dc/views/downstreamreprocess',
'modules/dc/views/multiplexreprocess.js',

'views/log',
'views/table',
Expand All @@ -17,7 +18,7 @@ define(['marionette',
'templates/dc/dc_autoproc.html'], function(Marionette, Backbone, Backgrid, TabView,
AutoProcAttachments, AutoIntegrations,
RDPlotView, AIPlotsView, AutoProcAttachmentsView, APMessagesView,
DownstreamView,
DownstreamView, MultiplexView,
LogView, TableView, table,
utils, template) {

Expand All @@ -34,6 +35,11 @@ define(['marionette',
'click a.apattach': 'showAttachments',
'click a.downstream': 'downstream',
'click .dll': utils.signHandler,
'click @ui.multiplex': 'multiplexReprocessing',
},

ui: {
multiplex: '.multiplex',
},

regions: {
Expand All @@ -42,6 +48,15 @@ define(['marionette',

onRender: function() {
this.messages.show(new APMessagesView({ messages: new Backbone.Collection(this.model.get('MESSAGES')), embed: true }))
if (this.model.get('TYPE').toLowerCase().includes('cluster') || !this.model.get('TYPE').toLowerCase().includes('multiplex')) {
this.ui.multiplex.hide()
}
},

multiplexReprocessing: function(e) {
if (e) e.preventDefault()
app.dialog.show(new MultiplexView({ model: this.getOption('templateHelpers').PARENT, scalingid: this.model.get('SCALINGID'), type: this.model.get('TYPE')}))

},

showAttachments: function(e) {
Expand Down
213 changes: 213 additions & 0 deletions client/src/js/modules/dc/views/multiplexreprocess.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
define(['backbone', 'marionette', 'views/dialog',
'collections/spacegroups',
'models/reprocessing',
'models/reprocessingparameter',
'collections/reprocessingparameters',
'utils/kvcollection',
'templates/dc/multiplex.html'
], function(Backbone, Marionette, DialogView,
Spacegroups,
Reprocessing,
ReprocessingParameter,
ReprocessingParameters,
KVCollection,
template
) {

const FilteringMethods = Backbone.Collection.extend(_.extend({
keyAttribute: 'NAME',
valueAttribute: 'VALUE',
}, KVCollection))

return ReprocessView = DialogView.extend({
template: template,
dialog: true,
className: 'rp content',
dOptions: {
width: '1000px',
},

ui: {
fields: 'input, select',
sg: 'select[name=sg]',
res: 'input[name=res]',
opts: 'div.options',
filteringMethod: 'select[name=method]',
sdcutoff: 'input[name=sdcutoff]',
cchalf: 'input[name=cchalf]',
groupsize: 'input[name=groupsize]',
},

buttons: {
Submit: 'submit',
Close: 'closeDialog',
},

events: {
'input @ui.fields': 'onFieldChanged',
'change @ui.fields': 'onFieldChanged',
'click a.opt': 'toggleOpts',
'change @ui.cchalf': 'updateCCHalf',
'change @ui.filteringMethod': 'updateFilteringMethod',
},

templateHelpers: function() {
return {
TYPE: this.getOption('type')
}
},

toggleOpts: function(e) {
e.preventDefault()
this.ui.opts.slideToggle()
},

updateCCHalf: function() {
const enabled = this.ui.cchalf.is(':checked')
if (enabled) {
this.ui.filteringMethod.prop('disabled', false).val('image_group')
this.ui.sdcutoff.prop('disabled', false)
this.ui.groupsize.prop('disabled', false)
} else {
this.ui.sdcutoff.prop('disabled', true).val('')
this.ui.filteringMethod.prop('disabled', true).val('')
this.ui.groupsize.prop('disabled', true).val('')
}
},

updateFilteringMethod: function() {
const val = this.ui.filteringMethod.val()
if (val === 'dataset') {
this.ui.groupsize.prop('disabled', true).val('')
} else {
this.ui.groupsize.prop('disabled', false)
}
},

submit: async function(e) {
e.preventDefault()
this._disableSubmitButton()
const reprocessing = new Reprocessing({
DATACOLLECTIONID: this.model.get('ID'),
RECIPE: 'trigger-multiplex',
DISPLAYNAME: this.type,
})

try {
await reprocessing.save()
const jobId = reprocessing.get('PROCESSINGJOBID')
const reprocessingparams = new ReprocessingParameters()

reprocessingparams.add(new ReprocessingParameter({
PROCESSINGJOBID: jobId,
PARAMETERKEY: 'scaling_id',
PARAMETERVALUE: this.scalingid
}));

const res = this.ui.res.val()
if (res) reprocessingparams.add(new ReprocessingParameter({
PROCESSINGJOBID: jobId,
PARAMETERKEY: 'd_min',
PARAMETERVALUE: res
}))

const sg = this.ui.sg.val().replace(/\s/g, '')
if (sg) reprocessingparams.add(new ReprocessingParameter({
PROCESSINGJOBID: jobId,
PARAMETERKEY: 'spacegroup',
PARAMETERVALUE: sg
}))

const cchalf = this.ui.cchalf.prop('checked')
if (cchalf) reprocessingparams.add(new ReprocessingParameter({
PROCESSINGJOBID: jobId,
PARAMETERKEY: 'apply_cchalf_filtering',
PARAMETERVALUE: 1
}))

const method = this.ui.filteringMethod.val()
if (method) reprocessingparams.add(new ReprocessingParameter({
PROCESSINGJOBID: jobId,
PARAMETERKEY: 'cchalf_filtering_method',
PARAMETERVALUE: method
}))

const sdcutoff = this.ui.sdcutoff.val()
if (sdcutoff) reprocessingparams.add(new ReprocessingParameter({
PROCESSINGJOBID: jobId,
PARAMETERKEY: 'sd_cutoff',
PARAMETERVALUE: sdcutoff
}))

const groupsize = this.ui.groupsize.val()
if (groupsize) reprocessingparams.add(new ReprocessingParameter({
PROCESSINGJOBID: jobId,
PARAMETERKEY: 'image_group_size',
PARAMETERVALUE: groupsize
}))

await reprocessingparams.save()
this._enqueue({ PROCESSINGJOBID: reprocessing.get('PROCESSINGJOBID') })
app.message({ message: 'Multiplex reprocessing job successfully submitted'})

} catch {
app.alert({ message: 'Something went wrong starting that reprocessing run' })
}

},

onFieldChanged: function() {
this._enableSubmitButton();
},

_disableSubmitButton: function() {
var btn = $('.ui-dialog-buttonpane button:contains("Submit")')
btn.addClass('submitted').button('disable').button('option', 'label', 'Submitted!')
this.resetTimeout = setTimeout(() => {
this._enableSubmitButton()
}, 5000)
},

_enableSubmitButton: function() {
var btn = $('.ui-dialog-buttonpane button.submitted')
btn.removeClass('submitted').button('enable').button('option', 'label', 'Submit')
clearTimeout(this.resetTimeout);
},

_enqueue: function(options) {
Backbone.ajax({
url: app.apiurl+'/process/enqueue',
method: 'POST',
data: {
PROCESSINGJOBID: options.PROCESSINGJOBID,
},
})
},

initialize: function(options) {
this.scalingid = options.scalingid
this.type = options.type
this.title = 'Rerun multiplex processing - ' + this.type
this.filteringMethods = new FilteringMethods([
{ NAME: 'image_group', VALUE: 'image_group' },
{ NAME: 'dataset', VALUE: 'dataset' },
])
this.spacegroups = new Spacegroups(null, { state: { pageSize: 9999 } })
this.listenTo(this.spacegroups, 'sync', this.populateSpacegroups)
this.spacegroups.fetch()
},

onRender: function() {
this.ui.opts.hide()
this.ui.filteringMethod.html(this.filteringMethods.opts())
this.ui.filteringMethod.prop('disabled', true).val('')
this.ui.sdcutoff.prop('disabled', true)
this.ui.groupsize.prop('disabled', true)
},

populateSpacegroups: function() {
this.ui.sg.html('<option value=""> - </option>'+this.spacegroups.opts())
}

})
})
4 changes: 2 additions & 2 deletions client/src/js/modules/shipment/views/dispatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,12 @@ define(['marionette', 'views/form',
if (location) {
self.ui.loc.val(location)
if (restrictedLocations.includes(location.toLowerCase())) {
self.ui.dispatchState.text("Warning: This dewar is still on the beamline. We recommend waiting until the dewar returns to storage before requesting it's return. Dewars are not topped up with LN2 after a return is requested.")
self.ui.dispatchState.text("Warning: This dewar is still on the beamline. We recommend waiting until the dewar returns to storage before requesting its return. Dewars are not topped up with LN2 after a return is requested.")
} else if (
location.startsWith('tray-') &&
(!historyComment || (typeof historyComment === 'object' && !historyComment.checked))
) {
self.ui.dispatchState.text("Warning: This dewar has not had it's contents checked. We recommend asking your local contact to check the dewar's contents before requesting it's return. Dewars are not topped up with LN2 after a return is requested.")
self.ui.dispatchState.text("Warning: This dewar has not had its contents checked. We recommend asking your local contact to check the dewar's contents before requesting its return. Dewars are not topped up with LN2 after a return is requested.")
}
}
})
Expand Down
Loading
Loading