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/08/25 13:55:46 UTC

[incubator-dlab] 02/02: [DLAB-2002]: Improvement for library management

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

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

commit e118ab686b58db6d944e3074723e94519de104b1
Author: Dmytro_Gnatyshyn <di...@ukr.net>
AuthorDate: Tue Aug 25 16:55:19 2020 +0300

    [DLAB-2002]: Improvement for library management
---
 .../src/main/resources/webapp/src/app/core/util/sortUtils.ts     | 6 ++++++
 .../install-libraries/install-libraries.component.html           | 9 +++++----
 .../exploratory/install-libraries/install-libraries.component.ts | 3 +++
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/services/self-service/src/main/resources/webapp/src/app/core/util/sortUtils.ts b/services/self-service/src/main/resources/webapp/src/app/core/util/sortUtils.ts
index 2573d0d..3d204ba 100644
--- a/services/self-service/src/main/resources/webapp/src/app/core/util/sortUtils.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/core/util/sortUtils.ts
@@ -49,6 +49,12 @@ export class SortUtils {
     return groups.sort((arg1, arg2) => sortOrder.indexOf(arg1) - sortOrder.indexOf(arg2));
   }
 
+  public static libFilterGroupsSort(groups) {
+    const sortOrder = ['Apt/Yum', 'Python 2', 'Python 3', 'R packages', 'Java', 'Others'];
+
+    return groups.sort((arg1, arg2) => sortOrder.indexOf(arg1) - sortOrder.indexOf(arg2));
+  }
+
   public static flatDeep(arr, d = 1) {
     return d > 0 ? arr.reduce((acc, val) => acc.concat(Array.isArray(val) ? this.flatDeep(val, d - 1) : val), [])
       : arr.slice();
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 4eceabf..517d221 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
@@ -132,14 +132,15 @@
                     [matAutocomplete]="auto"
                     [formControl]="libSearch"
                     #trigger="matAutocompleteTrigger"
-                    (keyup.enter)="addLibrary(lib)"
+                    (keydown.enter)="addLibrary(lib)"
+                    (keyup)="clearLibSelection($event)"
                   >
                   <span
                     class="plus-icon"
-                    [ngClass]="{'not-allow': !this.selectedLib || this.selectedLib?.isInSelectedList}"
-                    matTooltip="Library is in selected list" matTooltipPosition="above" [matTooltipDisabled]="!this.selectedLib?.isInSelectedList"
+                    [ngClass]="{'not-allow': !this.selectedLib || this.selectedLib?.isInSelectedList || !isLibSelected}"
+                    matTooltip="Library is in selected list" matTooltipPosition="above" [matTooltipDisabled]="!this.selectedLib?.isInSelectedList || !isLibSelected"
                   >
-                  <mat-icon  (click)="addLibrary(lib)" (keyup.enter)="addLibrary(lib)" [ngClass]="{'not-allowed': !this.selectedLib || this.selectedLib?.isInSelectedList}">add</mat-icon>
+                  <mat-icon  (click)="addLibrary(lib)" (keyup.enter)="addLibrary(lib)" [ngClass]="{'not-allowed': !this.selectedLib || this.selectedLib?.isInSelectedList || !isLibSelected}">add</mat-icon>
                 </span>
                 </div>
                 <mat-autocomplete #auto="matAutocomplete" class="suggestions">
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 5eb86c4..d7afd5f 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
@@ -238,6 +238,7 @@ export class InstallLibrariesComponent implements OnInit, OnDestroy {
       return;
     }
     if (this.group === 'java') {
+      this.isLibSelected = true;
       this.libSearch.setValue(item.name + ':' + item.version);
       this.lib.name = item.name + ':' + item.version;
     } else {
@@ -317,6 +318,8 @@ export class InstallLibrariesComponent implements OnInit, OnDestroy {
         this.filterLibs();
         this.changeDetector.markForCheck();
         this.filterConfiguration.group = this.createFilterList(this.notebookLibs.map(v => this.groupsListMap[v.group]));
+        this.filterConfiguration.group = SortUtils.libFilterGroupsSort(this.filterConfiguration.group);
+        console.log(this.filterConfiguration.group);
         this.filterConfiguration.resource = this.createFilterList(this.notebookLibs.map(lib => lib.status.map(status => status.resource)));
         this.filterConfiguration.resourceType = this.createFilterList(this.notebookLibs.map(lib =>
           lib.status.map(status => status.resourceType)));


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