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/05/24 13:56:50 UTC

[incubator-dlab] branch project_grid updated (471218e -> df00d5d)

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

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


    from 471218e  fixed dialogs styles; extended classes
     new 40b2ab9  project creation form fixes
     new 7261a69  added create-edit project forms separation
     new c0eaf17  added data subscription on projects list
     new df00d5d  emit data on etit project action

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:
 .../webapp/src/app/administration/project/index.ts |  5 +-
 .../administration/project/project-data.service.ts | 14 +++--
 .../project-form/project-form.component.html       | 72 ++++++++++------------
 .../project-form/project-form.component.scss       |  6 ++
 .../project/project-form/project-form.component.ts |  6 +-
 .../project-list/project-list.component.scss       | 18 +++++-
 .../project/project-list/project-list.component.ts | 26 ++++----
 .../administration/project/project.component.html  |  8 ++-
 .../administration/project/project.component.ts    | 64 +++++++++++++++++--
 9 files changed, 151 insertions(+), 68 deletions(-)


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


[incubator-dlab] 04/04: emit data on etit project action

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

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

commit df00d5d1e7c37f7fe78eb506ca1f2f5e6076ea3e
Author: Andriana Kovalyshyn <An...@epam.com>
AuthorDate: Fri May 24 16:56:16 2019 +0300

    emit data on etit project action
---
 .../webapp/src/app/administration/project/index.ts |  5 +++--
 .../project-list/project-list.component.scss       | 18 +++++++++++++--
 .../project/project-list/project-list.component.ts | 26 +++++++++++++---------
 3 files changed, 34 insertions(+), 15 deletions(-)

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 4dfc82f..1c086d0 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
@@ -27,7 +27,7 @@ import { FormControlsModule } from '../../shared/form-controls';
 import { ProjectFormComponent } from './project-form/project-form.component';
 import { ProjectListComponent } from './project-list/project-list.component';
 
-import { ProjectComponent } from './project.component';
+import { ProjectComponent, EditProjectComponent } from './project.component';
 import { ProjectDataService } from './project-data.service';
 
 @NgModule({
@@ -38,7 +38,8 @@ import { ProjectDataService } from './project-data.service';
     MaterialModule,
     FormControlsModule
   ],
-  declarations: [ProjectComponent, ProjectFormComponent, ProjectListComponent],
+  declarations: [ProjectComponent, EditProjectComponent, ProjectFormComponent, ProjectListComponent],
+  entryComponents: [EditProjectComponent],
   providers: [ProjectDataService],
   exports: [ProjectComponent]
 })
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/project/project-list/project-list.component.scss b/services/self-service/src/main/resources/webapp/src/app/administration/project/project-list/project-list.component.scss
index fb706f5..a41856f 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/project/project-list/project-list.component.scss
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/project/project-list/project-list.component.scss
@@ -17,6 +17,20 @@
  * under the License.
  */
 
- table {
+table {
   width: 100%;
- }
\ No newline at end of file
+  .project-actions {
+    color: #607d8b;
+    span {
+      transition: all .5s ease-in-out;
+      cursor: pointer;
+      .mat-icon {
+        font-size: 18px;
+        padding-top: 5px;
+      }
+      &:hover {
+        color: darken(#607d8b, 10%);
+      }
+    }
+  }
+}
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 04c59c8..9e02839 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
@@ -17,9 +17,10 @@
  * under the License.
  */
 
- import { Component, OnInit } from '@angular/core';
+ import { Component, OnInit, Output, EventEmitter, OnDestroy } from '@angular/core';
  import { ToastrService } from 'ngx-toastr';
  import { MatTableDataSource } from '@angular/material';
+ import { Subscription } from 'rxjs';
 
  import { ProjectDataService } from '../project-data.service';
  import { ProjectService } from '../../../core/services';
@@ -30,10 +31,13 @@
   templateUrl: './project-list.component.html',
   styleUrls: ['./project-list.component.scss']
 })
-export class ProjectListComponent implements OnInit {
+export class ProjectListComponent implements OnInit, OnDestroy {
 
   displayedColumns: string[] = ['project_name', 'endpoints_list', 'project_tag', 'actions'];
   dataSource: Project[] | any;
+  @Output() editItem: EventEmitter<{}> = new EventEmitter();
+
+  private subscriptions: Subscription = new Subscription();
 
   constructor(
     public toastr: ToastrService,
@@ -43,20 +47,20 @@ export class ProjectListComponent implements OnInit {
 
 
   ngOnInit() {
-    this.getProjectsList();
+    this.subscriptions.add(this.projectDataService._projects.subscribe(value => {
+      this.dataSource = new MatTableDataSource(value);
+    }));
   }
 
-  public editProject(item: Project[]) {
-    debugger;
+  ngOnDestroy() {
+    this.subscriptions.unsubscribe();
+  }
+
+  public editProject(item: Project[]) {;
+    this.editItem.emit(item);
   }
   
   public deleteProject(item: Project[]) {
     debugger;
   }
-
-  private getProjectsList() {
-    // Project[] type
-    debugger;
-    this.dataSource = new MatTableDataSource(this.projectDataService.getProjects)
-  }
 }


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


[incubator-dlab] 01/04: project creation form fixes

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

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

commit 40b2ab9729254570d1504319a9ad25b54c3dd76f
Author: Andriana Kovalyshyn <An...@epam.com>
AuthorDate: Fri May 24 16:52:26 2019 +0300

    project creation form fixes
---
 .../project-form/project-form.component.html       | 72 ++++++++++------------
 .../project-form/project-form.component.scss       |  6 ++
 .../project/project-form/project-form.component.ts |  6 +-
 3 files changed, 45 insertions(+), 39 deletions(-)

diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/project/project-form/project-form.component.html b/services/self-service/src/main/resources/webapp/src/app/administration/project/project-form/project-form.component.html
index a579ace..098f41e 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/project/project-form/project-form.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/project/project-form/project-form.component.html
@@ -24,48 +24,44 @@
       <section class="inner-step mat-reset">
 
         <div class="form-block">
-          <div class="control-group">
-            <label class="label">Project name</label>
-            <div class="control">
-              <input type="text" formControlName="project_name" placeholder="Enter project name"
-                (blur)="generateProjectTag($event)">
-            </div>
-          </div>
-          <!-- <div class="control-group">
-            <label class="label">Endpoint name</label>
-            <div class="control">
-              <input type="text" formControlName="endpoints_list" placeholder="Enter endpoint name">
+          <div>
+            <div class="control-group">
+              <label class="label">Project name</label>
+              <div class="control">
+                <input type="text" formControlName="project_name" placeholder="Enter project name"
+                  (blur)="generateProjectTag($event)">
+              </div>
             </div>
-          </div> -->
-          <div class="control-group">
-              <div class="selector-wrapper">
-                <mat-form-field>
-                  <mat-select multiple formControlName="endpoints_list" placeholder="Select endpoint name">
-                    <mat-option class="multiple-select" disabled>
-                      <a class="select ani" (click)="selectOptions(list, 'all')">
-                        <i class="material-icons">playlist_add_check</i>&nbsp;All
-                      </a>
-                      <a class="deselect ani" (click)="selectOptions(list)">
-                        <i class="material-icons">clear</i>&nbsp;None
-                      </a>
-                    </mat-option>
-                    <mat-option *ngFor="let group of endpointsList" [value]="group">
-                      {{ group }}
-                    </mat-option>
-                  </mat-select>
-                  <button class="caret">
-                    <i class="material-icons">keyboard_arrow_down</i>
-                  </button>
-                </mat-form-field>
+            <div class="control-group">
+              <label class="label">Project tag</label>
+              <div class="control">
+                <input type="text" formControlName="project_tag" placeholder="dlab-{ project name }">
               </div>
             </div>
-
-          <div class="control-group">
-            <label class="label">Project tag</label>
-            <div class="control">
-              <input type="text" formControlName="project_tag" placeholder="dlab-{ project name }">
+            <div class="control-group">
+                <div class="selector-wrapper">
+                  <mat-form-field>
+                    <mat-select multiple formControlName="endpoints_list" placeholder="Select endpoint name">
+                      <mat-option class="multiple-select" disabled>
+                        <a class="select ani" (click)="selectOptions(list, 'all')">
+                          <i class="material-icons">playlist_add_check</i>&nbsp;All
+                        </a>
+                        <a class="deselect ani" (click)="selectOptions(list)">
+                          <i class="material-icons">clear</i>&nbsp;None
+                        </a>
+                      </mat-option>
+                      <mat-option *ngFor="let group of endpointsList" [value]="group">
+                        {{ group }}
+                      </mat-option>
+                    </mat-select>
+                    <button class="caret">
+                      <i class="material-icons">keyboard_arrow_down</i>
+                    </button>
+                  </mat-form-field>
+                </div>
             </div>
           </div>
+
           <div class="text-center m-bott-10">
             <button mat-raised-button type="button" class="butt" (click)="reset()">Clear</button>
             <button mat-raised-button type="button" class="butt next" matStepperNext>Next<i
@@ -78,7 +74,7 @@
     <mat-step>
       <ng-template matStepLabel>Users</ng-template>
       <div class="inner-step mat-reset">
-        <div class="form-block">
+        <div class="form-block split">
           <div class="control-group">
             <div class="selector-wrapper">
               <mat-form-field>
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/project/project-form/project-form.component.scss b/services/self-service/src/main/resources/webapp/src/app/administration/project/project-form/project-form.component.scss
index 8686a65..849c41c 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/project/project-form/project-form.component.scss
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/project/project-form/project-form.component.scss
@@ -22,4 +22,10 @@
   .next {
     margin-left: 25px;
   }
+  &.split {
+    flex-direction: column;
+    display: flex;
+    justify-content: space-between;
+    height: 210px;
+  }
 }
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/project/project-form/project-form.component.ts b/services/self-service/src/main/resources/webapp/src/app/administration/project/project-form/project-form.component.ts
index f1f936f..583a634 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/project/project-form/project-form.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/project/project-form/project-form.component.ts
@@ -17,7 +17,7 @@
  * under the License.
  */
 
- import { Component, OnInit } from '@angular/core';
+ import { Component, OnInit, Input } from '@angular/core';
  import { FormGroup, FormBuilder, Validators } from '@angular/forms';
  import { ToastrService } from 'ngx-toastr';
 
@@ -35,6 +35,8 @@ export class ProjectFormComponent implements OnInit {
   public groupsList: any = [];
   public endpointsList: any = [];
 
+  @Input() item: any;
+
   constructor(
     public toastr: ToastrService,
     private _fb: FormBuilder,
@@ -47,6 +49,8 @@ export class ProjectFormComponent implements OnInit {
     this.initFormModel();
     this.getGroupsData();
     this.getEndpointsData();
+
+    this.item && this.editSpecificProject(this.item);
   }
 
   public createProject(data) {


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


[incubator-dlab] 03/04: added data subscription on projects list

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

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

commit c0eaf171c4b50cf549df7c7b04c67985d9d9ab88
Author: Andriana Kovalyshyn <An...@epam.com>
AuthorDate: Fri May 24 16:55:13 2019 +0300

    added data subscription on projects list
---
 .../src/app/administration/project/project-data.service.ts | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 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 1bba48a..0cfb386 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
@@ -18,22 +18,24 @@
  */
 
 import { Injectable } from '@angular/core';
+import { of as observableOf, Observable, BehaviorSubject } from 'rxjs';
 
 import { ProjectService } from '../../core/services';
 import { Project } from './project.component';
 
 import { data } from './project-list/data';
+
 @Injectable()
 export class ProjectDataService {
-  dataSource: any;
-  // Project[];
+
+  _projects = new BehaviorSubject<any>(null);
 
   constructor(private projectService: ProjectService) {
     this.getProjectsList();
   }
 
-  get getProjects() {
-    return this.dataSource;
+  public getProjects() {
+    this._projects.asObservable();
   }
 
   public updateProjects() {
@@ -41,10 +43,10 @@ export class ProjectDataService {
   }
 
   private getProjectsList() {
-    this.dataSource = data.projects;
+    this._projects.next(data.projects);
 
     
     this.projectService.getProjectsList().subscribe(
-      (response: any) => this.dataSource = data.projects);
+      (response: any) => this._projects.next(response));
   }
 }
\ No newline at end of file


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


[incubator-dlab] 02/04: added create-edit project forms separation

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

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

commit 7261a69ae37b46c1c84d266c8a60d1fbccbd2614
Author: Andriana Kovalyshyn <An...@epam.com>
AuthorDate: Fri May 24 16:54:33 2019 +0300

    added create-edit project forms separation
---
 .../administration/project/project.component.html  |  8 ++-
 .../administration/project/project.component.ts    | 64 ++++++++++++++++++++--
 2 files changed, 64 insertions(+), 8 deletions(-)

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 b942896..9a9f6fa 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
@@ -20,15 +20,17 @@
 <div class="sub-nav base-retreat">
   <div>
     <button mat-raised-button class="butt butt-create"
-      (click)="createProject()">
+      (click)="createProject()" [disabled]="projects?.lenght < 1">
       <i class="material-icons">add</i>Create new
     </button>
   </div>
   <div></div>
 </div>
 
-<mat-card class="base-retreat project-form">
+<mat-card class="base-retreat project-form" *ngIf="projects?.lenght < 1; else list">
   <project-form></project-form>
 </mat-card>
 
-<project-list></project-list>
+<ng-template #list>
+  <project-list (editItem)="editProject($event)"></project-list>
+</ng-template>
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 1baea70..f39e0a9 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
@@ -17,7 +17,10 @@
  * under the License.
  */
 
-import { Component, OnInit } from '@angular/core';
+import { Component, OnInit, OnDestroy, Inject } from '@angular/core';
+import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
+import { Subscription } from 'rxjs';
+
 import { ProjectDataService } from './project-data.service';
 
 export interface Project {
@@ -32,15 +35,66 @@ export interface Project {
   templateUrl: './project.component.html',
   styleUrls: ['./project.component.scss']
 })
-export class ProjectComponent implements OnInit {
-  projectsList: Project[] = [];
-  constructor(private projectDataService: ProjectDataService) { }
+export class ProjectComponent implements OnInit, OnDestroy {
+  projects: Project[] = [];
+  private subscriptions: Subscription = new Subscription();
+
+  constructor(
+    public dialog: MatDialog,
+    private projectDataService: ProjectDataService
+  ) { }
 
   ngOnInit() {
-    this.projectsList = this.projectDataService.getProjects;
+    this.subscriptions.add(this.projectDataService._projects.subscribe(
+      value => this.projects = value));
+  }
+
+  ngOnDestroy() {
+    this.subscriptions.unsubscribe();
   }
 
   createProject() {
     console.log('create');
+
+    if (this.projects.length)
+      this.dialog.open(EditProjectComponent, { data: { action: 'create', item: null }, panelClass: 'modal-xl-s' })
+        .afterClosed().subscribe(() => {
+          console.log('Create project');
+        });
+  }
+
+  public editProject($event) {
+    this.dialog.open(EditProjectComponent, { data: { action: 'edit', item: $event }, panelClass: 'modal-xl-s' })
+      .afterClosed().subscribe(() => {
+        console.log('Update project');
+      });
   }
 }
+
+@Component({
+  selector: 'edit-project',
+  template: `
+    <div id="dialog-box" class="edit-form">
+      <div class="dialog-header">
+        <h4 class="modal-title">
+          <span *ngIf="data?.action === 'create'">Create new project</span>
+          <span *ngIf="data?.action === 'edit'">Edit {{ data.item.project_name }}</span>
+        </h4>
+        <button type="button" class="close" (click)="dialogRef.close()">&times;</button>
+      </div>
+      <div mat-dialog-content class="content project-form">
+        <project-form [item]="data.item"></project-form>
+      </div>
+    </div>
+  `,
+  styles: [`
+    .content { color: #718ba6; padding: 0; font-size: 14px; font-weight: 400; margin: 0; overflow: hidden; }
+    .edit-form { height: 380px; }
+  `]
+})
+export class EditProjectComponent {
+  constructor(
+    public dialogRef: MatDialogRef<EditProjectComponent>,
+    @Inject(MAT_DIALOG_DATA) public data: any
+  ) { }
+}
\ No newline at end of file


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