You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dlab.apache.org by dg...@apache.org on 2019/12/19 13:33:41 UTC

[incubator-dlab] 02/02: [1402] Conveyed edge node on confirmation dialog

This is an automated email from the ASF dual-hosted git repository.

dgnatyshyn pushed a commit to branch DLAB-1402
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git

commit a25ffd03095d52441f0a01aef4b51ae632fffdbc
Author: Dmytro Gnatyshyn <di...@ukr.net>
AuthorDate: Thu Dec 19 15:31:49 2019 +0200

    [1402] Conveyed edge node on confirmation dialog
---
 .../management/endpoints/endpoints.component.ts    | 55 +++++-----------------
 1 file changed, 12 insertions(+), 43 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 60d56d9..fa7b9a7 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
@@ -22,11 +22,10 @@ import { FormGroup, FormBuilder, Validators } from '@angular/forms';
 import { MatDialogRef, MAT_DIALOG_DATA, MatDialog } from '@angular/material/dialog';
 import { ToastrService } from 'ngx-toastr';
 
-import {EndpointService, UserResourceService} from '../../../core/services';
+import { EndpointService } from '../../../core/services';
 import { NotificationDialogComponent } from '../../../shared/modal-dialog/notification-dialog';
 import { PATTERNS } from '../../../core/util';
-import {ExploratoryModel} from "../../../resources/resources-grid/resources-grid.model";
-import {map} from "rxjs/operators";
+import { map } from "rxjs/operators";
 
 export interface Endpoint {
   name: string;
@@ -43,9 +42,6 @@ export class EndpointsComponent implements OnInit {
   public createEndpointForm: FormGroup;
   endpoints: Endpoint[] = [];
   displayedColumns: string[] = ['name', 'url', 'account', 'endpoint_tag', 'actions'];
-  private resources: any;
-  private filtredResource: {projectName, resourceList, nodeStatus};
-
 
   constructor(
     @Inject(MAT_DIALOG_DATA) public data: any,
@@ -54,14 +50,11 @@ export class EndpointsComponent implements OnInit {
     public dialog: MatDialog,
     private endpointService: EndpointService,
     private _fb: FormBuilder,
-    private userResourceService: UserResourceService,
-
   ) { }
 
   ngOnInit() {
     this.initFormModel();
     this.getEndpointList();
-    this.getResource();
   }
 
   public generateEndpointTag($event) {
@@ -75,33 +68,25 @@ export class EndpointsComponent implements OnInit {
     }, error => this.toastr.error(error.message || 'Endpoint connection failed!', 'Oops!'));
   }
 
-
-
-  public deleteEndpoint(data) {
+  public deleteEndpoint(data): void {
     this.endpointService.getEndpointsResource(data.name)
       .pipe(map(resource =>
         resource.projects.map(project =>
-          this.createFilterList(
+          EndpointsComponent.createResourceList(
             project.name,
             resource.exploratories.filter(notebook => notebook.project === project.name),
             project.endpoints.filter(endpoint => endpoint.name === data.name)[0].status))
           .filter(project => project.nodeStatus !== "TERMINATED")))
       .subscribe((resource: any) => {
-       //   this.dialog.open(NotificationDialogComponent, { data: { type: 'confirmation', item: data, list:  resource }, panelClass: 'modal-sm' })
-       //   .afterClosed().subscribe(result => {
-       //   result === 'noTerminate' && this.deleteEndpointOption(data, false);
-       //   result === 'terminate' && this.deleteEndpointOption(data, true);
-       // });
+         this.dialog.open(NotificationDialogComponent, { data: { type: 'confirmation', item: data, list:  resource }, panelClass: 'modal-sm' })
+         .afterClosed().subscribe(result => {
+         result === 'noTerminate' && this.deleteEndpointOption(data, false);
+         result === 'terminate' && this.deleteEndpointOption(data, true);
+       });
     });
-
-    this.dialog.open(NotificationDialogComponent, { data: { type: 'confirmation', item: data, list: this.filtredResource }, panelClass: 'modal-sm' })
-      .afterClosed().subscribe(result => {
-        result === 'noTerminate' && this.deleteEndpointOption(data, false);
-        result === 'terminate' && this.deleteEndpointOption(data, true);
-      });
   }
 
-  createFilterList(name, resource, nodeStatus){
+  private static createResourceList(name: string, resource: Array<any>, nodeStatus: string): Object {
     return {name, resource, nodeStatus}
   }
 
@@ -114,30 +99,14 @@ export class EndpointsComponent implements OnInit {
     });
   }
 
-  private deleteEndpointOption(data, option){
+  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!');
       this.getEndpointList();
     }, error => this.toastr.error(error.message || 'Endpoint creation failed!', 'Oops!'));
   }
 
-  private getEndpointList() {
+  private getEndpointList() : void{
     this.endpointService.getEndpointsData().subscribe((endpoints: any) => this.endpoints = endpoints);
   }
-
-  private getResourceList(endpoint) {
-    console.log(endpoint);
-    this.endpointService.getEndpointsResource(endpoint).subscribe((resource: any) => {
-      this.filtredResource = resource.exploratories;
-
-    });
-  }
-
-  private getResource(): void{
-  this.userResourceService.getUserProvisionedResources()
-   .subscribe((result: any) => {
-     this.resources = ExploratoryModel.loadEnvironments(result);
-     console.log(this.resources)
-    })
-  }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@dlab.apache.org
For additional commands, e-mail: commits-help@dlab.apache.org