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 0e3d531 [DLAB-1648]: Conveyed all resources which will be terminated during edge deletion (#670) 0e3d531 is described below commit 0e3d5312ded1bb8d4805963c40427cc013fb1b65 Author: Dmytro Gnatyshyn <42860905+dg1...@users.noreply.github.com> AuthorDate: Tue Mar 24 12:16:59 2020 +0200 [DLAB-1648]: Conveyed all resources which will be terminated during edge deletion (#670) --- .../administration/project/project.component.html | 3 +- .../administration/project/project.component.ts | 37 ++++++++++++++++++++-- .../src/app/reporting/reporting.component.ts | 1 - .../ami-create-dialog.component.html | 4 +-- .../notification-dialog.component.ts | 36 +++++++++++++++++++-- 5 files changed, 71 insertions(+), 10 deletions(-) diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/project/project.component.html b/services/self-service/src/main/resources/webapp/src/app/administration/project/project.component.html index b4ba7df..ab69bdb 100644 --- a/services/self-service/src/main/resources/webapp/src/app/administration/project/project.component.html +++ b/services/self-service/src/main/resources/webapp/src/app/administration/project/project.component.html @@ -47,8 +47,7 @@ </mat-card> <div [hidden]="!projectList.length"> - <project-list (editItem)="editProject($event)" (deleteItem)="deleteProject($event)" - (toggleStatus)="toggleStatus($event)"> + <project-list (editItem)="editProject($event)" (toggleStatus)="toggleStatus($event)"> </project-list> </div> </div> diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/project/project.component.ts b/services/self-service/src/main/resources/webapp/src/app/administration/project/project.component.ts index ba3d45a..9833a40 100644 --- a/services/self-service/src/main/resources/webapp/src/app/administration/project/project.component.ts +++ b/services/self-service/src/main/resources/webapp/src/app/administration/project/project.component.ts @@ -23,9 +23,10 @@ import { Subscription } from 'rxjs'; import { ToastrService } from 'ngx-toastr'; import { ProjectDataService } from './project-data.service'; -import { HealthStatusService, ProjectService } from '../../core/services'; +import {HealthStatusService, ProjectService, UserResourceService} from '../../core/services'; import { NotificationDialogComponent } from '../../shared/modal-dialog/notification-dialog'; import { ProjectListComponent } from './project-list/project-list.component'; +import {ExploratoryModel} from '../../resources/resources-grid/resources-grid.model'; export interface Endpoint { name: string; @@ -50,6 +51,7 @@ export class ProjectComponent implements OnInit, OnDestroy { projectList: Project[] = []; healthStatus: any; activeFiltering: boolean = false; + resources: any = []; private subscriptions: Subscription = new Subscription(); @@ -60,7 +62,8 @@ export class ProjectComponent implements OnInit, OnDestroy { public toastr: ToastrService, private projectService: ProjectService, private projectDataService: ProjectDataService, - private healthStatusService: HealthStatusService + private healthStatusService: HealthStatusService, + private userResourceService: UserResourceService ) { } ngOnInit() { @@ -70,12 +73,20 @@ export class ProjectComponent implements OnInit, OnDestroy { if (value) this.projectList = value; })); this.refreshGrid(); + this.getResources(); } ngOnDestroy() { this.subscriptions.unsubscribe(); } + private getResources() { + this.userResourceService.getUserProvisionedResources() + .subscribe((result: any) => { + this.resources = ExploratoryModel.loadEnvironments(result); + }); + } + refreshGrid() { this.projectDataService.updateProjects(); this.activeFiltering = false; @@ -110,6 +121,28 @@ export class ProjectComponent implements OnInit, OnDestroy { } private toggleStatusRequest(data, action) { + if ( action === 'terminate') { + const projectsResources = this.resources + .filter(resource => resource.project === data.project_name )[0].exploratory + .filter(expl => expl.status !== 'terminated' && expl.status !== 'terminating'); + + let termResources = []; + data.endpoint.forEach(v => { + termResources = [...termResources, ...projectsResources.filter(resource => resource.endpoint === v)]; + }); + + this.dialog.open(NotificationDialogComponent, { data: { + type: 'terminateNode', item: {action: data, resources: termResources.map(resource => resource.name)} + }, panelClass: 'modal-sm' }) + .afterClosed().subscribe(result => { + result && this.edgeNodeAction(data, action); + }); + } else { + this.edgeNodeAction(data, action); + } + } + + private edgeNodeAction(data, action) { this.projectService.toggleProjectStatus(data, action).subscribe(() => { this.refreshGrid(); this.toastr.success(`Edge node ${this.toEndpointAction(action)} is in progress!`, 'Processing!'); diff --git a/services/self-service/src/main/resources/webapp/src/app/reporting/reporting.component.ts b/services/self-service/src/main/resources/webapp/src/app/reporting/reporting.component.ts index b6fbc26..3433383 100644 --- a/services/self-service/src/main/resources/webapp/src/app/reporting/reporting.component.ts +++ b/services/self-service/src/main/resources/webapp/src/app/reporting/reporting.component.ts @@ -93,7 +93,6 @@ export class ReportingComponent implements OnInit, OnDestroy { const localEndpoint = endpoints.filter(endpoint => endpoint.name === 'local'); if (localEndpoint.length) { this.PROVIDER = localEndpoint[0].cloudProvider.toLowerCase(); - console.log(this.PROVIDER); if (this.PROVIDER) { this.rebuildBillingReport(); } diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/ami-create-dialog/ami-create-dialog.component.html b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/ami-create-dialog/ami-create-dialog.component.html index 1e7c25c..4a7a4a6 100644 --- a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/ami-create-dialog/ami-create-dialog.component.html +++ b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/ami-create-dialog/ami-create-dialog.component.html @@ -33,9 +33,7 @@ image name already exists in project.</span> <span class="error" *ngIf="!createAMIForm.valid && createAMIForm.controls['name'].dirty && !createAMIForm.controls['name'].hasError('duplication')"> - image name - <span *ngIf="provider === 'azure'"> cannot be longer than 10 characters and</span> - can only contain letters, numbers, hyphens and '_'</span> + Name cannot be longer than 10 characters and can only contain letters, numbers, hyphens and '_' but can not end with special characters</span> </div> </div> <div class="control-group"> 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 6b66ce4..20ec20f 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 @@ -30,6 +30,13 @@ import {Endpoint} from '../../../administration/project/project.component'; <button type="button" class="close" (click)="dialogRef.close()">×</button> </header> <div mat-dialog-content class="content message"> + <div *ngIf="data.type === 'terminateNode'" class="table-header"> + <div *ngIf="data.item.action.endpoint.length > 0"> + Edge node<span *ngIf="data.item.action.endpoint.length>1">s</span> + <span class="strong">{{ ' ' + data.item.action.endpoint.join(', ') }}</span> in project + <span class="strong">{{ data.item.action.project_name }}</span> will be terminated. + </div> + </div> <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> @@ -102,8 +109,7 @@ import {Endpoint} from '../../../administration/project/project.component'; </mat-list-item> </div> </mat-list> - <p class="m-top-20"><span class="strong">Do you want to proceed?</span></p> - + <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 @@ -114,6 +120,30 @@ import {Endpoint} from '../../../administration/project/project.component'; </button> </div> </div> + <div class="confirm-dialog" *ngIf="data.type === 'terminateNode'"> + <mat-list *ngIf="data.item.resources.length > 0"> + <mat-list-item class="list-header sans"> + <div class="endpoint">Resources</div> + <div class="status">Further status</div> + </mat-list-item> + <div class="scrolling-content"> + <mat-list-item *ngFor="let resource of data.item.resources" class="sans node"> + <div class="endpoint ellipsis">{{resource}}</div> + <div class="status terminated">Terminated</div> + </mat-list-item> + </div> + </mat-list> + <div mat-dialog-content class="bottom-message" *ngIf="data.item.resources.length > 0"> + <span class="confirm-message">All connected computational resources will be terminated as well.</span> + </div> + <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 type="button" class="butt butt-success" mat-raised-button + (click)="dialogRef.close(true)">Yes + </button> + </div> + </div> </div> </div> `, @@ -140,6 +170,8 @@ import {Endpoint} from '../../../administration/project/project.component'; .confirm-message{color: #ef5c4b;font-size: 13px;min-height: 18px; text-align: center; padding-top: 20px} .checkbox{margin-right: 5px;vertical-align: middle; margin-bottom: 3px;} label{cursor: pointer} + .bottom-message{padding-top: 15px;} + .table-header{padding-bottom: 10px;} `] --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@dlab.apache.org For additional commands, e-mail: commits-h...@dlab.apache.org