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/30 09:42:34 UTC

[incubator-dlab] 01/01: [DLAB-1488]: Fixed project status is not auto-updated

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

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

commit a163c5f4d7535a47cac218ad03ee006384ea2f2d
Author: Dmytro Gnatyshyn <di...@ukr.net>
AuthorDate: Thu Jan 30 11:41:09 2020 +0200

    [DLAB-1488]: Fixed project status is not auto-updated
---
 .../app/administration/project/project-data.service.ts | 17 ++++++++---------
 .../edge-action-dialog/edge-action-dialog.component.ts | 18 ++++++------------
 2 files changed, 14 insertions(+), 21 deletions(-)

diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/project/project-data.service.ts b/services/self-service/src/main/resources/webapp/src/app/administration/project/project-data.service.ts
index d4d721b..e21990d 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/project/project-data.service.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/project/project-data.service.ts
@@ -27,7 +27,7 @@ import { Project } from './project.component';
 @Injectable()
 export class ProjectDataService {
   _projects = new BehaviorSubject<any>(null);
-
+  endpointsList: any;
   constructor(private projectService: ProjectService, private endpointService: EndpointService) {
     this.getProjectsList();
   }
@@ -37,18 +37,17 @@ export class ProjectDataService {
   }
 
   private getProjectsList() {
-    let endpointsList;
-    this.endpointService.getEndpointsData().subscribe(list => endpointsList = list);
+    this.endpointService.getEndpointsData().subscribe(list => this.endpointsList = list);
     this.projectService.getProjectsList()
       .pipe(
         mergeMap ((response: Project[]) => {
-            if(response) {
+            if (response) {
               response.forEach(project => project.endpoints.forEach(endpoint => {
-                const filtredEndpoints =  endpointsList.filter(v => v.name === endpoint.name);
-                if(filtredEndpoints.length){
-                  endpoint.endpointStatus = endpointsList.filter(v => v.name === endpoint.name)[0].status;
-                }else{
-                  endpoint.endpointStatus = "N/A"
+                const filtredEndpoints =  this.endpointsList.filter(v => v.name === endpoint.name);
+                if (filtredEndpoints.length) {
+                  endpoint.endpointStatus = this.endpointsList.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/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 9f75c8f..511cd62 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
@@ -5,10 +5,10 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
 @Component({
   selector: 'edge-action-dialog',
   template: `
-  <div id="dialog-box">
+  <div id="dialog-box" *ngIf="data.type">
     <header class="dialog-header">
       <h4 class="modal-title"><span class="action">{{data.type | titlecase}}</span> edge node</h4>
-      <button type="button" class="close" (click)="dialogRef.close()">&times;</button>
+      <button type="button" class="close" (click)="closeModal()">&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>
@@ -24,7 +24,7 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
       <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" mat-raised-button (click)="closeModal()">No</button>
         <button type="button" class="butt butt-success" mat-raised-button (click)="dialogRef.close(endpointsNewStatus)" [disabled]="!endpointsNewStatus.length">Yes</button>
       </div>
       </div>
@@ -42,18 +42,10 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
     .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;}
   `]
 })
 
@@ -64,7 +56,9 @@ export class EdgeActionDialogComponent {
     @Inject(MAT_DIALOG_DATA) public data: any) {
   }
 
-  ngOnInit() {
+  private closeModal() {
+    this.dialogRef.close();
+    this.data.item.forEach(endpoint => endpoint.checked = false);
   }
 
   public endpointAction() {


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