You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dlab.apache.org by dg...@apache.org on 2020/02/05 16:00:52 UTC

[incubator-dlab] 02/02: [DLAB-1509]: Removed actions from quota popup

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

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

commit 38abe02f1909d933094422722635b757d539f7d1
Author: Dmytro Gnatyshyn <di...@ukr.net>
AuthorDate: Wed Feb 5 17:58:08 2020 +0200

    [DLAB-1509]: Removed actions from quota popup
---
 .../services/applicationServiceFacade.service.ts   |  1 +
 .../reporting-grid/reporting-grid.component.html   |  2 +-
 .../reporting-grid/reporting-grid.component.ts     |  5 +--
 .../src/app/reporting/reporting.component.ts       | 38 +++++++++++++++-------
 4 files changed, 32 insertions(+), 14 deletions(-)

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 6e2aab3..0056039 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
@@ -347,6 +347,7 @@ export class ApplicationServiceFacade {
       data,
       { responseType: 'text', observe: 'response' });
   }
+
   public buildGetBackupStatusRequest(uuid): Observable<any> {
     return this.buildRequest(HTTPMethod.GET,
       this.requestRegistry.Item(ApplicationServiceFacade.BACKUP),
diff --git a/services/self-service/src/main/resources/webapp/src/app/reporting/reporting-grid/reporting-grid.component.html b/services/self-service/src/main/resources/webapp/src/app/reporting/reporting-grid/reporting-grid.component.html
index 5069a7c..6e50e61 100644
--- a/services/self-service/src/main/resources/webapp/src/app/reporting/reporting-grid/reporting-grid.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/reporting/reporting-grid/reporting-grid.component.html
@@ -212,7 +212,7 @@
 
     <tr mat-header-row *matHeaderRowDef="displayedColumns; sticky: true" class="header-row"></tr>
 
-    <tr [hidden]="!collapseFilterRow" mat-header-row *matHeaderRowDef="displayedFilterColumns; sticky: true"
+    <tr [hidden]="!collapseFilterRow || !PROVIDER" mat-header-row *matHeaderRowDef="displayedFilterColumns; sticky: true"
       class="filter-row"></tr>
     <tr mat-row *matRowDef="let row; columns: displayedColumns;" class="DATA"></tr>
 
diff --git a/services/self-service/src/main/resources/webapp/src/app/reporting/reporting-grid/reporting-grid.component.ts b/services/self-service/src/main/resources/webapp/src/app/reporting/reporting-grid/reporting-grid.component.ts
index 74308ab..1856688 100644
--- a/services/self-service/src/main/resources/webapp/src/app/reporting/reporting-grid/reporting-grid.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/reporting/reporting-grid/reporting-grid.component.ts
@@ -17,9 +17,10 @@
  * under the License.
  */
 
-import { Component, OnInit, Output, EventEmitter, ViewChild } from '@angular/core';
+import {Component, OnInit, Output, EventEmitter, ViewChild, Input} from '@angular/core';
 
 import { DICTIONARY, ReportingConfigModel } from '../../../dictionary/global.dictionary';
+import {logger} from 'codelyzer/util/logger';
 
 @Component({
   selector: 'dlab-reporting-grid',
@@ -37,12 +38,12 @@ export class ReportingGridComponent implements OnInit {
   reportData: Array<any> = [];
   fullReport: Array<any>;
   isFiltered: boolean = false;
-  private PROVIDER: string = 'aws';
 
   @ViewChild('nameFilter', { static: false }) filter;
 
   @Output() filterReport: EventEmitter<{}> = new EventEmitter();
   @Output() resetRangePicker: EventEmitter<boolean> = new EventEmitter();
+  @Input() PROVIDER: string;
   displayedColumns: string[] = ['name', 'user', 'project', 'type', 'status', 'shape', 'service', 'charge'];
   displayedFilterColumns: string[] = ['name-filter', 'user-filter', 'project-filter', 'type-filter', 'status-filter', 'shape-filter', 'service-filter', 'actions'];
 
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 83d7bc6..bd8be6b 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
@@ -21,7 +21,7 @@
 import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core';
 import { ToastrService } from 'ngx-toastr';
 
-import { BillingReportService, HealthStatusService } from '../core/services';
+import {BillingReportService, EndpointService, HealthStatusService} from '../core/services';
 import { ReportingGridComponent } from './reporting-grid/reporting-grid.component';
 import { ToolbarComponent } from './toolbar/toolbar.component';
 
@@ -38,7 +38,7 @@ import {ProgressBarService} from '../core/services/progress-bar.service';
                   (setRangeOption)="setRangeOption($event)">
     </dlab-toolbar>
     <mat-divider></mat-divider>
-    <dlab-reporting-grid (filterReport)="filterReport($event)" (resetRangePicker)="resetRangePicker()"></dlab-reporting-grid>
+    <dlab-reporting-grid [PROVIDER]="PROVIDER" (filterReport)="filterReport($event)" (resetRangePicker)="resetRangePicker()"></dlab-reporting-grid>
   </div>
 
   `,
@@ -68,25 +68,41 @@ export class ReportingComponent implements OnInit, OnDestroy {
   data: any;
   billingEnabled: boolean;
   admin: boolean;
-  private PROVIDER: string = 'aws';
+  private PROVIDER: string;
 
   constructor(
     private billingReportService: BillingReportService,
     private healthStatusService: HealthStatusService,
     public toastr: ToastrService,
     private progressBarService: ProgressBarService,
+    private endpointService: EndpointService,
   ) { }
 
   ngOnInit() {
-    this.rebuildBillingReport();
+    this.getBillingProvider();
   }
 
   ngOnDestroy() {
     this.clearStorage();
   }
 
+  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.PROVIDER) {
+              this.rebuildBillingReport();
+            }
+      }
+    });
+  }
+
   getGeneralBillingData() {
-    setTimeout(() => {this.progressBarService.startProgressBar();} , 0);
+    setTimeout(() => {this.progressBarService.startProgressBar(); } , 0);
     this.billingReportService.getGeneralBillingData(this.reportData)
       .subscribe(data => {
         this.data = data;
@@ -113,12 +129,12 @@ export class ReportingComponent implements OnInit, OnDestroy {
   }
 
   rebuildBillingReport($event?): void {
-    this.clearStorage();
-    this.resetRangePicker();
-    this.reportData.defaultConfigurations();
-
-    this.getEnvironmentHealthStatus();
-    this.getGeneralBillingData();
+    if (this.PROVIDER) {
+      this.clearStorage();
+      this.resetRangePicker();
+      this.reportData.defaultConfigurations();
+      this.getGeneralBillingData();
+    }
   }
 
   exportBillingReport(): void {


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