This is an automated email from the ASF dual-hosted git repository. dgnatyshyn pushed a commit to branch DLAB-1321 in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git
commit 00eaed7ad3b72d83ad4c3851db777efa481716a3 Author: Dmytro Gnatyshyn <di1...@ukr.net> AuthorDate: Fri Dec 13 14:28:35 2019 +0200 [DLAB-1386]: Fixed bag --- .../management/endpoints/endpoints.component.ts | 6 +- .../notification-dialog.component.ts | 165 +++++++++++---------- 2 files changed, 90 insertions(+), 81 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 31a5d2d..3012aa9 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 @@ -85,10 +85,14 @@ export class EndpointsComponent implements OnInit { this.dialog.open(NotificationDialogComponent, { data: { type: 'confirmation', item: data, list: this.filtredResource }, panelClass: 'modal-sm' }) .afterClosed().subscribe(result => { - result === 'noTerminate' && this.endpointService.deleteEndpoint(data.name).subscribe(() => { + result === 'noTerminate' && this.endpointService.deleteEndpoint(`${data.name}?with-resources=false`).subscribe(() => { this.toastr.success('Endpoint successfully deleted!', 'Success!'); this.getEndpointList(); }, error => this.toastr.error(error.message || 'Endpoint creation failed!', 'Oops!')); + result === 'terminate' && this.endpointService.deleteEndpoint(`${data.name}?with-resources=true`).subscribe(() => { + this.toastr.success('Endpoint successfully deleted. All related resources are terminated!', '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/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 f371079..834792c 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 @@ -23,89 +23,95 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; @Component({ selector: 'notification-dialog', template: ` - <div id="dialog-box"> - <header class="dialog-header"> - <h4 class="modal-title"><i class="material-icons">priority_high</i>Warning</h4> - <button type="button" class="close" (click)="dialogRef.close()">×</button> - </header> - <div mat-dialog-content class="content message"> - <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"> + <div id="dialog-box"> + <header class="dialog-header"> + <h4 class="modal-title"><i class="material-icons">priority_high</i>Warning</h4> + <button type="button" class="close" (click)="dialogRef.close()">×</button> + </header> + <div mat-dialog-content class="content message"> + <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">{{ item.exploratory_name }}</span> <span *ngIf="data.template.notebook.length > 1">, </span> </span> will be stopped and all computational resources will be stopped/terminated - </div> - - <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">{{ item.computational_name }}</span> on <span class="strong">{{ item.exploratory_name }}</span> - will be stopped - </p> - </div> - <span class="strong">by a schedule in 15 minutes.</span> - </div> - <div *ngIf="data.type === 'message'"><span [innerHTML]="data.template"></span></div> - <div *ngIf="data.type === 'confirmation'" class="confirm-dialog"> - <p *ngIf="data.template; else label"> - <span [innerHTML]="data.template"></span> - </p> - <ng-template #label> - <p> - <span class="ellipsis label-name strong" matTooltip="{{ data.item.name }}" matTooltipPosition="above" [matTooltipDisabled]="data.item.name.length > 35"> + </div> + + <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">{{ item.computational_name }}</span> on <span + class="strong">{{ item.exploratory_name }}</span> + will be stopped + </p> + </div> + <span class="strong">by a schedule in 15 minutes.</span> + </div> + <div *ngIf="data.type === 'message'"><span [innerHTML]="data.template"></span></div> + <div *ngIf="data.type === 'confirmation'" class="confirm-dialog"> + <p *ngIf="data.template; else label"> + <span [innerHTML]="data.template"></span> + </p> + <ng-template #label> + <p> + <span class="ellipsis label-name strong" matTooltip="{{ data.item.name }}" matTooltipPosition="above" + [matTooltipDisabled]="data.item.name.length > 35"> {{ data.item.name }}</span> will be {{ data.action || 'disconnected' }}. - </p> - </ng-template> - - <div *ngIf="data.list && data.list.length && data.type === 'confirmation'"> - <div class="resource-list"> - <div class="resource-list-header"> - <div class="resource-name">Resource</div> - <div class="project">Project</div> - </div> - <div class="scrolling-content resource-heigth" > - <div class="resource-list-row sans node" *ngFor="let project of data.list"> - <div class="resource-name ellipsis"> - <div *ngFor="let notebook of project.filtredExploratory">{{notebook.name}}</div> - </div> - <div class="project ellipsis">{{project.project}}</div> - </div> - </div> - </div> - <div class="confirm-resource-terminating"> - <label> - <input class="checkbox" type="checkbox" - (change)="terminateResource()"/>Terminate all related resources - </label> + </p> + </ng-template> + + <div *ngIf="data.list && data.list.length && data.type === 'confirmation'"> + <div class="resource-list"> + <div class="resource-list-header"> + <div class="resource-name">Resource</div> + <div class="project">Project</div> + </div> + <div class="scrolling-content resource-heigth"> + <div class="resource-list-row sans node" *ngFor="let project of data.list"> + <div class="resource-name ellipsis"> + <div *ngFor="let notebook of project.filtredExploratory">{{notebook.name}}</div> + </div> + <div class="project ellipsis">{{project.project}}</div> + </div> + </div> + </div> + <div class="confirm-resource-terminating"> + <label> + <input class="checkbox" type="checkbox" + (change)="terminateResource()"/>Do not terminate all related resources + </label> + </div> + <p class="confirm-message"> + <span *ngIf="!willNotTerminate">All connected computational resources will be terminated as well</span> + </p> + </div> + <mat-list *ngIf="data.item.endpoints?.length"> + <mat-list-item class="list-header sans"> + <div class="endpoint">Edge node in endpoint</div> + <div class="status">Further status</div> + </mat-list-item> + <div class="scrolling-content"> + <mat-list-item *ngFor="let endpoint of data.item.endpoints" class="sans node"> + <div class="endpoint ellipsis">{{endpoint.name}}</div> + <div class="status terminated">Terminated</div> + </mat-list-item> + </div> + </mat-list> + <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> + </div> + </div> </div> - <p class="confirm-message"> - <span *ngIf="willResourceTermineted">All connected computational resources will be terminated as well</span> - </p> - </div> - <mat-list *ngIf="data.item.endpoints?.length"> - <mat-list-item class="list-header sans"> - <div class="endpoint">Edge node in endpoint</div> - <div class="status">Further status</div> - </mat-list-item> - <div class="scrolling-content"> - <mat-list-item *ngFor="let endpoint of data.item.endpoints" class="sans node"> - <div class="endpoint ellipsis">{{endpoint.name}}</div> - <div class="status terminated">Terminated</div> - </mat-list-item> - </div> - </mat-list> - <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.willResourceTermineted" type="button" class="butt butt-success" mat-raised-button (click)="dialogRef.close('noTerminate')">Yes</button> - <button *ngIf="this.willResourceTermineted" type="button" class="butt butt-success" mat-raised-button (click)="dialogRef.close('terminate')">Yes</button> - </div> </div> - </div> - </div> `, styles: [` .content { color: #718ba6; padding: 20px 50px; font-size: 14px; font-weight: 400; margin: 0; } @@ -137,15 +143,14 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; `] }) export class NotificationDialogComponent { - public willResourceTermineted: boolean = false; + public willNotTerminate: boolean = false; constructor( public dialogRef: MatDialogRef<NotificationDialogComponent>, @Inject(MAT_DIALOG_DATA) public data: any ) { - console.log(data); } public terminateResource(): void{ - this.willResourceTermineted = !this.willResourceTermineted; + this.willNotTerminate = !this.willNotTerminate; } } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@dlab.apache.org For additional commands, e-mail: commits-h...@dlab.apache.org