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/10/05 14:31:55 UTC

[incubator-datalab] 02/02: [DATALAB-1534]: Added possibility to recreate edge node after edge termination/failing

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

dgnatyshyn pushed a commit to branch DATALAB-1534
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git

commit 7bbdbe7a1d976b01820554f2ac2c887fa3596ab9
Author: Dmytro_Gnatyshyn <di...@ukr.net>
AuthorDate: Mon Oct 5 17:31:30 2020 +0300

    [DATALAB-1534]: Added possibility to recreate edge node after edge termination/failing
---
 .../project/project-list/project-list.component.html        | 12 +++++++++---
 .../project/project-list/project-list.component.ts          | 13 +++++++++++++
 .../src/app/administration/project/project.component.ts     |  3 +++
 3 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/project/project-list/project-list.component.html b/services/self-service/src/main/resources/webapp/src/app/administration/project/project-list/project-list.component.html
index ef82f31..81d4ddf 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/project/project-list/project-list.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/project/project-list/project-list.component.html
@@ -71,19 +71,25 @@
       <bubble-up #actions class="list-menu" position="bottom-left" alternative="top-left">
         <ul class="list-unstyled">
           <div class="active-items"></div>
-          <li class="project-seting-item" *ngIf="areStoppedEndpoints(element)" (click)="openEdgeDialog('start', element)">
+          <li class="project-seting-item" *ngIf="element.areStoppedNode" (click)="openEdgeDialog('start', element)">
             <i class="material-icons">play_circle_outline</i>
             <a class="action">
               Start edge node
             </a>
           </li>
-          <li class="project-seting-item" *ngIf="areStartedEndpoints(element)" (click)="openEdgeDialog('stop', element )">
+          <li class="project-seting-item" *ngIf="element.areRunningNode" (click)="openEdgeDialog('stop', element )">
             <i class="material-icons">pause_circle_outline</i>
             <a class="action" >
               Stop edge node
             </a>
           </li>
-          <li class="project-seting-item " *ngIf="areStoppedEndpoints(element) || areStartedEndpoints(element)" (click)="openEdgeDialog('terminate', element)">
+          <li class="project-seting-item " *ngIf="element.areTerminatedNode" (click)="openEdgeDialog('recreate', element)">
+            <i class="material-icons">refresh</i>
+            <a class="action">
+              Recreate edge node
+            </a>
+          </li>
+          <li class="project-seting-item " *ngIf="element.areStoppedNode || element.areRunningNode" (click)="openEdgeDialog('terminate', element)">
             <i class="material-icons">phonelink_off</i>
             <a class="action">
               Terminate edge node
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/project/project-list/project-list.component.ts b/services/self-service/src/main/resources/webapp/src/app/administration/project/project-list/project-list.component.ts
index 5d20373..4900fd8 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/project/project-list/project-list.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/project/project-list/project-list.component.ts
@@ -70,6 +70,13 @@ export class ProjectListComponent implements OnInit, OnDestroy {
     setTimeout(() => {this.progressBarService.startProgressBar(); } , 0);
     this.subscriptions.add(this.projectDataService._projects.subscribe((value: Project[]) => {
       this.projectList = value;
+      if (this.projectList) {
+        this.projectList.forEach(project => {
+          project.areRunningNode = this.areStartedEndpoints(project);
+          project.areStoppedNode = this.areStoppedEndpoints(project);
+          project.areTerminatedNode = this.areTerminatedOrFailedEndpoints(project);
+        });
+      }
       if (value) this.dataSource = new MatTableDataSource(value);
       this.progressBarService.stopProgressBar();
     }, () => this.progressBarService.stopProgressBar()));
@@ -117,6 +124,9 @@ export class ProjectListComponent implements OnInit, OnDestroy {
         if (action === 'terminate') {
           return endpoint.status === 'RUNNING' || endpoint.status === 'STOPPED';
         }
+        if (action === 'recreate') {
+          return endpoint.status === 'TERMINATED' || endpoint.status === 'FAILED';
+        }
       });
       this.dialog.open(EdgeActionDialogComponent, {data: {type: action, item: endpoints}, panelClass: 'modal-sm'})
         .afterClosed().subscribe(endpoint => {
@@ -134,4 +144,7 @@ export class ProjectListComponent implements OnInit, OnDestroy {
   public areStoppedEndpoints(project) {
     return project.endpoints.filter(endpoint => endpoint.status === 'STOPPED').length > 0;
   }
+  public areTerminatedOrFailedEndpoints(project) {
+    return project.endpoints.filter(endpoint => endpoint.status === 'TERMINATED' || endpoint.status === 'FAILED').length > 0;
+  }
 }
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 183be85..6779c5c 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
@@ -40,6 +40,9 @@ export interface Project {
   tag: string;
   groups: string[];
   shared_image_enabled?: boolean;
+  areStoppedNode?: boolean;
+  areTerminatedNode?: boolean;
+  areRunningNode?: boolean;
 }
 
 @Component({


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