You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by bo...@apache.org on 2018/09/18 01:58:17 UTC

[kylin] branch master updated: KYLIN-3526 Add check for hybrid name with special character

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

boblu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kylin.git


The following commit(s) were added to refs/heads/master by this push:
     new 2b2a203  KYLIN-3526 Add check for hybrid name with special character
2b2a203 is described below

commit 2b2a203008451da69f9b30998be65e6062010691
Author: Emiya0306 <wo...@qq.com>
AuthorDate: Mon Sep 17 18:54:51 2018 +0800

    KYLIN-3526 Add check for hybrid name with special character
---
 webapp/app/js/controllers/hybridInstanceSchema.js | 1 +
 webapp/app/partials/cubes/hybrid_edit.html        | 9 +++++----
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/webapp/app/js/controllers/hybridInstanceSchema.js b/webapp/app/js/controllers/hybridInstanceSchema.js
index 668f6dc..e03bb01 100644
--- a/webapp/app/js/controllers/hybridInstanceSchema.js
+++ b/webapp/app/js/controllers/hybridInstanceSchema.js
@@ -48,6 +48,7 @@ KylinApp.controller('HybridInstanceSchema', function (
     name: '',
     model: ''
   };
+  $scope.$validator = {}
 
   resetPageData();
 
diff --git a/webapp/app/partials/cubes/hybrid_edit.html b/webapp/app/partials/cubes/hybrid_edit.html
index 21b130f..2903460 100644
--- a/webapp/app/partials/cubes/hybrid_edit.html
+++ b/webapp/app/partials/cubes/hybrid_edit.html
@@ -33,7 +33,7 @@
 
   <div class="row" ng-controller="HybridInstanceSchema">
     <div class="col-xs-12">
-      <form role="form" name="hybrid_cube_form form-inline" novalidate>
+      <ng-form role="form" name="$validator" novalidate>
 
         <h1 class="form-title">Hybrid Designer</h1>
 
@@ -41,8 +41,9 @@
           <div class="col-xs-5 form-group">
             <div class="row">
               <label class="col-xs-3 control-label no-padding-right font-color-default" for="hybridName">Hybrid Name</label>
-              <div class="col-xs-9">
-                <input type="text" class="form-control" id="hybridName" placeholder="Hybrid Name" ng-disabled="isFormDisabled || isEdit" ng-model="form.name">
+              <div class="col-xs-9" ng-class="{ 'has-error': $validator.name.$invalid && $validator.name.$dirty }">
+                <input type="text" name="name" class="form-control" id="hybridName" placeholder="Hybrid Name" ng-disabled="isFormDisabled || isEdit" ng-model="form.name" ng-pattern="/^\w+$/">
+                <small class="help-block" ng-show="!$validator.name.$error.required && $validator.name.$invalid && $validator.name.$dirty">Hybrid name is invalid.</small>
               </div>
             </div>
           </div>
@@ -170,7 +171,7 @@
           </div>
         </div>
 
-      </form>
+      </ng-form>
     </div>
   </div>
 </div>
\ No newline at end of file