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/09/25 14:43:12 UTC

[incubator-dlab] branch develop updated: [DLAB-2039]: Added endpoint for instances on 'Environment management' (#924)

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

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


The following commit(s) were added to refs/heads/develop by this push:
     new 1f7aea7  [DLAB-2039]: Added endpoint for instances on 'Environment management' (#924)
1f7aea7 is described below

commit 1f7aea756a2dbb226dd26564bcefdb50b1cadda8
Author: Dmytro Gnatyshyn <42...@users.noreply.github.com>
AuthorDate: Fri Sep 25 17:43:03 2020 +0300

    [DLAB-2039]: Added endpoint for instances on 'Environment management' (#924)
    
    [DLAB-2039]: Added endpoint for instances on 'Environment management' page
---
 .../management-grid/management-grid.component.html | 18 ++++++++++
 .../management-grid/management-grid.component.scss | 39 +++++++++++++++++-----
 .../management-grid/management-grid.component.ts   | 21 +++++++-----
 .../administration/management/management.model.ts  |  6 +++-
 4 files changed, 66 insertions(+), 18 deletions(-)

diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.html b/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.html
index 71a20db..e0bb662 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.html
@@ -79,6 +79,18 @@
       <td mat-cell *matCellDef="let element">{{ element.project }}</td>
     </ng-container>
 
+    <ng-container matColumnDef="endpoint">
+      <th mat-header-cell *matHeaderCellDef class="endpoint label-header">
+        <span class="label">Endpoint</span>
+        <button mat-icon-button aria-label="More" class="ar" (click)="toggleFilterRow()">
+          <i class="material-icons">
+            <span *ngIf="filtering && filterForm.endpoints.length > 0 && !collapsedFilterRow">filter_list</span>
+            <span [hidden]="filtering && filterForm.endpoints.length > 0 && !collapsedFilterRow">more_vert</span>
+          </i>
+        </button> </th>
+      <td mat-cell *matCellDef="let element">{{ element.endpoint }}</td>
+    </ng-container>
+
     <ng-container matColumnDef="type">
       <th mat-header-cell *matHeaderCellDef class="type label-header">
         <span class="label">Name</span>
@@ -241,6 +253,12 @@
           [items]="filterConfiguration.projects" [model]="filterForm.projects"></multi-select-dropdown>
       </th>
     </ng-container>
+    <ng-container matColumnDef="endpoint-filter" sticky>
+      <th mat-header-cell *matHeaderCellDef class="filter-row-item">
+        <multi-select-dropdown (selectionChange)="onUpdate($event)" [type]="'endpoints'"
+                               [items]="filterConfiguration.endpoints" [model]="filterForm.endpoints"></multi-select-dropdown>
+      </th>
+    </ng-container>
     <ng-container matColumnDef="shape-filter" sticky>
       <th mat-header-cell *matHeaderCellDef class="filter-row-item">
         <multi-select-dropdown (selectionChange)="onUpdate($event)" [type]="'shapes'"
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 5c4c62b..e9162fb 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
@@ -40,7 +40,7 @@
     }
     .name,
     .project {
-      width: 12%;
+      width: 10%;
 
       .list-menu li {
         text-transform: inherit;
@@ -48,18 +48,22 @@
     }
 
     .shape {
-      width: 17% !important;
+      width: 15% !important;
       .label{
         position: absolute;
       }
     }
 
+    .endpoint{
+      width: 10% !important;
+    }
+
     .status {
-      width: 12% !important;
+      width: 10% !important;
     }
 
     .type {
-      width: 11%;
+      width: 10%;
     }
 
     .resources {
@@ -91,47 +95,66 @@
         left: 21px;
         top: 2px;
       }
+
       .settings{
         min-width: 7%;
       }
+
       &.mat-column-checkbox{
         z-index: 12 !important;
         padding-left: 10px;
+
         .ar{
           position: absolute;
           top: 10px;
         }
       }
+
       &.user{
         z-index: 11 !important;
+
       }
+
       &.type{
         z-index: 10 !important;
       }
 
       &.project {
         z-index: 9 !important;
+
+        .label {
+          position: absolute;
+        }
       }
 
-      &.shape {
+      &.endpoint {
         z-index: 8 !important;
+
+        .label {
+          position: absolute;
+        }
       }
 
-      &.status {
+      &.shape {
         z-index: 7 !important;
       }
 
-      &.resources {
+      &.status {
         z-index: 6 !important;
       }
 
-      &.actions {
+      &.resources {
         z-index: 5 !important;
+      }
+
+      &.actions {
+        z-index: 4 !important;
         min-width: 100px !important;
       }
     }
 
     .dashboard_table_body {
+
       td:first-child {
         cursor: default;
       }
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.ts b/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.ts
index ab4bda7..5b3d8de 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.ts
@@ -49,8 +49,8 @@ export class ManagementGridComponent implements OnInit {
   allEnvironmentData: Array<any>;
   allFilteredEnvironmentData: Array<any>;
   loading: boolean = false;
-  filterConfiguration: ManagementConfigModel = new ManagementConfigModel([], '', [], [], [], []);
-  filterForm: ManagementConfigModel = new ManagementConfigModel([], '', [], [], [], []);
+  filterConfiguration: ManagementConfigModel = new ManagementConfigModel([], '', [], [], [], [], []);
+  filterForm: ManagementConfigModel = new ManagementConfigModel([], '', [], [], [], [], []);
   filtering: boolean = false;
   collapsedFilterRow: boolean = false;
 
@@ -62,11 +62,11 @@ export class ManagementGridComponent implements OnInit {
   @Output() actionToggle: EventEmitter<ManageAction> = new EventEmitter();
   @Output() emitSelectedList: EventEmitter<ManageAction> = new EventEmitter();
 
-  displayedColumns: string[] = [ 'checkbox', 'user', 'type', 'project', 'shape', 'status', 'resources', 'actions'];
-  displayedFilterColumns: string[] = ['checkbox-filter', 'user-filter', 'type-filter', 'project-filter', 'shape-filter', 'status-filter', 'resource-filter', 'actions-filter'];
+  displayedColumns: string[] = [ 'checkbox', 'user', 'type', 'project', 'endpoint', 'shape', 'status', 'resources', 'actions'];
+  displayedFilterColumns: string[] = ['checkbox-filter', 'user-filter', 'type-filter', 'project-filter', 'endpoint-filter', 'shape-filter', 'status-filter', 'resource-filter', 'actions-filter'];
   private selected;
   private allActiveNotebooks: any;
-  private cashedFilterForm: ManagementConfigModel = new ManagementConfigModel([], '', [], [], [], []);
+  private cashedFilterForm: ManagementConfigModel = new ManagementConfigModel([], '', [], [], [], [], []);
   private isFilterSelected: boolean;
   private isFilterChanged: boolean;
 
@@ -146,6 +146,7 @@ export class ManagementGridComponent implements OnInit {
         const isStatus = config.statuses.length > 0 ? (config.statuses.indexOf(item.status) !== -1) : (config.type !== 'active');
         const isShape = config.shapes.length > 0 ? (config.shapes.indexOf(item.shape) !== -1) : true;
         const isProject = config.projects.length > 0 ? (config.projects.indexOf(item.project) !== -1) : true;
+        const isEndpoint = config.endpoints.length > 0 ? (config.endpoints.indexOf(item.endpoint) !== -1) : true;
 
         const modifiedResources = containsStatus(item.resources, config.resources);
         let isResources = config.resources.length > 0 ? (modifiedResources && modifiedResources.length > 0) : true;
@@ -157,7 +158,7 @@ export class ManagementGridComponent implements OnInit {
           isResources = true;
         }
 
-        return isUser && isTypeName && isStatus && isShape && isProject && isResources;
+        return isUser && isTypeName && isStatus && isShape && isProject && isResources && isEndpoint;
       });
     }
     this.allFilteredEnvironmentData = filteredData;
@@ -203,10 +204,11 @@ export class ManagementGridComponent implements OnInit {
 
 
   private getDefaultFilterConfiguration(data): void {
-    const users = [], projects = [], shapes = [], statuses = [], resources = [];
+    const users = [], projects = [], shapes = [], statuses = [], resources = [], endpoints = [];
 
     data && data.forEach((item: any) => {
       if (item.user && users.indexOf(item.user) === -1) users.push(item.user);
+      if (item.endpoint && endpoints.indexOf(item.endpoint) === -1) endpoints.push(item.endpoint);
       if (item.status && statuses.indexOf(item.status.toLowerCase()) === -1) statuses.push(item.status.toLowerCase());
       if (item.project && projects.indexOf(item.project) === -1) projects.push(item.project);
       if (item.shape && shapes.indexOf(item.shape) === -1) shapes.push(item.shape);
@@ -218,7 +220,7 @@ export class ManagementGridComponent implements OnInit {
       }
     });
 
-    this.filterConfiguration = new ManagementConfigModel(users, '', projects, shapes, statuses, resources);
+    this.filterConfiguration = new ManagementConfigModel(users, '', projects, shapes, statuses, resources, endpoints);
   }
 
   openNotebookDetails(data) {
@@ -356,7 +358,8 @@ export class ReconfirmationDialogComponent {
     if (data.notebooks && data.notebooks.length) {
       this.notebooks = JSON.parse(JSON.stringify(data.notebooks));
       this.notebooks = this.notebooks.map(notebook => {
-        notebook.resources = notebook.resources.filter(res => res.status !== 'failed' && res.status !== 'terminated' && res.status.slice(0, 4) !== data.action);
+        notebook.resources = notebook.resources.filter(res => res.status !== 'failed' &&
+          res.status !== 'terminated' && res.status.slice(0, 4) !== data.action);
         if (notebook.resources.length) {
           this.isClusterLength = true;
         }
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/management/management.model.ts b/services/self-service/src/main/resources/webapp/src/app/administration/management/management.model.ts
index 4387884..52e5ee9 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/management/management.model.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/management/management.model.ts
@@ -27,6 +27,7 @@ export class EnvironmentModel {
     public ip: string,
     public type?: string,
     public project?: string,
+    public endpoint?: string,
     public cloud_provider?: string,
     public exploratory_urls?: Array<any>
   ) { }
@@ -42,6 +43,7 @@ export class EnvironmentModel {
         value.public_ip,
         value.resource_type,
         value.project,
+        value.endpoint,
         value.cloud_provider,
         value.exploratory_urls
       ));
@@ -85,7 +87,7 @@ export interface GeneralEnvironmentStatus {
 export class ManagementConfigModel {
 
   static getDefault(): ManagementConfigModel {
-    return new ManagementConfigModel([], '', [], [], [], []);
+    return new ManagementConfigModel([], '', [], [], [], [], []);
   }
 
   constructor(
@@ -95,6 +97,7 @@ export class ManagementConfigModel {
     public shapes: Array<string>,
     public statuses: Array<string>,
     public resources: Array<string>,
+    public endpoints: Array<string>,
 
   ) { }
 
@@ -105,5 +108,6 @@ export class ManagementConfigModel {
     this.shapes = [];
     this.statuses = [];
     this.resources = [];
+    this.endpoints = [];
   }
 }


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