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/03 10:11:32 UTC

[incubator-dlab] branch DLAB-1119-2 created (now 50803e8)

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

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


      at 50803e8  [DLAB-1153]: added active project filtering

This branch includes the following new commits:

     new 50803e8  [DLAB-1153]: added active project filtering

The 1 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.



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


[incubator-dlab] 01/01: [DLAB-1153]: added active project filtering

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

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

commit 50803e8aef3dfdfc3b01ee4e7d396d8a4e2fc149
Author: Andriana Kovalyshyn <An...@epam.com>
AuthorDate: Thu Oct 3 13:11:15 2019 +0300

    [DLAB-1153]: added active project filtering
---
 .../management-grid/management-grid.component.scss |  8 ++++++++
 .../project/project-list/project-list.component.ts | 17 ++++++++++++++--
 .../administration/project/project.component.html  |  8 ++++++++
 .../administration/project/project.component.ts    | 23 ++++++++++++++++++++--
 .../src/main/resources/webapp/src/styles.scss      |  4 ++++
 5 files changed, 56 insertions(+), 4 deletions(-)

diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.scss b/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.scss
index 996d0c0..f0e5229 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.scss
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.scss
@@ -47,6 +47,14 @@
       padding: 5px;
     }
 
+    .settings {
+      padding-right: 24px;
+
+      .actions {
+        margin-top: 2px;
+      }
+    }
+
     .actions-col {
       width: 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 6a3054e..6659338 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
@@ -24,7 +24,7 @@ import { Subscription } from 'rxjs';
 
 import { ProjectDataService } from '../project-data.service';
 import { ProjectService } from '../../../core/services';
-import { Project } from '../project.component';
+import { Project, Endpoint } from '../project.component';
 
 @Component({
   selector: 'project-list',
@@ -35,6 +35,8 @@ export class ProjectListComponent implements OnInit, OnDestroy {
 
   displayedColumns: string[] = ['name', 'groups', 'endpoints', 'actions'];
   dataSource: Project[] | any = [];
+  projectList: Project[];
+
   @Output() editItem: EventEmitter<{}> = new EventEmitter();
   @Output() deleteItem: EventEmitter<{}> = new EventEmitter();
   @Output() toggleStatus: EventEmitter<{}> = new EventEmitter();
@@ -50,7 +52,8 @@ export class ProjectListComponent implements OnInit, OnDestroy {
 
   ngOnInit() {
     this.subscriptions.add(this.projectDataService._projects.subscribe((value: Project[]) => {
-      if (value) this.dataSource = new MatTableDataSource(value);
+      this.projectList = value;
+      if (value) this.dataSource = new MatTableDataSource(value)
     }));
   }
 
@@ -58,6 +61,16 @@ export class ProjectListComponent implements OnInit, OnDestroy {
     this.subscriptions.unsubscribe();
   }
 
+  public showActiveInstances(): void {
+    console.log(this.projectList);
+    const filteredList = this.projectList.map(project => {
+      project.endpoints = project.endpoints.filter((endpoint: Endpoint) => endpoint.status !== 'TERMINATED' && endpoint.status !== 'TERMINATING')
+      return project;
+    })
+
+    this.dataSource = new MatTableDataSource(filteredList);
+  }
+
   public toggleEndpointAction(project, action, endpoint) {
     this.toggleStatus.emit({ project, endpoint, action });
   }
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 2e01d31..b4ba7df 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
@@ -26,6 +26,14 @@
       </button>
     </div>
     <div>
+      <button mat-raised-button class="butt butt-tool mr-10" (click)="toggleFiltering()">
+        <span *ngIf="!activeFiltering">
+          <i class="material-icons">visibility_off</i> Show active
+        </span>
+        <span *ngIf="activeFiltering">
+          <i class="material-icons">visibility</i> Show all
+        </span>
+      </button>
       <button mat-raised-button class="butt" (click)="refreshGrid()" [hidden]="!projectList.length">
         <i class="material-icons">autorenew</i>Refresh
       </button>
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 53c53bd..b370d52 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,7 @@
  * under the License.
  */
 
-import { Component, OnInit, OnDestroy, Inject } from '@angular/core';
+import { Component, OnInit, OnDestroy, Inject, ViewChild } from '@angular/core';
 import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
 import { Subscription } from 'rxjs';
 import { ToastrService } from 'ngx-toastr';
@@ -25,10 +25,17 @@ import { ToastrService } from 'ngx-toastr';
 import { ProjectDataService } from './project-data.service';
 import { HealthStatusService, ProjectService } from '../../core/services';
 import { NotificationDialogComponent } from '../../shared/modal-dialog/notification-dialog';
+import { ProjectListComponent } from './project-list/project-list.component';
+
+export interface Endpoint {
+  name: string;
+  status: string;
+  edgeInfo: any;
+}
 
 export interface Project {
   name: string;
-  endpoints: string[];
+  endpoints: Endpoint[];
   tag: string;
   groups: string[];
 }
@@ -37,12 +44,16 @@ export interface Project {
   selector: 'dlab-project',
   templateUrl: './project.component.html'
 })
+
 export class ProjectComponent implements OnInit, OnDestroy {
   projectList: Project[] = [];
   healthStatus: any;
+  activeFiltering: boolean = false;
 
   private subscriptions: Subscription = new Subscription();
 
+  @ViewChild(ProjectListComponent, { static: false }) list: ProjectListComponent;
+
   constructor(
     public dialog: MatDialog,
     public toastr: ToastrService,
@@ -66,6 +77,7 @@ export class ProjectComponent implements OnInit, OnDestroy {
 
   refreshGrid() {
     this.projectDataService.updateProjects();
+    this.activeFiltering = false;
   }
 
   createProject() {
@@ -77,6 +89,13 @@ export class ProjectComponent implements OnInit, OnDestroy {
         });
   }
 
+  public toggleFiltering(): void {
+    this.activeFiltering = !this.activeFiltering;
+
+    this.activeFiltering ? this.list.showActiveInstances() : this.projectDataService.updateProjects();
+
+  }
+
   public editProject($event) {
     this.dialog.open(EditProjectComponent, { data: { action: 'edit', item: $event }, panelClass: 'modal-xl-s' })
       .afterClosed().subscribe(() => {
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 9cc4a59..7e65cb8 100644
--- a/services/self-service/src/main/resources/webapp/src/styles.scss
+++ b/services/self-service/src/main/resources/webapp/src/styles.scss
@@ -318,6 +318,10 @@ input[type='number'] {
   margin-left: 10px;
 }
 
+.mr-10 {
+  margin-right: 10px;
+}
+
 .full-height {
   height: 100%;
 }


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