This is an automated email from the ASF dual-hosted git repository. dgnatyshyn pushed a commit to branch DLAB-2020 in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git
commit 7d4f352c6b494d37f6c615b2f234e0d4f0567467 Author: Dmytro_Gnatyshyn <di1...@ukr.net> AuthorDate: Wed Sep 2 15:44:31 2020 +0300 [DLAB-2020]: Minor changes about library installation --- .../webapp/src/app/core/pipes/highlight.pipe.ts | 2 +- .../install-libraries.component.html | 4 ++-- .../install-libraries.component.ts | 26 ++++++++-------------- 3 files changed, 12 insertions(+), 20 deletions(-) diff --git a/services/self-service/src/main/resources/webapp/src/app/core/pipes/highlight.pipe.ts b/services/self-service/src/main/resources/webapp/src/app/core/pipes/highlight.pipe.ts index 7bad3a9..652ff58 100644 --- a/services/self-service/src/main/resources/webapp/src/app/core/pipes/highlight.pipe.ts +++ b/services/self-service/src/main/resources/webapp/src/app/core/pipes/highlight.pipe.ts @@ -24,7 +24,7 @@ import {PipeTransform, Pipe} from '@angular/core'; @Pipe({ name: 'highlight' }) export class HighLightPipe implements PipeTransform { transform(text: string, search: string): string { - return search ? text.replace(new RegExp(search, 'i'), `<span class="highlight">${search}</span>`) : text; + return search ? text.replace(new RegExp(search, 'i'), `<span class="highlight">${text.match(new RegExp(search, 'i'))[0]}</span>`) : text; } } diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/install-libraries/install-libraries.component.html b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/install-libraries/install-libraries.component.html index c54f165..a13eebc 100644 --- a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/install-libraries/install-libraries.component.html +++ b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/install-libraries/install-libraries.component.html @@ -121,8 +121,8 @@ [ngClass]="{'not-allow': lib.name?.length < 2 || (autoComplete === 'ENABLED' && !isLibSelected ) || this.selectedLib?.isInSelectedList || isVersionInvalid || autoComplete === 'UPDATING'}" - - matTooltip="Library is in selected list" matTooltipPosition="above" [matTooltipDisabled]="!this.selectedLib?.isInSelectedList" + [matTooltip]="this.selectedLib?.isInSelectedList ? 'Library is in selected list' : 'Please select library from autocomplete'" + matTooltipPosition="above" [matTooltipDisabled]="(!this.selectedLib?.isInSelectedList && isLibSelected) || lib.name?.length < 2 || !this.selectedLib?.isInSelectedList && autoComplete === 'NONE'" > <mat-icon (click)="addLibrary(lib)" diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/install-libraries/install-libraries.component.ts b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/install-libraries/install-libraries.component.ts index 94d7666..a614c30 100644 --- a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/install-libraries/install-libraries.component.ts +++ b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/install-libraries/install-libraries.component.ts @@ -73,6 +73,7 @@ export class InstallLibrariesComponent implements OnInit, OnDestroy { }; private readonly CHECK_GROUPS_TIMEOUT: number = 5000; + private readonly INSTALLATION_IN_PROGRESS_CHECK: number = 10000; private clear: number; public filterConfiguration: FilterLibsModel = new FilterLibsModel('', [], [], [], []); @@ -114,8 +115,6 @@ export class InstallLibrariesComponent implements OnInit, OnDestroy { } ngOnDestroy() { - window.clearTimeout(this.loadLibsTimer); - window.clearTimeout(this.clear); this.unsubscribe$.next(); this.unsubscribe$.complete(); } @@ -224,8 +223,13 @@ export class InstallLibrariesComponent implements OnInit, OnDestroy { } public addLibrary(item): void { + if ((this.autoComplete === 'ENABLED' && !this.isLibSelected ) + || (this.selectedLib && this.selectedLib.isInSelectedList) || this.isVersionInvalid || this.autoComplete === 'UPDATING') { + return; + } + this.isLibSelected = false; - if ( !this.selectedLib.isInSelectedList && !this.isVersionInvalid) { + if ( (!this.selectedLib && !this.isVersionInvalid) || (!this.selectedLib.isInSelectedList && !this.isVersionInvalid)) { if ( this.selectedLib && this.group !== 'java') { this.model.selectedLibs.push({ group: this.group, name: item.name, version: item.version || 'N/A' }); } else { @@ -288,17 +292,9 @@ export class InstallLibrariesComponent implements OnInit, OnDestroy { public isInstallingInProgress(): void { this.installingInProgress = this.notebookLibs.some(lib => lib.filteredStatus.some(status => status.status === 'installing')); if (this.installingInProgress) { - // window.clearTimeout(this.loadLibsTimer); - // this.loadLibsTimer = window.setTimeout(() => this.getInstalledLibrariesList(), 10000); - timer(10000).pipe(take(1)).subscribe(v => this.getInstalledLibrariesList()); + timer(this.INSTALLATION_IN_PROGRESS_CHECK).pipe(take(1)).subscribe(v => this.getInstalledLibrariesList()); } - const source = timer(1000); - - const subscribe = source.subscribe(val => console.log(val)); - - console.log(source); - console.log(subscribe); - } + } public reinstallLibrary(item, lib) { const retry = [{ group: lib.group, name: lib.name, version: lib.version }]; @@ -361,7 +357,6 @@ export class InstallLibrariesComponent implements OnInit, OnDestroy { } else { this.libs_uploaded = false; this.uploading = true; - // this.clear = window.setTimeout(() => this.uploadLibGroups(), this.CHECK_GROUPS_TIMEOUT); timer(this.CHECK_GROUPS_TIMEOUT).pipe(take(1)).subscribe(() => this.uploadLibGroups()); } } @@ -454,9 +449,6 @@ export class InstallLibrariesComponent implements OnInit, OnDestroy { this.model.selectedLibs = []; this.filteredList = []; this.groupsList = []; - - clearTimeout(this.clear); - clearTimeout(this.loadLibsTimer); this.selectorsReset(true); } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@dlab.apache.org For additional commands, e-mail: commits-h...@dlab.apache.org