This is an automated email from the ASF dual-hosted git repository. ankovalyshyn pushed a commit to branch DLAB-1056 in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git
commit 39fa56364f35244929f6ccb0edc6782558616521 Author: Andriana Kovalyshyn <[email protected]> AuthorDate: Mon Sep 16 17:04:12 2019 +0300 [DLAB-1056]: added filtering by project to billing report --- .../app/reporting/reporting-grid/reporting-grid.component.html | 8 ++++---- .../app/reporting/reporting-grid/reporting-grid.component.scss | 1 + .../src/app/reporting/reporting-grid/reporting-grid.component.ts | 4 ++-- .../resources/webapp/src/app/reporting/reporting.component.ts | 7 +++++-- 4 files changed, 12 insertions(+), 8 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 eada0ff..dbaef33 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 @@ -51,12 +51,12 @@ <ng-container matColumnDef="project"> <th mat-header-cell *matHeaderCellDef class="th_project"> <span class="label">Project</span> - <!-- <button mat-icon-button aria-label="More" class="ar" (click)="toggleFilterRow()"> + <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> <ng-template #project_filtered>more_vert</ng-template> </i> - </button> --> + </button> </th> <td mat-cell *matCellDef="let element"> {{element.project}} </td> <td mat-footer-cell *matFooterCellDef></td> @@ -157,8 +157,8 @@ </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> --> + <multi-select-dropdown *ngIf="filterConfiguration" (selectionChange)="onUpdate($event)" [type]="'project'" + [items]="filterConfiguration.project" [model]="filteredReportData.project"></multi-select-dropdown> </th> </ng-container> <ng-container matColumnDef="type-filter"> diff --git a/services/self-service/src/main/resources/webapp/src/app/reporting/reporting-grid/reporting-grid.component.scss b/services/self-service/src/main/resources/webapp/src/app/reporting/reporting-grid/reporting-grid.component.scss index 29fb1b2..be0cb7f 100644 --- a/services/self-service/src/main/resources/webapp/src/app/reporting/reporting-grid/reporting-grid.component.scss +++ b/services/self-service/src/main/resources/webapp/src/app/reporting/reporting-grid/reporting-grid.component.scss @@ -34,6 +34,7 @@ tr { th { font-size: 11px; + padding-right: 5px; } td { 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 9cc7914..d303723 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 @@ -32,8 +32,8 @@ export class ReportingGridComponent implements OnInit { readonly DICTIONARY = DICTIONARY; filterConfiguration: ReportingConfigModel; - filteredReportData: ReportingConfigModel = new ReportingConfigModel([], [], [], [], [], '', '', ''); - collapseFilterRow: boolean = false; + filteredReportData: ReportingConfigModel = new ReportingConfigModel([], [], [], [], [], '', '', '', []); + collapseFilterRow: boolean = true; reportData: Array<any> = []; fullReport: Array<any>; isFiltered: boolean = false; 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 f8f0c85..8ecf158 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 @@ -125,7 +125,7 @@ export class ReportingComponent implements OnInit, OnDestroy { } getDefaultFilterConfiguration(data): void { - const users = [], types = [], shapes = [], services = [], statuses = []; + const users = [], types = [], shapes = [], services = [], statuses = [], projects = []; data.lines.forEach((item: any) => { if (item.user && users.indexOf(item.user) === -1) @@ -134,6 +134,9 @@ export class ReportingComponent implements OnInit, OnDestroy { if (item.status && statuses.indexOf(item.status.toLowerCase()) === -1) statuses.push(item.status.toLowerCase()); + if (item.project && projects.indexOf(item.project) === -1) + projects.push(item.project); + if (item[DICTIONARY.billing.resourceType] && types.indexOf(item[DICTIONARY.billing.resourceType]) === -1) types.push(item[DICTIONARY.billing.resourceType]); @@ -161,7 +164,7 @@ export class ReportingComponent implements OnInit, OnDestroy { }); if (!this.reportingGrid.filterConfiguration || !localStorage.getItem('report_config')) { - this.filterConfiguration = new ReportingConfigModel(users, services, types, statuses, shapes, '', '', ''); + this.filterConfiguration = new ReportingConfigModel(users, services, types, statuses, shapes, '', '', '', projects); this.reportingGrid.setConfiguration(this.filterConfiguration); localStorage.setItem('report_config', JSON.stringify(this.filterConfiguration)); } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
