This is an automated email from the ASF dual-hosted git repository. dgnatyshyn pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git
The following commit(s) were added to refs/heads/develop by this push: new 158f42e [DLAB-1887]: Made the same behaviour for refresh buttons on all pages (#799) 158f42e is described below commit 158f42ec6e73b99efb811be677db8e38330f0c1a Author: Dmytro Gnatyshyn <42860905+dg1...@users.noreply.github.com> AuthorDate: Wed Jun 24 20:02:59 2020 +0300 [DLAB-1887]: Made the same behaviour for refresh buttons on all pages (#799) [DLAB-1887]: Made the same behavior 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 ++++ .../resources/webapp/src/app/core/services/audit.service.ts | 2 +- .../app/reports/audit/audit-grid/audit-grid.component.html | 2 +- .../app/reports/audit/audit-grid/audit-grid.component.ts | 13 +++++++++---- .../audit/audit-toolbar/audit-toolbar.component.html | 3 --- .../audit/audit-toolbar/audit-toolbar.component.scss | 2 +- .../webapp/src/app/reports/audit/audit.component.ts | 6 +++--- .../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.component.ts | 1 + 14 files changed, 35 insertions(+), 25 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/core/services/audit.service.ts b/services/self-service/src/main/resources/webapp/src/app/core/services/audit.service.ts index 499c716..1d54792 100644 --- a/services/self-service/src/main/resources/webapp/src/app/core/services/audit.service.ts +++ b/services/self-service/src/main/resources/webapp/src/app/core/services/audit.service.ts @@ -18,7 +18,7 @@ export class AuditService { queryString += `&resource-names=${filterData.resources.join(',')}`; } if (filterData.resource_types.length) { - queryString += `&resource_types=${filterData.resource_types.map(v => v.toLowerCase()).join(',')}`; + queryString += `&resource-types=${filterData.resource_types.join(',')}`; } if (filterData.users.length) { queryString += `&users=${filterData.users.join(',')}`; diff --git a/services/self-service/src/main/resources/webapp/src/app/reports/audit/audit-grid/audit-grid.component.html b/services/self-service/src/main/resources/webapp/src/app/reports/audit/audit-grid/audit-grid.component.html index faf6256..a6125f9 100644 --- a/services/self-service/src/main/resources/webapp/src/app/reports/audit/audit-grid/audit-grid.component.html +++ b/services/self-service/src/main/resources/webapp/src/app/reports/audit/audit-grid/audit-grid.component.html @@ -204,7 +204,7 @@ <i class="material-icons">close</i> </button> - <button mat-icon-button class="btn apply" (click)="refreshAudit(true)" [disabled]="!didFilterChanged()"> + <button mat-icon-button class="btn apply" (click)="buildAuditGrid(true)" [disabled]="!didFilterChanged()"> <i class="material-icons">done</i> </button> </div> diff --git a/services/self-service/src/main/resources/webapp/src/app/reports/audit/audit-grid/audit-grid.component.ts b/services/self-service/src/main/resources/webapp/src/app/reports/audit/audit-grid/audit-grid.component.ts index d0f6e2d..dedd0c7 100644 --- a/services/self-service/src/main/resources/webapp/src/app/reports/audit/audit-grid/audit-grid.component.ts +++ b/services/self-service/src/main/resources/webapp/src/app/reports/audit/audit-grid/audit-grid.component.ts @@ -53,7 +53,7 @@ export class AuditGridComponent implements OnInit { ngOnInit() {} - public refreshAudit(filter?) { + public buildAuditGrid(filter?) { if (!this.showItemsPrPage) { if (window.localStorage.getItem('audit_per_page')) { this.showItemsPrPage = +window.localStorage.getItem('audit_per_page'); @@ -84,6 +84,11 @@ export class AuditGridComponent implements OnInit { }); } + public refreshAuditPage() { + this.filterAuditData = this.copiedFilterAuditData; + this.getAuditData(); + } + public setAvaliblePeriod(period) { this.filterAuditData.date_start = period.start_date; this.filterAuditData.date_end = period.end_date; @@ -106,7 +111,7 @@ export class AuditGridComponent implements OnInit { this.firstItem = 1; if (this.lastItem !== item) { this.lastItem = item; - this.refreshAudit(); + this.buildAuditGrid(); } } @@ -131,12 +136,12 @@ export class AuditGridComponent implements OnInit { public loadItemsForPage(action) { this.changePage(action); - this.refreshAudit(); + this.buildAuditGrid(); } public resetFilterConfigurations() { this.filterAuditData = FilterAuditModel.getDefault(); - this.refreshAudit(true); + this.buildAuditGrid(true); } public didFilterChanged() { diff --git a/services/self-service/src/main/resources/webapp/src/app/reports/audit/audit-toolbar/audit-toolbar.component.html b/services/self-service/src/main/resources/webapp/src/app/reports/audit/audit-toolbar/audit-toolbar.component.html index 601a4dd..3562b08 100644 --- a/services/self-service/src/main/resources/webapp/src/app/reports/audit/audit-toolbar/audit-toolbar.component.html +++ b/services/self-service/src/main/resources/webapp/src/app/reports/audit/audit-toolbar/audit-toolbar.component.html @@ -34,9 +34,6 @@ <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?.report_lines.length">--> -<!-- <i class="material-icons">file_download</i>Export--> -<!-- </button>--> <button mat-raised-button class="butt" (click)="rebuild($event)"> <i class="material-icons">autorenew</i>Refresh </button> diff --git a/services/self-service/src/main/resources/webapp/src/app/reports/audit/audit-toolbar/audit-toolbar.component.scss b/services/self-service/src/main/resources/webapp/src/app/reports/audit/audit-toolbar/audit-toolbar.component.scss index 4a150bf..744bfdc 100644 --- a/services/self-service/src/main/resources/webapp/src/app/reports/audit/audit-toolbar/audit-toolbar.component.scss +++ b/services/self-service/src/main/resources/webapp/src/app/reports/audit/audit-toolbar/audit-toolbar.component.scss @@ -41,7 +41,7 @@ section.toolbar { button { &:first-child { - margin-right: 10px; + margin-right: 0; } } diff --git a/services/self-service/src/main/resources/webapp/src/app/reports/audit/audit.component.ts b/services/self-service/src/main/resources/webapp/src/app/reports/audit/audit.component.ts index 814c444..6f48b71 100644 --- a/services/self-service/src/main/resources/webapp/src/app/reports/audit/audit.component.ts +++ b/services/self-service/src/main/resources/webapp/src/app/reports/audit/audit.component.ts @@ -83,16 +83,16 @@ export class AuditComponent implements OnInit, OnDestroy { } public buildAuditReport() { - this.auditGrid.refreshAudit(); + this.auditGrid.buildAuditGrid(); } public rebuildAuditGrid() { - this.buildAuditReport(); + this.auditGrid.refreshAuditPage(); } private getEnvironmentHealthStatus() { this.healthStatusService.getEnvironmentHealthStatus() - .subscribe((result: any) => {}); + .subscribe(); } public setRangeOption(event) { 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..210aef3 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 && type">Select {{ type }}</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