This is an automated email from the ASF dual-hosted git repository. ankovalyshyn pushed a commit to branch feature/projects in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git
commit 9125adf31d7c719ab7496c0882a2ddbf92893c3e Author: Andriana Kovalyshyn <andriana_kovalys...@epam.com> AuthorDate: Wed Jun 5 17:45:00 2019 +0300 [DLAB-747]: update data after stop/terminate resources --- .../management-grid/management-grid.component.ts | 53 ++++++++-------------- 1 file changed, 19 insertions(+), 34 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 1173e83..bc865b5 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 @@ -23,8 +23,7 @@ import { ToastrService } from 'ngx-toastr'; import { HealthStatusService, UserAccessKeyService } from '../../../core/services'; import { ConfirmationDialogType } from '../../../shared'; -import { FileUtils } from '../../../core/util'; -import { ConfirmationDialogComponent } from '../../../shared/modal-dialog/confirmation-dialog/confirmation-dialog.component'; +import { ConfirmationDialogComponent } from '../../../shared/modal-dialog/confirmation-dialog'; export interface ManageAction { action: string; @@ -55,10 +54,9 @@ export class ManagementGridComponent implements OnInit { constructor( private healthStatusService: HealthStatusService, - private userAccessKeyService: UserAccessKeyService, public toastr: ToastrService, public dialog: MatDialog - ) {} + ) { } ngOnInit() { } @@ -70,41 +68,35 @@ export class ManagementGridComponent implements OnInit { toggleResourceAction(environment, action: string, resource?) { if (resource) { const resource_name = resource ? resource.computational_name : environment.name; - const dialogRef: MatDialogRef<ReconfirmationDialogComponent> = this.dialog.open(ReconfirmationDialogComponent, { + this.dialog.open(ReconfirmationDialogComponent, { data: { action, resource_name, user: environment.user }, - width: '550px', - panelClass: 'error-modalbox' - }); - dialogRef.afterClosed().subscribe(result => { + width: '550px', panelClass: 'error-modalbox' + }).afterClosed().subscribe(result => { result && this.actionToggle.emit({ action, environment, resource }); }); } else { const type = (environment.name === 'edge node' || environment.type.toLowerCase() === 'edge node') - ? ConfirmationDialogType.StopEdgeNode : ConfirmationDialogType.StopExploratory; + ? ConfirmationDialogType.StopEdgeNode : ConfirmationDialogType.StopExploratory; if (action === 'stop') { this.dialog.open(ConfirmationDialogComponent, { data: { notebook: environment, type: type, manageAction: this.isAdmin }, panelClass: 'modal-md' - }); + }).afterClosed().subscribe(() => this.buildGrid()); } else if (action === 'terminate') { this.dialog.open(ConfirmationDialogComponent, { data: { notebook: environment, type: ConfirmationDialogType.TerminateExploratory, manageAction: this.isAdmin } - }); + }).afterClosed().subscribe(() => this.buildGrid()); } else if (action === 'run') { - this.healthStatusService - .runEdgeNode() - .subscribe(() => { - this.buildGrid(); - this.toastr.success('Edge node is starting!', 'Processing!'); - }, error => this.toastr.error('Edge Node running failed!', 'Oops!')); - } else if (action === 'recreate') { - this.healthStatusService - .recreateEdgeNode() - .subscribe(() => { - this.buildGrid(); - this.toastr.success('Edge Node recreation is processing!', 'Processing!'); - }, error => this.toastr.error('Edge Node recreation failed!', 'Oops!')); - } + this.healthStatusService.runEdgeNode().subscribe(() => { + this.buildGrid(); + this.toastr.success('Edge node is starting!', 'Processing!'); + }, () => this.toastr.error('Edge Node running failed!', 'Oops!')); + } else if (action === 'recreate') { + this.healthStatusService.recreateEdgeNode().subscribe(() => { + this.buildGrid(); + this.toastr.success('Edge Node recreation is processing!', 'Processing!'); + }, () => this.toastr.error('Edge Node recreation failed!', 'Oops!')); + } } } @@ -132,13 +124,6 @@ export class ManagementGridComponent implements OnInit { showReuploaKeydDialog() { this.keyReuploadDialog.open({ isFooter: false }); } - - public generateUserKey() { - this.userAccessKeyService.regenerateAccessKey().subscribe(data => { - FileUtils.downloadFile(data); - this.buildGrid(); - }); - } } @@ -168,5 +153,5 @@ export class ReconfirmationDialogComponent { constructor( public dialogRef: MatDialogRef<ReconfirmationDialogComponent>, @Inject(MAT_DIALOG_DATA) public data: any - ) {} + ) { } } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@dlab.apache.org For additional commands, e-mail: commits-h...@dlab.apache.org