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
The following commit(s) were added to refs/heads/DLAB-1571 by this push:
new dcab9cb [DLAB-1566]: Changed billing model for remote endpoints
new becd827 Merge remote-tracking branch 'origin/DLAB-1571' into DLAB-1571
dcab9cb is described below
commit dcab9cb575d2d1744e80835461aef7f86e619eea
Author: Dmytro Gnatyshyn <[email protected]>
AuthorDate: Thu Mar 5 12:29:58 2020 +0200
[DLAB-1566]: Changed billing model for remote endpoints
---
.../reporting-grid/reporting-grid.component.html | 38 +++++++++++-----------
.../src/app/reporting/reporting.component.ts | 13 ++++----
.../webapp/src/dictionary/gcp.dictionary.ts | 2 +-
.../webapp/src/dictionary/global.dictionary.ts | 36 ++++++++++----------
4 files changed, 45 insertions(+), 44 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 4a92bc6..ae9da36 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,7 +25,7 @@
<span class="label"> Environment name </span>
<button mat-icon-button aria-label="More" class="ar"
(click)="toggleFilterRow()">
<i class="material-icons">
- <span *ngIf="filteredReportData.dlab_id.length > 0; else
dlab_id_filtered">filter_list</span>
+ <span *ngIf="filteredReportData.dlabId.length > 0; else
dlab_id_filtered">filter_list</span>
<ng-template #dlab_id_filtered>more_vert</ng-template>
</i>
</button>
@@ -39,7 +39,7 @@
<span class="label"> User </span>
<button mat-icon-button aria-label="More" class="ar"
(click)="toggleFilterRow()">
<i class="material-icons">
- <span *ngIf="filteredReportData.user.length > 0; else
user_filtered">filter_list</span>
+ <span *ngIf="filteredReportData.users.length > 0; else
user_filtered">filter_list</span>
<ng-template #user_filtered>more_vert</ng-template>
</i>
</button>
@@ -53,7 +53,7 @@
<span class="label">Project</span>
<button mat-icon-button aria-label="More" class="ar"
(click)="toggleFilterRow()">
<i class="material-icons">
- <span *ngIf="filteredReportData.project.length > 0; else
project_filtered">filter_list</span>
+ <span *ngIf="filteredReportData.projects.length > 0; else
project_filtered">filter_list</span>
<ng-template #project_filtered>more_vert</ng-template>
</i>
</button>
@@ -67,7 +67,7 @@
<span class="label"> Resource Type </span>
<button mat-icon-button aria-label="More" class="ar"
(click)="toggleFilterRow()">
<i class="material-icons">
- <span *ngIf="filteredReportData.resource_type.length > 0; else
type_filtered">filter_list</span>
+ <span *ngIf="filteredReportData.resourceTypes.length > 0; else
type_filtered">filter_list</span>
<ng-template #type_filtered>more_vert</ng-template>
</i>
</button>
@@ -81,7 +81,7 @@
<span class="label"> Status </span>
<button mat-icon-button aria-label="More" class="ar"
(click)="toggleFilterRow()">
<i class="material-icons">
- <span *ngIf="filteredReportData.status.length > 0; else
status_filtered">filter_list</span>
+ <span *ngIf="filteredReportData.statuses.length > 0; else
status_filtered">filter_list</span>
<ng-template #status_filtered>more_vert</ng-template>
</i>
</button>
@@ -100,13 +100,13 @@
<button mat-icon-button aria-label="More" class="ar"
(click)="toggleFilterRow()">
<i class="material-icons">
<span
- *ngIf="filteredReportData['shape'].length > 0; else
shape_filtered">filter_list</span>
+ *ngIf="filteredReportData['shapes'].length > 0; else
shape_filtered">filter_list</span>
<ng-template #shape_filtered>more_vert</ng-template>
</i>
</button>
</th>
<td mat-cell *matCellDef="let element">
- <span [outerHTML]="element['shape'] | lineBreak"></span>
+ <span [outerHTML]="element['shapes'] | lineBreak"></span>
</td>
<td mat-footer-cell *matFooterCellDef class="table-footer"></td>
</ng-container>
@@ -117,7 +117,7 @@
<button mat-icon-button aria-label="More" class="ar"
(click)="toggleFilterRow()">
<i class="material-icons">
<span
- *ngIf="filteredReportData['shape'].length > 0; else
service_filtered">filter_list</span>
+ *ngIf="filteredReportData['shapes'].length > 0; else
service_filtered">filter_list</span>
<ng-template #service_filtered>more_vert</ng-template>
</i>
</button>
@@ -135,7 +135,7 @@
</th>
<td mat-cell *matCellDef="let element">
- {{ element[DICTIONARY[PROVIDER].billing.cost].toFixed(2) }} {{
element[DICTIONARY[PROVIDER].billing.currencyCode] }}
+ {{ element[DICTIONARY[PROVIDER].billing.cost] }} {{
element[DICTIONARY[PROVIDER].billing.currencyCode] }}
</td>
<td mat-footer-cell *matFooterCellDef class="table-footer">
Total <span *ngIf="reportData?.length"> {{ fullReport['cost_total'] }}
@@ -147,47 +147,47 @@
<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.dlab_id =
$event.target.value" />
+ [value]="filtered?.dlab_id" (input)="filteredReportData.dlabId =
$event.target.value" />
</th>
</ng-container>
<ng-container matColumnDef="user-filter">
<th mat-header-cell *matHeaderCellDef>
<multi-select-dropdown *ngIf="filterConfiguration"
(selectionChange)="onUpdate($event)" [type]="'user'"
- [items]="filterConfiguration.user"
[model]="filteredReportData.user"></multi-select-dropdown>
+ [items]="filterConfiguration.users"
[model]="filteredReportData.users"></multi-select-dropdown>
</th>
</ng-container>
<ng-container matColumnDef="project-filter">
<th mat-header-cell *matHeaderCellDef>
<multi-select-dropdown *ngIf="filterConfiguration"
(selectionChange)="onUpdate($event)" [type]="'project'"
- [items]="filterConfiguration.project"
[model]="filteredReportData.project"></multi-select-dropdown>
+ [items]="filterConfiguration.projects"
[model]="filteredReportData.projects"></multi-select-dropdown>
</th>
</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.resource_type"
[model]="filteredReportData.resource_type">
+ [items]="filterConfiguration.resourceTypes"
[model]="filteredReportData.resourceTypes">
</multi-select-dropdown>
</th>
</ng-container>
<ng-container matColumnDef="status-filter">
<th mat-header-cell *matHeaderCellDef>
<multi-select-dropdown *ngIf="filterConfiguration"
(selectionChange)="onUpdate($event)" [type]="'status'"
- [items]="filterConfiguration.status"
[model]="filteredReportData.status"></multi-select-dropdown>
+ [items]="filterConfiguration.statuses"
[model]="filteredReportData.statuses"></multi-select-dropdown>
</th>
</ng-container>
<ng-container matColumnDef="shape-filter">
<th mat-header-cell *matHeaderCellDef>
<multi-select-dropdown *ngIf="filterConfiguration"
(selectionChange)="onUpdate($event)"
- [type]="[DICTIONARY[PROVIDER].billing.instance_size]"
[items]="filterConfiguration[DICTIONARY[PROVIDER].billing.instance_size]"
-
[model]="filteredReportData[DICTIONARY[PROVIDER].billing.instance_size]"></multi-select-dropdown>
+ [type]="'shapes'" [items]="filterConfiguration['shapes']"
+ [model]="filteredReportData['shapes']"></multi-select-dropdown>
</th>
</ng-container>
<ng-container matColumnDef="service-filter">
<th mat-header-cell *matHeaderCellDef>
<multi-select-dropdown *ngIf="filterConfiguration"
(selectionChange)="onUpdate($event)"
- [type]="['service']"
- [items]="filterConfiguration['service']"
- [model]="filteredReportData['service']"></multi-select-dropdown>
+ [type]="['products']"
+ [items]="filterConfiguration['products']"
+ [model]="filteredReportData['products']"></multi-select-dropdown>
</th>
</ng-container>
<ng-container matColumnDef="actions" stickyEnd>
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 51cca06..543c86e 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
@@ -79,7 +79,8 @@ export class ReportingComponent implements OnInit, OnDestroy {
) { }
ngOnInit() {
- this.getBillingProvider();
+
+ this.getEnvironmentHealthStatus();
}
ngOnDestroy() {
@@ -87,14 +88,13 @@ export class ReportingComponent implements OnInit,
OnDestroy {
}
getBillingProvider() {
- this.getEnvironmentHealthStatus();
if (this.admin) {
this.endpointService.getEndpointsData().subscribe(list => {
- // @ts-ignore
- const endpoints = [...list];
+ const endpoints = JSON.parse(JSON.stringify(list));
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();
}
@@ -212,8 +212,8 @@ export class ReportingComponent implements OnInit,
OnDestroy {
}
setRangeOption(dateRangeOption: any): void {
- this.reportData.date_start = dateRangeOption.start_date;
- this.reportData.date_end = dateRangeOption.end_date;
+ this.reportData.dateStart = dateRangeOption.start_date;
+ this.reportData.dateEnd = dateRangeOption.end_date;
this.getGeneralBillingData();
}
@@ -227,6 +227,7 @@ export class ReportingComponent implements OnInit,
OnDestroy {
.subscribe((result: any) => {
this.billingEnabled = result.billingEnabled;
this.admin = result.admin;
+ this.getBillingProvider();
});
}
}
diff --git
a/services/self-service/src/main/resources/webapp/src/dictionary/gcp.dictionary.ts
b/services/self-service/src/main/resources/webapp/src/dictionary/gcp.dictionary.ts
index 0d02f63..d92b7ff 100644
---
a/services/self-service/src/main/resources/webapp/src/dictionary/gcp.dictionary.ts
+++
b/services/self-service/src/main/resources/webapp/src/dictionary/gcp.dictionary.ts
@@ -42,7 +42,7 @@ export const NAMING_CONVENTION_GCP = {
'service_filter_key': 'product',
'type': 'dlab_resource_type',
'resourceType': 'dlab_resource_type',
- 'instance_size': 'shape',
+ 'instance_size': 'shapes',
'dlabId': 'dlab_id'
},
'service': 'Product',
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 dfb97b0..f72aea2 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
@@ -36,27 +36,27 @@ export class ReportingConfigModel {
}
constructor(
- public user: Array<string>,
- public service: Array<string>,
- public resource_type: Array<string>,
- public status: Array<string>,
- public shape: Array<string>,
- public date_start: string,
- public date_end: string,
- public dlab_id: string,
- public project?: Array<string>
+ public users: Array<string>,
+ public products: Array<string>,
+ public resourceTypes: Array<string>,
+ public statuses: Array<string>,
+ public shapes: Array<string>,
+ public dateStart: string,
+ public dateEnd: string,
+ public dlabId: string,
+ public projects: Array<string>
) { }
defaultConfigurations(): void {
- this.user = [];
- this.service = [];
- this.resource_type = [];
- this.status = [];
- this.shape = [];
- this.date_start = '';
- this.date_end = '';
- this.dlab_id = '';
- this.project = [];
+ this.users = [];
+ this.products = [];
+ this.resourceTypes = [];
+ this.statuses = [];
+ this.shapes = [];
+ this.dateStart = '';
+ this.dateEnd = '';
+ this.dlabId = '';
+ this.projects = [];
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]