extensions/xnat/src/components/XNATNavigation/helpers/SubjectRouter.js
/**
   * _generateSessionMetadata - generates missing metadata for
   *
   * @param  {Boolean[]} sessionsWithMetadata An array of which indicies in
   *                     this.sessions have metadata.
   * @returns {null}
   */
generates missing metadata for
@param  {Boolean[]} sessionsWithMetadata An array of which indicies in
this.sessions have metadata.
@returns {null}
generates missing metadata for @param { Boolean [] } sessionsWithMetadata An array of which indicies in this . sessions have metadata . @returns { null }
_generateSessionMetadata(sessionsWithMetadata) {
    const sessionJSONToGenerate = [];
    for (let i = 0; i < sessionsWithMetadata.length; i++) {
      if (!sessionsWithMetadata[i]) {
        sessionJSONToGenerate.push(this.sessions[i].ID);
      }
    }
    let jsonGenerated = 0;
    const promises = [];
    for (let i = 0; i < sessionJSONToGenerate.length; i++) {
      const cancelablePromise = fetchJSON(
        `xapi/viewer/projects/${this.projectId}/experiments/${sessionJSONToGenerate[i]}`
      );
      promises.push(cancelablePromise.promise);
      cancelablePromise.promise.then(() => {
        jsonGenerated++;
      });
    }
    Promise.all(promises).then(() => {
      this._loadRoute();
    });
  }
_generateSessionMetadata ( sessionsWithMetadata ) { const sessionJSONToGenerate = [ ] ; for ( let i = 0 ; i < sessionsWithMetadata . length ; i ++ ) { if ( ! sessionsWithMetadata [ i ] ) { sessionJSONToGenerate . push ( this . sessions [ i ] . ID ) ; } } let jsonGenerated = 0 ; const promises = [ ] ; for ( let i = 0 ; i < sessionJSONToGenerate . length ; i ++ ) { const cancelablePromise = fetchJSON ( ` ${ this . projectId } ${ sessionJSONToGenerate [ i ] } ` ) ; promises . push ( cancelablePromise . promise ) ; cancelablePromise . promise . then ( ( ) => { jsonGenerated ++ ; } ) ; } Promise . all ( promises ) . then ( ( ) => { this . _loadRoute ( ) ; } ) ; }
_generateSessionMetadata - generates missing metadata for
 @param  {Boolean[]} sessionsWithMetadata An array of which indicies in
                     this.sessions have metadata.
_generateSessionMetadata - generates missing metadata for @param { Boolean [] } sessionsWithMetadata An array of which indicies in this . sessions have metadata .
// Generate metadata // progressDialog.show({ //   notificationText: `generating metadata for ${this.subjectLabel}...`, //   progressText: `${jsonGenerated}/${sessionJSONToGenerate.length} <i class="fa fa-spin fa-circle-o-notch fa-fw">`, // }); // progressDialog.update({ //   notificationText: `generating metadata for ${this.subjectLabel}...`, //   progressText: `${jsonGenerated}/${sessionJSONToGenerate.length} <i class="fa fa-spin fa-circle-o-notch fa-fw">`, // });