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

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

commit 8a348a0882b441a61661f76f338e90f9cc5f1b64
Author: Andriana Kovalyshyn <andriana_kovalys...@epam.com>
AuthorDate: Tue May 28 11:01:03 2019 +0300

    [DLAB-635]: fix displaying comditions; cleanup ref
---
 .../administration/project/project-data.service.ts |  4 ---
 .../administration/project/project.component.html  | 38 ++++++++++++----------
 .../administration/project/project.component.ts    | 14 +++-----
 3 files changed, 25 insertions(+), 31 deletions(-)

diff --git 
a/services/self-service/src/main/resources/webapp/src/app/administration/project/project-data.service.ts
 
b/services/self-service/src/main/resources/webapp/src/app/administration/project/project-data.service.ts
index 1df5a18..ad877f2 100644
--- 
a/services/self-service/src/main/resources/webapp/src/app/administration/project/project-data.service.ts
+++ 
b/services/self-service/src/main/resources/webapp/src/app/administration/project/project-data.service.ts
@@ -32,10 +32,6 @@ export class ProjectDataService {
     this.getProjectsList();
   }
 
-  public getProjects() {
-    this._projects.asObservable();
-  }
-
   public updateProjects() {
     this.getProjectsList();
   }
diff --git 
a/services/self-service/src/main/resources/webapp/src/app/administration/project/project.component.html
 
b/services/self-service/src/main/resources/webapp/src/app/administration/project/project.component.html
index 956e1d7..beabad0 100644
--- 
a/services/self-service/src/main/resources/webapp/src/app/administration/project/project.component.html
+++ 
b/services/self-service/src/main/resources/webapp/src/app/administration/project/project.component.html
@@ -17,24 +17,26 @@
   ~ under the License.
   -->
 
-<div class="sub-nav base-retreat">
-  <div>
-    <button mat-raised-button class="butt butt-create"
-      (click)="createProject()" [disabled]="projects?.lenght < 1">
-      <i class="material-icons">add</i>Create new
-    </button>
-  </div>
-  <div>
-    <button mat-raised-button class="butt" (click)="refreshGrid()" 
[hidden]="projects?.lenght < 1">
-      <i class="material-icons">autorenew</i>Refresh
-    </button>
+
+<div *ngIf="projectList">
+  <div class="sub-nav base-retreat">
+    <div>
+      <button mat-raised-button class="butt butt-create" 
(click)="createProject()" [disabled]="!projectList.length">
+        <i class="material-icons">add</i>Create new
+      </button>
+    </div>
+    <div>
+      <button mat-raised-button class="butt" (click)="refreshGrid()" 
[hidden]="!projectList.length">
+        <i class="material-icons">autorenew</i>Refresh
+      </button>
+    </div>
   </div>
-</div>
 
-<mat-card class="base-retreat project-form" *ngIf="projects?.lenght < 1">
-  <project-form></project-form>
-</mat-card>
+  <mat-card class="base-retreat project-form" *ngIf="!projectList.length">
+    <project-form></project-form>
+  </mat-card>
 
-<div [hidden]="projects?.lenght < 1">
-  <project-list (editItem)="editProject($event)" 
(deleteItem)="deleteProject($event)"></project-list>
-</div>
+  <div [hidden]="!projectList.length">
+    <project-list (editItem)="editProject($event)" 
(deleteItem)="deleteProject($event)"></project-list>
+  </div>
+</div>
\ No newline at end of file
diff --git 
a/services/self-service/src/main/resources/webapp/src/app/administration/project/project.component.ts
 
b/services/self-service/src/main/resources/webapp/src/app/administration/project/project.component.ts
index 59824b9..6a1f7a9 100644
--- 
a/services/self-service/src/main/resources/webapp/src/app/administration/project/project.component.ts
+++ 
b/services/self-service/src/main/resources/webapp/src/app/administration/project/project.component.ts
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-import { Component, OnInit, OnDestroy, Inject, ChangeDetectorRef } from 
'@angular/core';
+import { Component, OnInit, OnDestroy, Inject } from '@angular/core';
 import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
 import { Subscription } from 'rxjs';
 
@@ -38,7 +38,7 @@ export interface Project {
   styleUrls: ['./project.component.scss']
 })
 export class ProjectComponent implements OnInit, OnDestroy {
-  projects: Project[] = [];
+  projectList: Project[] = [];
   healthStatus: any;
 
   private subscriptions: Subscription = new Subscription();
@@ -47,18 +47,14 @@ export class ProjectComponent implements OnInit, OnDestroy {
     public dialog: MatDialog,
     private projectService: ProjectService,
     private projectDataService: ProjectDataService,
-    private healthStatusService: HealthStatusService,
-    private ref: ChangeDetectorRef,
+    private healthStatusService: HealthStatusService
   ) { }
 
   ngOnInit() {
     this.getEnvironmentHealthStatus();
     this.subscriptions.add(this.projectDataService._projects.subscribe(
       (value: Project[]) => {
-        if (value) {
-          this.projects = value;
-          this.ref.detectChanges();
-        }
+        if (value) this.projectList = value;
       }));
   }
 
@@ -73,7 +69,7 @@ export class ProjectComponent implements OnInit, OnDestroy {
   createProject() {
     console.log('create');
 
-    if (this.projects.length)
+    if (this.projectList.length)
       this.dialog.open(EditProjectComponent, { data: { action: 'create', item: 
null }, panelClass: 'modal-xl-s' })
         .afterClosed().subscribe(() => {
           console.log('Create project');


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

Reply via email to