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/08/03 10:50:09 UTC

[incubator-dlab] 02/02: [DLAB-1969]: Added possibility to switch between project on list of resources

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

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

commit d56fc073835b831c85aff64e3dbcf245901bd71c
Author: Dmytro_Gnatyshyn <di...@ukr.net>
AuthorDate: Mon Aug 3 13:47:49 2020 +0300

    [DLAB-1969]: Added possibility to switch between project on list of resources
---
 .../src/app/resources/resources.component.html     | 49 ++++++++++++----------
 .../src/app/resources/resources.component.ts       | 11 +++--
 .../resources/webapp/src/assets/styles/_theme.scss | 15 +++++++
 3 files changed, 50 insertions(+), 25 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 d47559f..d6b9616 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
@@ -18,7 +18,7 @@
   -->
 
 <div class="base-retreat">
-  <div class="sub-nav">
+  <div class="sub-nav resource-btns">
     <div class="selection">
       <span
         matTooltip="{{!healthStatus?.projectAssigned ? 'You are not assigned to any project' : 'You have not any active project'}}"
@@ -26,22 +26,21 @@
         [matTooltipClass]="'bucket-item-tooltip'"
         [matTooltipDisabled]="healthStatus?.projectAssigned && resourcesGrid.activeProjectsList?.length !== 0"
       >
-        <span>{{resourcesGrid.activeProject}}</span>
       <button mat-raised-button class="butt butt-create" (click)="createEnvironment()"
         [disabled]="!healthStatus?.projectAssigned || !resourcesGrid.activeProjectsList?.length">
         <i class="material-icons">add</i>Create new
       </button>
       </span>
       <div class="mat-reset">
-        <div class="control selector-wrapper" *ngIf="projects.length">
+        <div class="control selector-wrapper" *ngIf="resourcesGrid.activeProjectsList?.length">
           <mat-form-field>
             <mat-label>Select active project</mat-label>
             <mat-select [(value)]="resourcesGrid.activeProject">
-              <mat-option *ngIf="projects.length > 1" (click)="setActiveProject()">Show all</mat-option>
-              <mat-option *ngFor="let project of projects" [value]="project.name"
+              <mat-option *ngIf="resourcesGrid.activeProjectsList?.length > 1" (click)="setActiveProject('')">Show all</mat-option>
+              <mat-option *ngFor="let project of resourcesGrid.activeProjectsList" [value]="project.name"
                 (click)="setActiveProject(project.name)">
                 {{ project.name }}</mat-option>
-              <mat-option *ngIf="!projects.length" class="multiple-select ml-10" disabled>Projects list is empty
+              <mat-option *ngIf="!resourcesGrid.activeProjectsList?.length" class="multiple-select ml-10" disabled>Projects list is empty
               </mat-option>
             </mat-select>
             <button class="caret">
@@ -60,23 +59,29 @@
       >
         <button mat-raised-button class="butt butt-tool" (click)="bucketBrowser(this.bucketStatus?.view)"
                 [disabled]="!this.bucketStatus?.view || resourcesGrid.bucketsList?.length === 0">
-        <i class="material-icons"></i>Bucket browser
-      </button>
+          <i class="material-icons"></i>Bucket browser
+        </button>
+      </span>
+      <span>
+        <button mat-raised-button class="butt butt-tool" (click)="manageUngit()">
+          <i class="material-icons"></i>Git credentials
+        </button>
+      </span>
+      <span>
+        <button mat-raised-button class="butt butt-tool show-all-btn" (click)="toggleFiltering()">
+          <span *ngIf="!resourcesGrid.activeFiltering">
+            <i class="material-icons">visibility_off</i> Show active
+          </span>
+          <span *ngIf="resourcesGrid.activeFiltering">
+            <i class="material-icons">visibility</i> Show all
+          </span>
+        </button>
+      </span>
+      <span>
+        <button mat-raised-button class="butt" (click)="refreshGrid()">
+          <i class="material-icons">autorenew</i>Refresh
+        </button>
       </span>
-      <button mat-raised-button class="butt butt-tool" (click)="manageUngit()">
-        <i class="material-icons"></i>Git credentials
-      </button>
-      <button mat-raised-button class="butt butt-tool" (click)="toggleFiltering()">
-        <span *ngIf="!resourcesGrid.activeFiltering">
-          <i class="material-icons">visibility_off</i> Show active
-        </span>
-        <span *ngIf="resourcesGrid.activeFiltering">
-          <i class="material-icons">visibility</i> Show all
-        </span>
-      </button>
-      <button mat-raised-button class="butt" (click)="refreshGrid()">
-        <i class="material-icons">autorenew</i>Refresh
-      </button>
     </div>
   </div>
   <mat-divider></mat-divider>
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 301509d..f5af0e9 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
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-import { Component, OnInit, ViewChild } from '@angular/core';
+import {AfterViewInit, Component, OnInit, ViewChild} from '@angular/core';
 import { ToastrService } from 'ngx-toastr';
 import { MatDialog } from '@angular/material/dialog';
 
@@ -35,10 +35,10 @@ import {BucketBrowserComponent} from './bucket-browser/bucket-browser.component'
   styleUrls: ['./resources.component.scss']
 })
 
-export class ResourcesComponent implements OnInit {
+export class ResourcesComponent implements OnInit, AfterViewInit {
   public exploratoryEnvironments: Exploratory[] = [];
   public healthStatus: any;
-  projects: Project[] = [];
+  projects = [];
 
   @ViewChild(ResourcesGridComponent, { static: true }) resourcesGrid: ResourcesGridComponent;
 
@@ -53,6 +53,11 @@ export class ResourcesComponent implements OnInit {
   ngOnInit() {
     this.getEnvironmentHealthStatus();
     this.exploratoryEnvironments = this.resourcesGrid.environments;
+    this.projects = this.resourcesGrid.activeProjectsList;
+  }
+
+  ngAfterViewInit() {
+    console.log(this.resourcesGrid);
   }
 
   public createEnvironment(): void {
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 3b2e0ff..ee719c5 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
@@ -969,4 +969,19 @@ mat-progress-bar {
   }
 }
 
+.show-all-btn.mat-raised-button .mat-button-wrapper > *{
+  vertical-align: baseline;
+}
+
+.resource-btns {
+  .mat-raised-button{
+    line-height: 38px;
+  }
+
+  .mat-select-value{
+    margin-top: 1px;
+  }
+}
+
+
 


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