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/30 15:32:19 UTC

[incubator-dlab] 01/01: [DLAB-1420]: Fixed bugs in action menu for project management

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

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

commit 8f7974ce5994c80d00c335192b3979bc6de1059a
Author: Dmytro Gnatyshyn <di...@ukr.net>
AuthorDate: Mon Dec 30 17:31:31 2019 +0200

    [DLAB-1420]: Fixed bugs in  action menu for project management
---
 .../project-list/project-list.component.html       | 27 +++++++++++-----------
 .../project/project-list/project-list.component.ts |  7 +++++-
 .../administration/project/project.component.ts    |  2 +-
 .../src/app/core/services/endpoint.service.ts      |  1 -
 .../edge-action-dialog.component.ts                | 10 ++++----
 .../notification-dialog.component.ts               | 11 +++++----
 6 files changed, 32 insertions(+), 26 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 06246d4..b8c1c39 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
@@ -69,35 +69,34 @@
       <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)">
+          <li class="project-seting-item" *ngIf="areStoppedEndpoints(element)" (click)="openEdgeDialog('start', element)">
             <i class="material-icons">play_circle_outline</i>
-            <a class="action" (click)="openEdgeDialog('start', element)">
+            <a class="action">
               Start edge node
             </a>
           </li>
-          <li class="project-seting-item" *ngIf="areStartedEndpoints(element)">
+          <li class="project-seting-item" *ngIf="areStartedEndpoints(element)" (click)="openEdgeDialog('stop', element )">
             <i class="material-icons">pause_circle_outline</i>
-            <a class="action" (click)="openEdgeDialog('stop', element )">
+            <a class="action" >
               Stop edge node
             </a>
           </li>
-          <li class="project-seting-item " *ngIf="areStoppedEndpoints(element) || areStartedEndpoints(element)">
-            <i class="material-icons">highlight_off</i>
-            <a class="action" (click)="openEdgeDialog('terminate', element)">
+          <li class="project-seting-item " *ngIf="areStoppedEndpoints(element) || areStartedEndpoints(element)" (click)="openEdgeDialog('terminate', element)">
+            <i class="material-icons">phonelink_off</i>
+            <a class="action">
               Terminate edge node
             </a>
           </li>
-          <li class="project-seting-item">
+          <li class="project-seting-item" (click)="editProject(element)">
             <i class="material-icons">mode_edit</i>
-            <a (click)="editProject(element)">
-              Edit {{element.name }}
+            <a >
+              Edit project
             </a>
           </li>
-          <li class="project-seting-item" *ngIf="!isInProgress(element) && isActiveEndpoint(element)">
+          <li class="project-seting-item" *ngIf="!isInProgress(element) && isActiveEndpoint(element)" (click)="deleteProject(element)">
             <i class="material-icons">delete_forever</i>
-            <a (click)="deleteProject(element)" class="action"
-               [ngClass]="{'not-allowed' : isInProgress(element) || !isActiveEndpoint(element) }">
-              Delete {{element.name }}
+            <a  class="action" [ngClass]="{'not-allowed' : isInProgress(element) || !isActiveEndpoint(element) }">
+              Delete project
             </a>
           </li>
         </ul>
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 5256d77..146e99e 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
@@ -73,7 +73,12 @@ export class ProjectListComponent implements OnInit, OnDestroy {
       this.endpointService.getEndpointsData().subscribe((endpoints: any) => {
         if(this.projectList){
           this.projectList.forEach(project => project.endpoints.forEach(endpoint => {
-            endpoint.endpointStatus = endpoints.filter(v => v.name === endpoint.name)[0].status;
+            const filtredEndpoints =  endpoints.filter(v => v.name === endpoint.name);
+            if(filtredEndpoints.length){
+              endpoint.endpointStatus = endpoints.filter(v => v.name === endpoint.name)[0].status;
+            }else{
+              endpoint.endpointStatus = "N/A"
+            }
           }))
         }
        });
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 382cd17..72b6430 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
@@ -105,7 +105,7 @@ export class ProjectComponent implements OnInit, OnDestroy {
   }
 
   public deleteProject($event) {
-    this.dialog.open(NotificationDialogComponent, { data: { type: 'confirmation', item: $event }, panelClass: 'modal-sm' })
+    this.dialog.open(NotificationDialogComponent, { data: { type: 'confirmation', item: $event , action: 'decommissioned', }, panelClass: 'modal-sm' })
       .afterClosed().subscribe(result => {
         result && this.projectService.deleteProject($event.name).subscribe(() => {
           this.refreshGrid();
diff --git a/services/self-service/src/main/resources/webapp/src/app/core/services/endpoint.service.ts b/services/self-service/src/main/resources/webapp/src/app/core/services/endpoint.service.ts
index 2abe823..67efbe2 100644
--- a/services/self-service/src/main/resources/webapp/src/app/core/services/endpoint.service.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/core/services/endpoint.service.ts
@@ -36,7 +36,6 @@ export class EndpointService {
       .buildGetEndpointsData()
       .pipe(
         map(response => {
-          console.log(response);
           return response
         }),
         catchError(ErrorUtils.handleServiceError));
diff --git a/services/self-service/src/main/resources/webapp/src/app/shared/modal-dialog/edge-action-dialog/edge-action-dialog.component.ts b/services/self-service/src/main/resources/webapp/src/app/shared/modal-dialog/edge-action-dialog/edge-action-dialog.component.ts
index 0152c3d..f223c74 100644
--- a/services/self-service/src/main/resources/webapp/src/app/shared/modal-dialog/edge-action-dialog/edge-action-dialog.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/shared/modal-dialog/edge-action-dialog/edge-action-dialog.component.ts
@@ -10,7 +10,7 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
       <h4 class="modal-title"><span class="action">{{data.type | titlecase}}</span> endpoints</h4>
       <button type="button" class="close" (click)="dialogRef.close()">&times;</button>
     </header>
-      <div mat-dialog-content class="content message">
+      <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">
@@ -20,12 +20,13 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
                   </label>
               </li>
           </ul>
-      </div>
+
       <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-10">
         <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)">Yes</button>
+        <button type="button" class="butt butt-success" mat-raised-button (click)="dialogRef.close(endpointsNewStatus)" [disabled]="!endpointsNewStatus.length">Yes</button>
+      </div>
       </div>
   </div>
   `,
@@ -57,7 +58,7 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
 })
 
 export class EdgeActionDialogComponent {
-  public endpointsNewStatus: Array<object>;
+  public endpointsNewStatus: Array<object> = [];
   constructor(
     public dialogRef: MatDialogRef<EdgeActionDialogComponent>,
     @Inject(MAT_DIALOG_DATA) public data: any) {
@@ -68,5 +69,6 @@ export class EdgeActionDialogComponent {
 
   public endpointAction() {
     this.endpointsNewStatus = this.data.item.filter(endpoint => endpoint.checked);
+    console.log(this.endpointsNewStatus)
   }
 }
diff --git a/services/self-service/src/main/resources/webapp/src/app/shared/modal-dialog/notification-dialog/notification-dialog.component.ts b/services/self-service/src/main/resources/webapp/src/app/shared/modal-dialog/notification-dialog/notification-dialog.component.ts
index 37aad61..0961008 100644
--- a/services/self-service/src/main/resources/webapp/src/app/shared/modal-dialog/notification-dialog/notification-dialog.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/shared/modal-dialog/notification-dialog/notification-dialog.component.ts
@@ -56,6 +56,7 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
                   <ng-template #label>
                       <p>
             <span *ngIf="!!data.list">Endpoint</span>
+            <span *ngIf="data.action && data.action === 'decommissioned'">Project</span>
             <span class="ellipsis strong" matTooltip="{{ data.item.name }}" matTooltipPosition="above"
                   [matTooltipDisabled]="data.item.name.length > 35">
              {{ data.item.name }}</span> will be {{ data.action || 'disconnected' }}.
@@ -123,14 +124,14 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
     header h4 i { vertical-align: bottom; }
     header a i { font-size: 20px; }
     header a:hover i { color: #35afd5; cursor: pointer; }
-    .plur { font-style: normal; }    
+    .plur { font-style: normal; }
     .scrolling-content{overflow-y: auto; max-height: 200px; }
     .endpoint { width: 70%; text-align: left; color: #577289;}
     .status { width: 30%;text-align: left;}
     .label { font-size: 15px; font-weight: 500; font-family: "Open Sans",sans-serif;}
-    .node { font-weight: 300;}     
+    .node { font-weight: 300;}
     .resource-name { width: 280px;text-align: left; padding: 10px 0;line-height: 26px;}
-    .project { width: 30%;text-align: left; padding: 10px 0;line-height: 26px;}    
+    .project { width: 30%;text-align: left; padding: 10px 0;line-height: 26px;}
     .resource-list{max-width: 100%; margin: 0 auto;margin-top: 20px; }
     .resource-list-header{display: flex; font-weight: 600; font-size: 16px;height: 48px; border-top: 1px solid #edf1f5; border-bottom: 1px solid #edf1f5; padding: 0 20px;}
     .resource-list-row{display: flex; border-bottom: 1px solid #edf1f5;padding: 0 20px;}
@@ -138,8 +139,8 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
     .confirm-message{color: #35afd5;font-size: 13px;min-height: 18px; text-align: center;}
     .checkbox{margin-right: 5px;vertical-align: middle; margin-bottom: 3px;}
     label{cursor: pointer}
-    
-    
+
+
   `]
 })
 export class NotificationDialogComponent{


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