Skip to content
Merged

v23 #1517

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
2 changes: 1 addition & 1 deletion idc/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,11 +594,11 @@ def cart_data(request):
filtergrp_list, partitions, field_list if (not doi_or_size_only) else None, limit, offset,
with_records=(not doi_or_size_only), dois_only=dois_only, size_only=size_only
)
print("response: {}".format(response))
if dois_only:
response = {'dois': response['dois']}
if size_only:
response = {
"total_size": response['total_size'],
"display_size": convert_disk_size(response['total_size'])
}
except Exception as e:
Expand Down
45 changes: 22 additions & 23 deletions static/js/cartutils.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,28 @@ define(['filterutils','jquery', 'tippy', 'base' ], function(filterutils, $, tip
$(this).removeAttr('disabled');
!$(this).hasClass('tip-titled') && $(this).attr("title",$(this).attr("data-default-title"));
});
let cart_disk_size = 0;
let cart_disk_display_size = "(Calculating...)";
let cart_disk_resp = await fetch(`${BASE_URL}/cart_data/`, {
method: "POST",
body: new URLSearchParams({
'filtergrp_list': JSON.stringify(window.filtergrp_list ? window.filtergrp_list : [{}]),
'partitions': JSON.stringify(window.partitions),
'size_only': 'true'
}),
headers: {"X-CSRFToken": $.getCookie('csrftoken'), "content-type": 'application/x-www-form-urlencoded'}
});
if(!cart_disk_resp.ok) {
console.error("Unable to fetch cart size!");
cart_disk_size = 4;
cart_disk_display_size = "(Unable to retrieve size.)";
} else {
let cart_disk_res = await cart_disk_resp.json();
cart_disk_size = cart_disk_res['total_size']/Math.pow(1000,4);
cart_disk_display_size = cart_disk_res['display_size'];
}
$('.cart_disk_size').html(cart_disk_display_size);
base.updateDownloadBtns('cart', cart_has_contents, cart_disk_size, nmseries);
} else {
$('#cart_stats_holder').html('<span id="#cart_stats">Your cart is currently empty</span>');
$('#cart_stats').addClass('empty-cart');
Expand All @@ -155,29 +177,6 @@ define(['filterutils','jquery', 'tippy', 'base' ], function(filterutils, $, tip
!$(this).hasClass('tip-titled') && $(this).attr("title","Add items to the cart to enable this feature.");
});
}
let cart_disk_size = 0;
let cart_disk_display_size = "(Calculating...)";
let cart_disk_resp = await fetch(`${BASE_URL}/cart_data/`, {
method: "POST",
body: new URLSearchParams({
'filtergrp_list': JSON.stringify(window.filtergrp_list ? window.filtergrp_list : [{}]),
'partitions': JSON.stringify(window.partitions),
'size_only': 'true'
}),
headers: {"X-CSRFToken": $.getCookie('csrftoken'), "content-type": 'application/x-www-form-urlencoded'}
});
if(!cart_disk_resp.ok) {
console.error("Unable to fetch cart size!");
cart_disk_size = 4;
cart_disk_display_size = "(Unable to retrieve size.)";
} else {
let cart_disk_res = await cart_disk_resp.json();
cart_disk_size = cart_disk_res['total_size']/Math.pow(1000,4);
cart_disk_display_size = cart_disk_res['display_size'];
}
$('.cart_disk_size').html(cart_disk_display_size);
base.updateDownloadBtns('cart', cart_has_contents, cart_disk_size, nmseries);

}

// remove all items from the cart. clear the glblcart, carHist, cartDetails
Expand Down
3 changes: 1 addition & 2 deletions static/js/cohorts/export-manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,9 @@ require([

$('#download-s5cmd').addClass('iscart');
$('#download-idc-index').addClass('iscart');

$('.filter-tab.manifest-file').hide();
$('.filter-tab.manifest-bq').hide();

!$('.manifest-idc-index, .manifest-s5cmd').hasClass('active') && $('a[href="#manifest-idc-index"]').tab('show');
update_file_names();
}

Expand Down
8 changes: 4 additions & 4 deletions static/js/explore.js
Original file line number Diff line number Diff line change
Expand Up @@ -481,8 +481,8 @@ require([

let disabled_messages = {
'download-all-disabled': chromium_only,
'download-size-disabled': "This set of images is over 3TB in size. Please use manifest download to obtain these images.",
'download-count-disabled': "This set of images contains over 65000 records. Please use manifest download to obtain these images.",
'download-size-disabled': "This set of files is over 3TB in size. Please use manifest download to obtain these files.",
'download-count-disabled': "This set of files contains over 65000 records. Please use manifest download to obtain these files.",
'download-cart-disabled': "Add items to the cart to enable this feature.",
'download-cohort-disabled': "Select a filter to enable this feature."
};
Expand All @@ -492,9 +492,9 @@ require([
return disabled_messages[$(ref).attr('data-disabled-type')];
}
let download_type = $(ref).attr('data-download-type');
return `Download all of the image instances in this ${download_type}.`;
return `Download all of the files in this ${download_type}.`;
},
content: 'Download all images.', // placeholder text
content: 'Download all files.', // placeholder text
theme: 'dark',
placement: 'left',
arrow: false,
Expand Down
3 changes: 2 additions & 1 deletion static/js/tables.js
Original file line number Diff line number Diff line change
Expand Up @@ -1270,7 +1270,8 @@ define(['cartutils','filterutils','tippy','jquery', 'base'], function(cartutils,
data-collection="${row['collection_id']}"
data-study="${row['StudyInstanceUID']}"
data-patient="${row['PatientID']}"
data-series-size="${row['instance_size']}"
data-series-size="${row['instance_size']}"
data-download-type="series"
></i>`
}
return `<i class="fa fa-download is-disabled download-instances" data-disabled-type="download-all-disabled"></i>`
Expand Down