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/29 14:09:24 UTC

[incubator-dlab] 03/04: [DLAB-845]: added validation check for uniq cluster name per user

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

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

commit 92583d8fc43fd0d5ddc69d480744eb2d2d7a4975
Author: Andriana Kovalyshyn <An...@epam.com>
AuthorDate: Mon Jul 29 17:07:43 2019 +0300

    [DLAB-845]: added validation check for uniq cluster name per user
---
 .../computational-resource-create-dialog.component.ts   | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

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 cf6e72a..13c16de 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
@@ -279,16 +279,11 @@ export class ComputationalResourceCreateDialogComponent implements OnInit {
   }
 
   private containsComputationalResource(conputational_resource_name: string): boolean {
-    if (conputational_resource_name)
-      for (let index = 0; index < this.resourcesList.length; index++) {
-        if (this.notebook_instance.name === this.resourcesList[index].name) {
-          for (let iindex = 0; iindex < this.resourcesList[index].resources.length; iindex++) {
-            const computational_name = this.resourcesList[index].resources[iindex].computational_name.toString().toLowerCase();
-            if (CheckUtils.delimitersFiltering(conputational_resource_name) === CheckUtils.delimitersFiltering(computational_name))
-              return true;
-          }
-        }
-      }
-    return false;
+    if (conputational_resource_name) {
+      return this.resourcesList.filter(project => project.exploratory.some(item =>
+        item.resources.some(resource =>
+          CheckUtils.delimitersFiltering(conputational_resource_name) === CheckUtils.delimitersFiltering(resource.computational_name))
+      )).length > 0;
+    }
   }
 }


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