Skip to content

Commit 33c69c7

Browse files
authored
Merge pull request #1483 from ImagingDataCommons/release-48-sp
Various fixes
2 parents 9eb08d1 + 054bfc2 commit 33c69c7

File tree

5 files changed

+69
-71
lines changed

5 files changed

+69
-71
lines changed

idc/urls.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@
3030
urlpatterns = [
3131

3232
re_path(r'^$', views.landing_page, name='landing_page'),
33-
re_path(r'^quota/', views.quota_page, name='quota_page'),
33+
re_path(r'^quota/$', views.quota_page, name='quota_page'),
3434
re_path(r'^users/(?P<user_id>\d+)/$', views.user_detail, name='user_detail'),
3535
re_path(r'^users/api/', views_api.user_detail, name='user_detail_api'),
3636

3737
re_path(r'^cohort_detail/(?P<cohort_id>\d+)/$', demo_views.cohort_detail, name='cohort_detail'),
38-
re_path(r'robots.txt', TemplateView.as_view(template_name="robots.txt", content_type="text/plain"), name='robots'),
39-
re_path(r'sitemap.xml', TemplateView.as_view(template_name="sitemap.xml", content_type="text/xml"), name='sitemap'),
38+
re_path(r'robots.txt$', TemplateView.as_view(template_name="robots.txt", content_type="text/plain"), name='robots'),
39+
re_path(r'sitemap.xml$', TemplateView.as_view(template_name="sitemap.xml", content_type="text/xml"), name='sitemap'),
4040

4141
re_path(r'^cohorts/', include('cohorts.urls')),
4242
path('admin/', admin.site.urls),
@@ -52,18 +52,18 @@
5252
re_path(r'^tables/', views.populate_tables, name='populate_tables'),
5353
re_path(r'^studymp/', views.studymp, name='studymp'),
5454
re_path(r'^warning/', views.warn_page, name='warn'),
55-
re_path(r'^about/', views.about_page, name='about_page'),
55+
re_path(r'^about/$', views.about_page, name='about_page'),
5656
re_path(r'^dashboard/', views.dashboard_page, name='dashboard'),
5757
re_path(r'^extended_login/$', views.extended_login_view, name='extended_login'),
58-
re_path(r'^privacy/', views.privacy_policy, name='privacy'),
59-
re_path(r'^news/', views.news_page, name='news'),
58+
re_path(r'^privacy/$', views.privacy_policy, name='privacy'),
59+
re_path(r'^news/$', views.news_page, name='news'),
6060
re_path(r'^cart/$', views.cart_page, name='cart'),
6161
re_path(r'^explore/cart/$', views.cart_page, name='get_explore_cart'),
6262
re_path(r'^cart_data/$', views.cart_data, name='get_cart_data'),
6363
re_path(r'^cart_data_stats/$', views.cart_data_stats, name='get_cart_data_stats'),
6464
re_path(r'^series_ids/(?P<patient_id>[A-Za-z0-9\.\-_]+)/$', views.get_series, name='get_series_by_case'),
6565
re_path(r'^series_ids/(?P<patient_id>[A-Za-z0-9\.\-_]+)/(?P<study_uid>[0-9\.]+)/$', views.get_series, name='get_series'),
66-
re_path(r'^collaborators/', views.collaborators, name='collaborators'),
66+
re_path(r'^collaborators/$', views.collaborators, name='collaborators'),
6767
re_path(r'^collections/', include('idc_collections.urls')),
6868
# re_path(r'^share/', include('sharing.urls')),
6969
]

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cryptography==44.0.2
2-
django==4.2.20
2+
django==4.2.24
33
django-allauth==0.63.1
44
django-anymail[mailgun]
55
django-axes==5.40.0
@@ -23,7 +23,7 @@ pyjwt==2.4.0
2323
pyopenssl==25.0.0
2424
pytz==2025.2
2525
PyYAML==6.0.2
26-
requests==2.32.3
26+
requests==2.32.4
2727
requests-oauthlib==0.7.0
2828
rsa==4.7
2929
simplejson==3.20.1

static/js/downloader.js

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -184,16 +184,18 @@ require([
184184
if (key !== "") {
185185
const keys = key.split("/");
186186
const instance = keys[keys.length - 1];
187-
s3_urls.push({
188-
'url': `https://${this.bucket}.s3.us-east-1.amazonaws.com/${key}`,
189-
'study': this.study_id,
190-
'collection': this.collection_id,
191-
'series': this.series_id,
192-
'modality': this.modality,
193-
'instance': instance,
194-
'patient': this.patient_id,
195-
'directory': this.directory
196-
});
187+
if(instance.length > 0) {
188+
s3_urls.push({
189+
'url': `https://${this.bucket}.s3.us-east-1.amazonaws.com/${key}`,
190+
'study': this.study_id,
191+
'collection': this.collection_id,
192+
'series': this.series_id,
193+
'modality': this.modality,
194+
'instance': instance,
195+
'patient': this.patient_id,
196+
'directory': this.directory
197+
});
198+
}
197199
}
198200
});
199201
});
@@ -445,12 +447,16 @@ require([
445447
await outputStream.close();
446448
self.postMessage({message: "done", path: s3_url, localFilePath: filePath, size: response.headers.get('content-length')});
447449
} catch (error) {
448-
let msg = error.name || "Unnamed Error" + " when attempting to fetch URL " + s3_url;
450+
let msg = (error.name || "Unnamed Error") + " when attempting to fetch URL " + s3_url;
449451
if(error.name === "AbortError" || (error.name === undefined && pending_abort)) {
450452
msg = "Fetch was aborted. The user may have cancelled their downloads.";
451453
} else {
452-
console.error(msg);
453-
console.error(error);
454+
console.error("[Worker Error]", error.name);
455+
console.error("[Worker Error]", error.message);
456+
if(error.message.indexOf("getFileHandle") >= 0) {
457+
console.error("[Worker Error] File name attempted: ",fileName);
458+
}
459+
console.error("[Worker Error] on S3 target ", s3_url);
454460
}
455461
self.postMessage({message: 'error', path: s3_url, error: error, 'text': msg});
456462
}
@@ -649,7 +655,10 @@ require([
649655
downloader_manager.cancel();
650656
});
651657

652-
$('.container-fluid').on('click', '.download-all-instances', async function () {
658+
$('.container-fluid').on('click', '.download-all-instances', async function (event) {
659+
// Stop propagation to the other handlers or the showDirectoryPicker will complain.
660+
event.stopImmediatePropagation();
661+
event.preventDefault();
653662
const clicked = $(this);
654663
let directoryHandle = await window.showDirectoryPicker({
655664
id: 'idc-downloads',

static/js/filterutils.js

Lines changed: 24 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -58,62 +58,44 @@ require([
5858

5959
// Return an object for consts/methods used by most views
6060
define(['jquery', 'base'], function($, base) {
61-
62-
6361
var ANONYMOUS_FILTERS = {};
6462
var showFilters = [];
6563
var first_filter_load = true;
6664

67-
const update_bq_filters = function() {
68-
let filters = parseFilterObj();
69-
if (Object.keys(filters).length <= 0) {
70-
$('#export-manifest').attr("disabled", "disabled");
71-
$('.bq-string-copy').attr("disabled","disabled");
72-
$('.bq-string-display').attr("disabled","disabled");
73-
$('.bq-string-display').attr("title","Select a filter to enable this feature.");
74-
$('.bq-string').html("");
75-
$('#export-manifest-form input[name="filters"]').val("");
76-
} else {
77-
$('#export-manifest').removeAttr("disabled");
78-
$('.bq-string-copy').removeAttr("disabled");
79-
$('.bq-string-display').removeAttr("disabled");
80-
$('.bq-string-display').attr("title","Click to display this filter as a BQ string.");
81-
$('.bq-string-display').attr('filter-params', JSON.stringify(filters));
82-
$('.bq-string-copy').attr('filter-params', JSON.stringify(filters));
83-
$('#export-manifest-form input[name="filters"]').val(JSON.stringify(filters));
84-
}
85-
};
86-
87-
var update_filter_url = function() {
65+
const update_filter_controls = function() {
8866
let filters = parseFilterObj();
8967
if (Object.keys(filters).length <= 0) {
9068
$('.filter-placeholder').show();
91-
$('.get-filter-uri').attr("disabled","disabled");
92-
$('#export-manifest').attr("disabled","disabled");
93-
$('#export-manifest').attr("data-no-filters", "true");
94-
if(!$('#export-manifest').attr('data-pending-manifest')) {
95-
$('#export-manifest').attr("title", "Select a filter to enable this feature.");
96-
}
97-
$('.get-filter-uri').attr("title","Select a filter to enable this feature.");
98-
$('.filter-url').html("");
99-
$('.copy-url').removeAttr("content");
100-
$('.copy-url').attr("disabled","disabled");
69+
$('.filter-activated-controls').each(function(){
70+
if(!$(this).attr('data-pending-manifest')) {
71+
$(this).attr("disabled","disabled");
72+
$(this).attr("title","Select a filter to enable this feature.");
73+
}
74+
})
75+
$('.bq-string, .citations-list').html("");
76+
$('.bq-string-copy, .citations-button').attr('filter-params', "");
10177
$('.hide-filter-uri').triggerHandler('click');
10278
$('.url-too-long').hide();
10379
$('#export-manifest-form').attr(
10480
'action',
10581
$('#export-manifest-form').data('uri-base')
10682
);
83+
$('.filter-url').html("");
84+
$('.copy-url').removeAttr("content");
85+
$('#export-manifest').attr("data-no-filters", "true");
86+
$('#export-manifest-form input[name="filters"]').val("");
10787
} else {
10888
$('.filter-placeholder').hide();
109-
$('.get-filter-uri').removeAttr("disabled");
89+
$('.filter-activated-controls').each((function(){
90+
if(!$(this).attr('data-pending-manifest')) {
91+
$(this).attr("title", $(this).attr("data-default-title"));
92+
$(this).removeAttr("disabled");
93+
}
94+
}));
95+
$('.bq-string-display').attr('filter-params', JSON.stringify(filters));
96+
$('.bq-string-copy, .citations-button').attr('filter-params', JSON.stringify(filters));
97+
$('#export-manifest-form input[name="filters"]').val(JSON.stringify(filters));
11098
$('#export-manifest').removeAttr("data-no-filters");
111-
if(!$('#export-manifest').attr('data-pending-manifest')) {
112-
$('#export-manifest').removeAttr("disabled");
113-
$('#export-manifest').attr("title", "Export these search results as a manifest for downloading.");
114-
}
115-
$('.copy-url').removeAttr("disabled");
116-
$('.get-filter-uri').attr("title","Click to display this filter set's query URL.");
11799
let url = BASE_URL+"/explore/filters/?";
118100
let encoded_filters = []
119101
for (let i in filters) {
@@ -675,8 +657,7 @@ define(['jquery', 'base'], function($, base) {
675657

676658
if (mkFilt) {
677659
isFiltered = mkFiltText();
678-
update_filter_url();
679-
update_bq_filters();
660+
update_filter_controls();
680661
if (window.location.href.search(/\/filters\//g) >= 0) {
681662
if (!first_filter_load) {
682663
window.history.pushState({}, '', window.location.origin + "/explore/")
@@ -1230,8 +1211,7 @@ define(['jquery', 'base'], function($, base) {
12301211

12311212

12321213
return {
1233-
update_bq_filters: update_bq_filters,
1234-
update_filter_url: update_filter_url,
1214+
update_filter_controls: update_filter_controls,
12351215
updateCollectionTotals: updateCollectionTotals,
12361216
parseFilterObj: parseFilterObj,
12371217
findFilterCats: findFilterCats,

templates/idc/explore_data_core.html

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -626,21 +626,30 @@ <h4>Cohort Filters</h4>
626626
collections are not publicly available
627627
</div>
628628
<div class="space-top-10">
629-
<button id="export-manifest" class="btn btn-primary btn-small" disabled data-toggle="modal"
629+
<button id="export-manifest" class="btn btn-primary btn-small filter-activated-controls" disabled data-toggle="modal"
630+
data-default-title="Export this cohort's series as a manifest for download."
630631
data-target="#export-manifest-modal"
631632
title="Select a filter to enable this feature."
632633
> Manifest <i class="fa fa-solid fa-download"></i>
633634
</button>
634-
<button class="btn btn-small btn-default bq-string-display" disabled data-toggle="modal"
635+
<button class="btn btn-small btn-special citations-button filter-activated-controls" disabled data-toggle="modal" data-target="#citations-modal" role="button"
636+
data-default-title="Display this cohort's citation list in Vancouver format."
637+
title= "Select a filter to enable this feature."
638+
> Citations <i class="fa fa-list-numeric"></i>
639+
</button>
640+
<button class="btn btn-small btn-default bq-string-display filter-activated-controls" disabled data-toggle="modal"
641+
data-default-title="Display this cohort's filter as a BQ SQL string."
635642
data-target="#bq-string-display" title= "Select a filter to enable this feature."
636643
> SQL
637644
</button>
638645
<button
639-
class="btn btn-small btn-special get-filter-uri" disabled role="button"
646+
class="btn btn-small btn-special get-filter-uri filter-activated-controls" disabled role="button"
647+
data-default-title="Display this cohort's filter query URL."
640648
title="Select a filter to enable this feature."
641649
> URL <i class="fa fa-angles-right"></i>
642650
</button>
643-
<button class="btn btn-small btn-special hide-filter-uri" role="button"
651+
<button class="btn btn-small btn-special hide-filter-uri filter-activated-controls" role="button"
652+
data-default-title="Hide the filter query URL."
644653
title="Hide the filter query URL." style="display: none;"
645654
> URL <i class="fa fa-angles-down"></i>
646655
</button>

0 commit comments

Comments
 (0)