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/10/18 14:42:11 UTC

[incubator-dlab] 01/04: [DLAB-1157]: added project selector control

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

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

commit 1e6435e5820d9ef45e4780327e6cbe26415438ca
Author: Andriana Kovalyshyn <An...@epam.com>
AuthorDate: Wed Oct 16 15:50:18 2019 +0300

    [DLAB-1157]: added project selector control
---
 .../src/app/resources/resources.component.html      | 21 ++++++++++++++++++++-
 .../src/app/resources/resources.component.scss      | 10 ++++++++++
 .../webapp/src/app/resources/resources.component.ts | 18 +++++++++++++++---
 .../webapp/src/app/resources/resources.module.ts    |  2 +-
 .../resources/webapp/src/assets/styles/_theme.scss  |  4 ++++
 5 files changed, 50 insertions(+), 5 deletions(-)

diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/resources.component.html b/services/self-service/src/main/resources/webapp/src/app/resources/resources.component.html
index 7595650..db7b9da 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/resources.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/resources.component.html
@@ -19,11 +19,30 @@
 
 <div class="base-retreat">
   <div class="sub-nav">
-    <div>
+    <div class="selection">
       <button mat-raised-button class="butt butt-create" (click)="createEnvironment()"
         [disabled]="!healthStatus?.projectAssigned">
         <i class="material-icons">add</i>Create new
       </button>
+
+      <div class="mat-reset">
+        <!-- *ngIf="!projects.length -->
+        <div class="control selector-wrapper">
+          <mat-form-field>
+            <mat-label>Select active project</mat-label>
+            <mat-select>
+              <mat-option *ngFor="let project of projects" [value]="project.name" (click)="setActiveProject(project)">
+                {{ project.name }}</mat-option>
+              <mat-option *ngIf="!projects.length" class="multiple-select ml-10" disabled>Projects list is empty
+              </mat-option>
+            </mat-select>
+            <button class="caret">
+              <i class="material-icons">keyboard_arrow_down</i>
+            </button>
+          </mat-form-field>
+        </div>
+      </div>
+
     </div>
     <div>
       <button mat-raised-button class="butt butt-tool" (click)="manageUngit()">
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/resources.component.scss b/services/self-service/src/main/resources/webapp/src/app/resources/resources.component.scss
index e4a13ae..c8f91ee 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/resources.component.scss
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/resources.component.scss
@@ -22,7 +22,17 @@
 }
 
 .butt {
+  &.butt-create {
+    margin-right: 10px;
+  }
+
   &.butt-tool {
     margin-right: 10px;
   }
 }
+
+.base-retreat {
+  .selector-wrapper {
+    height: 38px;
+  }
+}
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/resources.component.ts b/services/self-service/src/main/resources/webapp/src/app/resources/resources.component.ts
index eb7e4bd..bc1459e 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/resources.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/resources.component.ts
@@ -24,9 +24,10 @@ import { MatDialog } from '@angular/material/dialog';
 
 import { ResourcesGridComponent } from './resources-grid/resources-grid.component';
 import { ExploratoryEnvironmentCreateComponent } from './exploratory/create-environment';
-import { ExploratoryModel, Exploratory } from './resources-grid/resources-grid.model';
-import { HealthStatusService } from '../core/services';
+import { Exploratory } from './resources-grid/resources-grid.model';
+import { HealthStatusService, ProjectService } from '../core/services';
 import { ManageUngitComponent } from './manage-ungit/manage-ungit.component';
+import { Project } from './../administration/project/project.component';
 
 @Component({
   selector: 'dlab-resources',
@@ -37,17 +38,20 @@ import { ManageUngitComponent } from './manage-ungit/manage-ungit.component';
 export class ResourcesComponent implements OnInit {
   public exploratoryEnvironments: Exploratory[] = [];
   public healthStatus: any;
+  projects: Project[] = [];
 
   @ViewChild(ResourcesGridComponent, { static: true }) resourcesGrid: ResourcesGridComponent;
 
   constructor(
     public toastr: ToastrService,
     private healthStatusService: HealthStatusService,
-    private dialog: MatDialog
+    private dialog: MatDialog,
+    private projectService: ProjectService
   ) { }
 
   ngOnInit() {
     this.getEnvironmentHealthStatus();
+    this.getProjects();
     this.exploratoryEnvironments = this.resourcesGrid.environments;
   }
 
@@ -75,6 +79,14 @@ export class ResourcesComponent implements OnInit {
       .afterClosed().subscribe(() => this.refreshGrid());
   }
 
+  public setActiveProject(project): void {
+    console.log(project)
+  }
+
+  private getProjects() {
+    this.projectService.getProjectsList().subscribe((projects: any) => this.projects = projects);
+  }
+
   private getEnvironmentHealthStatus() {
     this.healthStatusService.getEnvironmentHealthStatus().subscribe(
       (result: any) => {
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/resources.module.ts b/services/self-service/src/main/resources/webapp/src/app/resources/resources.module.ts
index 9f3e25d..7ce335b 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/resources.module.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/resources.module.ts
@@ -45,4 +45,4 @@ import { ConfirmDeleteAccountDialog } from './manage-ungit/manage-ungit.componen
   entryComponents: [ManageUngitComponent, ConfirmDeleteAccountDialog],
   exports: [ResourcesComponent]
 })
-export class ResourcesModule {}
+export class ResourcesModule { }
diff --git a/services/self-service/src/main/resources/webapp/src/assets/styles/_theme.scss b/services/self-service/src/main/resources/webapp/src/assets/styles/_theme.scss
index e694771..8aef4d4 100644
--- a/services/self-service/src/main/resources/webapp/src/assets/styles/_theme.scss
+++ b/services/self-service/src/main/resources/webapp/src/assets/styles/_theme.scss
@@ -314,6 +314,10 @@ span.mat-slide-toggle-content {
           font-weight: 300;
           padding-top: 10px;
 
+          .mat-select-value {
+            max-width: inherit;
+          }
+
           .mat-select-value-text {
             span {
               color: #607d8b;


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