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

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

commit 89f412b5772bf68dfb6962b828f1e5c7aeeb3a65
Author: Dmytro Gnatyshyn <[email protected]>
AuthorDate: Mon Feb 24 11:35:45 2020 +0200

    [DLAB-1567]: billing issues for user who has not administrative role
---
 .../src/app/reporting/reporting.component.ts       | 29 ++++++++++++++--------
 .../app/reporting/toolbar/toolbar.component.html   |  3 +--
 2 files changed, 19 insertions(+), 13 deletions(-)

diff --git 
a/services/self-service/src/main/resources/webapp/src/app/reporting/reporting.component.ts
 
b/services/self-service/src/main/resources/webapp/src/app/reporting/reporting.component.ts
index d135261..2737ea7 100644
--- 
a/services/self-service/src/main/resources/webapp/src/app/reporting/reporting.component.ts
+++ 
b/services/self-service/src/main/resources/webapp/src/app/reporting/reporting.component.ts
@@ -88,22 +88,29 @@ export class ReportingComponent implements OnInit, 
OnDestroy {
 
   getBillingProvider() {
     this.getEnvironmentHealthStatus();
-    this.endpointService.getEndpointsData().subscribe(list => {
-      // @ts-ignore
-      const endpoints = [...list];
-      const localEndpoint = endpoints.filter(endpoint => endpoint.name === 
'local');
-      if (localEndpoint.length) {
-        this.PROVIDER = localEndpoint[0].cloudProvider.toLowerCase();
+    if (this.admin) {
+      this.endpointService.getEndpointsData().subscribe(list => {
+        // @ts-ignore
+        const endpoints = [...list];
+        const localEndpoint = endpoints.filter(endpoint => endpoint.name === 
'local');
+        if (localEndpoint.length) {
+          this.PROVIDER = localEndpoint[0].cloudProvider.toLowerCase();
+          if (this.PROVIDER) {
+            this.rebuildBillingReport();
+          }
+        }
+      }, e => {
+        this.PROVIDER = 'gcp';
         if (this.PROVIDER) {
-              this.rebuildBillingReport();
-            }
-      }
-    }, e => {
+          this.rebuildBillingReport();
+        }
+      }) ;
+    } else {
       this.PROVIDER = 'gcp';
       if (this.PROVIDER) {
         this.rebuildBillingReport();
       }
-      }) ;
+    }
   }
 
   getGeneralBillingData() {
diff --git 
a/services/self-service/src/main/resources/webapp/src/app/reporting/toolbar/toolbar.component.html
 
b/services/self-service/src/main/resources/webapp/src/app/reporting/toolbar/toolbar.component.html
index bbab2a4..30de007 100644
--- 
a/services/self-service/src/main/resources/webapp/src/app/reporting/toolbar/toolbar.component.html
+++ 
b/services/self-service/src/main/resources/webapp/src/app/reporting/toolbar/toolbar.component.html
@@ -33,13 +33,12 @@
   <div id="range-picker">
     <ng-daterangepicker [(ngModel)]="value" [options]="options" 
(ngModelChange)="onChange($event)"></ng-daterangepicker>
   </div>
-  <div class="action-butt" *ngIf="healthStatus && healthStatus.admin">
+  <div class="action-butt">
     <button mat-raised-button class="butt" (click)="export($event)" 
[disabled]="!reportData?.lines.length">
       <i class="material-icons">file_download</i>Export
     </button>
     <button mat-raised-button class="butt" (click)="rebuild($event)">
       <i class="material-icons">autorenew</i>Refresh
     </button>
-
   </div>
 </section>


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to