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 2020/01/29 11:40:52 UTC

[incubator-dlab] branch DLAB-1357 updated: Added confirmation dialog for clusters action

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

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


The following commit(s) were added to refs/heads/DLAB-1357 by this push:
     new 20b1df1  Added confirmation dialog for clusters action
20b1df1 is described below

commit 20b1df17b7102c64c608e402140b0f3649372743
Author: Dmytro Gnatyshyn <di...@ukr.net>
AuthorDate: Wed Jan 29 13:37:59 2020 +0200

    Added confirmation dialog for clusters action
---
 .../legion-list/legion-list.component.html         |  2 +-
 .../legion-list/legion-list.component.ts           | 17 +++++++++--
 .../webapp/src/app/administration/project/index.ts |  2 +-
 .../odahu-action-dialog.component.ts               | 33 ++--------------------
 4 files changed, 19 insertions(+), 35 deletions(-)

diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/legion-deployment/legion-list/legion-list.component.html b/services/self-service/src/main/resources/webapp/src/app/administration/legion-deployment/legion-list/legion-list.component.html
index 11325bc..0a30f4d 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/legion-deployment/legion-list/legion-list.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/legion-deployment/legion-list/legion-list.component.html
@@ -53,7 +53,7 @@
               Stop
             </a>
           </li>
-          <li class="project-seting-item" (click)="odahuAction(element, 'terminate')">
+          <li class="project-seting-item" *ngIf="element.status !== 'TERMINATED' || element.status !== 'TERMINATING'" (click)="odahuAction(element, 'terminate')">
             <i class="material-icons">phonelink_off</i>
             <a class="action">
               Terminate
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/legion-deployment/legion-list/legion-list.component.ts b/services/self-service/src/main/resources/webapp/src/app/administration/legion-deployment/legion-list/legion-list.component.ts
index 8f1931b..ce7c1b3 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/legion-deployment/legion-list/legion-list.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/legion-deployment/legion-list/legion-list.component.ts
@@ -3,6 +3,10 @@ import {Subscription} from 'rxjs';
 import {LegionDeploymentDataService} from '../legion-deployment-data.service';
 import { MatTableDataSource } from '@angular/material/table';
 import {LegionDeploymentService} from '../../../core/services';
+import {EdgeActionDialogComponent} from '../../../shared/modal-dialog/edge-action-dialog';
+import {ToastrService} from 'ngx-toastr';
+import {MatDialog} from '@angular/material/dialog';
+import {OdahuActionDialogComponent, OdahuActionDialogModule} from '../../../shared/modal-dialog/odahu-action-dialog';
 
 @Component({
   selector: 'legion-list',
@@ -17,7 +21,9 @@ export class LegionListComponent implements OnInit {
 
   constructor(
     private legionDeploymentDataService: LegionDeploymentDataService,
-    private legionDeploymentService: LegionDeploymentService
+    private legionDeploymentService: LegionDeploymentService,
+    public toastr: ToastrService,
+    public dialog: MatDialog
   ) { }
 
   ngOnInit() {
@@ -31,8 +37,13 @@ export class LegionListComponent implements OnInit {
   }
 
   private odahuAction(element: any, action: string) {
-    this.legionDeploymentService.odahuAction(element,  action).subscribe(v =>
-      this.legionDeploymentDataService.updateClasters()
+    this.dialog.open(OdahuActionDialogComponent, {data: {type: action, item: element}, panelClass: 'modal-sm'})
+      .afterClosed().subscribe(result => {
+        result && this.legionDeploymentService.odahuAction(element,  action).subscribe(v =>
+          this.legionDeploymentDataService.updateClasters(),
+          error => this.toastr.error(`Odahu cluster ${action} failed!`, 'Oops!')
+        ) ;
+      }, error => this.toastr.error(error.message || `Odahu cluster ${action} failed!`, 'Oops!')
     );
   }
 
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/project/index.ts b/services/self-service/src/main/resources/webapp/src/app/administration/project/index.ts
index 609ea59..8203e55 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/project/index.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/project/index.ts
@@ -30,7 +30,7 @@ import { ProjectListComponent } from './project-list/project-list.component';
 
 import { ProjectComponent, EditProjectComponent } from './project.component';
 import { ProjectDataService } from './project-data.service';
-import {BubbleModule} from "../../shared/bubble";
+import {BubbleModule} from '../../shared/bubble';
 
 @NgModule({
   imports: [
diff --git a/services/self-service/src/main/resources/webapp/src/app/shared/modal-dialog/odahu-action-dialog/odahu-action-dialog.component.ts b/services/self-service/src/main/resources/webapp/src/app/shared/modal-dialog/odahu-action-dialog/odahu-action-dialog.component.ts
index a5923f0..3ead81e 100644
--- a/services/self-service/src/main/resources/webapp/src/app/shared/modal-dialog/odahu-action-dialog/odahu-action-dialog.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/shared/modal-dialog/odahu-action-dialog/odahu-action-dialog.component.ts
@@ -7,64 +7,37 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
   template: `
   <div id="dialog-box">
     <header class="dialog-header">
-      <h4 class="modal-title"><span class="action">{{data.type | titlecase}}</span> edge node</h4>
+      <h4 class="modal-title"><span class="action">{{data.type | titlecase}}</span> Odahu cluster</h4>
       <button type="button" class="close" (click)="dialogRef.close()">&times;</button>
     </header>
       <div mat-dialog-content class="content message mat-dialog-content">
-          <h3 class="strong">Select the items you want to {{data.type}}</h3>
-          <ul class="endpoint-list scrolling-content">
-              <li *ngFor="let endpoint of data.item" class="endpoint-list-item">
-                  <label class="strong">
-                      <input type="checkbox" [(ngModel)]="endpoint.checked" (change)="endpointAction()">
-                      {{endpoint.name}}
-                  </label>
-              </li>
-          </ul>
-
+          <h3 class="strong">Odahu cluster {{data.item.name}} will be {{data.type}}</h3>
       <p class="m-top-20 action-text"><span class="strong">Do you want to proceed?</span></p>
 
       <div class="text-center m-top-30 m-bott-30">
         <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(endpointsNewStatus)" [disabled]="!endpointsNewStatus.length">Yes</button>
+        <button type="button" class="butt butt-success" mat-raised-button (click)="dialogRef.close(true)">Yes</button>
       </div>
       </div>
   </div>
   `,
   styles: [`
     .content { color: #718ba6; padding: 20px 50px; font-size: 14px; font-weight: 400; margin: 0; }
-    .info { color: #35afd5; }
     .info .confirm-dialog { color: #607D8B; }
     header { display: flex; justify-content: space-between; color: #607D8B; }
     header h4 i { vertical-align: bottom; }
     header a i { font-size: 20px; }
     header a:hover i { color: #35afd5; cursor: pointer; }
-    .endpoint-list{text-align: left; margin-top: 30px}
-    .endpoint-list-item{padding: 5px 0}
     .action{text-transform: capitalize}
     .action-text { text-align: center; }
-    .label-name { display: inline-block; width: 100% }
-    .scrolling-content{overflow-y: auto; max-height: 200px; }
-    .endpoint { width: 70%; text-align: left; color: #577289;}
-    .status { width: 30%;text-align: right;}
     label { font-size: 15px; font-weight: 500; font-family: "Open Sans",sans-serif; cursor: pointer; display: flex; align-items: center;}
     label input {margin-top: 2px; margin-right: 5px;}
-
-    .node { font-weight: 300;}
-    .label-name { display: inline-block; width: 100%}
-    .scrolling-content{overflow-y: auto; max-height: 200px;}
-    .endpoint { width: 280px;text-align: left;}
-    .status { text-align: left;}
   `]
 })
 
 export class OdahuActionDialogComponent {
-  public endpointsNewStatus: Array<object> = [];
   constructor(
     public dialogRef: MatDialogRef<OdahuActionDialogComponent>,
     @Inject(MAT_DIALOG_DATA) public data: any) {
   }
-
-  public endpointAction() {
-    this.endpointsNewStatus = this.data.item.filter(endpoint => endpoint.checked);
-  }
 }


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