You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dlab.apache.org by an...@apache.org on 2019/07/03 14:44:07 UTC

[incubator-dlab] branch feature/projects updated (3ec5b41 -> b86a97f)

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

ankovalyshyn pushed a change to branch feature/projects
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git.


    from 3ec5b41  DLAB-835 added project_name param for start/stop actions
     new 0224312  [DLAB-831]: prevent project edition for not active projects
     new 93c2639  [DLAB-834]: added stop / start actions to project
     new 8e861a1  [DLAB-834]: added stop / start actions to project service
     new b86a97f  Merge branch 'feature/projects' of github.com:apache/incubator-dlab into feature/projects

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../project-list/project-list.component.html       | 17 ++++++-
 .../project/project-list/project-list.component.ts |  9 +++-
 .../administration/project/project.component.html  |  4 +-
 .../administration/project/project.component.ts    | 17 +++++++
 .../services/applicationServiceFacade.service.ts   | 57 +++++++++++++---------
 .../src/app/core/services/project.service.ts       | 13 ++++-
 .../resources-grid/resources-grid.component.css    |  5 +-
 .../notification-dialog.component.ts               |  4 +-
 .../src/main/resources/webapp/src/styles.scss      |  5 +-
 9 files changed, 97 insertions(+), 34 deletions(-)


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


[incubator-dlab] 01/04: [DLAB-831]: prevent project edition for not active projects

Posted by an...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ankovalyshyn pushed a commit to branch feature/projects
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git

commit 0224312dad8a87744e20eedc63fa70475be7519b
Author: Andriana Kovalyshyn <An...@epam.com>
AuthorDate: Wed Jul 3 14:12:34 2019 +0300

    [DLAB-831]: prevent project edition for not active projects
---
 .../project/project-list/project-list.component.html               | 7 +++++--
 .../src/app/resources/resources-grid/resources-grid.component.css  | 5 ++++-
 services/self-service/src/main/resources/webapp/src/styles.scss    | 5 +++--
 3 files changed, 12 insertions(+), 5 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 d43d801..0423209 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
@@ -51,8 +51,11 @@
   <ng-container matColumnDef="actions">
     <th mat-header-cell *matHeaderCellDef class="project-actions"></th>
     <td mat-cell *matCellDef="let element" class="project-actions">
-      <span (click)="editProject(element)">
-        <mat-icon>mode_edit</mat-icon>
+      <span [ngClass]="{'not-active' : element.status.toLowerCase() !== 'active' }">
+        <a [ngClass]="{'not-allowed' : element.status.toLowerCase() !== 'active' }"
+          (click)="element.status.toLowerCase() === 'active' && editProject(element)">
+          <mat-icon>mode_edit</mat-icon>
+        </a>
       </span>
       <span (click)="deleteProject(element)">
         <mat-icon>delete_forever</mat-icon>
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.css b/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.css
index 406e726..f013f2d 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.css
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.css
@@ -149,6 +149,7 @@
 .settings {
   position: relative;
 }
+
 .settings .disabled {
   opacity: 0.4;
   cursor: not-allowed;
@@ -168,12 +169,13 @@
 .data-grid .list-menu li {
   font-size: 14px;
   border-bottom: 1px solid #edf1f5;
-  padding: 12px 15px;
+  padding: 8px 15px;
   cursor: pointer;
   margin: 5px -5px;
   color: #577289;
   transition: all 0.45s ease-in-out;
 }
+
 .data-grid .list-menu a.navigate {
   text-decoration: none;
   color: #577289;
@@ -207,6 +209,7 @@
 .data-grid .message_block {
   background: #edf6f9;
 }
+
 .message_block td {
   text-align: left !important;
 }
diff --git a/services/self-service/src/main/resources/webapp/src/styles.scss b/services/self-service/src/main/resources/webapp/src/styles.scss
index ed72357..5b72b0f 100644
--- a/services/self-service/src/main/resources/webapp/src/styles.scss
+++ b/services/self-service/src/main/resources/webapp/src/styles.scss
@@ -104,7 +104,8 @@ mat-chip.mat-chip strong {
 
 .running,
 .starting,
-.installed {
+.installed,
+.active {
   color: #49af38;
 }
 
@@ -141,7 +142,7 @@ mat-chip.mat-chip strong {
 }
 
 .not-active {
-  cursor: not-allowed;
+  cursor: not-allowed !important;
   opacity: .6;
 }
 


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


[incubator-dlab] 04/04: Merge branch 'feature/projects' of github.com:apache/incubator-dlab into feature/projects

Posted by an...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ankovalyshyn pushed a commit to branch feature/projects
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git

commit b86a97f4099ebedf3b5ebb86b3acb13f25eb58d7
Merge: 8e861a1 3ec5b41
Author: Andriana Kovalyshyn <An...@epam.com>
AuthorDate: Wed Jul 3 17:43:55 2019 +0300

    Merge branch 'feature/projects' of github.com:apache/incubator-dlab into feature/projects

 .../dto/base/computational/ComputationalBase.java  | 12 +++++++++
 .../service/impl/ComputationalServiceImpl.java     |  6 +++--
 .../epam/dlab/backendapi/util/RequestBuilder.java  | 26 ++++++++++++-------
 .../service/impl/ComputationalServiceImplTest.java | 29 ++++++++++++----------
 .../dlab/backendapi/util/RequestBuilderTest.java   |  6 ++---
 5 files changed, 52 insertions(+), 27 deletions(-)


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


[incubator-dlab] 03/04: [DLAB-834]: added stop / start actions to project service

Posted by an...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ankovalyshyn pushed a commit to branch feature/projects
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git

commit 8e861a1a99cabefa476cefda8ddfb2628c3073f6
Author: Andriana Kovalyshyn <An...@epam.com>
AuthorDate: Wed Jul 3 17:43:40 2019 +0300

    [DLAB-834]: added stop / start actions to project service
---
 .../services/applicationServiceFacade.service.ts   | 57 +++++++++++++---------
 .../src/app/core/services/project.service.ts       | 13 ++++-
 .../notification-dialog.component.ts               |  4 +-
 3 files changed, 47 insertions(+), 27 deletions(-)

diff --git a/services/self-service/src/main/resources/webapp/src/app/core/services/applicationServiceFacade.service.ts b/services/self-service/src/main/resources/webapp/src/app/core/services/applicationServiceFacade.service.ts
index bec6ee9..2cfb52d 100644
--- a/services/self-service/src/main/resources/webapp/src/app/core/services/applicationServiceFacade.service.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/core/services/applicationServiceFacade.service.ts
@@ -95,8 +95,9 @@ export class ApplicationServiceFacade {
     return this.buildRequest(RequestMethod.Post,
       this.requestRegistry.Item(ApplicationServiceFacade.AUTHORIZE),
       body,
-      { responseType: 'text',
-        headers: { 'Content-Type': 'text/plain'},
+      {
+        responseType: 'text',
+        headers: { 'Content-Type': 'text/plain' },
         observe: 'response'
       });
   }
@@ -112,7 +113,7 @@ export class ApplicationServiceFacade {
     return this.buildRequest(RequestMethod.Get,
       this.requestRegistry.Item(ApplicationServiceFacade.ACCESS_KEY),
       null,
-      { observe: 'response'});
+      { observe: 'response' });
   }
 
   public buildGenerateAccessKey(): Observable<any> {
@@ -133,8 +134,9 @@ export class ApplicationServiceFacade {
     return this.buildRequest(RequestMethod.Post,
       this.requestRegistry.Item(ApplicationServiceFacade.ACCESS_KEY),
       body,
-      { observe: 'response',
-        headers: { 'Upload': 'true'}
+      {
+        observe: 'response',
+        headers: { 'Upload': 'true' }
       });
   }
 
@@ -142,8 +144,9 @@ export class ApplicationServiceFacade {
     return this.buildRequest(RequestMethod.Post,
       this.requestRegistry.Item(ApplicationServiceFacade.ACCESS_KEY) + option,
       body,
-      { observe: 'response',
-        headers: { 'Upload': 'true'}
+      {
+        observe: 'response',
+        headers: { 'Upload': 'true' }
       });
   }
 
@@ -183,14 +186,14 @@ export class ApplicationServiceFacade {
     return this.buildRequest(RequestMethod.Put,
       this.requestRegistry.Item(ApplicationServiceFacade.COMPUTATIONAL_RESOURCES_DATAENGINESERVICE),
       data,
-      { observe: 'response'});
+      { observe: 'response' });
   }
 
   public buildCreateComputationalResources_DataengineRequest(data): Observable<any> {
     return this.buildRequest(RequestMethod.Put,
       this.requestRegistry.Item(ApplicationServiceFacade.COMPUTATIONAL_RESOURCES_DATAENGINE),
       data,
-      { observe: 'response'});
+      { observe: 'response' });
   }
 
   public buildDeleteComputationalResourcesRequest(data): Observable<any> {
@@ -236,21 +239,21 @@ export class ApplicationServiceFacade {
       data);
   }
 
-  public buildRunEdgeNodeRequest(): Observable<any>  {
+  public buildRunEdgeNodeRequest(): Observable<any> {
     return this.buildRequest(RequestMethod.Post,
       this.requestRegistry.Item(ApplicationServiceFacade.EDGE_NODE_START),
       null,
       { responseType: 'text' });
   }
 
-  public buildSuspendEdgeNodeRequest(): Observable<any>  {
+  public buildSuspendEdgeNodeRequest(): Observable<any> {
     return this.buildRequest(RequestMethod.Post,
       this.requestRegistry.Item(ApplicationServiceFacade.EDGE_NODE_STOP),
       null,
       { responseType: 'text', observe: 'response' });
   }
 
-  public buildRecreateEdgeNodeRequest(): Observable<any>  {
+  public buildRecreateEdgeNodeRequest(): Observable<any> {
     return this.buildRequest(RequestMethod.Post,
       this.requestRegistry.Item(ApplicationServiceFacade.EDGE_NODE_RECREATE),
       null,
@@ -279,7 +282,7 @@ export class ApplicationServiceFacade {
     return this.buildRequest(RequestMethod.Post,
       this.requestRegistry.Item(ApplicationServiceFacade.LIB_INSTALL),
       data,
-      { observe: 'response', responseType: 'text'});
+      { observe: 'response', responseType: 'text' });
   }
 
   public buildGetInstalledLibrariesList(data): Observable<any> {
@@ -360,7 +363,7 @@ export class ApplicationServiceFacade {
     return this.buildRequest(RequestMethod.Post,
       this.requestRegistry.Item(ApplicationServiceFacade.SCHEDULER) + param,
       data,
-      { observe: 'response'});
+      { observe: 'response' });
   }
 
   public buildResetScheduleSettings(data): Observable<any> {
@@ -379,29 +382,31 @@ export class ApplicationServiceFacade {
     return this.buildRequest(RequestMethod.Get,
       this.requestRegistry.Item(ApplicationServiceFacade.ACTIVE_LIST),
       null);
-    }
+  }
 
   public buildManageEnvironment(action, data): Observable<any> {
     return this.buildRequest(RequestMethod.Post,
       this.requestRegistry.Item(ApplicationServiceFacade.ENV) + action,
       data,
-      { observe: 'response',
-        headers: { 'Content-Type': 'text/plain'}
+      {
+        observe: 'response',
+        headers: { 'Content-Type': 'text/plain' }
       });
-    }
+  }
 
   public buildGetAllEnvironmentData(): Observable<any> {
     return this.buildRequest(RequestMethod.Get,
       this.requestRegistry.Item(ApplicationServiceFacade.FULL_ACTIVE_LIST),
       null);
-    }
+  }
 
   public buildEnvironmentManagement(param, data): Observable<any> {
     return this.buildRequest(RequestMethod.Post,
       this.requestRegistry.Item(ApplicationServiceFacade.ENV) + param,
       data,
-      { observe: 'response',
-        headers: { 'Content-Type': 'text/plain'}
+      {
+        observe: 'response',
+        headers: { 'Content-Type': 'text/plain' }
       });
   }
 
@@ -409,7 +414,7 @@ export class ApplicationServiceFacade {
     return this.buildRequest(RequestMethod.Put,
       this.requestRegistry.Item(ApplicationServiceFacade.BUDGET),
       data,
-      { observe: 'response'});
+      { observe: 'response' });
   }
 
   public buildGetSsnMonitorData(): Observable<any> {
@@ -429,7 +434,7 @@ export class ApplicationServiceFacade {
     return this.buildRequest(method,
       this.requestRegistry.Item(ApplicationServiceFacade.SETTINGS) + param,
       null,
-      { observe: 'response'});
+      { observe: 'response' });
   }
 
   public buildGetGroupsData(): Observable<any> {
@@ -540,6 +545,12 @@ export class ApplicationServiceFacade {
       null);
   }
 
+  public buildToggleProjectStatus(param, data): Observable<any> {
+    return this.buildRequest(RequestMethod.Post,
+      this.requestRegistry.Item(ApplicationServiceFacade.PROJECT) + param,
+      data);
+  }
+
   public buildGetEndpointsData(): Observable<any> {
     return this.buildRequest(RequestMethod.Get,
       this.requestRegistry.Item(ApplicationServiceFacade.ENDPOINT),
diff --git a/services/self-service/src/main/resources/webapp/src/app/core/services/project.service.ts b/services/self-service/src/main/resources/webapp/src/app/core/services/project.service.ts
index bdb2dc4..3923533 100644
--- a/services/self-service/src/main/resources/webapp/src/app/core/services/project.service.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/core/services/project.service.ts
@@ -43,7 +43,7 @@ export class ProjectService {
         map(response => response),
         catchError(ErrorUtils.handleServiceError));
   }
-  
+
   public getProjectsList(): Observable<{}> {
     return this.applicationServiceFacade
       .buildGetProjectsList()
@@ -52,7 +52,7 @@ export class ProjectService {
         catchError(ErrorUtils.handleServiceError));
   }
 
- public getUserProjectsList(): Observable<{}> {
+  public getUserProjectsList(): Observable<{}> {
     return this.applicationServiceFacade
       .buildGetUserProjectsList()
       .pipe(
@@ -68,4 +68,13 @@ export class ProjectService {
         map(response => response),
         catchError(ErrorUtils.handleServiceError));
   }
+
+  public toggleProjectStatus(data, action): Observable<{}> {
+    const url = `/${action}`;
+    return this.applicationServiceFacade
+      .buildToggleProjectStatus(url, data)
+      .pipe(
+        map(response => response),
+        catchError(ErrorUtils.handleServiceError));
+  }
 }
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 6faf871..6469f37 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
@@ -51,7 +51,7 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
       <div *ngIf="data.type === 'confirmation'" class="confirm-dialog">
         <p>
           <strong class="ellipsis label-name" matTooltip="{{ data.item.name }}" matTooltipPosition="above" [matTooltipDisabled]="data.item.name.length > 35">
-          {{ data.item.name }}</strong> will be decommissioned.
+          {{ data.item.name }}</strong> will be {{ data.action || 'decommissioned' }}.
         </p>
         <p class="m-top-20"><strong>Do you want to proceed?</strong></p>
       
@@ -81,6 +81,6 @@ export class NotificationDialogComponent {
     @Inject(MAT_DIALOG_DATA) public data: any
   ) {
     console.log(data);
-    
+
   }
 }


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


[incubator-dlab] 02/04: [DLAB-834]: added stop / start actions to project

Posted by an...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ankovalyshyn pushed a commit to branch feature/projects
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git

commit 93c2639ea428413ae6acd318d1eebe78c3356717
Author: Andriana Kovalyshyn <An...@epam.com>
AuthorDate: Wed Jul 3 17:43:06 2019 +0300

    [DLAB-834]: added stop / start actions to project
---
 .../project/project-list/project-list.component.html    | 16 +++++++++++++---
 .../project/project-list/project-list.component.ts      |  9 ++++++++-
 .../app/administration/project/project.component.html   |  4 +++-
 .../src/app/administration/project/project.component.ts | 17 +++++++++++++++++
 4 files changed, 41 insertions(+), 5 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 0423209..01d858f 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
@@ -51,9 +51,19 @@
   <ng-container matColumnDef="actions">
     <th mat-header-cell *matHeaderCellDef class="project-actions"></th>
     <td mat-cell *matCellDef="let element" class="project-actions">
-      <span [ngClass]="{'not-active' : element.status.toLowerCase() !== 'active' }">
-        <a [ngClass]="{'not-allowed' : element.status.toLowerCase() !== 'active' }"
-          (click)="element.status.toLowerCase() === 'active' && editProject(element)">
+      <span>
+        <a class="start-stop-action">
+          <mat-icon *ngIf="element.status === 'ACTIVE'" (click)="toggleProjectStatus(element, 'stop')">
+            pause_circle_outline
+          </mat-icon>
+          <mat-icon *ngIf="element.status === 'STOPPED'" (click)="toggleProjectStatus(element, 'start')">
+            play_circle_outline
+          </mat-icon>
+        </a>
+      </span>
+      <span [ngClass]="{'not-active' : element.status !== 'ACTIVE' }">
+        <a [ngClass]="{'not-allowed' : element.status !== 'ACTIVE' }"
+          (click)="element.status === 'ACTIVE' && editProject(element)">
           <mat-icon>mode_edit</mat-icon>
         </a>
       </span>
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 5cf2d81..1dd8210 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
@@ -23,6 +23,7 @@ import { MatTableDataSource } from '@angular/material';
 import { Subscription } from 'rxjs';
 
 import { ProjectDataService } from '../project-data.service';
+import { ProjectService } from '../../../core/services';
 import { Project } from '../project.component';
 
 @Component({
@@ -36,12 +37,14 @@ export class ProjectListComponent implements OnInit, OnDestroy {
   dataSource: Project[] | any = [];
   @Output() editItem: EventEmitter<{}> = new EventEmitter();
   @Output() deleteItem: EventEmitter<{}> = new EventEmitter();
+  @Output() toggleStatus: EventEmitter<{}> = new EventEmitter();
 
   private subscriptions: Subscription = new Subscription();
 
   constructor(
     public toastr: ToastrService,
-    private projectDataService: ProjectDataService
+    private projectDataService: ProjectDataService,
+    private projectService: ProjectService
   ) { }
 
 
@@ -55,6 +58,10 @@ export class ProjectListComponent implements OnInit, OnDestroy {
     this.subscriptions.unsubscribe();
   }
 
+  public toggleProjectStatus(project, action) {
+    this.toggleStatus.emit({ project, action });
+  }
+
   public editProject(item: Project[]) {
     this.editItem.emit(item);
   }
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/project/project.component.html b/services/self-service/src/main/resources/webapp/src/app/administration/project/project.component.html
index a40f264..2e01d31 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/project/project.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/project/project.component.html
@@ -39,6 +39,8 @@
   </mat-card>
 
   <div [hidden]="!projectList.length">
-    <project-list (editItem)="editProject($event)" (deleteItem)="deleteProject($event)"></project-list>
+    <project-list (editItem)="editProject($event)" (deleteItem)="deleteProject($event)"
+      (toggleStatus)="toggleStatus($event)">
+    </project-list>
   </div>
 </div>
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 dc888cf..261b4d9 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
@@ -91,6 +91,23 @@ export class ProjectComponent implements OnInit, OnDestroy {
       });
   }
 
+  public toggleStatus($event) {
+    const data = { 'project_name': $event.project.name };
+
+    if ($event.action === 'stop') {
+      this.dialog.open(NotificationDialogComponent, { data: { type: 'confirmation', item: $event.project, action: 'stopped' }, panelClass: 'modal-sm' })
+        .afterClosed().subscribe(result => {
+          result && this.toggleStatusRequest(data, $event.action);
+        });
+    } else {
+      this.toggleStatusRequest(data, $event.action);
+    }
+  }
+
+  private toggleStatusRequest(data, action) {
+    this.projectService.toggleProjectStatus(data, action).subscribe(res => this.refreshGrid());
+  }
+
   private getEnvironmentHealthStatus() {
     this.healthStatusService.getEnvironmentHealthStatus()
       .subscribe((result: any) => this.healthStatus = result);


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