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/11/22 14:35:09 UTC

[incubator-dlab] branch develop updated: [DLAB-1301] Added A-z sorting for notebook templates

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

ankovalyshyn 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 e2a9042  [DLAB-1301] Added A-z sorting for notebook templates
     new ada0530  Merge pull request #436 from DG1202/DLAB-1301
e2a9042 is described below

commit e2a90420c93b1f719209409a524a281f5d2d0e6c
Author: Dmytro Gnatyshyn <di...@ukr.net>
AuthorDate: Thu Nov 21 18:16:52 2019 +0200

    [DLAB-1301] Added A-z sorting for notebook templates
---
 .../create-environment/create-environment.component.ts     | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

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 cb50764..5b907f4 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
@@ -27,6 +27,7 @@ import { UserResourceService, ProjectService } from '../../../core/services';
 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';
+import {tap} from "rxjs/operators";
 
 @Component({
   selector: 'create-environment',
@@ -73,7 +74,7 @@ export class ExploratoryEnvironmentCreateComponent implements OnInit {
       this.projects = projects;
       const activeProject = projects.find(item => item.name === this.resourceGrid.activeProject);
       if (this.resourceGrid.activeProject && activeProject) {
-        this.setEndpoints(activeProject)
+        this.setEndpoints(activeProject);
         this.createExploratoryForm.controls['project'].setValue(activeProject.name);
       }
     });
@@ -88,7 +89,14 @@ export class ExploratoryEnvironmentCreateComponent implements OnInit {
   }
 
   public getTemplates(project, endpoint) {
-    this.userResourceService.getExploratoryTemplates(project, endpoint).subscribe(templates => this.templates = templates);
+    this.userResourceService.getExploratoryTemplates(project, endpoint)
+      .pipe(tap(results => {
+        results.sort((a,b) => (a.exploratory_environment_versions[0].template_name > b.exploratory_environment_versions[0].template_name) ? 1 : -1)
+      }))
+      .subscribe(templates =>  {
+        this.templates = templates;
+      }
+      );
   }
 
   public getShapes(template) {
@@ -103,7 +111,7 @@ export class ExploratoryEnvironmentCreateComponent implements OnInit {
       template_name: this.currentTemplate.exploratory_environment_versions[0].template_name
     };
 
-    data.cluster_config = data.cluster_config ? JSON.parse(data.cluster_config) : null
+    data.cluster_config = data.cluster_config ? JSON.parse(data.cluster_config) : null;
     this.userResourceService.createExploratoryEnvironment({ ...parameters, ...data }).subscribe((response: any) => {
       if (response.status === HTTP_STATUS_CODES.OK) this.dialogRef.close();
     }, error => this.toastr.error(error.message || 'Exploratory creation failed!', 'Oops!'));


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