1616 *
1717 */
1818
19- // by @pieper 6/25/25
19+ // initial design by @pieper 6/25/25
2020require . config ( {
2121 baseUrl : STATIC_FILES_URL + 'js/' ,
2222 paths : {
@@ -29,13 +29,20 @@ require([
2929 'base' , 'jquery'
3030] , function ( base , $ ) {
3131
32- const byte_level = {
32+ const byte_level = Object . freeze ( {
3333 1 : "KB" ,
3434 2 : "MB" ,
3535 3 : "GB" ,
3636 4 : "TB" ,
3737 5 : "PB"
38- } ;
38+ } ) ;
39+
40+ const REQ_TYPE = Object . freeze ( {
41+ COLLECTION : 1 ,
42+ CASE : 2 ,
43+ STUDY : 3 ,
44+ SERIES : 4
45+ } ) ;
3946
4047 function size_display_string ( size ) {
4148 if ( size <= 0 ) {
@@ -99,6 +106,7 @@ require([
99106 }
100107
101108 class DownloadRequest {
109+ request_type = REQ_TYPE . SERIES ;
102110 region = "us-east-1" ;
103111
104112 constructor ( request ) {
@@ -111,6 +119,20 @@ require([
111119 this . crdc_series_id = request [ 'crdc_series_id' ] ;
112120 this . directory = request [ 'directory' ] ;
113121 this . total_size = parseFloat ( request [ 'series_size' ] ) ;
122+
123+ if ( this . series_id ) {
124+ this . request_type = REQ_TYPE . SERIES ;
125+ } else if ( this . study_id ) {
126+ this . request_type = REQ_TYPE . STUDY ;
127+ } else if ( this . patient_id ) {
128+ this . request_type = REQ_TYPE . CASE ;
129+ } else {
130+ this . request_type = REQ_TYPE . COLLECTION ;
131+ }
132+ }
133+
134+ get request_type ( ) {
135+ return
114136 }
115137
116138 async getAllS3ObjectKeys ( ) {
@@ -181,7 +203,7 @@ require([
181203
182204 class DownloadQueueManager {
183205 WORKING_QUEUE_LIMIT = 2000 ;
184- HOPPER_LIMIT = 500 ;
206+ HOPPER_LIMIT = 4000 ;
185207
186208 hopper = [ ] ;
187209 working_queue = [ ] ;
@@ -249,6 +271,7 @@ require([
249271 async _update_queue ( ) {
250272 if ( this . working_queue . length < this . WORKING_QUEUE_LIMIT && this . hopper . length > 0 ) {
251273 let request = this . hopper . pop ( ) ;
274+ if ( request )
252275 await request . loadAllKeys ( ) . then ( keys => {
253276 this . working_queue . push ( ...keys ) ;
254277 } ) ;
0 commit comments