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

Query string IDs #64

Closed
wants to merge 1 commit into from
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -175,19 +175,29 @@
}
if (selected.length > 1) {
// handle batch annotation...
var productListQuery = new Array();
var well_index;
for (var i=0; i<selected.length; i++) {
productListQuery[i] = selected[i]["id"].replace("-","=");
well_index = well_index || selected[i]["index"];
}
var query = '{% url 'batch_annotate' %}'+"?"+productListQuery.join("&");
// dict of {'type': ids}
let well_index;
let typeIds = selected.reduce(function (prev, s) {
well_index = well_index || s.index;
let dtype = s.id.split('-')[0];
let objId = s.id.split('-')[1];
if (!prev[dtype]) {
prev[dtype] = [];
}
prev[dtype].push(objId);
return prev;
}, {});
// query = 'image=1,2,3&dataset=4,5,6'
var query = Object.keys(typeIds).map(dtype => {
return dtype + '=' + typeIds[dtype].join(',');
}).join('&');
if (well_index) {
query += "&index=" + well_index;
}
var url = '{% url 'batch_annotate' %}' + "?" + query;
// Load right hand panel...
$.ajax({
url: query,
url,
dataType: "html",
// Need to check that the selected objects haven't changed during AJAX call...
success: function(data) {
Expand Down