Skip to content

Commit

Permalink
LIMS-979: Add Unqueue All and Unqueue Selected buttons to Container Q…
Browse files Browse the repository at this point in the history
…ueue page (#665)

* LIMS-979: Add Unqueue All and Unqueue Selected buttons to Container Queue page

* Use let instead of var

Co-authored-by: Guilherme Francisco <[email protected]>

* LIMS-979: Use post requests for queueing/unqueueing

---------

Co-authored-by: Mark Williams <[email protected]>
Co-authored-by: Guilherme Francisco <[email protected]>
  • Loading branch information
3 people authored Jan 19, 2024
1 parent 28a021b commit 30a3164
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 3 deletions.
55 changes: 54 additions & 1 deletion client/src/js/modules/imaging/views/queuecontainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
Expand Down Expand Up @@ -577,7 +579,7 @@ define(['marionette',
this.$el.addClass('loading');
Backbone.ajax({
url: app.apiurl+'/sample/sub/queue/cid/'+this.model.get('CONTAINERID'),
method: "post",
method: 'post',
data: data,
success: function(resp) {
_.each(resp, function (r) {
Expand All @@ -592,6 +594,57 @@ define(['marionette',
})
},

unqueueSelectedSamples: function(e) {
e.preventDefault()

let self = this
this.$el.addClass('loading');
let 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) {
let 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()

let self = this
this.$el.addClass('loading');
Backbone.ajax({
url: app.apiurl+'/sample/sub/queue/cid/'+this.model.get('CONTAINERID'),
method: 'post',
data: {
queued: 1,
UNQUEUE: 1,
},
success: function(resp) {
_.each(resp, function (r) {
let 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()
Expand Down
12 changes: 10 additions & 2 deletions client/src/js/templates/imaging/queuecontainer.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,20 @@ <h2>Available Samples</h2>
</div>

<h2>Queued Samples</h2>
<div class="r rpreset">

<div class="filter">
<span class="r">
<a href="#" class="button unqueuesel" title="Remove the selected samples from the queue"><i class="fa fa-minus"></i> Unqueue Selected</a>
<a href="#" class="button unqueueall" title="Remove all samples from the queue"><i class="fa fa-minus"></i> Unqueue All</a>
</span></div>
<div>
<span class="r rpreset">
Presets: <select name="preset"></select>
<a href="#" class="button apply" title="Apply this preset to the selected samples"><i class="fa fa-check-square-o"></i> Apply to Selected</a>
<a href="#" class="button applyall" title="Apply this preset to all samples"><i class="fa fa-file-text-o"></i> Apply to All</a>
</span>
<span class="filter filter-nohide qfilt"></span>
</div>
<div class="filter filter-nohide qfilt"></div>
<div class="qsamples"></div>

<% if (!CONTAINERQUEUEID) { %>
Expand Down

0 comments on commit 30a3164

Please sign in to comment.