Skip to content

Commit b550d64

Browse files
authored
Merge pull request #1539 from ImagingDataCommons/release-50-sp
1515, modality operator fix
2 parents 689a012 + 8f1674f commit b550d64

4 files changed

Lines changed: 77 additions & 68 deletions

File tree

static/js/cartutils.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,6 @@ define(['filterutils','jquery', 'tippy', 'base' ], function(filterutils, $, tip
709709
ndic['aggregate_level'] = 'StudyInstanceUID'
710710
ndic['results_level'] = 'StudyInstanceUID'
711711
var csrftoken = $.getCookie('csrftoken');
712-
window.show_spinner();
713712
$.ajax({
714713
url: url,
715714
dataType: 'json',
@@ -730,19 +729,16 @@ define(['filterutils','jquery', 'tippy', 'base' ], function(filterutils, $, tip
730729
});
731730
var txt =$('#cart-table_info').text().replace('entries','studies');
732731
$('#cart-table_info').text(txt);
733-
window.hide_spinner();
734732
},
735733
error: function () {
736734
console.log("problem getting data");
737735
alert("There was an error fetching server data. Please alert the systems administrator");
738-
window.hide_spinner();
739736
}
740737
});
741738
}
742739
});
743740
} catch(Exception){
744741
alert("The following error was reported when processing server data: "+ Exception +". Please alert the systems administrator");
745-
window.hide_spinner();
746742
}
747743
}
748744

static/js/explore.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ require([
105105
})
106106

107107
$('#save-cohort-modal').on('show.bs.modal', function() {
108-
109108
var modality_join = $('.join_val').filter(':checked').prop('value');
110109
var filters = {};
111110
$('.search-scope .search-checkbox-list input:checked , ' +
@@ -131,14 +130,12 @@ require([
131130
+ '"><span class="attr">' + $(this).data('filter-display-attr') + ':</span></p>');
132131
}
133132

134-
135133
if ( ($(this).data('filter-display-attr')=='Modality') && (filters[$(this).data('filter-attr-id')]) ){
136134
$(`${modal_filter_block} p.` + $(this).data('filter-attr-id')).append(
137135
'<span class="val">' + modality_join + '</span>'
138136
);
139137
}
140138

141-
142139
$(`${modal_filter_block} p.` + $(this).data('filter-attr-id')).append(
143140
'<span class="val">' + $(this).data('filter-display-val') + '</span>'
144141
);

static/js/image_search.js

Lines changed: 42 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ require([
123123
}
124124
var csrftoken = $.getCookie('csrftoken');
125125
let deferred = $.Deferred();
126-
// window.show_spinner();
126+
window.show_spinner();
127127
$.ajax({
128128
url: url,
129129
data: ndic,
@@ -278,7 +278,7 @@ require([
278278
console.log('error loading data');
279279
},
280280
complete: function() {
281-
//window.hide_spinner();
281+
window.hide_spinner();
282282
}
283283
});
284284
return deferred.promise();
@@ -306,90 +306,90 @@ require([
306306
}
307307

308308
window.displayInfo = function(targ) {
309-
let collection_id=$(targ).attr('value');
310-
let collectionDisp=$(targ).data('filterDisplayVal')
309+
let collection_id = $(targ).attr('value');
310+
let collectionDisp = $(targ).data('filterDisplayVal')
311311

312-
let pos =$(targ).parent().find('.collection_info, .analysis_info').offset();
312+
let pos = $(targ).parent().find('.collection_info, .analysis_info').offset();
313313
let info_icon = $(targ).parent().find('.collection_info, .analysis_info');
314314
let tooltip='';
315315
if ($(info_icon).hasClass('collection_info')){
316316
tooltip = collection_tooltips[collection_id];
317-
}
318-
else {
317+
} else {
319318
tooltip = analysis_results_tooltips[collection_id];
320319
}
321-
322-
$('#collection-modal').find('#collecton-modal-title').text(collectionDisp);
323-
$('#collection-modal').find('.modal-body').html(tooltip);
324-
325-
$('#collection-modal').addClass('fade');
326-
$('#collection-modal').addClass('in');
327-
$('#collection-modal').css("display","block");
328-
var width=$('#collection-modal').find('.modal-content').outerWidth();
329-
var height =$('#collection-modal').find('.modal-content').outerHeight();
330-
$('#collection-modal').height(height);
331-
$('#collection-modal').width(width);
332-
333-
$('#collection-modal').css({position:"absolute", top: Math.max((pos.top-height),0), left: pos.left })
320+
let collex_modal = $('#collection-modal');
321+
collex_modal.find('#collecton-modal-title').text(collectionDisp);
322+
collex_modal.find('.modal-body').html(tooltip);
323+
324+
collex_modal.addClass('fade');
325+
collex_modal.addClass('in');
326+
collex_modal.css("display","block");
327+
let width=collex_modal.find('.modal-content').outerWidth();
328+
let height=collex_modal.find('.modal-content').outerHeight();
329+
collex_modal.height(height);
330+
collex_modal.width(width);
331+
collex_modal.css({position:"absolute", top: Math.max((pos.top-height),0), left: pos.left })
334332
}
335333

336334
var filterItemBindings = function (filterId) {
337-
$('#' + filterId).find('.join_val').on('click', function () {
338-
var attribute = $(this).closest('.list-group-item__body, .list-group-sub-item__body','.colections-list')[0].id;
339-
if (filterObj.hasOwnProperty(attribute) && (window.filterObj[attribute]['values'].length>1)){
335+
let selFilter = $(`#${filterId}`);
336+
selFilter.find('.join_val').on('click', function () {
337+
let attribute = $(this).closest('.list-group-item__body, .list-group-sub-item__body','.colections-list')[0].id;
338+
if (filterObj.hasOwnProperty(attribute) && (window.filterObj[attribute]['values'].length >= 1)){
340339
filterutils.mkFiltText();
341340
filterObj[attribute]['op']=$(this).attr('value');
342341
updateFacetsData(true);
343342
}
344343
});
345344

346-
$('#' + filterId).find('.collection_info, .analysis_info').on("mouseenter", function(e){
345+
selFilter.find('.collection_info, .analysis_info').on("mouseenter", function(e){
347346
$(e.target).addClass('fa-lg');
348347
});
349348

350-
$('#' + filterId).find('.collection_info, .analysis_info').on("mouseleave", function(e){
349+
selFilter.find('.collection_info, .analysis_info').on("mouseleave", function(e){
351350
$(e.target).removeClass('fa-lg');
352351
});
353352

354-
$('#' + filterId).find('input:checkbox').not('.hide-zeros').on('click', function (e) {
355-
var targ=e.target;
353+
selFilter.find('input:checkbox').not('.hide-zeros').on('click', function (e) {
354+
let targ=e.target;
356355
if ($(e.target).parent().find('.collection_info.fa-lg, .analysis_info.fa-lg').length>0){
357356
$(targ).prop("checked",!$(targ).prop("checked"));
358357
window.displayInfo(targ);
359-
}
360-
else{
358+
} else {
361359
handleFilterSelectionUpdate(this, true, true);
362360
}
363-
364361
});
365362

366-
$('#' + filterId).find('.show-more').on('click', function () {
363+
selFilter.find('.show-more').on('click', function () {
367364
$(this).parent().parent().children('.less-checks').show();
368365
$(this).parent().parent().children('.less-checks').removeClass('is-hidden');
369366
$(this).parent().parent().children('.more-checks').addClass('is-hidden');
370367

371368
$(this).parent().hide();
372-
var extras = $(this).closest('.list-group-item__body, .collection-list, .list-group-sub-item__body').children('.search-checkbox-list').children('.extra-values')
369+
var extras = $(this).closest('.list-group-item__body, .collection-list, .list-group-sub-item__body')
370+
.children('.search-checkbox-list')
371+
.children('.extra-values')
373372

374-
if ( ($('#'+filterId).closest('.search-configuration').find('.hide-zeros').length>0) && ($('#'+filterId).closest('.search-configuration').find('.hide-zeros').prop('checked'))){
373+
if ( (selFilter.closest('.search-configuration').find('.hide-zeros').length>0)
374+
&& ($('#'+filterId).closest('.search-configuration').find('.hide-zeros').prop('checked'))){
375375
extras=extras.not('.zeroed');
376376
}
377377
extras.removeClass('is-hidden');
378378
});
379379

380-
$('#' + filterId).find('.show-less').on('click', function () {
380+
selFilter.find('.show-less').on('click', function () {
381381
$(this).parent().parent().children('.more-checks').show();
382382
$(this).parent().parent().children('.more-checks').removeClass('is-hidden');
383383
$(this).parent().parent().children('.less-checks').addClass('is-hidden');
384384

385385
$(this).parent().hide();
386-
$(this).closest('.list-group-item__body, .collection-list, .list-group-sub-item__body').children('.search-checkbox-list').children('.extra-values').addClass('is-hidden');
386+
$(this).closest('.list-group-item__body, .collection-list, .list-group-sub-item__body')
387+
.children('.search-checkbox-list').children('.extra-values').addClass('is-hidden');
387388
});
388389

389-
$('#' + filterId).find('.check-all').on('click', function () {
390+
selFilter.find('.check-all').on('click', function () {
390391
if (!is_cohort) {
391392
filterutils.checkUncheckAll(this, true, true);
392-
393393
}
394394
});
395395

@@ -432,11 +432,9 @@ require([
432432
$('.list-group-item__body').each(function() {
433433
let $group = $(this);
434434
let my_id = $group.data('filter-attr-id');
435-
if (my_id != null)
436-
{
435+
if (my_id != null) {
437436
let checkboxes = $group.find("input:checked").not(".hide-zeros").not(".sort_val").not('.join_val');
438-
if (checkboxes.length > 0)
439-
{
437+
if (checkboxes.length > 0) {
440438
let values = [];
441439
checkboxes.each(function() {
442440
let $checkbox = $(this);
@@ -542,10 +540,10 @@ require([
542540
}
543541

544542
window.changePage = function(wrapper){
545-
var elem=$('#'+wrapper);
546-
var valStr = elem.find('.dataTables_controls').find('.goto-page-number').val();
543+
let elem=$('#'+wrapper);
544+
let valStr = elem.find('.dataTables_controls').find('.goto-page-number').val();
547545
try {
548-
var val =parseInt(valStr);
546+
let val = parseInt(valStr);
549547
if (Number.isInteger(val) && (val>0) ) {
550548
elem.find('table').DataTable().page(val-1).draw(false);
551549
}

static/js/tables.js

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ define(['cartutils','filterutils','tippy','jquery', 'base'], function(cartutils,
8080
$('#proj_table, #cases_tab, #studies_tab, #series_tab, #cart-table').on('preInit.dt', function(){
8181
window.show_spinner();
8282
});
83+
8384
$('#proj_table, #cases_tab, #studies_tab, #series_tab, #cart-table').on('draw.dt', function(){
8485
window.hide_spinner();
8586
// Auto-width needing to be shut off at the table header level during draw time.
@@ -238,6 +239,20 @@ define(['cartutils','filterutils','tippy','jquery', 'base'], function(cartutils,
238239
cache.data.sort((a,b)=> compCols(a,b,col,dir,isNum,hasAux,auxCol,auxIsNum))
239240
}
240241

242+
const rowIsOpen = function(row_id, row_type, collection_id=null, patient_id=null) {
243+
if(row_type === "project") {
244+
return ((window.selProjects && row_id in window.selProjects
245+
&& 'state' in window.selProjects[row_id])
246+
&& ('view' in window.selProjects[row_id]['state'])
247+
&& (window.selProjects[row_id]['state']['view'] ));
248+
} else if(row_type === "case") {
249+
return (collection_id in window.openCases) && (row_id in window.openCases[collection_id]);
250+
} else if(row_type === "study") {
251+
return (patient_id in window.openStudies) && (row_id in window.openStudies[patient_id]);
252+
}
253+
return false;
254+
}
255+
241256
// classes for project(collection) table columns
242257
var projectTableColDefs = function(){
243258
return [
@@ -432,6 +447,8 @@ define(['cartutils','filterutils','tippy','jquery', 'base'], function(cartutils,
432447
}
433448
setRowCartClasses(row);
434449

450+
rowIsOpen(data[0], "project") && $(row).addClass('open');
451+
435452
$(row).on('click', function(event) {
436453
handleRowClick("collections", row, event, [projid])
437454
});
@@ -514,7 +531,7 @@ define(['cartutils','filterutils','tippy','jquery', 'base'], function(cartutils,
514531
const caseTableColumns = function() {
515532
const caret_col = {
516533
"type": "html", "orderable": false, "data":"PatientID", render: function (PatientID, type, row) {
517-
collection_id=row['collection_id'][0]
534+
let collection_id=row['collection_id'][0]
518535
if ((collection_id in window.openCases) && (PatientID in window.openCases[collection_id]) ) {
519536
//return '<input type="checkbox" checked>'
520537
return '<a role="button">'+
@@ -655,6 +672,7 @@ define(['cartutils','filterutils','tippy','jquery', 'base'], function(cartutils,
655672
}
656673

657674
setRowCartClasses(row);
675+
rowIsOpen(caseid, "case", projid) && $(row).addClass('open');
658676

659677
$(row).on('click', function(event) {
660678
handleRowClick('cases', row, event,[projid, caseid])
@@ -849,22 +867,23 @@ define(['cartutils','filterutils','tippy','jquery', 'base'], function(cartutils,
849867

850868
if ('nf_unique_series' in data){
851869
$(row).attr('mxseries', data['nf_unique_series']);
852-
} else {
853-
$(row).attr('mxseries', data['unique_series']);
854-
}
855-
$(row).attr('series_in_filter', data['unique_series']);
856-
if ('unique_series_cart' in data){
857-
$(row).attr('series_in_cart', data['unique_series_cart']);
858-
} else {
859-
$(row).attr('series_in_cart', 0);
860-
}
861-
if ('unique_series_filter_and_cart' in data){
862-
$(row).attr('series_in_filter_and_cart', data['unique_series_filter_and_cart']);
863-
} else {
864-
$(row).attr('series_in_filter_and_cart', 0);
865-
}
870+
} else {
871+
$(row).attr('mxseries', data['unique_series']);
872+
}
873+
$(row).attr('series_in_filter', data['unique_series']);
874+
if ('unique_series_cart' in data){
875+
$(row).attr('series_in_cart', data['unique_series_cart']);
876+
} else {
877+
$(row).attr('series_in_cart', 0);
878+
}
879+
if ('unique_series_filter_and_cart' in data){
880+
$(row).attr('series_in_filter_and_cart', data['unique_series_filter_and_cart']);
881+
} else {
882+
$(row).attr('series_in_filter_and_cart', 0);
883+
}
866884

867885
setRowCartClasses(row);
886+
rowIsOpen(studyid, "study", null, caseid) && $(row).addClass('open');
868887

869888
var cnt = 0;
870889
var content = ""
@@ -891,8 +910,7 @@ define(['cartutils','filterutils','tippy','jquery', 'base'], function(cartutils,
891910
"orderable": false,
892911
"data": "StudyInstanceUID",
893912
render: function (StudyInstanceUID, type, row) {
894-
var PatientID= row['PatientID']
895-
var collection_id=row['collection_id']
913+
let PatientID= row['PatientID']
896914
if ( (PatientID in window.openStudies) && (StudyInstanceUID in window.openStudies[PatientID])) {
897915
//return '<input type="checkbox" checked>'
898916
return '<a role="button">'+

0 commit comments

Comments
 (0)