You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datalab.apache.org by dg...@apache.org on 2020/11/20 12:36:18 UTC

[incubator-datalab] branch develop updated: [DATALAB-2159]: Removed instance which is already terminated from confirmation dialog (#985)

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-datalab.git


The following commit(s) were added to refs/heads/develop by this push:
     new d7fb015  [DATALAB-2159]: Removed instance which is already terminated from confirmation dialog (#985)
d7fb015 is described below

commit d7fb015a9f5270d5ed59e284a89ba757b9bcd091
Author: Dmytro Gnatyshyn <42...@users.noreply.github.com>
AuthorDate: Fri Nov 20 14:30:05 2020 +0200

    [DATALAB-2159]: Removed instance which is already terminated from confirmation dialog (#985)
    
    [DATALAB-2159]: Removed instance which is already terminated from confirmation dialog
---
 .../resources/resources-grid/resources-grid.component.ts   |  9 ++++-----
 .../confirmation-dialog/confirmation-dialog.component.html |  2 +-
 .../confirmation-dialog/confirmation-dialog.component.ts   | 14 +++++---------
 3 files changed, 10 insertions(+), 15 deletions(-)

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 6b0c198..7bae81b 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
@@ -246,16 +246,15 @@ export class ResourcesGridComponent implements OnInit {
           () => this.buildGrid(),
           error => this.toastr.error(error.message || 'Exploratory starting failed!', 'Oops!'));
     } else if (action === 'stop') {
-      // this.dialog.open(ReconfirmationDialogComponent, {
-      //   data: { notebooks: [data], type: 'notebook', action }, width: '550px', panelClass: 'error-modalbox'
-      // })
-      this.dialog.open(ConfirmationDialogComponent, { data: { notebook: data, type: ConfirmationDialogType.StopExploratory }, panelClass: 'modal-sm' })
+      const compute =  data.resources.filter(cluster => cluster.status === 'running');
+      this.dialog.open(ConfirmationDialogComponent, { data: { notebook: data, compute, type: ConfirmationDialogType.StopExploratory }, panelClass: 'modal-sm' })
         .afterClosed().subscribe((res) => {
         res && this.buildGrid();
       });
     } else if (action === 'terminate') {
+      const compute =  data.resources.filter(cluster => cluster.status === 'running' || cluster.status === 'stopped');
       this.dialog.open(ConfirmationDialogComponent, { data:
-          { notebook: data, type: ConfirmationDialogType.TerminateExploratory }, panelClass: 'modal-sm' })
+          { notebook: data, compute, type: ConfirmationDialogType.TerminateExploratory }, panelClass: 'modal-sm' })
         .afterClosed().subscribe((res) => res && this.buildGrid());
     } else if (action === 'install') {
       this.dialog.open(InstallLibrariesComponent, { data: data, panelClass: 'modal-fullscreen' })
diff --git a/services/self-service/src/main/resources/webapp/src/app/shared/modal-dialog/confirmation-dialog/confirmation-dialog.component.html b/services/self-service/src/main/resources/webapp/src/app/shared/modal-dialog/confirmation-dialog/confirmation-dialog.component.html
index 096a88c..20b0cc1 100644
--- a/services/self-service/src/main/resources/webapp/src/app/shared/modal-dialog/confirmation-dialog/confirmation-dialog.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/shared/modal-dialog/confirmation-dialog/confirmation-dialog.component.html
@@ -69,7 +69,7 @@
                     {{data.type  === 0 ? 'Stopped' : 'Terminated'}}
                   </div>
                 </div>
-                <div class="clusters-list-item" *ngFor="let cluster of notebook?.resources">
+                <div class="clusters-list-item" *ngFor="let cluster of data.compute">
                   <div class="cluster">{{cluster.computational_name}}</div>
                   <div class="status" [ngClass]="{
               'stopped': (data.type === 0 && cluster.image==='docker.datalab-dataengine'), 'terminated': data.type === 1 || (data.type===0 && cluster.image!=='docker.datalab-dataengine')
diff --git a/services/self-service/src/main/resources/webapp/src/app/shared/modal-dialog/confirmation-dialog/confirmation-dialog.component.ts b/services/self-service/src/main/resources/webapp/src/app/shared/modal-dialog/confirmation-dialog/confirmation-dialog.component.ts
index f296535..2a00a6c 100644
--- a/services/self-service/src/main/resources/webapp/src/app/shared/modal-dialog/confirmation-dialog/confirmation-dialog.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/shared/modal-dialog/confirmation-dialog/confirmation-dialog.component.ts
@@ -43,11 +43,10 @@ export class ConfirmationDialogComponent implements OnInit {
   dataengines: Array<any> = [];
   dataengineServices: Array<any> = [];
   confirmationType: number = 0;
+  public isClusterLength: boolean;
 
   @Input() manageAction: boolean = false;
-
   @Output() buildGrid: EventEmitter<{}> = new EventEmitter();
-  public isClusterLength: boolean;
 
   constructor(
     @Inject(MAT_DIALOG_DATA) public data: any,
@@ -61,6 +60,7 @@ export class ConfirmationDialogComponent implements OnInit {
   }
 
   ngOnInit() {
+    console.log(this.data);
     if (this.data.type !== 5) {
       this.confirmationType = this.data.type;
       this.notebook = this.data.notebook;
@@ -74,7 +74,7 @@ export class ConfirmationDialogComponent implements OnInit {
         this.healthStatusService,
         this.manageEnvironmentsService);
 
-      if (!this.confirmationType) this.filterResourcesByType(this.notebook.resources);
+      if (!this.confirmationType) this.filterResourcesByType(this.data.compute);
       this.isAliveResources = this.model.isAliveResources(this.notebook.resources);
       this.onlyKilled = this.notebook.resources ?
         !this.notebook.resources.some(el => el.status !== 'terminated' && el.status !== 'failed')
@@ -82,7 +82,7 @@ export class ConfirmationDialogComponent implements OnInit {
     }
 
     if (this.data.type === 0 || this.data.type === 1) {
-      if (this.notebook.resources.length) {
+      if (this.data.compute.length) {
         this.isClusterLength = true;
       }
     }
@@ -93,11 +93,7 @@ export class ConfirmationDialogComponent implements OnInit {
   }
 
   private filterResourcesByType(resources) {
-    resources
-      .filter(resource =>
-        (resource.status !== 'failed' && resource.status !== 'terminated'
-          && resource.status !== 'terminating' && resource.status !== 'stopped'))
-      .forEach(resource => {
+    resources.forEach(resource => {
         (resource.image === 'docker.datalab-dataengine') ? this.dataengines.push(resource) : this.dataengineServices.push(resource);
       });
   }


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