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 7a9efff [DLAB-1934] Implemented set of UI tasks in Audit(part2) (#818) 7a9efff is described below commit 7a9efff2add114754fe6e90866be4c77f6df0bfd Author: Dmytro Gnatyshyn <42860905+dg1...@users.noreply.github.com> AuthorDate: Fri Jul 10 17:46:23 2020 +0300 [DLAB-1934] Implemented set of UI tasks in Audit(part2) (#818) --- .../service/impl/ProjectServiceImpl.java | 2 +- .../service/impl/UserGroupServiceImpl.java | 8 +-- .../audit/audit-grid/audit-grid.component.ts | 84 ++++++++++++++-------- .../cluster-details/cluster-details.component.html | 2 +- .../cluster-details/cluster-details.component.ts | 10 ++- ...utational-resource-create-dialog.component.html | 2 +- .../resources-grid/resources-grid.component.ts | 2 +- .../notification-dialog.component.ts | 6 +- .../webapp/src/assets/styles/_dialogs.scss | 1 + 9 files changed, 73 insertions(+), 44 deletions(-) diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/ProjectServiceImpl.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/ProjectServiceImpl.java index b4d635d..530784a 100644 --- a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/ProjectServiceImpl.java +++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/ProjectServiceImpl.java @@ -65,7 +65,7 @@ public class ProjectServiceImpl implements ProjectService { private static final String AUDIT_ADD_ENDPOINT = "Added endpoint(s) %s"; private static final String AUDIT_ADD_GROUP = "Added group(s) %s"; private static final String AUDIT_REMOVE_GROUP = "Removed group(s) %s"; - private static final String AUDIT_UPDATE_BUDGET = "Update budget %d->%d"; + private static final String AUDIT_UPDATE_BUDGET = "Update quota %d->%d"; private static final String AUDIT_ADD_EDGE_NODE = "Create edge node for endpoint %s, requested in project %s"; private final ProjectDAO projectDAO; diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/UserGroupServiceImpl.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/UserGroupServiceImpl.java index f4d7c5c..c646a53 100644 --- a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/UserGroupServiceImpl.java +++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/UserGroupServiceImpl.java @@ -58,10 +58,10 @@ import static com.epam.dlab.backendapi.domain.AuditResourceTypeEnum.GROUP; @Singleton @Slf4j public class UserGroupServiceImpl implements UserGroupService { - private static final String AUDIT_ADD_ROLE_MESSAGE = "Added role(s): %s.\n"; - private static final String AUDIT_REMOVE_ROLE_MESSAGE = "Removed role(s): %s.\n"; - private static final String AUDIT_ADD_USER_MESSAGE = "Added user(s): %s.\n"; - private static final String AUDIT_REMOVE_USER_MESSAGE = "Removed user(s): %s.\n"; + private static final String AUDIT_ADD_ROLE_MESSAGE = "Add role(s): %s.\n"; + private static final String AUDIT_REMOVE_ROLE_MESSAGE = "Remove role(s): %s.\n"; + private static final String AUDIT_ADD_USER_MESSAGE = "Add user(s): %s.\n"; + private static final String AUDIT_REMOVE_USER_MESSAGE = "Remove user(s): %s.\n"; private static final String ROLE_NOT_FOUND_MSG = "Any of role : %s were not found"; private static final String ADMIN = "admin"; private static final String PROJECT_ADMIN = "projectAdmin"; 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 c710b3f..4bb0d6c 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 @@ -176,8 +176,8 @@ export class AuditGridComponent implements OnInit { <button type="button" class="close" (click)="dialogRef.close()">×</button> </header> <div mat-dialog-content class="content audit-info-content" [ngClass]="{'pb-40': actionList[0].length > 1}"> - <mat-list *ngIf="actionList[0].length > 1 || data.element.info.indexOf('Update budget') !== -1;else message"> - <ng-container *ngIf="data.element.info.indexOf('Update budget') === -1;else quotas"> + <mat-list *ngIf="actionList[0].length > 1 && data.element.type === 'FOLLOW_LINK'|| data.element.info.indexOf('Update quota') !== -1;else message"> + <ng-container *ngIf="data.element.info.indexOf('Update quota') === -1;else quotas"> <mat-list-item class="list-header"> <div class="info-item-title" [ngClass]="{'same-column-width': data.dialogSize === 'small'}">Action</div> <div class="info-item-data" [ngClass]="{'same-column-width': data.dialogSize === 'small'}"> Description </div> @@ -203,17 +203,17 @@ export class AuditGridComponent implements OnInit { <ng-template #quotas> <mat-list-item class="list-header"> <div class="same-column-width" >Action</div> - <div class="info-item-quota-first" > Previous value </div> - <div class="info-item-quota-last" > New value </div> + <div class="info-item-title"> Previous value </div> + <div class="info-item-quota"> New value </div> </mat-list-item> <div class="scrolling-content mat-list-wrapper" id="scrolling"> - <mat-list-item class="list-item" *ngFor="let action of actionList"> - <div class="same-column-width">{{updateBudget[0]}}</div> - <div class="info-item-quota-first"> - {{updateBudget[1]}} + <mat-list-item class="list-item" *ngFor="let action of updateBudget"> + <div class="same-column-width">{{action[0]}}</div> + <div class="info-item-title"> + {{action[1]}} </div> - <div class="info-item-quota-last"> - {{updateBudget[2]}} + <div class="info-item-quota"> + {{action[2]}} </div> </mat-list-item> </div> @@ -222,22 +222,30 @@ export class AuditGridComponent implements OnInit { <ng-template #message> <div class="message-wrapper"> <p *ngIf="data.element.type !== 'COMPUTE'; else computation"> - <span *ngIf="data.element.info.indexOf('Scheduled') !== -1;else notScheduledNotebook">{{data.element.action | titlecase}} by scheduler.</span> + <span *ngIf="data.element.info.indexOf('Scheduled') !== -1;else notScheduledNotebook">{{data.element.action | titlecase}} by scheduler.1</span> <ng-template #notScheduledNotebook> - <span>{{data.element.info}}.</span> + <span *ngIf="data.element.type === 'WEB_TERMINAL'">{{data.element.info}} <span class="strong">{{data.element.resourceName}}</span>.2</span> + <span *ngIf="data.element.type !== 'WEB_TERMINAL' && data.element.type !== 'FOLLOW_LINK' && data.element.type !== 'EDGE_NODE'" >{{data.element.info}}.</span> + <span *ngIf="data.element.type === 'EDGE_NODE' && data.element.action === 'CREATE'"> + Create edge node for endpoint <span class="strong">{{data.element.resourceName}}</span>, requested in project <span class="strong">{{data.element.project}}</span> + .</span> </ng-template> </p> <ng-template #computation> - <p *ngIf="data.element.info.indexOf('Scheduled') !== -1;else notScheduled"> {{data.element.action | titlecase}} by scheduler, requested for notebook <span class="strong">{{data.element.info.split(' ')[data.element.info.split(' ').length - 1] }}.</span></p> - <ng-template #notScheduled> - <p> {{data.element.action | titlecase}} computational resource <span class="strong">{{data.element.resourceName}}</span>, requested for notebook <span class="strong">{{data.element.info.split(' ')[data.element.info.split(' ').length - 1] }}.</span></p> + <p *ngIf="data.element.info.indexOf('Scheduled') !== -1;else notScheduled"> {{data.element.action | titlecase}} by scheduler, requested for notebook <span class="strong">{{data.element.info.split(' ')[data.element.info.split(' ').length - 1] }}</span>.</p> + <ng-template #notScheduled> + <p> + <span *ngIf="data.element.action === 'FOLLOW_LINK'">Follow compute <span class="strong">{{info.cluster}}</span> <span>{{info.custerType}}</span> link, requested for notebook <span class="strong">{{info.notebook}}</span>.</span> + <span *ngIf="data.element.action !== 'FOLLOW_LINK'">{{data.element.action | titlecase}} computational resource <span class="strong">{{data.element.resourceName}}</span>, requested for notebook <span class="strong">{{data.element.info.split(' ')[data.element.info.split(' ').length - 1] }}</span>.</span> + </p> </ng-template> </ng-template> </div> </ng-template></div> </div> `, + styles: [` .content { color: #718ba6; padding: 20px 30px; font-size: 14px; font-weight: 400; margin: 0; } .pb-40 { padding-bottom: 40px; } @@ -250,33 +258,47 @@ export class AuditGridComponent implements OnInit { label{cursor: pointer} .message-wrapper{min-height: 70px;; display: flex; align-items: center} .mat-list-wrapper{padding-top: 5px;} - .list-item{color: #718ba6; height: auto; line-height: 20px;} - .info-item-title{width: 40%; padding: 10px 0} - .info-item-quota-first{width: 30%; padding: 10px 0} - .info-item-quota-last{width: 20%; padding: 10px 0} + .list-item{color: #718ba6; height: auto; line-height: 20px; font-size: 14px} + .info-item-title{width: 40%; padding: 10px 0;font-size: 14px;} + .info-item-quota{width: 30%; padding: 10px 0;font-size: 14px;} .list-header {padding-top: 5px;} - .info-item-data{width: 60%; text-align: left; padding: 10px 0} - .file-description{ overflow: hidden; display: block; direction: rtl;} - .same-column-width{width: 50%; padding: 10px 0} + .info-item-data{width: 60%; text-align: left; padding: 10px 0; font-size: 14px;} + .file-description{ overflow: hidden; display: block; direction: rtl; font-size: 14px;} + .same-column-width{width: 50%; padding: 10px 0; font-size: 14px;} `] }) export class AuditInfoDialogComponent { actionList: string[][]; - updateBudget: string[] = []; + updateBudget: string[][] = []; + info; constructor( public dialogRef: MatDialogRef<AuditInfoDialogComponent>, @Inject(MAT_DIALOG_DATA) public data: any ) { - if (data.element.info.indexOf('Update budget') !== -1) { - this.data.element.info.replace('->', ' ').split(' ').forEach((v, i, arr) => { - if (i === 1) { - this.updateBudget.push(`${arr[0]} ${arr[1]}`); - } - if (i > 1) { - this.updateBudget.push(arr[i]); - } + if (data.element.action === 'FOLLOW_LINK' && data.element.type === 'COMPUTE') { + this.info = JSON.parse(data.element.info); + } + if (data.element.info.indexOf('Update quota') !== -1) { + this.data.element.info.replace(/->/g, ' ').split('/n').forEach( (val, j) => { + this.updateBudget[j] = []; + val.split(' ') + .forEach((v, i, arr) => { + if (arr[0] === 'Update') { + if (i === 1) { + this.updateBudget[j].push(`${arr[0]} ${arr[1]}`); + } + if (i > 1) { + this.updateBudget[j].push(arr[i]); + } + } else { + this.updateBudget[j].push(arr[i]); + } + + }); }); } this.actionList = data.element.info.split('\n').map(v => v.split(':')).filter(v => v[0] !== ''); } } + + diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/computational/cluster-details/cluster-details.component.html b/services/self-service/src/main/resources/webapp/src/app/resources/computational/cluster-details/cluster-details.component.html index 25f41d9..70d583b 100644 --- a/services/self-service/src/main/resources/webapp/src/app/resources/computational/cluster-details/cluster-details.component.html +++ b/services/self-service/src/main/resources/webapp/src/app/resources/computational/cluster-details/cluster-details.component.html @@ -103,7 +103,7 @@ <div class="m-top-10"> <p *ngFor="let item of resource.computational_url" class="ellipsis flex"> <span class="strong">{{ item.description }}:</span> - <a (click)="logAction(resource.computational_name, item.description)" href="{{item.url}}" target="_blank" matTooltip="{{item.url}}" + <a (click)="logAction(resource, environment)" href="{{item.url}}" target="_blank" matTooltip="{{item.url}}" matTooltipPosition="above">{{ item.url }}</a> </p> </div> 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 b6d32aa..1ed7bc4 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 @@ -118,7 +118,13 @@ export class DetailComputationalResourcesComponent implements OnInit { : null; } - private logAction(name: any, description: string) { - this.auditService.sendDataToAudit({resource_name: name, info: `Follow ${description} link`, type: 'COMPUTE'}).subscribe(); + private logAction(resource: any, environment) { + const clusterInfo = { + cluster: resource.computational_name, + notebook: environment.name, + clusterType: resource.dataEngineType === 'dataengine-service' ? 'Hadoop' : 'Master' + } + + this.auditService.sendDataToAudit({resource_name: resource.computational_name, info: JSON.stringify(clusterInfo), type: 'COMPUTE'}).subscribe(); } } diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource-create-dialog/computational-resource-create-dialog.component.html b/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource-create-dialog/computational-resource-create-dialog.component.html index 5656a92..1591221 100644 --- a/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource-create-dialog/computational-resource-create-dialog.component.html +++ b/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource-create-dialog/computational-resource-create-dialog.component.html @@ -145,7 +145,7 @@ </div> <div class="preemptible checkbox-group control-group m-top-30 m-bott-10" - *ngIf="PROVIDER === 'gcp' && selectedImage?.image === 'docker.dlab-dataengine-service1'"> + *ngIf="PROVIDER === 'gcp' && selectedImage?.image === 'docker.dlab-dataengine-service'"> <label class="label"> <input #preemptibleNode type="checkbox" (change)="selectPreemptibleNodes($event)" /> <span>Preemptible node</span> diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.ts b/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.ts index a354c40..2136151 100644 --- a/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.ts +++ b/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.ts @@ -417,6 +417,6 @@ export class ResourcesGridComponent implements OnInit { } logAction(name) { - this.auditService.sendDataToAudit({resource_name: name, info: `Open terminal on notebook ${name}`, type: 'WEB_TERMINAL'}).subscribe(); + this.auditService.sendDataToAudit({resource_name: name, info: `Open terminal, requested for notebook`, type: 'WEB_TERMINAL'}).subscribe(); } } 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 479a9e4..232eab1 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 @@ -40,7 +40,7 @@ import {Endpoint} from '../../../administration/project/project.component'; <div *ngIf="data.type === 'list'" class="info"> <div *ngIf="data.template.notebook.length > 0"> Following notebook server<span *ngIf="data.template.notebook.length>1">s</span> <span *ngFor="let item of data.template.notebook"> - <span class="strong blue">{{ item.exploratory_name}}</span> on project <span + <span class="strong blue">{{ item.exploratory_name}}</span> in project <span class="strong blue">{{ item.project }}</span> <span *ngIf="data.template.notebook.length > 1"> , </span> </span> will be stopped and all computational resources will be stopped/terminated @@ -49,8 +49,8 @@ import {Endpoint} from '../../../administration/project/project.component'; <div *ngIf="data.template.cluster.length > 0"> <p *ngFor="let item of data.template.cluster"> Computational resource<span *ngIf="data.template.cluster.length > 1">s </span> - <span class="strong blue">{{ item.computational_name }}</span> on <span - class="strong blue">{{ item.exploratory_name }}</span> on project<span + <span class="strong blue">{{ item.computational_name }}</span> for <span + class="strong blue">{{ item.exploratory_name }}</span> in project<span class="strong blue">{{ item.project }}</span> will be stopped </p> diff --git a/services/self-service/src/main/resources/webapp/src/assets/styles/_dialogs.scss b/services/self-service/src/main/resources/webapp/src/assets/styles/_dialogs.scss index 6bc4920..91b3ed4 100644 --- a/services/self-service/src/main/resources/webapp/src/assets/styles/_dialogs.scss +++ b/services/self-service/src/main/resources/webapp/src/assets/styles/_dialogs.scss @@ -68,6 +68,7 @@ mat-dialog-container { #dialog-box { color: $modal-text-color; min-height: 150px; + font-family: Roboto, "Helvetica Neue", sans-serif; .dialog-header { padding-left: 30px; --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@dlab.apache.org For additional commands, e-mail: commits-h...@dlab.apache.org