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/03/13 12:54:55 UTC

[incubator-dlab] branch DLAB-1571 updated (35d053a -> f74a6be)

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

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


 discard 35d053a  Refactoring
 discard 9b09d6a  Fixed search by dlabId
 discard 101fa77  Refactoring
 discard 4b791b9  [DLAB-643] Conveyed billing for remote aws endpoint
     new f74a6be  Changed billing for remote endpoint on UI

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (35d053a)
            \
             N -- N -- N   refs/heads/DLAB-1571 (f74a6be)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 pom.xml                                            |   2 +-
 services/billing-aws/billing.yml                   |   3 +-
 services/billing-aws/pom.xml                       | 128 ++++-----
 .../java/com/epam/dlab/BillingAwsApplication.java  |  37 ---
 .../main/java/com/epam/dlab/BillingScheduler.java  |   4 +-
 .../java/com/epam/dlab/conf/SecurityConfig.java    |  66 -----
 .../epam/dlab/controller/BillingController.java    |  50 ----
 .../main/java/com/epam/dlab/dao/BillingDAO.java    |  31 ---
 .../com/epam/dlab/dao/impl/BillingDAOImpl.java     | 109 --------
 .../java/com/epam/dlab/mongo/AdapterMongoDb.java   |   9 +-
 .../com/epam/dlab/mongo/DlabResourceTypeDAO.java   | 297 ++++++++++++++++++++-
 .../java/com/epam/dlab/mongo/ResourceItem.java     | 152 +++++++++++
 .../java/com/epam/dlab/mongo/ResourceItemList.java | 136 ++++++++++
 .../billing-aws/src/main/resources/application.yml |  34 ---
 .../ResourceItemListTest.java}                     |  29 +-
 .../billing/gcp/dao/impl/BigQueryBillingDAO.java   |  48 ++--
 .../service/impl/BillingServiceImplNew.java        |   2 +-
 .../reporting-grid/reporting-grid.component.html   |  22 +-
 .../reporting-grid/reporting-grid.component.ts     |   2 +-
 .../src/app/reporting/reporting.component.ts       |  56 ++--
 .../app/reporting/toolbar/toolbar.component.html   |   2 +-
 .../multi-select-dropdown.component.html           |   3 +-
 .../webapp/src/dictionary/global.dictionary.ts     |  16 +-
 23 files changed, 740 insertions(+), 498 deletions(-)
 delete mode 100644 services/billing-aws/src/main/java/com/epam/dlab/BillingAwsApplication.java
 delete mode 100644 services/billing-aws/src/main/java/com/epam/dlab/conf/SecurityConfig.java
 delete mode 100644 services/billing-aws/src/main/java/com/epam/dlab/controller/BillingController.java
 delete mode 100644 services/billing-aws/src/main/java/com/epam/dlab/dao/BillingDAO.java
 delete mode 100644 services/billing-aws/src/main/java/com/epam/dlab/dao/impl/BillingDAOImpl.java
 create mode 100644 services/billing-aws/src/main/java/com/epam/dlab/mongo/ResourceItem.java
 create mode 100644 services/billing-aws/src/main/java/com/epam/dlab/mongo/ResourceItemList.java
 delete mode 100644 services/billing-aws/src/main/resources/application.yml
 copy services/billing-aws/src/test/java/com/epam/dlab/{core/aggregate/DataAggregatorTest.java => mongo/ResourceItemListTest.java} (52%)


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


[incubator-dlab] 01/01: Changed billing for remote endpoint on UI

Posted by dg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit f74a6be709ebdabc525dc89f80861c9b2629d9a8
Author: Dmytro Gnatyshyn <di...@ukr.net>
AuthorDate: Fri Mar 13 14:52:49 2020 +0200

    Changed billing for remote endpoint on UI
---
 .../reporting-grid/reporting-grid.component.html   | 22 ++++-----
 .../reporting-grid/reporting-grid.component.ts     |  2 +-
 .../src/app/reporting/reporting.component.ts       | 56 +++++++++++-----------
 .../app/reporting/toolbar/toolbar.component.html   |  2 +-
 .../multi-select-dropdown.component.html           |  3 +-
 .../webapp/src/dictionary/global.dictionary.ts     | 16 +++----
 6 files changed, 52 insertions(+), 49 deletions(-)

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 ae9da36..78e3cda 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
@@ -25,12 +25,12 @@
         <span class="label"> Environment name </span>
         <button mat-icon-button aria-label="More" class="ar" (click)="toggleFilterRow()">
           <i class="material-icons">
-            <span *ngIf="filteredReportData.dlabId.length > 0; else dlab_id_filtered">filter_list</span>
+            <span *ngIf="filteredReportData.dlab_id.length > 0; else dlab_id_filtered">filter_list</span>
             <ng-template #dlab_id_filtered>more_vert</ng-template>
           </i>
         </button>
       </th>
-      <td mat-cell *matCellDef="let element"> {{element[DICTIONARY[PROVIDER].billing.dlabId]}} </td>
+      <td mat-cell *matCellDef="let element"> {{element.dlabId}} </td>
       <td mat-footer-cell *matFooterCellDef class="table-footer"></td>
     </ng-container>
 
@@ -67,12 +67,12 @@
         <span class="label"> Resource Type </span>
         <button mat-icon-button aria-label="More" class="ar" (click)="toggleFilterRow()">
           <i class="material-icons">
-            <span *ngIf="filteredReportData.resourceTypes.length > 0; else type_filtered">filter_list</span>
+            <span *ngIf="filteredReportData.resource_type.length > 0; else type_filtered">filter_list</span>
             <ng-template #type_filtered>more_vert</ng-template>
           </i>
         </button>
       </th>
-      <td mat-cell *matCellDef="let element"> {{element[DICTIONARY[PROVIDER].billing.resourceType]}} </td>
+      <td mat-cell *matCellDef="let element"> {{element.resource_type | titlecase}} </td>
       <td mat-footer-cell *matFooterCellDef class="table-footer"></td>
     </ng-container>
 
@@ -106,7 +106,7 @@
         </button>
       </th>
       <td mat-cell *matCellDef="let element">
-        <span [outerHTML]="element['shapes'] | lineBreak"></span>
+        <span>{{element.shape}}</span>
       </td>
       <td mat-footer-cell *matFooterCellDef class="table-footer"></td>
     </ng-container>
@@ -135,11 +135,11 @@
       </th>
 
       <td mat-cell *matCellDef="let element">
-        {{ element[DICTIONARY[PROVIDER].billing.cost] }} {{ element[DICTIONARY[PROVIDER].billing.currencyCode] }}
+        {{ element.cost }} {{ element['currency'] }}
       </td>
       <td mat-footer-cell *matFooterCellDef class="table-footer">
-        Total <span *ngIf="reportData?.length"> {{ fullReport['cost_total'] }}
-          {{ fullReport[DICTIONARY[PROVIDER].billing.currencyCode] }}</span>
+        Total <span *ngIf="reportData?.length"> {{ fullReport['total_cost'] }}
+          {{ fullReport['currency'] }}</span>
       </td>
     </ng-container>
 
@@ -147,7 +147,7 @@
     <ng-container matColumnDef="name-filter">
       <th mat-header-cell *matHeaderCellDef>
         <input #nameFilter type="text" placeholder="Filter by environment name" class="form-control filter-field"
-          [value]="filtered?.dlab_id" (input)="filteredReportData.dlabId = $event.target.value" />
+          [value]="filtered?.dlab_id" (input)="filteredReportData.dlab_id = $event.target['value']" />
       </th>
     </ng-container>
     <ng-container matColumnDef="user-filter">
@@ -164,8 +164,8 @@
     </ng-container>
     <ng-container matColumnDef="type-filter">
       <th mat-header-cell *matHeaderCellDef>
-        <multi-select-dropdown *ngIf="filterConfiguration" (selectionChange)="onUpdate($event)" [type]="'resource_type'"
-          [items]="filterConfiguration.resourceTypes" [model]="filteredReportData.resourceTypes">
+        <multi-select-dropdown *ngIf="filterConfiguration" (selectionChange)="onUpdate($event)" [type]="['resource_type']"
+          [items]="filterConfiguration.resource_type" [model]="filteredReportData.resource_type">
         </multi-select-dropdown>
       </th>
     </ng-container>
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 1856688..29914e5 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
@@ -81,7 +81,7 @@ export class ReportingGridComponent implements OnInit {
   resetFiltering(): void {
     this.filteredReportData.defaultConfigurations();
 
-    this.filter.nativeElement.value = ''
+    this.filter.nativeElement.value = '';
     this.filterReport.emit(this.filteredReportData);
     this.resetRangePicker.emit(true);
   }
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 543c86e..8cfdcd9 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
@@ -28,6 +28,7 @@ import { ToolbarComponent } from './toolbar/toolbar.component';
 import { FileUtils } from '../core/util';
 import { DICTIONARY, ReportingConfigModel } from '../../dictionary/global.dictionary';
 import {ProgressBarService} from '../core/services/progress-bar.service';
+import {logger} from 'codelyzer/util/logger';
 
 @Component({
   selector: 'dlab-reporting',
@@ -94,7 +95,6 @@ export class ReportingComponent implements OnInit, OnDestroy {
         const localEndpoint = endpoints.filter(endpoint => endpoint.name === 'local');
         if (localEndpoint.length) {
           this.PROVIDER = localEndpoint[0].cloudProvider.toLowerCase();
-          console.log(this.PROVIDER);
           if (this.PROVIDER) {
             this.rebuildBillingReport();
           }
@@ -118,7 +118,7 @@ export class ReportingComponent implements OnInit, OnDestroy {
     this.billingReportService.getGeneralBillingData(this.reportData)
       .subscribe(data => {
         this.data = data;
-        this.reportingGrid.refreshData(this.data, this.data.lines);
+        this.reportingGrid.refreshData(this.data, this.data.report_lines);
         this.reportingGrid.setFullReport(this.data.full_report);
 
         this.reportingToolbar.reportData = this.data;
@@ -159,7 +159,7 @@ export class ReportingComponent implements OnInit, OnDestroy {
   getDefaultFilterConfiguration(data): void {
     const users = [], types = [], shapes = [], services = [], statuses = [], projects = [];
 
-    data.lines.forEach((item: any) => {
+    data.report_lines.forEach((item: any) => {
       if (item.user && users.indexOf(item.user) === -1)
         users.push(item.user);
 
@@ -169,30 +169,32 @@ export class ReportingComponent implements OnInit, OnDestroy {
       if (item.project && projects.indexOf(item.project) === -1)
         projects.push(item.project);
 
-      if (item[DICTIONARY[this.PROVIDER].billing.resourceType] && types.indexOf(item[DICTIONARY[this.PROVIDER].billing.resourceType]) === -1)
-        types.push(item[DICTIONARY[this.PROVIDER].billing.resourceType]);
+      if (item['resource_type'] && types.indexOf(item['resource_type']) === -1)
+        types.push(item['resource_type']);
 
-      if (item[DICTIONARY[this.PROVIDER].billing.instance_size]) {
-        if (item[DICTIONARY[this.PROVIDER].billing.instance_size].indexOf('Master') > -1) {
-          for (let shape of item[DICTIONARY[this.PROVIDER].billing.instance_size].split('\n')) {
-            shape = shape.replace('Master: ', '');
-            shape = shape.replace(/Slave:\s+\d+ x /, '');
-            shape = shape.replace(/\s+/g, '');
-
-            shapes.indexOf(shape) === -1 && shapes.push(shape);
-          }
-        } else if (item[DICTIONARY[this.PROVIDER].billing.instance_size].match(/\d x \S+/)) {
-          const parsedShape = item[DICTIONARY[this.PROVIDER].billing.instance_size].match(/\d x \S+/)[0].split(' x ')[1];
-          if (shapes.indexOf(parsedShape) === -1) {
-            shapes.push(parsedShape);
-          }
-        } else {
-          shapes.indexOf(item[DICTIONARY[this.PROVIDER].billing.instance_size]) === -1 && shapes.push(item[DICTIONARY[this.PROVIDER].billing.instance_size]);
-        }
+      if (item.shape && types.indexOf(item.shape)) {
+        shapes.push(item.shape);
       }
-
-      if (item[DICTIONARY[this.PROVIDER].billing.service] && services.indexOf(item[DICTIONARY[this.PROVIDER].billing.service]) === -1)
-        services.push(item[DICTIONARY[this.PROVIDER].billing.service]);
+        // if (item.shapes.indexOf('Master') > -1) {
+        //   for (let shape of item.shapes.split('\n')) {
+        //     shape = shape.replace('Master: ', '');
+        //     shape = shape.replace(/Slave:\s+\d+ x /, '');
+        //     shape = shape.replace(/\s+/g, '');
+        //
+        //     shapes.indexOf(shape) === -1 && shapes.push(shape);
+        //   }
+        // } else if (item.shapes.match(/\d x \S+/)) {
+        //   const parsedShape = item.shapes.match(/\d x \S+/)[0].split(' x ')[1];
+        //   if (shapes.indexOf(parsedShape) === -1) {
+        //     shapes.push(parsedShape);
+        //   }
+        // } else {
+        //   shapes.indexOf(item.shapes) === -1 && shapes.push(item.shapes);
+        // }
+      // }
+
+      if (item.product && services.indexOf(item.product) === -1)
+        services.push(item.product);
     });
 
     if (!this.reportingGrid.filterConfiguration || !localStorage.getItem('report_config')) {
@@ -212,8 +214,8 @@ export class ReportingComponent implements OnInit, OnDestroy {
   }
 
   setRangeOption(dateRangeOption: any): void {
-    this.reportData.dateStart = dateRangeOption.start_date;
-    this.reportData.dateEnd = dateRangeOption.end_date;
+    this.reportData.date_start = dateRangeOption.start_date;
+    this.reportData.date_end = dateRangeOption.end_date;
     this.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 30de007..e79f3cb 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
@@ -34,7 +34,7 @@
     <ng-daterangepicker [(ngModel)]="value" [options]="options" (ngModelChange)="onChange($event)"></ng-daterangepicker>
   </div>
   <div class="action-butt">
-    <button mat-raised-button class="butt" (click)="export($event)" [disabled]="!reportData?.lines.length">
+    <button mat-raised-button class="butt" (click)="export($event)" [disabled]="!reportData?.report_lines.length">
       <i class="material-icons">file_download</i>Export
     </button>
     <button mat-raised-button class="butt" (click)="rebuild($event)">
diff --git a/services/self-service/src/main/resources/webapp/src/app/shared/form-controls/multi-select-dropdown/multi-select-dropdown.component.html b/services/self-service/src/main/resources/webapp/src/app/shared/form-controls/multi-select-dropdown/multi-select-dropdown.component.html
index 7f58adf..60744c4 100644
--- a/services/self-service/src/main/resources/webapp/src/app/shared/form-controls/multi-select-dropdown/multi-select-dropdown.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/shared/form-controls/multi-select-dropdown/multi-select-dropdown.component.html
@@ -40,7 +40,8 @@
           <li role="presentation" *ngIf="model">
             <a href="#" class="list-item" role="menuitem" (click)="toggleSelectedOptions($event, model, item)">
               <span class="material-icons" *ngIf="model.indexOf(item) >= 0">done</span>
-              {{item}}
+              <ng-container *ngIf="type[0] !== 'resource_type'">{{item}}</ng-container>
+              <ng-container *ngIf="type[0] === 'resource_type'">{{item | titlecase}}</ng-container>
             </a>
           </li>
         </ng-template>
diff --git a/services/self-service/src/main/resources/webapp/src/dictionary/global.dictionary.ts b/services/self-service/src/main/resources/webapp/src/dictionary/global.dictionary.ts
index f72aea2..26fe456 100644
--- a/services/self-service/src/main/resources/webapp/src/dictionary/global.dictionary.ts
+++ b/services/self-service/src/main/resources/webapp/src/dictionary/global.dictionary.ts
@@ -38,24 +38,24 @@ export class ReportingConfigModel {
   constructor(
     public users: Array<string>,
     public products: Array<string>,
-    public resourceTypes: Array<string>,
+    public resource_type: Array<string>,
     public statuses: Array<string>,
     public shapes: Array<string>,
-    public dateStart: string,
-    public dateEnd: string,
-    public dlabId: string,
+    public date_start: string,
+    public date_end: string,
+    public dlab_id: string,
     public projects: Array<string>
   ) { }
 
   defaultConfigurations(): void {
     this.users = [];
     this.products = [];
-    this.resourceTypes = [];
+    this.resource_type = [];
     this.statuses = [];
     this.shapes = [];
-    this.dateStart = '';
-    this.dateEnd = '';
-    this.dlabId = '';
+    this.date_start = '';
+    this.date_end = '';
+    this.dlab_id = '';
     this.projects = [];
   }
 }


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