From cb3afa76d93f7883958d46be41022a513f3c9904 Mon Sep 17 00:00:00 2001 From: Mark Williams Date: Mon, 18 Sep 2023 14:51:12 +0100 Subject: [PATCH 1/3] LIMS-979: Add Unqueue All and Unqueue Selected buttons to Container Queue page --- api/src/Page/Sample.php | 2 +- .../modules/imaging/views/queuecontainer.js | 53 ++++++++++++++++++- .../js/templates/imaging/queuecontainer.html | 12 ++++- 3 files changed, 63 insertions(+), 4 deletions(-) diff --git a/api/src/Page/Sample.php b/api/src/Page/Sample.php index 4c7bdebe7..7b8f88c9f 100644 --- a/api/src/Page/Sample.php +++ b/api/src/Page/Sample.php @@ -168,7 +168,7 @@ class Sample extends Page array('/sub/:ssid', 'put', '_update_sub_sample_full'), array('/sub', 'post', '_add_sub_sample'), array('/sub/:ssid', 'delete', '_delete_sub_sample'), - array('/sub/queue/cid/:cid', 'post', '_queue_all_sub_samples'), + array('/sub/queue/cid/:cid', 'get', '_queue_all_sub_samples'), array('/sub/queue(/:BLSUBSAMPLEID)', 'get', '_pre_q_sub_sample'), array('/plan', 'get', '_get_diffraction_plans'), diff --git a/client/src/js/modules/imaging/views/queuecontainer.js b/client/src/js/modules/imaging/views/queuecontainer.js index e4c6d396d..0ed464e0a 100644 --- a/client/src/js/modules/imaging/views/queuecontainer.js +++ b/client/src/js/modules/imaging/views/queuecontainer.js @@ -527,6 +527,8 @@ define(['marionette', 'click a.unqueue': 'unqueueContainer', 'click a.addpage': 'queuePageSamples', 'click a.addall': 'queueAllSamples', + 'click a.unqueuesel': 'unqueueSelectedSamples', + 'click a.unqueueall': 'unqueueAllSamples', 'change @ui.nodata': 'refreshSubSamples', 'change @ui.notcompleted': 'refreshSubSamples', }, @@ -571,7 +573,6 @@ define(['marionette', this.$el.addClass('loading'); Backbone.ajax({ url: app.apiurl+'/sample/sub/queue/cid/'+this.model.get('CONTAINERID'), - method: "post", data: {}, success: function(resp) { _.each(resp, function (r) { @@ -586,6 +587,56 @@ define(['marionette', }) }, + unqueueSelectedSamples: function(e) { + e.preventDefault() + + var self = this + this.$el.addClass('loading'); + var sids = _.map(this.qsubsamples.where({ isGridSelected: true }), function(ss) {return ss.get('BLSUBSAMPLEID')}) + + Backbone.ajax({ + url: app.apiurl+'/sample/sub/queue', + data: { + BLSUBSAMPLEID: sids, + UNQUEUE: 1, + }, + success: function(resp) { + _.each(resp, function (r) { + var ss = self.qsubsamples.findWhere({ BLSUBSAMPLEID: r.BLSUBSAMPLEID }) + ss.set({ READYFORQUEUE: '0' }) + }) + }, + complete: function(resp, status) { + self.$el.removeClass('loading') + self.refreshQSubSamples(self) + } + }) + }, + + unqueueAllSamples: function(e) { + e.preventDefault() + + var self = this + this.$el.addClass('loading'); + Backbone.ajax({ + url: app.apiurl+'/sample/sub/queue/cid/'+this.model.get('CONTAINERID'), + data: { + queued: 1, + UNQUEUE: 1, + }, + success: function(resp) { + _.each(resp, function (r) { + var ss = self.qsubsamples.fullCollection.findWhere({ BLSUBSAMPLEID: r.BLSUBSAMPLEID }) + ss.set({ READYFORQUEUE: '0' }) + }) + }, + complete: function(resp, status) { + self.$el.removeClass('loading') + self.refreshQSubSamples(self) + } + }) + }, + unqueueContainer: function(e) { e.preventDefault() diff --git a/client/src/js/templates/imaging/queuecontainer.html b/client/src/js/templates/imaging/queuecontainer.html index 26ecbe899..cff3c820b 100644 --- a/client/src/js/templates/imaging/queuecontainer.html +++ b/client/src/js/templates/imaging/queuecontainer.html @@ -49,12 +49,20 @@

Available Samples

Queued Samples

-
+ + +
+ Presets: Apply to Selected Apply to All + +
-
<% if (!CONTAINERQUEUEID) { %> From da3e06b540b803036dab27220608f59fd3985288 Mon Sep 17 00:00:00 2001 From: Mark W <24956497+ndg63276@users.noreply.github.com> Date: Thu, 18 Jan 2024 10:26:44 +0000 Subject: [PATCH 2/3] Use let instead of var Co-authored-by: Guilherme Francisco --- client/src/js/modules/imaging/views/queuecontainer.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/client/src/js/modules/imaging/views/queuecontainer.js b/client/src/js/modules/imaging/views/queuecontainer.js index 0ed464e0a..6e09e4428 100644 --- a/client/src/js/modules/imaging/views/queuecontainer.js +++ b/client/src/js/modules/imaging/views/queuecontainer.js @@ -590,9 +590,9 @@ define(['marionette', unqueueSelectedSamples: function(e) { e.preventDefault() - var self = this + let self = this this.$el.addClass('loading'); - var sids = _.map(this.qsubsamples.where({ isGridSelected: true }), function(ss) {return ss.get('BLSUBSAMPLEID')}) + let sids = _.map(this.qsubsamples.where({ isGridSelected: true }), function(ss) {return ss.get('BLSUBSAMPLEID')}) Backbone.ajax({ url: app.apiurl+'/sample/sub/queue', @@ -602,7 +602,7 @@ define(['marionette', }, success: function(resp) { _.each(resp, function (r) { - var ss = self.qsubsamples.findWhere({ BLSUBSAMPLEID: r.BLSUBSAMPLEID }) + let ss = self.qsubsamples.findWhere({ BLSUBSAMPLEID: r.BLSUBSAMPLEID }) ss.set({ READYFORQUEUE: '0' }) }) }, @@ -616,7 +616,7 @@ define(['marionette', unqueueAllSamples: function(e) { e.preventDefault() - var self = this + let self = this this.$el.addClass('loading'); Backbone.ajax({ url: app.apiurl+'/sample/sub/queue/cid/'+this.model.get('CONTAINERID'), @@ -626,7 +626,7 @@ define(['marionette', }, success: function(resp) { _.each(resp, function (r) { - var ss = self.qsubsamples.fullCollection.findWhere({ BLSUBSAMPLEID: r.BLSUBSAMPLEID }) + let ss = self.qsubsamples.fullCollection.findWhere({ BLSUBSAMPLEID: r.BLSUBSAMPLEID }) ss.set({ READYFORQUEUE: '0' }) }) }, From 395de3d780f3c5521f9ce7c8b1eaf298c2907b36 Mon Sep 17 00:00:00 2001 From: Mark Williams Date: Fri, 19 Jan 2024 11:27:30 +0000 Subject: [PATCH 3/3] LIMS-979: Use post requests for queueing/unqueueing --- api/src/Page/Sample.php | 2 +- client/src/js/modules/imaging/views/queuecontainer.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/api/src/Page/Sample.php b/api/src/Page/Sample.php index 7b8f88c9f..4c7bdebe7 100644 --- a/api/src/Page/Sample.php +++ b/api/src/Page/Sample.php @@ -168,7 +168,7 @@ class Sample extends Page array('/sub/:ssid', 'put', '_update_sub_sample_full'), array('/sub', 'post', '_add_sub_sample'), array('/sub/:ssid', 'delete', '_delete_sub_sample'), - array('/sub/queue/cid/:cid', 'get', '_queue_all_sub_samples'), + array('/sub/queue/cid/:cid', 'post', '_queue_all_sub_samples'), array('/sub/queue(/:BLSUBSAMPLEID)', 'get', '_pre_q_sub_sample'), array('/plan', 'get', '_get_diffraction_plans'), diff --git a/client/src/js/modules/imaging/views/queuecontainer.js b/client/src/js/modules/imaging/views/queuecontainer.js index 6e09e4428..ef2d5bcc0 100644 --- a/client/src/js/modules/imaging/views/queuecontainer.js +++ b/client/src/js/modules/imaging/views/queuecontainer.js @@ -573,6 +573,7 @@ define(['marionette', this.$el.addClass('loading'); Backbone.ajax({ url: app.apiurl+'/sample/sub/queue/cid/'+this.model.get('CONTAINERID'), + method: 'post', data: {}, success: function(resp) { _.each(resp, function (r) { @@ -620,6 +621,7 @@ define(['marionette', this.$el.addClass('loading'); Backbone.ajax({ url: app.apiurl+'/sample/sub/queue/cid/'+this.model.get('CONTAINERID'), + method: 'post', data: { queued: 1, UNQUEUE: 1,