You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dlab.apache.org by dg...@apache.org on 2020/07/13 10:02:12 UTC

[incubator-dlab] 03/03: [DLAB-1750] Added possibility to install lib with different version

This is an automated email from the ASF dual-hosted git repository.

dgnatyshyn pushed a commit to branch DLAB-1749
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git

commit 18104f0daa598f11546bf758d0102dc41b186e29
Author: Dmytro_Gnatyshyn <di...@ukr.net>
AuthorDate: Mon Jul 13 13:01:42 2020 +0300

    [DLAB-1750] Added possibility to install lib with different version
---
 .../install-libraries/install-libraries.component.html | 17 +++++++++--------
 .../install-libraries/install-libraries.component.scss |  5 +++++
 .../install-libraries/install-libraries.component.ts   | 18 +++++++++++++++---
 3 files changed, 29 insertions(+), 11 deletions(-)

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 610f67f..c4c96b0 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
@@ -56,23 +56,24 @@
             <mat-form-field class="chip-list">
               <input
                 type="text"
-                [placeholder]="group === 'java' ? 'Enter library name in <groupId>:<artifactId>:<versionId> format' : 'Enter library name'"
+                [placeholder]="group === 'java' ? 'Enter library name in <groupId>:<artifactId>:<versionId> format' : 'Enter library name in <name>:<version> format(version is not required)'"
                 matInput
                 [formControl]="libSearch"
                 [value]="query"
                 [matAutocomplete]="auto"
               >
-              <mat-icon matSuffix>search</mat-icon>
-              <mat-autocomplete #auto="matAutocomplete" class="suggestions">
-                <ng-template ngFor let-item [ngForOf]="filteredList" let-i="index">
+              <mat-icon matSuffix (click)="addLibrary(query)" class="add-icon">add</mat-icon>
+
+              <mat-autocomplete #auto="matAutocomplete" class="suggestions" >
+                <ng-template ngFor let-item [ngForOf]="filteredList" let-i="index" *ngIf="query.indexOf(':') === -1">
                   <mat-option [ngClass]="{ 'not-allowed': isDuplicated(item) }">
                     <div class="option" (click)="selectLibrary(item)">
                       <a *ngIf="!isDuplicated(item)">
                         <span [innerHTML]="item.name | highlight:query"></span>
-                        <span *ngIf="item.version && item.version !== 'N/A'">{{ item.version }}</span>
+<!--                        <span *ngIf="item.version && item.version !== 'N/A'">{{ item.version }}</span>-->
                       </a>
                       <span *ngIf="isInSelectedList || isInstalled">{{ item.name }}
-                        <span *ngIf="item.version && item.version !== 'N/A'">{{ item.version }}</span>
+<!--                        <span *ngIf="item.version && item.version !== 'N/A'">{{ item.version }}</span>-->
                       </span>
 
                       <strong *ngIf="isInSelectedList">selected
@@ -84,11 +85,11 @@
                     </div>
                   </mat-option>
                 </ng-template>
-                <mat-option *ngIf="model.isEmpty(filteredList) && !validity_format">
+                <mat-option *ngIf="model.isEmpty(filteredList) && !validity_format && query.indexOf(':') === -1">
                   <span class="configuring">No matches found</span>
                 </mat-option>
                 <mat-option *ngIf="validity_format?.length > 0">
-                  <span class="configuring">{{ validity_format }}</span>
+                  <span class="configuring" *ngIf="query.indexOf(':') === -1">{{ validity_format }}</span >
                 </mat-option>
               </mat-autocomplete>
             </mat-form-field>
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/install-libraries/install-libraries.component.scss b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/install-libraries/install-libraries.component.scss
index d8dfe57..b87846d 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/install-libraries/install-libraries.component.scss
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/install-libraries/install-libraries.component.scss
@@ -157,6 +157,11 @@ ul.resources{
   font-weight: 600;
 }
 
+.add-icon{
+  margin-right: 10px;
+  cursor: pointer;
+}
+
 .search-box {
   display: flex;
   padding: 20px 25px 10px;
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 d87805c..ea50a7d 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
@@ -187,13 +187,22 @@ export class InstallLibrariesComponent implements OnInit, OnDestroy {
     return this.isInSelectedList || this.isInstalled;
   }
 
-  public selectLibrary(item): void {
-    this.model.selectedLibs.push({ group: this.group, name: item.name, version: item.version });
+  public addLibrary(item): void {
+    const lib = item.split(':').filter(v => !!v);
+    console.log(lib);
+    this.model.selectedLibs.push({ group: this.group, name: lib[0], version: lib[1] || 'N/A' });
     this.query = '';
     this.libSearch.setValue('');
     this.filteredList = null;
   }
 
+  public selectLibrary(item): void {
+    // this.model.selectedLibs.push({ group: this.group, name: item.name, version: item.version });
+    // this.query = '';
+    this.libSearch.setValue(item.name + ':');
+    this.filteredList = null;
+  }
+
   public removeSelectedLibrary(item): void {
     this.model.selectedLibs.splice(this.model.selectedLibs.indexOf(item), 1);
   }
@@ -305,7 +314,10 @@ export class InstallLibrariesComponent implements OnInit, OnDestroy {
           });
     } else {
       this.model.getLibrariesList(this.group, this.query)
-        .subscribe(libs => this.filteredList = libs);
+        .subscribe(libs => {
+          console.log(libs);
+          this.filteredList = libs;
+        });
     }
   }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@dlab.apache.org
For additional commands, e-mail: commits-help@dlab.apache.org