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

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

commit 0bb204b8e712373073a82caf45747d8246af688f
Author: Dmytro_Gnatyshyn <di1...@ukr.net>
AuthorDate: Wed Jun 24 19:44:19 2020 +0300

    [DLAB-1887]: Made the same behaviour for refresh buttons on all pages
---
 .../management/management-grid/management-grid.component.ts  |  2 +-
 .../app/administration/management/management.component.html  |  2 +-
 .../app/administration/management/management.component.ts    |  4 ++++
 .../reporting/reporting-grid/reporting-grid.component.html   |  2 +-
 .../reporting/reporting-grid/reporting-grid.component.ts     |  3 ++-
 .../webapp/src/app/reports/reporting/reporting.component.ts  | 12 +++++++-----
 .../multi-select-dropdown.component.html                     |  6 +++---
 .../multi-select-dropdown/multi-select-dropdown.component.ts |  1 +
 8 files changed, 20 insertions(+), 12 deletions(-)

diff --git 
a/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.ts
 
b/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.ts
index f7dbaf4..226c9a5 100644
--- 
a/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.ts
+++ 
b/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.ts
@@ -107,7 +107,7 @@ export class ManagementGridComponent implements OnInit {
   }
 
   public resetFilterConfigurations(): void {
-    this.filterForm.defaultConfigurations();
+    // this.filterForm.defaultConfigurations();
     this.applyFilter(this.filterForm);
     this.buildGrid();
   }
diff --git 
a/services/self-service/src/main/resources/webapp/src/app/administration/management/management.component.html
 
b/services/self-service/src/main/resources/webapp/src/app/administration/management/management.component.html
index eeb2d9b..02ab5b9 100644
--- 
a/services/self-service/src/main/resources/webapp/src/app/administration/management/management.component.html
+++ 
b/services/self-service/src/main/resources/webapp/src/app/administration/management/management.component.html
@@ -66,7 +66,7 @@
         <i class="material-icons">backup</i>Backup
       </button> -->
     </div>
-    <button mat-raised-button class="butt" (click)="buildGrid()">
+    <button mat-raised-button class="butt" (click)="refreshGrid()">
       <i class="material-icons">autorenew</i>Refresh
     </button>
   </div>
diff --git 
a/services/self-service/src/main/resources/webapp/src/app/administration/management/management.component.ts
 
b/services/self-service/src/main/resources/webapp/src/app/administration/management/management.component.ts
index ed66061..d7e5a45 100644
--- 
a/services/self-service/src/main/resources/webapp/src/app/administration/management/management.component.ts
+++ 
b/services/self-service/src/main/resources/webapp/src/app/administration/management/management.component.ts
@@ -83,6 +83,10 @@ export class ManagementComponent implements OnInit {
     this.environmentsDataService.updateEnvironmentData();
   }
 
+  public refreshGrid() {
+     this.buildGrid();
+  }
+
   public manageEnvironmentAction($event) {
     this.manageEnvironmentsService
       .environmentManagement(
diff --git 
a/services/self-service/src/main/resources/webapp/src/app/reports/reporting/reporting-grid/reporting-grid.component.html
 
b/services/self-service/src/main/resources/webapp/src/app/reports/reporting/reporting-grid/reporting-grid.component.html
index 577e2d4..afd4873 100644
--- 
a/services/self-service/src/main/resources/webapp/src/app/reports/reporting/reporting-grid/reporting-grid.component.html
+++ 
b/services/self-service/src/main/resources/webapp/src/app/reports/reporting/reporting-grid/reporting-grid.component.html
@@ -182,7 +182,7 @@
     </ng-container>
     <ng-container matColumnDef="type-filter">
       <th mat-header-cell *matHeaderCellDef class="filter-row-item">
-        <multi-select-dropdown *ngIf="filterConfiguration" 
(selectionChange)="onUpdate($event)" [type]="['resource_type']"
+        <multi-select-dropdown *ngIf="filterConfiguration" 
(selectionChange)="onUpdate($event)" [type]="'resource_type'"
           [items]="filterConfiguration.resource_type" 
[model]="filteredReportData.resource_type">
         </multi-select-dropdown>
       </th>
diff --git 
a/services/self-service/src/main/resources/webapp/src/app/reports/reporting/reporting-grid/reporting-grid.component.ts
 
b/services/self-service/src/main/resources/webapp/src/app/reports/reporting/reporting-grid/reporting-grid.component.ts
index 421ad84..8ff5a8d 100644
--- 
a/services/self-service/src/main/resources/webapp/src/app/reports/reporting/reporting-grid/reporting-grid.component.ts
+++ 
b/services/self-service/src/main/resources/webapp/src/app/reports/reporting/reporting-grid/reporting-grid.component.ts
@@ -30,7 +30,7 @@ import { ReportingConfigModel } from 
'../../../../dictionary/global.dictionary';
 export class ReportingGridComponent implements OnInit {
 
   filterConfiguration: ReportingConfigModel;
-  filteredReportData: ReportingConfigModel = new ReportingConfigModel([], [], 
[], [], [], '', '', '', []);
+  // filteredReportData: ReportingConfigModel = new ReportingConfigModel([], 
[], [], [], [], '', '', '', []);
   collapseFilterRow: boolean = true;
   reportData: Array<any> = [];
   fullReport: Array<any>;
@@ -41,6 +41,7 @@ export class ReportingGridComponent implements OnInit {
 
   @Output() filterReport: EventEmitter<{}> = new EventEmitter();
   @Output() resetRangePicker: EventEmitter<boolean> = new EventEmitter();
+  @Input() filteredReportData: ReportingConfigModel;
   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'];
   filtered: any;
diff --git 
a/services/self-service/src/main/resources/webapp/src/app/reports/reporting/reporting.component.ts
 
b/services/self-service/src/main/resources/webapp/src/app/reports/reporting/reporting.component.ts
index a3e7fa2..98b578b 100644
--- 
a/services/self-service/src/main/resources/webapp/src/app/reports/reporting/reporting.component.ts
+++ 
b/services/self-service/src/main/resources/webapp/src/app/reports/reporting/reporting.component.ts
@@ -37,7 +37,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 (filterReport)="filterReport($event)" 
(resetRangePicker)="resetRangePicker()" [filteredReportData]="reportData" 
></dlab-reporting-grid>
   </div>
 
   `,
@@ -62,11 +62,12 @@ export class ReportingComponent implements OnInit, 
OnDestroy {
   @ViewChild(ReportingGridComponent, { static: false }) reportingGrid: 
ReportingGridComponent;
   @ViewChild(ToolbarComponent, { static: true }) reportingToolbar: 
ToolbarComponent;
 
-  reportData: ReportingConfigModel = ReportingConfigModel.getDefault();
+  reportData: ReportingConfigModel = new ReportingConfigModel([], [], [], [], 
[], '', '', '', []);
   filterConfiguration: ReportingConfigModel = 
ReportingConfigModel.getDefault();
   data: any;
   billingEnabled: boolean;
   admin: boolean;
+  private cashedFilterData: any;
 
   constructor(
     private billingReportService: BillingReportService,
@@ -87,12 +88,13 @@ export class ReportingComponent implements OnInit, 
OnDestroy {
 
   getGeneralBillingData() {
     setTimeout(() => {this.progressBarService.startProgressBar(); } , 0);
+    this.cashedFilterData = JSON.parse(JSON.stringify(this.reportData));
+    Object.setPrototypeOf(this.cashedFilterData, 
Object.getPrototypeOf(this.reportData));
     this.billingReportService.getGeneralBillingData(this.reportData)
       .subscribe(data => {
         this.data = data;
         this.reportingGrid.refreshData(this.data, this.data.report_lines);
         this.reportingGrid.setFullReport(this.data.is_full);
-
         this.reportingToolbar.reportData = this.data;
         if (!localStorage.getItem('report_period')) {
           localStorage.setItem('report_period', JSON.stringify({
@@ -114,14 +116,14 @@ export class ReportingComponent implements OnInit, 
OnDestroy {
 
   rebuildBillingReport(): void {
     this.checkAutorize();
+    console.log(this.cashedFilterData);
+    this.reportData = this.cashedFilterData;
     this.buildBillingReport();
-
   }
 
   buildBillingReport() {
     this.clearStorage();
     this.resetRangePicker();
-    this.reportData.defaultConfigurations();
     this.getGeneralBillingData();
   }
 
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 16c9a0f..ef43e63 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
@@ -19,7 +19,7 @@
 
 <div class="dropdown-multiselect btn-group" ngClass="{{type || ''}}">
   <button type="button" #list (click)="multiactions.toggle($event, list)">
-    <span class="ellipsis" *ngIf="model.length === 0">Select 
{{type.replace('_', ' ')}}</span>
+    <span class="ellipsis" *ngIf="model.length === 0">Select {{ type | 
convertaction }}</span>
     <span class="selected-items ellipsis" *ngIf="model.length !== 0">
       Selected {{model.length}} item<strong *ngIf="model.length > 1">s</strong>
     </span>
@@ -40,8 +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>
-              <ng-container *ngIf="type[0] !== 'resource_type' && type !== 
'resource_types'">{{item}}</ng-container>
-              <ng-container *ngIf="type[0] === 'resource_type' || type === 
'resource_types'">{{item | convertaction}}</ng-container>
+              <ng-container *ngIf="type !== 'resource_type' && type !== 
'resource_types'">{{item}}</ng-container>
+              <ng-container *ngIf="type === 'resource_type' || type === 
'resource_types'">{{item | titlecase}}</ng-container>
             </a>
           </li>
         </ng-template>
diff --git 
a/services/self-service/src/main/resources/webapp/src/app/shared/form-controls/multi-select-dropdown/multi-select-dropdown.component.ts
 
b/services/self-service/src/main/resources/webapp/src/app/shared/form-controls/multi-select-dropdown/multi-select-dropdown.component.ts
index 5fcb6d1..0e819ac 100644
--- 
a/services/self-service/src/main/resources/webapp/src/app/shared/form-controls/multi-select-dropdown/multi-select-dropdown.component.ts
+++ 
b/services/self-service/src/main/resources/webapp/src/app/shared/form-controls/multi-select-dropdown/multi-select-dropdown.component.ts
@@ -56,6 +56,7 @@ export class MultiSelectDropdownComponent {
   }
 
   onUpdate($event): void {
+    console.log(this.type);
     this.selectionChange.emit({ model: this.model, type: this.type, $event });
   }
 }


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

Reply via email to