function loadInput(dataset,proms) {
  datasets.set(dataset.key,dataset);
  dataset.status={status:"loading",start:new Date().getTime()};
  let input = dataset.input;

  console.log(`Started loading input "${dataset.key}"`);
  console.log(input);

  let prom = null;
  if(input.file){
    if(input.file.indexOf("/") >=0 ){
      // reject files that have path traversal characters
      recordLoadFailure(key,"Illegal input file name")
    } else {
      // get a promise for the parsed data
      prom = FlowParser.flowsFromFile('data/'+input.file,{max: max_records,
                                                          no_label: input.no_label});
    }
  } else if(input.url) {
    prom = FlowParser.flowsFromURL(input.url,{max: max_records,
                                              no_label: input.no_label});
  } // there's no "else" here because the following null check handles that case
  if(prom != null) {
    /* Without this rather annoying catch(_=>{}), the error which is handled
       just fine in the 'failure' function bubbles up again in Promise.all(...).
       When Promise.protoype.finally() is added to the standard, this won't be
       necessary. */
    if(proms) {
      proms.push(prom.catch(_=>{}));
    }
    // Either store the sucessfully loaded data or record that the load failed
    prom.then(acceptLoadedInput.bind(null,dataset),
              recordLoadFailure.bind(null,dataset));
  }
  //above use of bind inspired by:
  // https://stackoverflow.com/questions/32912459/promises-pass-additional-parameters-to-then-chain
}
// Start loading an input definition, including storing it in the input map
Start loading an input definition, including storing it in the input map
Start loading an input definition including storing it in the input map
function loadInput(dataset,proms) {
  datasets.set(dataset.key,dataset);
  dataset.status={status:"loading",start:new Date().getTime()};
  let input = dataset.input;
  console.log(`Started loading input "${dataset.key}"`);
  console.log(input);
  let prom = null;
  if(input.file){
    if(input.file.indexOf("/") >=0 ){
      recordLoadFailure(key,"Illegal input file name")
    } else {
      prom = FlowParser.flowsFromFile('data/'+input.file,{max: max_records,
                                                          no_label: input.no_label});
    }
  } else if(input.url) {
    prom = FlowParser.flowsFromURL(input.url,{max: max_records,
                                              no_label: input.no_label});
  } 
  if(prom != null) {
    if(proms) {
      proms.push(prom.catch(_=>{}));
    }
    prom.then(acceptLoadedInput.bind(null,dataset),
              recordLoadFailure.bind(null,dataset));
  }
}
function loadInput ( dataset , proms ) { datasets . set ( dataset . key , dataset ) ; dataset . status = { status : "loading" , start : new Date ( ) . getTime ( ) } ; let input = dataset . input ; console . log ( ` ${ dataset . key } ` ) ; console . log ( input ) ; let prom = null ; if ( input . file ) { if ( input . file . indexOf ( "/" ) >= 0 ) { recordLoadFailure ( key , "Illegal input file name" ) } else { prom = FlowParser . flowsFromFile ( 'data/' + input . file , { max : max_records , no_label : input . no_label } ) ; } } else if ( input . url ) { prom = FlowParser . flowsFromURL ( input . url , { max : max_records , no_label : input . no_label } ) ; } if ( prom != null ) { if ( proms ) { proms . push ( prom . catch ( _ => { } ) ) ; } prom . then ( acceptLoadedInput . bind ( null , dataset ) , recordLoadFailure . bind ( null , dataset ) ) ; } }
Start loading an input definition, including storing it in the input map
Start loading an input definition including storing it in the input map
// reject files that have path traversal characters // get a promise for the parsed data // there's no "else" here because the following null check handles that case /* Without this rather annoying catch(_=>{}), the error which is handled
       just fine in the 'failure' function bubbles up again in Promise.all(...).
       When Promise.protoype.finally() is added to the standard, this won't be
       necessary. */ // Either store the sucessfully loaded data or record that the load failed //above use of bind inspired by: // https://stackoverflow.com/questions/32912459/promises-pass-additional-parameters-to-then-chain