Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
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
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,
},
ndg63276 marked this conversation as resolved.
Show resolved Hide resolved
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
Loading