You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dlab.apache.org by an...@apache.org on 2019/05/24 13:56:53 UTC

[incubator-dlab] 03/04: added data subscription on projects list

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

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

commit c0eaf171c4b50cf549df7c7b04c67985d9d9ab88
Author: Andriana Kovalyshyn <An...@epam.com>
AuthorDate: Fri May 24 16:55:13 2019 +0300

    added data subscription on projects list
---
 .../src/app/administration/project/project-data.service.ts | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 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 1bba48a..0cfb386 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
@@ -18,22 +18,24 @@
  */
 
 import { Injectable } from '@angular/core';
+import { of as observableOf, Observable, BehaviorSubject } from 'rxjs';
 
 import { ProjectService } from '../../core/services';
 import { Project } from './project.component';
 
 import { data } from './project-list/data';
+
 @Injectable()
 export class ProjectDataService {
-  dataSource: any;
-  // Project[];
+
+  _projects = new BehaviorSubject<any>(null);
 
   constructor(private projectService: ProjectService) {
     this.getProjectsList();
   }
 
-  get getProjects() {
-    return this.dataSource;
+  public getProjects() {
+    this._projects.asObservable();
   }
 
   public updateProjects() {
@@ -41,10 +43,10 @@ export class ProjectDataService {
   }
 
   private getProjectsList() {
-    this.dataSource = data.projects;
+    this._projects.next(data.projects);
 
     
     this.projectService.getProjectsList().subscribe(
-      (response: any) => this.dataSource = data.projects);
+      (response: any) => this._projects.next(response));
   }
 }
\ No newline at end of file


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