From 2fc73e59dbfc5aa898e26f30dde6e12ab12ebb13 Mon Sep 17 00:00:00 2001
From: Mark Williams
Date: Thu, 12 Sep 2024 11:01:17 +0100
Subject: [PATCH 1/7] LIMS-1430: Allow queuing even if no visible samples
---
.../modules/imaging/views/queuecontainer.js | 52 +++++++++++++++----
.../js/templates/imaging/queuecontainer.html | 9 ++--
2 files changed, 45 insertions(+), 16 deletions(-)
diff --git a/client/src/js/modules/imaging/views/queuecontainer.js b/client/src/js/modules/imaging/views/queuecontainer.js
index 2ec12d35d..ab2611633 100644
--- a/client/src/js/modules/imaging/views/queuecontainer.js
+++ b/client/src/js/modules/imaging/views/queuecontainer.js
@@ -99,7 +99,7 @@ define(['marionette',
var self = this
p.save({}, {
success: function() {
- app.alert({ message: 'Preset successfully saved' })
+ app.message({ message: 'Preset successfully saved' })
self.column.get('plans').add(p)
},
error: function() {
@@ -539,6 +539,8 @@ define(['marionette',
xtal: '.xtalpreview',
nodata: 'input[name=nodata]',
notcompleted: 'input[name=notcompleted]',
+ queuebutton: '.queuebutton',
+ unqueuebutton: '.unqueuebutton',
},
@@ -650,12 +652,13 @@ define(['marionette',
e.preventDefault()
utils.confirm({
title: 'Unqueue Container?',
- content: 'Are you sure you want to remove this container from the queue? You will loose your current place',
+ content: 'Are you sure you want to remove this container from the queue? You will lose your current place',
callback: this.doUnqueueContainer.bind(this)
})
},
doUnqueueContainer: function() {
+ var self = this
Backbone.ajax({
url: app.apiurl+'/shipment/containers/queue',
data: {
@@ -663,7 +666,9 @@ define(['marionette',
UNQUEUE: 1,
},
success: function() {
- app.alert({ message: 'Container Successfully Unqueued' })
+ app.message({ message: 'Container Successfully Unqueued' })
+ self.ui.unqueuebutton.hide()
+ self.ui.queuebutton.show()
},
error: function() {
app.alert({ message: 'Something went wrong unqueuing this container' })
@@ -710,7 +715,7 @@ define(['marionette',
queueContainer: function(e) {
e.preventDefault()
- if (!this.qsubsamples.fullCollection.length) {
+ if (!this.typeselector.shadowCollection.length) {
app.alert({ message: 'Please add some samples before queuing this container' })
return
}
@@ -732,13 +737,16 @@ define(['marionette',
if (inv) inv.set({ isSelected: true })
} else {
+ var self = this
Backbone.ajax({
url: app.apiurl+'/shipment/containers/queue',
data: {
CONTAINERID: this.model.get('CONTAINERID')
},
success: function() {
- app.alert({ message: 'Container Successfully Queued' })
+ app.message({ message: 'Container Successfully Queued' })
+ self.ui.unqueuebutton.show()
+ self.ui.queuebutton.hide()
},
error: function() {
app.alert({ message: 'Something went wrong queuing this container' })
@@ -768,21 +776,25 @@ define(['marionette',
initialize: function() {
this._lastSample = null
+ this._subsamples_ready = []
this.platetypes = new PlateTypes()
this.type = this.platetypes.findWhere({ name: this.model.get('CONTAINERTYPE') })
+ this.unfilteredSubsamples = null
this.subsamples = new SubSamples()
this.subsamples.queryParams.cid = this.model.get('CONTAINERID')
this.subsamples.state.pageSize = 10
- this.listenTo(this.subsamples, 'change:isSelected', this.selectSubSample, this)
- this.listenTo(this.subsamples, 'sync add remove change:READYFORQUEUE', this.refreshQSubSamples, this)
- this.subsamples.fetch()
+
+ this._subsamples_ready.push(this.subsamples.fetch())
this.inspections = new ContainerInspections()
this.inspections.queryParams.cid = this.model.get('CONTAINERID')
this.inspections.setSorting('BLTIMESTAMP', 1)
- this.inspections.fetch().done(this.getInspectionImages.bind(this))
+
+ this._subsamples_ready.push(this.inspections.fetch())
+
+ $.when.apply($, this._subsamples_ready).done(this.onSubsamplesReady.bind(this))
this.inspectionimages = new InspectionImages()
@@ -832,6 +844,14 @@ define(['marionette',
this.ui.preset.html(this.plans.opts())
},
+ onSubsamplesReady: function() {
+ this.unfilteredSubsamples = this.subsamples.fullCollection.clone()
+ this.getInspectionImages()
+ this.refreshQSubSamples()
+ this.listenTo(this.subsamples, 'change:isSelected', this.selectSubSample, this)
+ this.listenTo(this.subsamples, 'sync add remove change:READYFORQUEUE', this.refreshQSubSamples, this)
+ },
+
getInspectionImages: function() {
this.inspectionimages.queryParams.iid = this.inspections.at(0).get('CONTAINERINSPECTIONID')
this.inspectionimages.fetch().done(this.selectSample.bind(this))
@@ -843,8 +863,8 @@ define(['marionette',
refreshQSubSamples: function() {
if (this.model.get('CONTAINERQUEUEID')) {
- this.qsubsamples.fullCollection.reset(this.subsamples.fullCollection.where({ CONTAINERQUEUEID: this.model.get('CONTAINERQUEUEID') }))
- } else this.qsubsamples.fullCollection.reset(this.subsamples.fullCollection.where({ READYFORQUEUE: '1' }))
+ this.qsubsamples.fullCollection.reset(this.unfilteredSubsamples.where({ CONTAINERQUEUEID: this.model.get('CONTAINERQUEUEID') }))
+ } else this.qsubsamples.fullCollection.reset(this.unfilteredSubsamples.where({ READYFORQUEUE: '1' }))
},
selectSubSample: function() {
@@ -859,6 +879,9 @@ define(['marionette',
onRender: function() {
+ if (!this.model.get('CONTAINERQUEUEID')) {
+ this.ui.unqueuebutton.hide()
+ }
this.subsamples.queryParams.nodata = this.getNoData.bind(this)
this.subsamples.queryParams.notcompleted = this.getNotCompleted.bind(this)
this._ready.done(this.doOnRender.bind(this))
@@ -928,6 +951,7 @@ define(['marionette',
if (this.model.get('CONTAINERQUEUEID')) {
this.ui.rpreset.hide()
+ this.ui.queuebutton.hide()
queuedSubSamples.push({ label: '', cell: table.StatusCell, editable: false })
queuedSubSamples.push({ label: '', cell: table.TemplateCell, editable: false, template: '' })
}
@@ -954,3 +978,9 @@ define(['marionette',
})
})
+
+// TODO
+//
+// * Hide add to queue buttons after container queued
+// * Hide show buttons in queue area (remove from queue etc)
+// * Display number of subsamples in queue
diff --git a/client/src/js/templates/imaging/queuecontainer.html b/client/src/js/templates/imaging/queuecontainer.html
index cff3c820b..cd1777e01 100644
--- a/client/src/js/templates/imaging/queuecontainer.html
+++ b/client/src/js/templates/imaging/queuecontainer.html
@@ -2,8 +2,7 @@
Prepare Container for Data Collection
This pages allows you to queue samples in a container for data collection
-<% if (CONTAINERQUEUEID) { %>
-
+
<% if (['disposed', 'in_storage', null].indexOf(CONTAINERSTATUS) > -1) { %>
This container is queued for data collection, you can not modify it without unqueuing it
Unqueue
@@ -11,7 +10,6 @@
Prepare Container for Data Collection
This container is en route for data collection, it cannot be unqueued.
<% } %>
-<% } %>
@@ -65,10 +63,11 @@
Queued Samples
-<% if (!CONTAINERQUEUEID) { %>
+
Queue Plate
Queuing the container will make the queued items immutable, please make sure you have added all sub samples, and that they have valid experimental plans
Queuing the container will make the queued items immutable, please make sure you have added all sub samples, and that they have valid experimental plans
+
From efadaf3cf2480a2181c79722a6a41edbc247d966 Mon Sep 17 00:00:00 2001
From: Mark Williams
Date: Mon, 16 Sep 2024 12:53:54 +0100
Subject: [PATCH 3/7] LIMS-1430: Watch all subsamples for changes
---
client/src/js/modules/imaging/views/queuecontainer.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/client/src/js/modules/imaging/views/queuecontainer.js b/client/src/js/modules/imaging/views/queuecontainer.js
index 62e92d359..eadee2d0f 100644
--- a/client/src/js/modules/imaging/views/queuecontainer.js
+++ b/client/src/js/modules/imaging/views/queuecontainer.js
@@ -851,8 +851,8 @@ define(['marionette',
this.getInspectionImages()
this.refreshQSubSamples()
this.listenTo(this.subsamples, 'change:isSelected', this.selectSubSample, this)
- this.listenTo(this.subsamples, 'sync add remove change:READYFORQUEUE', this.refreshQSubSamples, this)
- this.listenTo(this.subsamples, 'change', this.updateQueueLength)
+ this.listenTo(this.unfilteredSubsamples, 'sync add remove change:READYFORQUEUE', this.refreshQSubSamples, this)
+ this.listenTo(this.unfilteredSubsamples, 'change', this.updateQueueLength)
this.listenTo(this.model, 'change:CONTAINERQUEUEID', this.onContainerQueueIdChange)
},
From f31b74e38521ec0cd2a170d4ef4d66695baa9a65 Mon Sep 17 00:00:00 2001
From: Mark Williams
Date: Mon, 16 Sep 2024 12:57:17 +0100
Subject: [PATCH 4/7] LIMS-1430: Remove TODO list
---
client/src/js/modules/imaging/views/queuecontainer.js | 5 -----
1 file changed, 5 deletions(-)
diff --git a/client/src/js/modules/imaging/views/queuecontainer.js b/client/src/js/modules/imaging/views/queuecontainer.js
index eadee2d0f..e36c0b3ee 100644
--- a/client/src/js/modules/imaging/views/queuecontainer.js
+++ b/client/src/js/modules/imaging/views/queuecontainer.js
@@ -944,7 +944,6 @@ define(['marionette',
{ name: '_valid', label: 'Valid', cell: table.TemplateCell, editable: false, test: '_valid', template: '' },
{ name: '', cell: table.StatusCell, editable: false },
{ label: '', cell: SnapshotCell, editable: false, inspectionimages: this.inspectionimages },
-
]
if (app.mobile()) {
@@ -1001,7 +1000,3 @@ define(['marionette',
})
})
-
-// TODO
-//
-// * Add auto sample, filter to manual, add manual, remove auto doesnt work
From 48ff69f61df613e84e781fca3766a02fb4fdeb2e Mon Sep 17 00:00:00 2001
From: Mark Williams
Date: Mon, 16 Sep 2024 13:07:44 +0100
Subject: [PATCH 5/7] LIMS-1430: Display number is of data collections, not
samples
---
client/src/js/modules/imaging/views/queuecontainer.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/client/src/js/modules/imaging/views/queuecontainer.js b/client/src/js/modules/imaging/views/queuecontainer.js
index e36c0b3ee..4e9e2f465 100644
--- a/client/src/js/modules/imaging/views/queuecontainer.js
+++ b/client/src/js/modules/imaging/views/queuecontainer.js
@@ -858,7 +858,7 @@ define(['marionette',
updateQueueLength: function() {
var n = this.typeselector.shadowCollection.length
- this.ui.queuelength.html('('+n+' sample'+(n==1 ? '' : 's')+')')
+ this.ui.queuelength.html('('+n+' data collection'+(n==1 ? '' : 's')+')')
},
onContainerQueueIdChange: function() {
From ce9931bdaaf7208593c28438cab542cca84893e9 Mon Sep 17 00:00:00 2001
From: Mark Williams
Date: Mon, 16 Sep 2024 13:24:20 +0100
Subject: [PATCH 6/7] LIMS-1430: Dont allow queueing if hidden data collections
are invalid
---
client/src/js/modules/imaging/views/queuecontainer.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/client/src/js/modules/imaging/views/queuecontainer.js b/client/src/js/modules/imaging/views/queuecontainer.js
index 4e9e2f465..8e98b0c29 100644
--- a/client/src/js/modules/imaging/views/queuecontainer.js
+++ b/client/src/js/modules/imaging/views/queuecontainer.js
@@ -636,7 +636,7 @@ define(['marionette',
},
success: function(resp) {
_.each(resp, function (r) {
- let ss = self.qsubsamples.fullCollection.findWhere({ BLSUBSAMPLEID: r.BLSUBSAMPLEID })
+ let ss = self.typeselector.shadowCollection.findWhere({ BLSUBSAMPLEID: r.BLSUBSAMPLEID })
ss.set({ READYFORQUEUE: '0' })
})
},
@@ -721,7 +721,7 @@ define(['marionette',
return
}
- // need to validate all models here again incase they havnt been rendered
+ // need to validate all models here again in case they haven't been rendered
this.qsubsamples.fullCollection.each(function(qs) {
if (qs.get('_valid') !== undefined) return
@@ -730,7 +730,7 @@ define(['marionette',
console.log({ experimentCell: val })
}, this)
- var invalid = this.qsubsamples.fullCollection.where({ '_valid': false })
+ var invalid = this.typeselector.shadowCollection.where({ '_valid': false })
console.log('queue', invalid, invalid.length > 0)
if (invalid.length > 0) {
app.alert({ message: 'There are '+invalid.length+' sub samples with invalid experimental plans, please either correct or remove these from the queue' })
From 45fff57657ebb7f97c000f393836722200b1de2b Mon Sep 17 00:00:00 2001
From: Mark W <24956497+ndg63276@users.noreply.github.com>
Date: Mon, 23 Sep 2024 11:43:54 +0100
Subject: [PATCH 7/7] Update
client/src/js/modules/imaging/views/queuecontainer.js
Co-authored-by: Guilherme Francisco
---
client/src/js/modules/imaging/views/queuecontainer.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/client/src/js/modules/imaging/views/queuecontainer.js b/client/src/js/modules/imaging/views/queuecontainer.js
index 8e98b0c29..9de3e613f 100644
--- a/client/src/js/modules/imaging/views/queuecontainer.js
+++ b/client/src/js/modules/imaging/views/queuecontainer.js
@@ -858,7 +858,7 @@ define(['marionette',
updateQueueLength: function() {
var n = this.typeselector.shadowCollection.length
- this.ui.queuelength.html('('+n+' data collection'+(n==1 ? '' : 's')+')')
+ this.ui.queuelength.html(`(${n} data collection${n===1 ? '' : 's'})`)
},
onContainerQueueIdChange: function() {