Skip to content

Commit b6e1f11

Browse files
authored
Merge pull request #1517 from ImagingDataCommons/idc-prod-sp
v23
2 parents dd2d91e + 5905522 commit b6e1f11

5 files changed

Lines changed: 30 additions & 31 deletions

File tree

idc/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,11 +594,11 @@ def cart_data(request):
594594
filtergrp_list, partitions, field_list if (not doi_or_size_only) else None, limit, offset,
595595
with_records=(not doi_or_size_only), dois_only=dois_only, size_only=size_only
596596
)
597+
print("response: {}".format(response))
597598
if dois_only:
598599
response = {'dois': response['dois']}
599600
if size_only:
600601
response = {
601-
"total_size": response['total_size'],
602602
"display_size": convert_disk_size(response['total_size'])
603603
}
604604
except Exception as e:

static/js/cartutils.js

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,28 @@ define(['filterutils','jquery', 'tippy', 'base' ], function(filterutils, $, tip
147147
$(this).removeAttr('disabled');
148148
!$(this).hasClass('tip-titled') && $(this).attr("title",$(this).attr("data-default-title"));
149149
});
150+
let cart_disk_size = 0;
151+
let cart_disk_display_size = "(Calculating...)";
152+
let cart_disk_resp = await fetch(`${BASE_URL}/cart_data/`, {
153+
method: "POST",
154+
body: new URLSearchParams({
155+
'filtergrp_list': JSON.stringify(window.filtergrp_list ? window.filtergrp_list : [{}]),
156+
'partitions': JSON.stringify(window.partitions),
157+
'size_only': 'true'
158+
}),
159+
headers: {"X-CSRFToken": $.getCookie('csrftoken'), "content-type": 'application/x-www-form-urlencoded'}
160+
});
161+
if(!cart_disk_resp.ok) {
162+
console.error("Unable to fetch cart size!");
163+
cart_disk_size = 4;
164+
cart_disk_display_size = "(Unable to retrieve size.)";
165+
} else {
166+
let cart_disk_res = await cart_disk_resp.json();
167+
cart_disk_size = cart_disk_res['total_size']/Math.pow(1000,4);
168+
cart_disk_display_size = cart_disk_res['display_size'];
169+
}
170+
$('.cart_disk_size').html(cart_disk_display_size);
171+
base.updateDownloadBtns('cart', cart_has_contents, cart_disk_size, nmseries);
150172
} else {
151173
$('#cart_stats_holder').html('<span id="#cart_stats">Your cart is currently empty</span>');
152174
$('#cart_stats').addClass('empty-cart');
@@ -155,29 +177,6 @@ define(['filterutils','jquery', 'tippy', 'base' ], function(filterutils, $, tip
155177
!$(this).hasClass('tip-titled') && $(this).attr("title","Add items to the cart to enable this feature.");
156178
});
157179
}
158-
let cart_disk_size = 0;
159-
let cart_disk_display_size = "(Calculating...)";
160-
let cart_disk_resp = await fetch(`${BASE_URL}/cart_data/`, {
161-
method: "POST",
162-
body: new URLSearchParams({
163-
'filtergrp_list': JSON.stringify(window.filtergrp_list ? window.filtergrp_list : [{}]),
164-
'partitions': JSON.stringify(window.partitions),
165-
'size_only': 'true'
166-
}),
167-
headers: {"X-CSRFToken": $.getCookie('csrftoken'), "content-type": 'application/x-www-form-urlencoded'}
168-
});
169-
if(!cart_disk_resp.ok) {
170-
console.error("Unable to fetch cart size!");
171-
cart_disk_size = 4;
172-
cart_disk_display_size = "(Unable to retrieve size.)";
173-
} else {
174-
let cart_disk_res = await cart_disk_resp.json();
175-
cart_disk_size = cart_disk_res['total_size']/Math.pow(1000,4);
176-
cart_disk_display_size = cart_disk_res['display_size'];
177-
}
178-
$('.cart_disk_size').html(cart_disk_display_size);
179-
base.updateDownloadBtns('cart', cart_has_contents, cart_disk_size, nmseries);
180-
181180
}
182181

183182
// remove all items from the cart. clear the glblcart, carHist, cartDetails

static/js/cohorts/export-manifest.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,9 @@ require([
136136

137137
$('#download-s5cmd').addClass('iscart');
138138
$('#download-idc-index').addClass('iscart');
139-
140139
$('.filter-tab.manifest-file').hide();
141140
$('.filter-tab.manifest-bq').hide();
142-
141+
!$('.manifest-idc-index, .manifest-s5cmd').hasClass('active') && $('a[href="#manifest-idc-index"]').tab('show');
143142
update_file_names();
144143
}
145144

static/js/explore.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -481,8 +481,8 @@ require([
481481

482482
let disabled_messages = {
483483
'download-all-disabled': chromium_only,
484-
'download-size-disabled': "This set of images is over 3TB in size. Please use manifest download to obtain these images.",
485-
'download-count-disabled': "This set of images contains over 65000 records. Please use manifest download to obtain these images.",
484+
'download-size-disabled': "This set of files is over 3TB in size. Please use manifest download to obtain these files.",
485+
'download-count-disabled': "This set of files contains over 65000 records. Please use manifest download to obtain these files.",
486486
'download-cart-disabled': "Add items to the cart to enable this feature.",
487487
'download-cohort-disabled': "Select a filter to enable this feature."
488488
};
@@ -492,9 +492,9 @@ require([
492492
return disabled_messages[$(ref).attr('data-disabled-type')];
493493
}
494494
let download_type = $(ref).attr('data-download-type');
495-
return `Download all of the image instances in this ${download_type}.`;
495+
return `Download all of the files in this ${download_type}.`;
496496
},
497-
content: 'Download all images.', // placeholder text
497+
content: 'Download all files.', // placeholder text
498498
theme: 'dark',
499499
placement: 'left',
500500
arrow: false,

static/js/tables.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1270,7 +1270,8 @@ define(['cartutils','filterutils','tippy','jquery', 'base'], function(cartutils,
12701270
data-collection="${row['collection_id']}"
12711271
data-study="${row['StudyInstanceUID']}"
12721272
data-patient="${row['PatientID']}"
1273-
data-series-size="${row['instance_size']}"
1273+
data-series-size="${row['instance_size']}"
1274+
data-download-type="series"
12741275
></i>`
12751276
}
12761277
return `<i class="fa fa-download is-disabled download-instances" data-disabled-type="download-all-disabled"></i>`

0 commit comments

Comments
 (0)