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

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

commit a43112876f748b3d9ec0d59ff9bcdb1ac32aac46
Author: Andriana Kovalyshyn <andriana_kovalys...@epam.com>
AuthorDate: Thu Mar 7 08:24:04 2019 +0200

    [DLAB-477]: active filter fixes during first env creation
---
 .../resources-grid/resources-grid.component.css      |  3 +++
 .../resources-grid/resources-grid.component.ts       | 20 ++++++++++----------
 .../src/app/resources/resources.component.html       |  2 +-
 .../webapp/src/app/resources/resources.component.ts  |  8 +++-----
 4 files changed, 17 insertions(+), 16 deletions(-)

diff --git 
a/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.css
 
b/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.css
index 3d6b687..6b4682f 100644
--- 
a/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.css
+++ 
b/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.css
@@ -198,6 +198,9 @@
   border-bottom: 1px solid #edf1f5;
 }
 
+.dashboard_table .message_block {
+  background: #edf6f9;
+}
 .message_block td {
   text-align: left !important;
 }
diff --git 
a/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.ts
 
b/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.ts
index a1c4204..c897950 100644
--- 
a/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.ts
+++ 
b/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.ts
@@ -114,7 +114,7 @@ export class ResourcesGridComponent implements OnInit {
       return list.filter((item: any) => { if 
(selectedItems.indexOf(item.status) !== -1) return item; });
     };
 
-    filteredData = filteredData.filter((item: any) => {
+    config && (filteredData = filteredData.filter((item: any) => {
       const isName = 
item.name.toLowerCase().indexOf(config.name.toLowerCase()) !== -1;
       const isStatus = config.statuses.length > 0 ? 
(config.statuses.indexOf(item.status) !== -1) : (config.type !== 'active');
       const isShape = config.shapes.length > 0 ? 
(config.shapes.indexOf(item.shape) !== -1) : true;
@@ -130,9 +130,9 @@ export class ResourcesGridComponent implements OnInit {
       }
 
       return isName && isStatus && isShape && isResources;
-    });
+    }));
 
-    this.updateUserPreferences(config);
+    config && this.updateUserPreferences(config);
     this.filteredEnvironments = filteredData;
   }
 
@@ -254,13 +254,13 @@ export class ResourcesGridComponent implements OnInit {
 
   getUserPreferences(): void {
     this.userResourceService.getUserPreferences()
-      .subscribe((result: any) => {
-        this.isActiveFilter(result);
-        this.filterForm = this.loadUserPreferences( result.type ? 
this.filterActiveInstances() : this.aliveStatuses(result) );
-        this.applyFilter_btnClick(this.filterForm);
-      }, (error) => {
-        this.applyFilter_btnClick(this.filterForm); // in case of empty 
database
-      });
+      .subscribe((result: FilterConfigurationModel) => {
+        if (result) {
+          this.isActiveFilter(result);
+          this.filterForm = this.loadUserPreferences(result.type ? 
this.filterActiveInstances() : this.aliveStatuses(result));
+        }
+        this.applyFilter_btnClick(result ? this.filterForm : result);
+      }, () => this.applyFilter_btnClick(null));
   }
 
   loadUserPreferences(config): FilterConfigurationModel {
diff --git 
a/services/self-service/src/main/resources/webapp/src/app/resources/resources.component.html
 
b/services/self-service/src/main/resources/webapp/src/app/resources/resources.component.html
index e913ca4..c2ee208 100644
--- 
a/services/self-service/src/main/resources/webapp/src/app/resources/resources.component.html
+++ 
b/services/self-service/src/main/resources/webapp/src/app/resources/resources.component.html
@@ -27,7 +27,7 @@
     <button mat-raised-button class="butt butt-tool" (click)="manageUngit()">
       <i class="material-icons"></i>Git credentials
     </button>
-    <button mat-raised-button class="butt butt-tool" 
(click)="toggleFiltering()">
+    <button mat-raised-button class="butt butt-tool" 
(click)="toggleFiltering()" [disabled]="!exploratoryEnvironments.length">
       <span *ngIf="!resourcesGrid.activeFiltering">
         <i class="material-icons">visibility_off</i> Show active
       </span>
diff --git 
a/services/self-service/src/main/resources/webapp/src/app/resources/resources.component.ts
 
b/services/self-service/src/main/resources/webapp/src/app/resources/resources.component.ts
index 116225c..76002b0 100644
--- 
a/services/self-service/src/main/resources/webapp/src/app/resources/resources.component.ts
+++ 
b/services/self-service/src/main/resources/webapp/src/app/resources/resources.component.ts
@@ -23,7 +23,7 @@ import { ToastrService } from 'ngx-toastr';
 
 import { ResourcesGridComponent } from 
'./resources-grid/resources-grid.component';
 import { UserAccessKeyService, HealthStatusService } from '../core/services';
-import { ExploratoryEnvironmentVersionModel, ComputationalResourceImage } from 
'../core/models';
+import { ResourcesGridRowModel } from './resources-grid/resources-grid.model';
 import { HTTP_STATUS_CODES, FileUtils } from '../core/util';
 
 @Component({
@@ -35,11 +35,8 @@ import { HTTP_STATUS_CODES, FileUtils } from '../core/util';
 export class ResourcesComponent implements OnInit, OnDestroy {
 
   public userUploadAccessKeyState: number;
-  public exploratoryEnvironments: Array<ExploratoryEnvironmentVersionModel> = 
[];
-  public computationalResources: Array<ComputationalResourceImage> = [];
+  public exploratoryEnvironments: Array<ResourcesGridRowModel> = [];
   public healthStatus: any;
-  // public billingEnabled: boolean;
-  // public admin: boolean;
 
   @ViewChild('createAnalyticalModal') createAnalyticalModal;
   @ViewChild('manageUngitDialog') manageUngitDialog;
@@ -79,6 +76,7 @@ export class ResourcesComponent implements OnInit, OnDestroy {
   public refreshGrid(): void {
     this.resourcesGrid.buildGrid();
     this.getEnvironmentHealthStatus();
+    this.exploratoryEnvironments = this.resourcesGrid.environments;
   }
 
   public toggleFiltering(): void {


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

Reply via email to