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/07/23 11:16:17 UTC

[incubator-dlab] 01/02: [DLAB-814]: updated api calls; set quota per project

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

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

commit 1514dd2550191efb3797756f17d04afb24f5c8ee
Author: Andriana Kovalyshyn <An...@epam.com>
AuthorDate: Tue Jul 23 13:37:34 2019 +0300

    [DLAB-814]: updated api calls; set quota per project
---
 .../management/management.component.ts             |  3 +-
 .../services/applicationServiceFacade.service.ts   | 14 +++---
 .../src/app/core/services/healthStatus.service.ts  | 56 ++++++++++------------
 .../src/app/core/services/project.service.ts       |  9 ++++
 4 files changed, 41 insertions(+), 41 deletions(-)

diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/management/management.component.ts b/services/self-service/src/main/resources/webapp/src/app/administration/management/management.component.ts
index 7afbf17..326fda3 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/management/management.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/management/management.component.ts
@@ -117,7 +117,7 @@ export class ManagementComponent implements OnInit {
   }
 
   setBudgetLimits($event) {
-    this.healthStatusService.updateUsersBudget($event.projects).subscribe((result: any) => {
+    this.projectService.updateProjectsBudget($event.projects).subscribe((result: any) => {
       this.healthStatusService.updateTotalBudgetData($event.total).subscribe((res: any) => {
         result.status === HTTP_STATUS_CODES.OK
           && res.status === HTTP_STATUS_CODES.NO_CONTENT
@@ -131,7 +131,6 @@ export class ManagementComponent implements OnInit {
     this.healthStatusService.manageEnvironment(event.action, event.user)
       .subscribe(res => {
         this.getActiveUsersList().subscribe(usersList => {
-          // this.manageEnvironmentDialog.usersList = usersList;
           this.toastr.success(`Action ${event.action} is processing!`, 'Processing!');
           this.buildGrid();
         });
diff --git a/services/self-service/src/main/resources/webapp/src/app/core/services/applicationServiceFacade.service.ts b/services/self-service/src/main/resources/webapp/src/app/core/services/applicationServiceFacade.service.ts
index 2cfb52d..03206eb 100644
--- a/services/self-service/src/main/resources/webapp/src/app/core/services/applicationServiceFacade.service.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/core/services/applicationServiceFacade.service.ts
@@ -410,13 +410,6 @@ export class ApplicationServiceFacade {
       });
   }
 
-  public buildUpdateUsersBudget(data): Observable<any> {
-    return this.buildRequest(RequestMethod.Put,
-      this.requestRegistry.Item(ApplicationServiceFacade.BUDGET),
-      data,
-      { observe: 'response' });
-  }
-
   public buildGetSsnMonitorData(): Observable<any> {
     return this.buildRequest(RequestMethod.Get,
       this.requestRegistry.Item(ApplicationServiceFacade.SNN_MONITOR),
@@ -551,6 +544,13 @@ export class ApplicationServiceFacade {
       data);
   }
 
+  public buildUpdateProjectsBudget(param, data): Observable<any> {
+    return this.buildRequest(RequestMethod.Put,
+      this.requestRegistry.Item(ApplicationServiceFacade.PROJECT) + param,
+      data,
+      { observe: 'response' });
+  }
+
   public buildGetEndpointsData(): Observable<any> {
     return this.buildRequest(RequestMethod.Get,
       this.requestRegistry.Item(ApplicationServiceFacade.ENDPOINT),
diff --git a/services/self-service/src/main/resources/webapp/src/app/core/services/healthStatus.service.ts b/services/self-service/src/main/resources/webapp/src/app/core/services/healthStatus.service.ts
index 8dbad93..d593d08 100644
--- a/services/self-service/src/main/resources/webapp/src/app/core/services/healthStatus.service.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/core/services/healthStatus.service.ts
@@ -33,7 +33,7 @@ export class HealthStatusService {
   constructor(
     private applicationServiceFacade: ApplicationServiceFacade,
     private appRoutingService: AppRoutingService
-  ) {}
+  ) { }
 
   get statusData() {
     return this._statusData.asObservable();
@@ -49,39 +49,39 @@ export class HealthStatusService {
   }
 
   public isHealthStatusOk(): Observable<boolean> {
-      return this.applicationServiceFacade
-        .buildGetEnvironmentHealthStatus()
-        .pipe(
-          map(response => {
-            if (response.status === HTTP_STATUS_CODES.OK)
-              if (response.body.status === 'ok')
-                return true;
+    return this.applicationServiceFacade
+      .buildGetEnvironmentHealthStatus()
+      .pipe(
+        map(response => {
+          if (response.status === HTTP_STATUS_CODES.OK)
+            if (response.body.status === 'ok')
+              return true;
 
-            return false;
-          }));
+          return false;
+        }));
   }
 
   public getEnvironmentHealthStatus(): Observable<GeneralEnvironmentStatus> {
     return this.applicationServiceFacade
-    .buildGetEnvironmentHealthStatus()
-    .pipe(
-      map(response => {
-        this._statusData.next(response.body);
-        return response.body;
-      }),
-      catchError(ErrorUtils.handleServiceError));
+      .buildGetEnvironmentHealthStatus()
+      .pipe(
+        map(response => {
+          this._statusData.next(response.body);
+          return response.body;
+        }),
+        catchError(ErrorUtils.handleServiceError));
   }
 
   public getEnvironmentStatuses(): Observable<GeneralEnvironmentStatus> {
     const body = '?full=1';
     return this.applicationServiceFacade
-    .buildGetEnvironmentStatuses(body)
-    .pipe(
-      map(response => {
-        this._statusData.next(response);
-        return response;
-      }),
-      catchError(ErrorUtils.handleServiceError));
+      .buildGetEnvironmentStatuses(body)
+      .pipe(
+        map(response => {
+          this._statusData.next(response);
+          return response;
+        }),
+        catchError(ErrorUtils.handleServiceError));
   }
 
   public runEdgeNode(): Observable<{}> {
@@ -145,14 +145,6 @@ export class HealthStatusService {
         catchError(ErrorUtils.handleServiceError));
   }
 
-  public updateUsersBudget(data): Observable<{}> {
-    return this.applicationServiceFacade
-      .buildUpdateUsersBudget(data)
-      .pipe(
-        map(response => response),
-        catchError(ErrorUtils.handleServiceError));
-  }
-
   public getSsnMonitorData(): Observable<{}> {
     return this.applicationServiceFacade
       .buildGetSsnMonitorData()
diff --git a/services/self-service/src/main/resources/webapp/src/app/core/services/project.service.ts b/services/self-service/src/main/resources/webapp/src/app/core/services/project.service.ts
index 3923533..bc06862 100644
--- a/services/self-service/src/main/resources/webapp/src/app/core/services/project.service.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/core/services/project.service.ts
@@ -77,4 +77,13 @@ export class ProjectService {
         map(response => response),
         catchError(ErrorUtils.handleServiceError));
   }
+
+  public updateProjectsBudget(data): Observable<{}> {
+    const url = '/budget';
+    return this.applicationServiceFacade
+      .buildUpdateProjectsBudget(url, data)
+      .pipe(
+        map(response => response),
+        catchError(ErrorUtils.handleServiceError));
+  }
 }


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