You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datalab.apache.org by yt...@apache.org on 2021/07/23 07:42:10 UTC

[incubator-datalab] 01/01: [DATALAB-2460] limited custom tag length

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

ytykhun pushed a commit to branch DATALAB-2460
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git

commit 6d6d32d6b1266c7ab9868a48d386430aaf7a6f5c
Author: Yurii Tykhun <ty...@gmail.com>
AuthorDate: Fri Jul 23 10:41:09 2021 +0300

    [DATALAB-2460] limited custom tag length
---
 .../create-environment/create-environment.component.html          | 8 +++++++-
 .../create-environment/create-environment.component.ts            | 6 +++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/create-environment/create-environment.component.html b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/create-environment/create-environment.component.html
index 28d54f3..3d994ad 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/create-environment/create-environment.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/create-environment/create-environment.component.html
@@ -190,8 +190,14 @@
           <div class="control">
             <input type="text" class="form-control" placeholder="Enter custom tag" formControlName="custom_tag">
           </div>
+          <span 
+            class="error"
+            *ngIf="createExploratoryForm?.controls['custom_tag'].hasError('maxlength') &&
+                  !createExploratoryForm?.controls['custom_tag'].hasError('pattern')">
+              Custom tag name cannot be longer than {{maxCustomTagLength}} characters.
+            </span>
           <span class="error"
-            *ngIf="!createExploratoryForm?.controls.custom_tag.valid && createExploratoryForm?.controls.custom_tag.dirty">
+            *ngIf="createExploratoryForm?.controls['custom_tag'].hasError('pattern')">
             Custom tag can only contain letters, numbers, hyphens and '_' but can not end with special characters.</span>
         </div>
 
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 4468a18..0e6c5af 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
@@ -50,6 +50,7 @@ export class ExploratoryEnvironmentCreateComponent implements OnInit {
   images: Array<any>;
   selectedImage: any;
   maxNotebookLength: number = 14;
+  maxCustomTagLength: number = 63;
   public areShapes: boolean;
   public selectedCloud: string = '';
   public gpuCount: Array<number>;
@@ -307,7 +308,10 @@ export class ExploratoryEnvironmentCreateComponent implements OnInit {
         this.checkDuplication.bind(this)
       ]],
       cluster_config: ['', [this.validConfiguration.bind(this)]],
-      custom_tag: ['', [Validators.pattern(PATTERNS.namePattern)]],
+      custom_tag: ['', [
+        Validators.pattern(PATTERNS.namePattern),
+        Validators.maxLength(this.maxCustomTagLength)
+      ]],
       gpu_type: [null],
       gpu_count: [null],
       gpu_enabled: [false]

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