This is an automated email from the ASF dual-hosted git repository. dgnatyshyn pushed a commit to branch audit in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git
The following commit(s) were added to refs/heads/audit by this push: new 0a423f7 Change endpoint disconnecting settings new f8b8b37 Merge remote-tracking branch 'origin/audit' into audit 0a423f7 is described below commit 0a423f74b0cfbf9e5a5a310abaa98d0d98e1ecfe Author: Dmytro_Gnatyshyn <di1...@ukr.net> AuthorDate: Wed Jun 10 16:30:04 2020 +0300 Change endpoint disconnecting settings --- .../management/endpoints/endpoints.component.ts | 9 +++--- .../audit/audit-grid/audit-grid.component.html | 26 +++++++-------- .../audit/audit-grid/audit-grid.component.ts | 37 ++++++++++++++++++++-- .../audit/audit-toolbar/audit-toolbar.component.ts | 6 ++-- .../src/app/reports/audit/audit.component.ts | 11 +++---- .../cluster-details/cluster-details.component.ts | 2 +- .../notification-dialog.component.ts | 7 ++-- 7 files changed, 63 insertions(+), 35 deletions(-) diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/management/endpoints/endpoints.component.ts b/services/self-service/src/main/resources/webapp/src/app/administration/management/endpoints/endpoints.component.ts index 4c4b656..db3bb3c 100644 --- a/services/self-service/src/main/resources/webapp/src/app/administration/management/endpoints/endpoints.component.ts +++ b/services/self-service/src/main/resources/webapp/src/app/administration/management/endpoints/endpoints.component.ts @@ -86,8 +86,7 @@ export class EndpointsComponent implements OnInit { type: 'confirmation', item: data, list: resource }, panelClass: 'modal-sm' }) .afterClosed().subscribe(result => { - result === 'noTerminate' && this.deleteEndpointOption(data, false); - result === 'terminate' && this.deleteEndpointOption(data, true); + result && this.deleteEndpointOption(data); }); }); } @@ -112,9 +111,9 @@ export class EndpointsComponent implements OnInit { }); } - private deleteEndpointOption(data, option): void { - this.endpointService.deleteEndpoint(`${data.name}?with-resources=${option}`).subscribe(() => { - this.toastr.success(option ? 'Endpoint successfully disconnected. All related resources are terminating!' : 'Endpoint successfully disconnected!' , 'Success!'); + private deleteEndpointOption(data): void { + this.endpointService.deleteEndpoint(`${data.name}`).subscribe(() => { + this.toastr.success( 'Endpoint successfully disconnected. All related resources are terminating!', 'Success!'); this.getEndpointList(); }, error => this.toastr.error(error.message || 'Endpoint creation failed!', 'Oops!')); } 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 d280224..feb6f17 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 @@ -39,7 +39,7 @@ <div class="label"><span class="text">Project</span></div> <button mat-icon-button aria-label="More" class="ar" (click)="toggleFilterRow()"> <i class="material-icons"> - <span *ngIf="filterAuditData.users.length > 0; else user_filtered">filter_list</span> + <span *ngIf="filterAuditData.project.length > 0; else user_filtered">filter_list</span> <ng-template #user_filtered>more_vert</ng-template> </i> </button> @@ -53,12 +53,12 @@ <div class="label"><span class="text">Resource</span></div> <button mat-icon-button aria-label="More" class="ar" (click)="toggleFilterRow()"> <i class="material-icons"> - <span *ngIf="filterAuditData.users.length > 0; else user_filtered">filter_list</span> + <span *ngIf="filterAuditData.resource.length > 0; else user_filtered">filter_list</span> <ng-template #user_filtered>more_vert</ng-template> </i> </button> </th> - <td mat-cell *matCellDef="let element"><span class="table-item">{{element.resource}}</span></td> + <td mat-cell *matCellDef="let element"><span class="table-item">{{element.resourceName}}</span></td> <td mat-footer-cell *matFooterCellDef class="table-footer"></td> </ng-container> @@ -71,17 +71,17 @@ <div class="label"> <span class="text"> Action </span> </div> - <button mat-icon-button aria-label="More" class="ar" (click)="toggleFilterRow()"> - <i class="material-icons"> - <span *ngIf="filterAuditData.actions.length > 0; else action_filtered">filter_list</span> - <ng-template #action_filtered>more_vert</ng-template> - </i> - </button> +<!-- <button mat-icon-button aria-label="More" class="ar" (click)="toggleFilterRow()">--> +<!-- <i class="material-icons">--> +<!-- <span *ngIf="filterAuditData.actions.length > 0; else action_filtered">filter_list</span>--> +<!-- <ng-template #action_filtered>more_vert</ng-template>--> +<!-- </i>--> +<!-- </button>--> </th> <td mat-cell *matCellDef=" let element"> <div class="action-wrapper"> <span>{{element.action}}</span> - <div class="audit-info" (click)="openActionInfo(element)" *ngIf="element.info"> + <div class="audit-info" (click)="openActionInfo(element)" *ngIf="element.info.length"> <i class="material-icons">info</i> </div> </div> @@ -97,7 +97,7 @@ <!-- </div>--> <div class="label"><span class="text">Date</span></div> </th> - <td mat-cell *matCellDef="let element"> {{element.date}} </td> + <td mat-cell *matCellDef="let element"> {{element.timestamp | date: 'dd/MM/yyyy hh:mm:ss aa'}} </td> <td mat-footer-cell *matFooterCellDef class="table-footer"></td> </ng-container> @@ -111,14 +111,14 @@ <ng-container matColumnDef="project-filter"> <th mat-header-cell *matHeaderCellDef class="filter-row-item"> <multi-select-dropdown *ngIf="filterConfiguration" (selectionChange)="onUpdate($event)" [type]="'projects'" - [items]="filterConfiguration.users" [model]="filterAuditData.users"></multi-select-dropdown> + [items]="filterConfiguration.project" [model]="filterAuditData.project"></multi-select-dropdown> </th> </ng-container> <ng-container matColumnDef="resource-filter"> <th mat-header-cell *matHeaderCellDef class="filter-row-item"> <multi-select-dropdown *ngIf="filterConfiguration" (selectionChange)="onUpdate($event)" [type]="'resources'" - [items]="filterConfiguration.users" [model]="filterAuditData.users"></multi-select-dropdown> + [items]="filterConfiguration.resource" [model]="filterAuditData.resource"></multi-select-dropdown> </th> </ng-container> 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 d18908c..811e3e1 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 @@ -21,6 +21,7 @@ import {Component, Inject, OnInit} from '@angular/core'; import {FilterAuditModel} from '../filter-audit.model'; import {NotificationDialogComponent} from '../../../shared/modal-dialog/notification-dialog'; import {MAT_DIALOG_DATA, MatDialog, MatDialogRef} from '@angular/material/dialog'; +import {AuditService} from '../../../core/services/audit.service'; @Component({ selector: 'dlab-audit-grid', @@ -38,14 +39,44 @@ export class AuditGridComponent implements OnInit { constructor( public dialogRef: MatDialogRef<AuditInfoDialogComponent>, - public dialog: MatDialog + public dialog: MatDialog, + private auditService: AuditService, ) { } ngOnInit() {} - public refreshAudit(auditData) { - this.auditData = auditData; + public refreshAudit() { + this.auditService.getAuditData().subscribe(auditData => { + this.auditData = auditData; + this.createFilterData(this.auditData); + }); + } + + public createFilterData (auditData) { + const users = []; + const resource = []; + const project = []; + const actions = []; + const date_start = ''; + const date_end = ''; + console.log(auditData); + auditData.forEach(auditItem => { + if (!users.includes(auditItem.user)) { + users.push(auditItem.user); + } + if (!resource.includes(auditItem.resourceName)) { + resource.push(auditItem.resourceName); + } + if (!project.includes(auditItem.project)) { + project.push(auditItem.project); + } + if (!actions.includes(auditItem.action)) { + actions.push(auditItem.action); + } + }); + this.filterConfiguration = new FilterAuditModel(users, resource, project, actions, '', ''); + console.log(this.filterAuditData); } toggleFilterRow(): void { diff --git a/services/self-service/src/main/resources/webapp/src/app/reports/audit/audit-toolbar/audit-toolbar.component.ts b/services/self-service/src/main/resources/webapp/src/app/reports/audit/audit-toolbar/audit-toolbar.component.ts index 87daf36..cc4933e 100644 --- a/services/self-service/src/main/resources/webapp/src/app/reports/audit/audit-toolbar/audit-toolbar.component.ts +++ b/services/self-service/src/main/resources/webapp/src/app/reports/audit/audit-toolbar/audit-toolbar.component.ts @@ -44,7 +44,7 @@ export class AuditToolbarComponent implements OnInit, AfterViewInit { options: NgDateRangePickerOptions; rangeLabels: any; - @Output() rebuildReport: EventEmitter<{}> = new EventEmitter(); + @Output() rebuildAudit: EventEmitter<{}> = new EventEmitter(); @Output() exportReport: EventEmitter<{}> = new EventEmitter(); @Output() setRangeOption: EventEmitter<{}> = new EventEmitter(); @@ -104,10 +104,12 @@ export class AuditToolbarComponent implements OnInit, AfterViewInit { } rebuild($event): void { - this.rebuildReport.emit($event); + this.rebuildAudit.emit($event); } // export($event): void { // this.exportReport.emit($event); // } + + } 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 fba41b2..3b355bb 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 @@ -39,7 +39,7 @@ import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog'; <!-- </dlab-toolbar>--> <!-- <mat-divider></mat-divider>--> <!-- <dlab-reporting-grid (filterReport)="filterReport($event)" (resetRangePicker)="resetRangePicker()"></dlab-reporting-grid>--> - <audit-toolbar> + <audit-toolbar (rebuildAudit)="rebuildAuditGrid()"> </audit-toolbar> <mat-divider></mat-divider> <dlab-audit-grid></dlab-audit-grid> @@ -84,12 +84,11 @@ export class AuditComponent implements OnInit, OnDestroy { } public buildAuditReport() { - this.auditData = this.auditService.getAuditData().subscribe(auditData => { - console.log(auditData); - // this.auditGrid.refreshAudit(auditData); - }); - + this.auditGrid.refreshAudit(); + } + public rebuildAuditGrid() { + this.buildAuditReport(); } private getEnvironmentHealthStatus() { diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/computational/cluster-details/cluster-details.component.ts b/services/self-service/src/main/resources/webapp/src/app/resources/computational/cluster-details/cluster-details.component.ts index 415cfaa..a70d784 100644 --- a/services/self-service/src/main/resources/webapp/src/app/resources/computational/cluster-details/cluster-details.component.ts +++ b/services/self-service/src/main/resources/webapp/src/app/resources/computational/cluster-details/cluster-details.component.ts @@ -119,7 +119,7 @@ export class DetailComputationalResourcesComponent implements OnInit { } private logAction(name: any, description: string) { - this.auditService.sendDataToAudit({resource_name: name, info: ['User opened link' + description]}).subscribe(); + this.auditService.sendDataToAudit({resource_name: name, info: [`User followed ${description} link`]}).subscribe(); console.log(`${name}: ${description}`); } } diff --git a/services/self-service/src/main/resources/webapp/src/app/shared/modal-dialog/notification-dialog/notification-dialog.component.ts b/services/self-service/src/main/resources/webapp/src/app/shared/modal-dialog/notification-dialog/notification-dialog.component.ts index 20ec20f..a860b39 100644 --- a/services/self-service/src/main/resources/webapp/src/app/shared/modal-dialog/notification-dialog/notification-dialog.component.ts +++ b/services/self-service/src/main/resources/webapp/src/app/shared/modal-dialog/notification-dialog/notification-dialog.component.ts @@ -112,11 +112,8 @@ import {Endpoint} from '../../../administration/project/project.component'; <p class="m-top-20"><span class="strong">Do you want to proceed?</span></p> <div class="text-center m-top-30 m-bott-10"> <button type="button" class="butt" mat-raised-button (click)="dialogRef.close()">No</button> - <button *ngIf="!this.willNotTerminate" type="button" class="butt butt-success" mat-raised-button - (click)="dialogRef.close('terminate')">Yes - </button> - <button *ngIf="this.willNotTerminate" type="button" class="butt butt-success" mat-raised-button - (click)="dialogRef.close('noTerminate')">Yes + <button type="button" class="butt butt-success" mat-raised-button + (click)="dialogRef.close(true)">Yes </button> </div> </div> --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@dlab.apache.org For additional commands, e-mail: commits-h...@dlab.apache.org