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/06/20 14:13:24 UTC

[incubator-dlab] branch feature/projects updated (c58af0b -> fef3054)

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 c58af0b  [DLAB-805]: added extra check if clusters creation are not allowed
     new 4de2536  [DLAB-747]: added key upload form
     new 3e6be34  [DLAB-747]: patch project creation form with file; validation added
     new fef3054  [DLAB-747]: patch project creation form with file

The 3 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-form/project-form.component.html       | 32 ++++++++++++++++++-
 .../project-form/project-form.component.scss       |  6 ++++
 .../project/project-form/project-form.component.ts | 36 ++++++++++++++++++++--
 .../webapp/src/assets/styles/_dialogs.scss         |  2 +-
 4 files changed, 72 insertions(+), 4 deletions(-)


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


[incubator-dlab] 03/03: [DLAB-747]: patch project creation form with file

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 fef3054506bbc81a336eb38baa2b44a41e4b63db
Author: Andriana Kovalyshyn <An...@epam.com>
AuthorDate: Thu Jun 20 17:13:14 2019 +0300

    [DLAB-747]: patch project creation form with file
---
 .../project-form/project-form.component.html       | 49 +++++++++++++---------
 .../project-form/project-form.component.scss       |  6 +++
 .../webapp/src/assets/styles/_dialogs.scss         |  2 +-
 3 files changed, 36 insertions(+), 21 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 a48c10d..45314de 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
@@ -21,28 +21,35 @@
   <mat-horizontal-stepper #stepper class="stepper ani">
     <mat-step>
       <ng-template matStepLabel>Key upload</ng-template>
-
-      <div class="row-wrap upload-key">
-        <div class="col">
-          <label class="control-label">
-            <span>Upload public key to start project creation</span>
-          </label>
-          <div>
-            <a href="#/help/publickeyguide" target="_blank">
-              <small class="helper_instruction"><i class="material-icons">help_outline</i>Where can I get public key?</small>
-            </a>
+      <section class="inner-step mat-reset upload-key">
+        <div class="form-block split">
+          <div class="row-wrap">
+            <div class="col">
+              <label class="control-label">
+                <span>Upload public key to start project creation</span>
+              </label>
+              <div>
+                <a href="#/help/publickeyguide" target="_blank">
+                  <small class="helper_instruction"><i class="material-icons">help_outline</i>Where can I get public key?</small>
+                </a>
+              </div>
+            </div>
+            <div class="col txt-r">
+              <span mat-raised-button class="butt butt-file">
+                <span class="upload-icon"></span> Upload
+                <input (change)="onFileChange($event)" type="file" name="file" accept=".pub" />
+              </span>
+    
+              <div *ngIf="keyLabel" class="m-bott-10 m-top-10 ellipsis" [class.danger_color]="!accessKeyValid">{{ keyLabel }}</div>
+            </div>
+          </div>
+          <div class="text-center m-bott-10">
+            <button mat-raised-button type="button" class="butt" [disabled]="item" (click)="reset()">Clear</button>
+            <button mat-raised-button type="button" class="butt next" matStepperNext>Next<i
+                class="material-icons">keyboard_arrow_right</i></button>
           </div>
         </div>
-        <div class="col txt-r">
-          <span mat-raised-button class="butt butt-file">
-            <span class="upload-icon"></span> Upload
-            <input (change)="onFileChange($event)" type="file" name="file" accept=".pub" />
-          </span>
-
-          <div *ngIf="keyLabel" class="m-bott-10 m-top-10 ellipsis" [class.danger_color]="!accessKeyValid">{{ keyLabel }}</div>
-        </div>
-      </div>
-
+      </section>
     </mat-step>
     <mat-step>
       <ng-template matStepLabel>Project</ng-template>
@@ -99,6 +106,8 @@
 
           <div class="text-center m-bott-10">
             <button mat-raised-button type="button" class="butt" [disabled]="item" (click)="reset()">Clear</button>
+            <button mat-raised-button matStepperPrevious class="butt"><i
+              class="material-icons">keyboard_arrow_left</i>Back</button>
             <button mat-raised-button type="button" class="butt next" matStepperNext>Next<i
                 class="material-icons">keyboard_arrow_right</i></button>
           </div>
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 bbdf8cd..8782430 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
@@ -41,3 +41,9 @@
     font-weight: 300;
   }
 }
+
+.upload-key {
+  .row-wrap {
+    padding: 35px 25px;
+  }
+}
\ No newline at end of file
diff --git a/services/self-service/src/main/resources/webapp/src/assets/styles/_dialogs.scss b/services/self-service/src/main/resources/webapp/src/assets/styles/_dialogs.scss
index f163887..311048c 100644
--- a/services/self-service/src/main/resources/webapp/src/assets/styles/_dialogs.scss
+++ b/services/self-service/src/main/resources/webapp/src/assets/styles/_dialogs.scss
@@ -105,7 +105,7 @@ mat-dialog-container {
           text-align: center;
           box-shadow: 0 3px 1px -2px rgba(0,0,0,.2), 0 2px 2px 0 rgba(0,0,0,.14), 0 1px 5px 0 rgba(0,0,0,.12);
           .upload-icon {
-            background: url(/img/upload-icon.png) no-repeat;
+            background: url(/../../assets/img/upload-icon.png) no-repeat;
             background-size: 100%;
             display: inline-block;
             width: 17px;


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


[incubator-dlab] 01/03: [DLAB-747]: added key upload form

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 4de2536d1cb2bb613d2b5b78a6897f5395358321
Author: Andriana Kovalyshyn <An...@epam.com>
AuthorDate: Thu Jun 20 15:22:21 2019 +0300

    [DLAB-747]: added key upload form
---
 .../project-form/project-form.component.html       | 23 +++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

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 f16e70b..a48c10d 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
@@ -21,7 +21,28 @@
   <mat-horizontal-stepper #stepper class="stepper ani">
     <mat-step>
       <ng-template matStepLabel>Key upload</ng-template>
-      KEY UPLOAD
+
+      <div class="row-wrap upload-key">
+        <div class="col">
+          <label class="control-label">
+            <span>Upload public key to start project creation</span>
+          </label>
+          <div>
+            <a href="#/help/publickeyguide" target="_blank">
+              <small class="helper_instruction"><i class="material-icons">help_outline</i>Where can I get public key?</small>
+            </a>
+          </div>
+        </div>
+        <div class="col txt-r">
+          <span mat-raised-button class="butt butt-file">
+            <span class="upload-icon"></span> Upload
+            <input (change)="onFileChange($event)" type="file" name="file" accept=".pub" />
+          </span>
+
+          <div *ngIf="keyLabel" class="m-bott-10 m-top-10 ellipsis" [class.danger_color]="!accessKeyValid">{{ keyLabel }}</div>
+        </div>
+      </div>
+
     </mat-step>
     <mat-step>
       <ng-template matStepLabel>Project</ng-template>


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


[incubator-dlab] 02/03: [DLAB-747]: patch project creation form with file; validation added

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 3e6be349efb8ae67787e1a0cf9ffdefe65f7c0ef
Author: Andriana Kovalyshyn <An...@epam.com>
AuthorDate: Thu Jun 20 15:23:32 2019 +0300

    [DLAB-747]: patch project creation form with file; validation added
---
 .../project/project-form/project-form.component.ts | 36 ++++++++++++++++++++--
 1 file changed, 34 insertions(+), 2 deletions(-)

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 5a1e2ea..a332f9e 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, Input, Output, EventEmitter, ViewChild } from '@angular/core';
+import { Component, OnInit, Input, Output, EventEmitter, ViewChild, ChangeDetectorRef } from '@angular/core';
 import { FormGroup, FormBuilder, Validators } from '@angular/forms';
 import { ToastrService } from 'ngx-toastr';
 import { Subscription } from 'rxjs';
@@ -38,6 +38,8 @@ export class ProjectFormComponent implements OnInit {
   public groupsList: any = [];
   public endpointsList: any = [];
   public projectList: Project[] = [];
+  public accessKeyValid: boolean;
+  public keyLabel: string = '';
 
   @Input() item: any;
   @Output() update: EventEmitter<{}> = new EventEmitter();
@@ -51,7 +53,8 @@ export class ProjectFormComponent implements OnInit {
     private projectService: ProjectService,
     private projectDataService: ProjectDataService,
     private rolesService: RolesGroupsService,
-    private endpointService: EndpointService
+    private endpointService: EndpointService,
+    private cd: ChangeDetectorRef
   ) { }
 
   ngOnInit() {
@@ -94,6 +97,25 @@ export class ProjectFormComponent implements OnInit {
     this.projectForm.controls.tag.setValue(user_tag.toLowerCase());
   }
 
+  public onFileChange($event) {
+    const reader = new FileReader();
+
+    if($event.target.files && $event.target.files.length) {
+      const [file] = $event.target.files;
+      reader.readAsDataURL(file);
+
+      reader.onload = () => {
+        this.projectForm.patchValue({
+          key: reader.result
+        });
+
+        this.accessKeyValid = this.isValidKey(file.name);
+        this.keyLabel = this.getLabel(file);
+        this.cd.markForCheck();
+      };
+    }
+  }
+
   public selectOptions(list, key, select?) {
     let filter = key === 'endpoints' ? list.map(el => el.name) : list;
     this.projectForm.controls[key].setValue(select ? filter : []);
@@ -111,6 +133,7 @@ export class ProjectFormComponent implements OnInit {
   public editSpecificProject(item: Project) {
 
     this.projectForm = this._fb.group({
+      'key': [''],
       'name': [item.name, Validators.required],
       'endpoints': [item.endpoints],
       'tag': [item.tag, Validators.required],
@@ -118,6 +141,15 @@ export class ProjectFormComponent implements OnInit {
     });
   }
 
+  private getLabel(file: File): string {
+    debugger;
+    return file ? !this.accessKeyValid ? 'Public key is required.' : file.name : '';
+  }
+
+  private isValidKey(value): boolean {
+    return value.toLowerCase().endsWith('.pub');
+  }
+
   private getGroupsData() {
     this.rolesService.getGroupsData().subscribe(
       (list: any) => this.groupsList = list.map(el => el.group),


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