private async uploadingQueue()

in services/self-service/src/main/resources/webapp/src/app/resources/bucket-browser/bucket-browser.component.ts [193:236]


  private async uploadingQueue(files) {
    if (files.length) {
      let askForAll = true;
      let skipAll = false;

      const folderFiles = this.folderItems.reduce((existFiles, item) => {
        if (!item.children) {
          existFiles.push(item.item);
        }
        return existFiles;
      }, []);

      for (const file of files) {
        const existFile = folderFiles.find(v => v === file['name']);
        const uploadItem = {
          name: file['name'],
          file: file,
          size: file.size,
          path: this.path,
        };

        if (existFile && askForAll) {
          const result = await this.openResolveDialog(existFile);
          if (result) {
            askForAll = !result.forAll;
            if (result.forAll && !result.replaceObject) {
              skipAll = true;
            }
            if (result.replaceObject) {
              this.addedFiles.push(uploadItem);
              this.uploadNewFile(uploadItem);
            }
          }
        } else if (!existFile || (existFile && !askForAll && !skipAll)) {
          this.addedFiles.push(uploadItem);
          this.uploadNewFile(uploadItem);
        }
      }
    }
    setTimeout(() => {
      const element = document.querySelector('#upload-list');
      element && element.scrollIntoView({ block: 'end', behavior: 'smooth' });
    }, 10);
  }