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/07/15 09:20:48 UTC

[incubator-dlab] branch feature/projects updated: [DLAB-854]: management grid and configuration model fixes

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

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


The following commit(s) were added to refs/heads/feature/projects by this push:
     new d41cd4c  [DLAB-854]: management grid and configuration model fixes
     new e9b8cbf  Merge branch 'feature/projects' of github.com:apache/incubator-dlab into feature/projects
d41cd4c is described below

commit d41cd4ce6e6810ded3bfaabbbdfb2da019c25c42
Author: Andriana Kovalyshyn <An...@epam.com>
AuthorDate: Mon Jul 15 12:19:55 2019 +0300

    [DLAB-854]: management grid and configuration model fixes
---
 .../management-grid/management-grid.component.ts       | 11 ++++++-----
 .../administration/management/management.component.ts  |  8 ++++----
 .../app/administration/management/management.model.ts  | 18 +++++++++++++++++-
 3 files changed, 27 insertions(+), 10 deletions(-)

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 e717e9b..9034816 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
@@ -25,6 +25,7 @@ import { HealthStatusService } from '../../../core/services';
 import { ConfirmationDialogType } from '../../../shared';
 import { ConfirmationDialogComponent } from '../../../shared/modal-dialog/confirmation-dialog';
 import { EnvironmentsDataService } from '../management-data.service';
+import { EnvironmentModel } from '../management.model';
 
 export interface ManageAction {
   action: string;
@@ -62,7 +63,7 @@ export class ManagementGridComponent implements OnInit {
   ) { }
 
   ngOnInit() {
-    this.environmentsDataService._data.subscribe(data => this.allEnvironmentData = data);
+    this.environmentsDataService._data.subscribe(data => this.allEnvironmentData = EnvironmentModel.loadEnvironments(data));
   }
 
   buildGrid(): void {
@@ -79,7 +80,7 @@ export class ManagementGridComponent implements OnInit {
         result && this.actionToggle.emit({ action, environment, resource });
       });
     } else {
-      const type = (environment.resource_type.toLowerCase() === 'edge node')
+      const type = (environment.type.toLowerCase() === 'edge node')
         ? ConfirmationDialogType.StopEdgeNode : ConfirmationDialogType.StopExploratory;
 
       if (action === 'stop') {
@@ -109,9 +110,9 @@ export class ManagementGridComponent implements OnInit {
       if (notebook.name === 'edge node') {
         return this.allEnvironmentData
           .filter(env => env.user === notebook.user)
-          .some(el => this.inProgress([el]) || this.inProgress(el.computational_resources));
-      } else if (notebook.computational_resources.length) {
-        return this.inProgress(notebook.computational_resources);
+          .some(el => this.inProgress([el]) || this.inProgress(el.resources));
+      } else if (notebook.resources && notebook.resources.length) {
+        return this.inProgress(notebook.resources);
       }
     }
     return false;
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/management/management.component.ts b/services/self-service/src/main/resources/webapp/src/app/administration/management/management.component.ts
index c737bdb..246c19b 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/management/management.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/management/management.component.ts
@@ -77,7 +77,7 @@ export class ManagementComponent implements OnInit {
         $event.environment.user,
         $event.action,
         $event.environment.resource_type === 'edge node' ? 'edge' : $event.environment.resource_name,
-        $event.computational_resources ? $event.computational_resources.computational_name : null
+        $event.resources ? $event.resources.computational_name : null
       ).subscribe(
         () => this.buildGrid(),
         error => this.toastr.error('Environment management failed!', 'Oops!'));
@@ -108,9 +108,9 @@ export class ManagementComponent implements OnInit {
   }
 
   isEnvironmentsInProgress(data): boolean {
-    return data.some(el => {
-      return el.status === 'creating' || el.status === 'starting' ||
-        el.computational_resources.some(elem => elem.status === 'creating' || elem.status === 'starting' || elem.status === 'configuring');
+    return data.some(item => {
+      return item.exploratory.some(el => el.status === 'creating' || el.status === 'starting' ||
+        el.resources.some(elem => elem.status === 'creating' || elem.status === 'starting' || elem.status === 'configuring'));
     });
   }
 
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 641e098..dcc293c 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
@@ -25,8 +25,24 @@ export class EnvironmentModel {
     public resources: Array<any>,
     public user: string,
     public ip: string,
-    public type?: string
+    public type?: string,
+    public project?: string,
   ) { }
+
+  public static loadEnvironments(data: Array<any>) {
+    if (data) {
+      return data.map(value => new EnvironmentModel(
+        value.resource_name,
+        value.status,
+        value.shape,
+        value.computational_resources,
+        value.user,
+        value.public_ip,
+        value.resource_type,
+        value.project,
+      ));
+    }
+  }
 }
 
 export class BackupOptionsModel {


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