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/07/01 11:35:58 UTC

[incubator-dlab] branch DLAB-1883 created (now 0cbf7a2)

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

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


      at 0cbf7a2  [DLAB-1883]: Disabled access to bucket if endpoint is stopped or terminated

This branch includes the following new commits:

     new 0cbf7a2  [DLAB-1883]: Disabled access to bucket if endpoint is stopped or terminated

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-1883]: Disabled access to bucket if endpoint is stopped or terminated

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

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

commit 0cbf7a2881b474eb01584bf345fb2cf1eae9a59e
Author: Dmytro_Gnatyshyn <di...@ukr.net>
AuthorDate: Wed Jul 1 14:35:38 2020 +0300

    [DLAB-1883]: Disabled access to bucket if endpoint is stopped or terminated
---
 .../project-list/project-list.component.html       |  2 +-
 .../project-list/project-list.component.scss       |  6 +-
 .../audit/audit-grid/audit-grid.component.scss     |  2 +-
 .../resources-grid/resources-grid.component.ts     | 95 ++++++++++++++--------
 4 files changed, 65 insertions(+), 40 deletions(-)

diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/project/project-list/project-list.component.html b/services/self-service/src/main/resources/webapp/src/app/administration/project/project-list/project-list.component.html
index d8f697f..04f525b 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/project/project-list/project-list.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/project/project-list/project-list.component.html
@@ -36,7 +36,7 @@
     <th mat-header-cell *matHeaderCellDef class="endpoints">
       <span class="label-endpoint"> Endpoint </span>
       <span class="label-endpoint-status"> Endpoint status </span>
-      <span class="label-status"> Edge node status </span>
+      <span class="label-status">Edge node status </span>
     </th>
     <td mat-cell *matCellDef="let element" class="source endpoints">
       <div *ngIf="!element.endpoints?.length; else list">
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/project/project-list/project-list.component.scss b/services/self-service/src/main/resources/webapp/src/app/administration/project/project-list/project-list.component.scss
index efe9ba3..b985d94 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/project/project-list/project-list.component.scss
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/project/project-list/project-list.component.scss
@@ -34,11 +34,7 @@ table {
     padding: 15px 0;
 
     .resource-wrap {
-      .resource-name {
-        width: 30%;
-        padding-left: 0;
-      }
-      resource-name, resource-status{
+      .resource-name, .resource-status {
         width: 30%;
         padding-left: 0;
       }
diff --git a/services/self-service/src/main/resources/webapp/src/app/reports/audit/audit-grid/audit-grid.component.scss b/services/self-service/src/main/resources/webapp/src/app/reports/audit/audit-grid/audit-grid.component.scss
index d2f4f9a..67abbaf 100644
--- a/services/self-service/src/main/resources/webapp/src/app/reports/audit/audit-grid/audit-grid.component.scss
+++ b/services/self-service/src/main/resources/webapp/src/app/reports/audit/audit-grid/audit-grid.component.scss
@@ -277,6 +277,6 @@
 }
 
 .audit-user{
-  padding-left: 14px;
+  padding-left: 19px;
 }
 
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.ts b/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.ts
index 164b539..c67f019 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.ts
@@ -16,15 +16,13 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-/* tslint:disable:no-empty */
 
+import {Project} from '../../administration/project/project.component';
 import {Component, Input, OnInit} from '@angular/core';
 import { animate, state, style, transition, trigger } from '@angular/animations';
 import { ToastrService } from 'ngx-toastr';
 import { MatDialog } from '@angular/material/dialog';
-
 import {ProjectService, UserResourceService} from '../../core/services';
-
 import { ExploratoryModel, Exploratory } from './resources-grid.model';
 import { FilterConfigurationModel } from './filter-configuration.model';
 import { GeneralEnvironmentStatus } from '../../administration/management/management.model';
@@ -37,15 +35,40 @@ import { ComputationalResourceCreateDialogComponent } from '../computational/com
 import { CostDetailsDialogComponent } from '../exploratory/cost-details-dialog';
 import { ConfirmationDialogComponent } from '../../shared/modal-dialog/confirmation-dialog';
 import { SchedulerComponent } from '../scheduler';
-
 import { DICTIONARY } from '../../../dictionary/global.dictionary';
 import {ProgressBarService} from '../../core/services/progress-bar.service';
 import {ComputationModel} from '../computational/computational-resource.model';
 import {NotebookModel} from '../exploratory/notebook.model';
 
+export interface SharedEndpoint {
+  edge_node_ip: string;
+  shared_bucket_name?: string | null;
+  shared_container_name?: string | null;
+  status: string;
+  user_own_bucket_name?: string | null;
+  user_container_name?: string | null;
+  user_own_bicket_name?: string | null;
+}
 
+export interface ProjectEndpoint {
+  account: string;
+  cloudProvider: string;
+  endpoint_tag: string;
+  name: string;
+  status: string;
+  url: string;
+}
 
+export interface BucketList {
+  name: string;
+  children: Bucket[];
+  length?: number;
+}
 
+export interface Bucket {
+  name: string;
+  endpoint: string;
+}
 
 @Component({
   selector: 'resources-grid',
@@ -89,7 +112,7 @@ export class ResourcesGridComponent implements OnInit {
 
   public displayedColumns: string[] = this.filteringColumns.map(item => item.name);
   public displayedFilterColumns: string[] = this.filteringColumns.map(item => item.filter_class);
-  public bucketsList;
+  public bucketsList: BucketList;
   public activeProjectsList: any;
 
 
@@ -108,7 +131,7 @@ export class ResourcesGridComponent implements OnInit {
   }
 
   public getUserProjects() {
-    this.projectService.getUserProjectsList(true).subscribe((projects: any) => {
+    this.projectService.getUserProjectsList(true).subscribe((projects: Project[]) => {
       this.activeProjectsList = projects;
     });
   }
@@ -130,11 +153,11 @@ export class ResourcesGridComponent implements OnInit {
     this.collapseFilterRow = !this.collapseFilterRow;
   }
 
-  public onUpdate($event) {
+  public onUpdate($event): void {
     this.filterForm[$event.type] = $event.model;
   }
 
-  public selectActiveProject(project = '') {
+  public selectActiveProject(project = ''): void {
     this.filterForm.project = project;
     this.applyFilter_btnClick(this.filterForm);
   }
@@ -154,7 +177,7 @@ export class ResourcesGridComponent implements OnInit {
    }
 
 
-  public isResourcesInProgress(notebook) {
+  public isResourcesInProgress(notebook): boolean {
     const env = this.getResourceByName(notebook.name, notebook.project);
 
     if (env && env.resources.length) {
@@ -192,7 +215,7 @@ export class ResourcesGridComponent implements OnInit {
       .afterClosed().subscribe(() => this.buildGrid());
   }
 
-  public exploratoryAction(data, action: string) {
+  public exploratoryAction(data, action: string): void {
     const resource = this.getResourceByName(data.name, data.project);
 
     if (action === 'deploy') {
@@ -224,6 +247,34 @@ export class ResourcesGridComponent implements OnInit {
     }
   }
 
+  public getBuckets(): void {
+    const bucketsList = [];
+    this.environments.forEach(project => {
+      if (project.endpoints && project.endpoints.length !== 0) {
+        project.endpoints.forEach((endpoint: ProjectEndpoint) => {
+          if (endpoint.status === 'ACTIVE') {
+            const currEndpoint: SharedEndpoint = project.projectEndpoints[endpoint.name];
+            const edgeItem: BucketList = {name: `${project.project} (${endpoint.name})`, children: []};
+            const projectBucket: string = currEndpoint.user_own_bicket_name
+              || currEndpoint.user_own_bucket_name
+              || currEndpoint.user_container_name;
+            const sharedBucket: string = currEndpoint.shared_bucket_name || currEndpoint.shared_container_name;
+            if (projectBucket && currEndpoint.status !== 'terminated'
+              && currEndpoint.status !== 'terminating' && currEndpoint.status !== 'failed') {
+              edgeItem.children.push({name: projectBucket, endpoint: endpoint.name});
+            }
+            if (sharedBucket) {
+              edgeItem.children.push({name: sharedBucket, endpoint: endpoint.name});
+            }
+            bucketsList.push(edgeItem);
+          }
+        });
+      }
+    });
+
+    this.bucketsList = SortUtils.flatDeep(bucketsList, 1).filter(v => v.children.length);
+  }
+
 
   // PRIVATE
   private getResourceByName(notebook_name: string, project_name: string) {
@@ -254,7 +305,7 @@ export class ResourcesGridComponent implements OnInit {
     this.filterConfiguration = new FilterConfigurationModel('', statuses, shapes, resources, '', '');
   }
 
-  private applyFilter_btnClick(config: FilterConfigurationModel) {
+  public applyFilter_btnClick(config: FilterConfigurationModel): void {
 
     let filteredData = this.getEnvironmentsListCopy();
 
@@ -342,28 +393,6 @@ export class ResourcesGridComponent implements OnInit {
       if (filterConfig[index].length) this.activeFiltering = true;
   }
 
-  public getBuckets() {
-    const bucketsList = this.environments.map(project => {
-      return Object.keys(project.projectEndpoints).map(key => {
-        if (project.endpoints.length === 0) {
-          return;
-        }
-        const currEndpoint = project.projectEndpoints[key];
-        const edgeItem = {name: `${project.project} (${key})`, children: []};
-        const projectBucket = currEndpoint.user_own_bicket_name || currEndpoint.user_own_bucket_name || currEndpoint.user_container_name;
-        const sharedBucket = currEndpoint.shared_bucket_name || currEndpoint.shared_container_name;
-        if (projectBucket && currEndpoint.status !== 'terminated' && currEndpoint.status !== 'terminating' && currEndpoint.status !== 'failed') {
-          edgeItem.children.push({name: projectBucket, endpoint: key});
-        }
-        if (sharedBucket) {
-          edgeItem.children.push({name: sharedBucket, endpoint: key});
-        }
-        return edgeItem;
-      }).filter(v => v);
-    });
-    this.bucketsList = SortUtils.flatDeep(bucketsList, 1).filter(v => v.children.length);
-  }
-
   private getUserPreferences(): void {
     this.userResourceService.getUserPreferences()
       .subscribe((result: FilterConfigurationModel) => {


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