private getFilteredList()

in services/self-service/src/main/resources/webapp/src/app/resources/exploratory/install-libraries/install-libraries.component.ts [396:441]


  private getFilteredList(): void {
    this.validity_format = '';
    if (this.lib.name.length > 1) {
      if (this.group === 'java') {
        this.model.getDependencies(this.lib.name)
          .pipe(
            takeUntil(this.unsubscribe$)
          )
          .subscribe(
            libs => {
              this.filteredList = [libs];
              this.filteredList.forEach(lib => {
                lib.isInSelectedList = this.model.selectedLibs
                  .some(el => {
                    return lib.name.toLowerCase() === el.name.toLowerCase();
                  });
                lib.isInstalled = this.notebookLibs.some(libr => {
                    return lib.name.toLowerCase() === libr.name.toLowerCase() &&
                      this.group === libr.group &&
                      libr.status.some(res => res.resource === this.destination.name);
                  }
                );
              });
              this.isDuplicated(this.lib);
            },
            error => {
              if (error.status === HTTP_STATUS_CODES.NOT_FOUND
                || error.status === HTTP_STATUS_CODES.BAD_REQUEST
                || error.status === HTTP_STATUS_CODES.INTERNAL_SERVER_ERROR) {
                this.validity_format = error.message || '';
                if (error.message.indexOf('query param artifact') !== -1 || error.message.indexOf('Illegal character') !== -1) {
                  this.validity_format = 'Wrong library name format. Should be <groupId>:<artifactId>:<versionId>.';
                }
                if (error.message.indexOf('not found') !== -1) {
                  this.validity_format = 'No matches found.';
                }
                this.filteredList = null;
              }
            });
      } else {
        if (this.lib.name && this.lib.name.length > 1) {
          this.getMatchedLibs();
        }
      }
    }
  }