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/12 13:55:11 UTC

[incubator-dlab] branch feature/projects updated: [DLAB-851]: added shapes list sorting

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 13c46b1  [DLAB-851]: added shapes list sorting
13c46b1 is described below

commit 13c46b1cded3fb04d9a01030201d6f9ba4653f72
Author: Andriana Kovalyshyn <An...@epam.com>
AuthorDate: Fri Jul 12 16:54:58 2019 +0300

    [DLAB-851]: added shapes list sorting
---
 .../models/computationalResourceImage.model.ts     |  6 ++--
 .../resources/webapp/src/app/core/util/index.ts    |  2 +-
 .../app/core/util/{sortUtil.ts => sortUtils.ts}    |  2 +-
 ...mputational-resource-create-dialog.component.ts |  5 ++--
 .../create-environment.component.ts                |  7 ++---
 .../install-libraries.component.ts                 | 34 +++++++++++-----------
 .../resources-grid/resources-grid.component.ts     |  2 +-
 7 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/services/self-service/src/main/resources/webapp/src/app/core/models/computationalResourceImage.model.ts b/services/self-service/src/main/resources/webapp/src/app/core/models/computationalResourceImage.model.ts
index b419102..102f1dc 100644
--- a/services/self-service/src/main/resources/webapp/src/app/core/models/computationalResourceImage.model.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/core/models/computationalResourceImage.model.ts
@@ -20,7 +20,7 @@
 import { ComputationalResourceApplicationTemplate } from './computationalResourceApplicationTemplate.model';
 import { ResourceShapeTypesModel } from './resourceShapeTypes.model';
 import { ImageType } from './imageType.enum';
-import { SortUtil } from '../util';
+import { SortUtils } from '../util';
 
 export class ComputationalResourceImage {
   image: string;
@@ -38,13 +38,13 @@ export class ComputationalResourceImage {
     this.environment_type = ImageType.СOMPUTATIONAL;
     this.application_templates = [];
     this.limits = jsonModel.limits;
-    this.shapes = new ResourceShapeTypesModel(SortUtil.shapesSort(jsonModel.computation_resources_shapes));
+    this.shapes = new ResourceShapeTypesModel(SortUtils.shapesSort(jsonModel.computation_resources_shapes));
 
     if (jsonModel.templates && jsonModel.templates.length > 0)
       for (let index = 0; index < jsonModel.templates.length; index++)
         this.application_templates.push(
           new ComputationalResourceApplicationTemplate(jsonModel.templates[index],
-          this.shapes, this.image, this.template_name, this.description));
+            this.shapes, this.image, this.template_name, this.description));
 
   }
 }
diff --git a/services/self-service/src/main/resources/webapp/src/app/core/util/index.ts b/services/self-service/src/main/resources/webapp/src/app/core/util/index.ts
index 35462c0..afef07e 100644
--- a/services/self-service/src/main/resources/webapp/src/app/core/util/index.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/core/util/index.ts
@@ -18,7 +18,7 @@
  */
 
 export * from './http-status-codes';
-export * from './sortUtil';
+export * from './sortUtils';
 export * from './errorUtils';
 export * from './dateUtils';
 export * from './fileUtils';
diff --git a/services/self-service/src/main/resources/webapp/src/app/core/util/sortUtil.ts b/services/self-service/src/main/resources/webapp/src/app/core/util/sortUtils.ts
similarity index 98%
rename from services/self-service/src/main/resources/webapp/src/app/core/util/sortUtil.ts
rename to services/self-service/src/main/resources/webapp/src/app/core/util/sortUtils.ts
index 6d0abfb..88c5a22 100644
--- a/services/self-service/src/main/resources/webapp/src/app/core/util/sortUtil.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/core/util/sortUtils.ts
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-export class SortUtil {
+export class SortUtils {
   public static statusSort(arg1: string, arg2: string): number {
     const order = ['creating', 'running', 'stopping', 'stopped', 'terminating', 'terminated', 'failed'];
 
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource-create-dialog/computational-resource-create-dialog.component.ts b/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource-create-dialog/computational-resource-create-dialog.component.ts
index 761ca2e..cf6e72a 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource-create-dialog/computational-resource-create-dialog.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource-create-dialog/computational-resource-create-dialog.component.ts
@@ -24,7 +24,7 @@ import { ToastrService } from 'ngx-toastr';
 
 import { ComputationalResourceModel } from './computational-resource-create.model';
 import { UserResourceService } from '../../../core/services';
-import { HTTP_STATUS_CODES, PATTERNS, CheckUtils } from '../../../core/util';
+import { HTTP_STATUS_CODES, PATTERNS, CheckUtils, SortUtils } from '../../../core/util';
 
 import { DICTIONARY } from '../../../../dictionary/global.dictionary';
 import { CLUSTER_CONFIGURATION } from './cluster-configuration-templates';
@@ -251,7 +251,8 @@ export class ComputationalResourceCreateDialogComponent implements OnInit {
     if (this.notebook_instance.template_name.toLowerCase().indexOf('tensorflow') !== -1
       || this.notebook_instance.template_name.toLowerCase().indexOf('deep learning') !== -1) {
       const allowed: any = ['GPU optimized'];
-      const filtered = Object.keys(this.selectedImage.computation_resources_shapes)
+      const filtered = Object.keys(
+        SortUtils.shapesSort(this.selectedImage.computation_resources_shapes))
         .filter(key => allowed.includes(key))
         .reduce((obj, key) => {
           obj[key] = this.selectedImage.computation_resources_shapes[key];
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/create-environment/create-environment.component.ts b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/create-environment/create-environment.component.ts
index 6fc0b07..6e0fda5 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/create-environment/create-environment.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/create-environment/create-environment.component.ts
@@ -24,7 +24,7 @@ import { ToastrService } from 'ngx-toastr';
 
 import { Project } from '../../../administration/project/project.component';
 import { UserResourceService, ProjectService } from '../../../core/services';
-import { CheckUtils, HTTP_STATUS_CODES, PATTERNS } from '../../../core/util';
+import { CheckUtils, SortUtils, HTTP_STATUS_CODES, PATTERNS } from '../../../core/util';
 import { DICTIONARY } from '../../../../dictionary/global.dictionary';
 import { CLUSTER_CONFIGURATION } from '../../computational/computational-resource-create-dialog/cluster-configuration-templates';
 
@@ -42,7 +42,7 @@ export class ExploratoryEnvironmentCreateComponent implements OnInit {
   templates = [];
   endpoints: Array<String> = [];
   currentTemplate: any;
-  shapes: Array<any> = [];
+  shapes = [] || {};
   resourceGrid: any;
   images: Array<any>;
 
@@ -79,7 +79,7 @@ export class ExploratoryEnvironmentCreateComponent implements OnInit {
 
   public getShapes(template) {
     this.currentTemplate = template;
-    this.shapes = template.exploratory_environment_shapes;
+    this.shapes = SortUtils.shapesSort(template.exploratory_environment_shapes);
     this.getImagesList();
   }
 
@@ -105,7 +105,6 @@ export class ExploratoryEnvironmentCreateComponent implements OnInit {
   }
 
   private initFormModel(): void {
-
     this.createExploratoryForm = this._fb.group({
       project: ['', Validators.required],
       endpoint: ['', Validators.required],
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/install-libraries/install-libraries.component.ts b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/install-libraries/install-libraries.component.ts
index a41e691..39602b7 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/install-libraries/install-libraries.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/install-libraries/install-libraries.component.ts
@@ -25,8 +25,8 @@ import { ToastrService } from 'ngx-toastr';
 import { debounceTime } from 'rxjs/operators';
 
 import { InstallLibrariesModel } from './install-libraries.model';
-import { LibrariesInstallationService} from '../../../core/services';
-import { SortUtil, HTTP_STATUS_CODES } from '../../../core/util';
+import { LibrariesInstallationService } from '../../../core/services';
+import { SortUtils, HTTP_STATUS_CODES } from '../../../core/util';
 
 
 @Component({
@@ -94,7 +94,7 @@ export class InstallLibrariesComponent implements OnInit {
   }
 
   uploadLibGroups(): void {
-     this.librariesInstallationService.getGroupsList(this.notebook.name, this.model.computational_name)
+    this.librariesInstallationService.getGroupsList(this.notebook.name, this.model.computational_name)
       .subscribe(
         response => {
           this.libsUploadingStatus(response);
@@ -112,12 +112,12 @@ export class InstallLibrariesComponent implements OnInit {
 
   private getResourcesList() {
     this.notebook.type = 'EXPLORATORY';
-    this.notebook.title = `${ this.notebook.name } <em class="capt">notebook</em>`;
+    this.notebook.title = `${this.notebook.name} <em class="capt">notebook</em>`;
     return [this.notebook].concat(this.notebook.resources
       .filter(item => item.status === 'running')
       .map(item => {
         item['name'] = item.computational_name;
-        item['title'] = `${ item.computational_name } <em class="capt">cluster</em>`;
+        item['title'] = `${item.computational_name} <em class="capt">cluster</em>`;
         item['type'] = 'СOMPUTATIONAL';
         return item;
       }));
@@ -134,7 +134,7 @@ export class InstallLibrariesComponent implements OnInit {
     const templateCheck = PREVENT_TEMPLATES.some(template => CURRENT_TEMPLATE.indexOf(template) !== -1);
 
     const filteredGroups = templateCheck ? groupsList.filter(group => group !== 'java') : groupsList;
-    return SortUtil.libGroupsSort(filteredGroups);
+    return SortUtils.libGroupsSort(filteredGroups);
   }
 
   public onUpdate($event) {
@@ -156,7 +156,7 @@ export class InstallLibrariesComponent implements OnInit {
   }
 
   public isDuplicated(item) {
-    const select = {group: this.group, name: item.name, version: item.version};
+    const select = { group: this.group, name: item.name, version: item.version };
 
     this.isInSelectedList = this.model.selectedLibs.filter(el => JSON.stringify(el) === JSON.stringify(select)).length > 0;
 
@@ -171,7 +171,7 @@ export class InstallLibrariesComponent implements OnInit {
   }
 
   public selectLibrary(item): void {
-    this.model.selectedLibs.push({group: this.group, name: item.name, version: item.version});
+    this.model.selectedLibs.push({ group: this.group, name: item.name, version: item.version });
 
     this.query = '';
     this.libSearch.setValue('');
@@ -220,7 +220,7 @@ export class InstallLibrariesComponent implements OnInit {
   }
 
   public reinstallLibrary(item, lib) {
-    const retry = [{group: lib.group, name: lib.name, version: lib.version}];
+    const retry = [{ group: lib.group, name: lib.name, version: lib.version }];
 
     if (this.getResourcesList().find(el => el.name === item.resource).type === 'СOMPUTATIONAL') {
       this.model.confirmAction(retry, item.resource);
@@ -263,13 +263,13 @@ export class InstallLibrariesComponent implements OnInit {
         .subscribe(
           lib => this.filteredList = [lib],
           error => {
-          if (error.status === HTTP_STATUS_CODES.NOT_FOUND
-            || error.status === HTTP_STATUS_CODES.BAD_REQUEST
-            || error.status === HTTP_STATUS_CODES.INTERNAL_SERVER_ERROR) {
-            this.validity_format = error.message;
-            this.filteredList = null;
-          }
-        });
+            if (error.status === HTTP_STATUS_CODES.NOT_FOUND
+              || error.status === HTTP_STATUS_CODES.BAD_REQUEST
+              || error.status === HTTP_STATUS_CODES.INTERNAL_SERVER_ERROR) {
+              this.validity_format = error.message;
+              this.filteredList = null;
+            }
+          });
     } else {
       this.model.getLibrariesList(this.group, this.query)
         .subscribe(libs => this.filteredList = libs);
@@ -290,7 +290,7 @@ export class InstallLibrariesComponent implements OnInit {
     this.isInSelectedList = false;
     this.uploading = false;
     this.model.selectedLibs = [];
-    this.filteredList = null ;
+    this.filteredList = null;
     this.destination = null;
     this.groupsList = [];
 
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 881f74b..d1084eb 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
@@ -29,7 +29,7 @@ import { ExploratoryModel, Exploratory } from './resources-grid.model';
 import { FilterConfigurationModel } from './filter-configuration.model';
 import { GeneralEnvironmentStatus } from '../../administration/management/management.model';
 import { ConfirmationDialogType } from '../../shared';
-import { SortUtil, CheckUtils } from '../../core/util';
+import { SortUtils, CheckUtils } from '../../core/util';
 import { DetailDialogComponent } from '../exploratory/detail-dialog';
 import { AmiCreateDialogComponent } from '../exploratory/ami-create-dialog';
 import { InstallLibrariesComponent } from '../exploratory/install-libraries';


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