Repository: kylin
Updated Branches:
  refs/heads/2.x-staging 294476854 -> 73b98e895


KYLIN-1290 disable form validation when click prev step in cube&model wizard


Project: http://git-wip-us.apache.org/repos/asf/kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/73b98e89
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/73b98e89
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/73b98e89

Branch: refs/heads/2.x-staging
Commit: 73b98e89577170b71ba610c64e23597735ee00ab
Parents: 2944768
Author: jian <[email protected]>
Authored: Fri Jan 8 11:53:57 2016 +0800
Committer: jian <[email protected]>
Committed: Fri Jan 8 11:54:44 2016 +0800

----------------------------------------------------------------------
 webapp/app/js/controllers/cubeSchema.js         |  9 ++-
 webapp/app/js/controllers/modelSchema.js        |  7 ++-
 webapp/app/partials/cubes/cube_schema.html      |  4 +-
 webapp/app/partials/models/model_schema.html    |  6 +-
 .../app/partials/streaming/streaming_edit.html  | 34 -----------
 .../partials/streaming/streaming_schema.html    | 63 --------------------
 6 files changed, 18 insertions(+), 105 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/73b98e89/webapp/app/js/controllers/cubeSchema.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/cubeSchema.js 
b/webapp/app/js/controllers/cubeSchema.js
index 32a1d18..936add0 100755
--- a/webapp/app/js/controllers/cubeSchema.js
+++ b/webapp/app/js/controllers/cubeSchema.js
@@ -168,8 +168,13 @@ KylinApp.controller('CubeSchemaCtrl', function ($scope, 
QueryService, UserServic
 
   });
 
-    $scope.checkCubeForm = function(){
-        if(!$scope.curStep.form){
+    $scope.checkCubeForm = function(stepIndex){
+      // do not check for Prev Step
+      if (stepIndex + 1 < $scope.curStep.step) {
+        return true;
+      }
+
+      if(!$scope.curStep.form){
             return true;
         }
         if($scope.state.mode==='view'){

http://git-wip-us.apache.org/repos/asf/kylin/blob/73b98e89/webapp/app/js/controllers/modelSchema.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/modelSchema.js 
b/webapp/app/js/controllers/modelSchema.js
index 2815ac7..f1d2684 100644
--- a/webapp/app/js/controllers/modelSchema.js
+++ b/webapp/app/js/controllers/modelSchema.js
@@ -124,7 +124,12 @@ KylinApp.controller('ModelSchemaCtrl', function ($scope, 
QueryService, UserServi
     }
   };
 
-  $scope.checkForm = function () {
+  $scope.checkForm = function (stepIndex) {
+    // do not check for Prev Step
+    if (stepIndex + 1 < $scope.curStep.step) {
+      return true;
+    }
+
     if (!$scope.curStep.form) {
       return true;
     }

http://git-wip-us.apache.org/repos/asf/kylin/blob/73b98e89/webapp/app/partials/cubes/cube_schema.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/cubes/cube_schema.html 
b/webapp/app/partials/cubes/cube_schema.html
index 4b7e9ce..5cf39dc 100644
--- a/webapp/app/partials/cubes/cube_schema.html
+++ b/webapp/app/partials/cubes/cube_schema.html
@@ -25,7 +25,7 @@
                 <ul class="wizard-steps">
                     <li ng-repeat="step in wizardSteps"
                         class="{{step==curStep?'active':''}} 
{{step.isComplete?'complete':''}}">
-                        <span style="cursor:pointer;" 
ng-click="checkCubeForm()?goToStep($index):''" class="step">{{step.step = 
($index + 1)}}</span>
+                        <span style="cursor:pointer;" 
ng-click="checkCubeForm($index)?goToStep($index):''" class="step">{{step.step = 
($index + 1)}}</span>
                         <span class="title">{{step.title}}</span>
                      </li>
                 </ul>
@@ -46,7 +46,7 @@
                             <i class="ace-icon fa fa-arrow-left"></i>
                             Prev
                         </button>
-                        <button id="nextButton" class="btn btn-success 
btn-next"  ng-click="checkCubeForm()?nextView():''" 
ng-disabled="forms[curStep.form].$invalid"
+                        <button id="nextButton" class="btn btn-success 
btn-next"  ng-click="checkCubeForm($index)?nextView():''" 
ng-disabled="forms[curStep.form].$invalid"
                                 ng-show="curStep.title!='Overview'">
                             Next
                             <i class="ace-icon fa fa-arrow-right 
icon-on-right"></i>

http://git-wip-us.apache.org/repos/asf/kylin/blob/73b98e89/webapp/app/partials/models/model_schema.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/models/model_schema.html 
b/webapp/app/partials/models/model_schema.html
index bd4d5b6..fec9153 100644
--- a/webapp/app/partials/models/model_schema.html
+++ b/webapp/app/partials/models/model_schema.html
@@ -26,7 +26,7 @@
                 <ul class="wizard-steps">
                     <li ng-repeat="step in wizardSteps"
                         class="{{step==curStep?'active':''}} 
{{step.isComplete?'complete':''}}">
-                        <span style="cursor:pointer;" 
ng-click="checkForm()?goToStep($index):''" class="step">{{step.step = ($index + 
1)}}</span>
+                        <span style="cursor:pointer;" 
ng-click="checkForm($index)?goToStep($index):''" class="step">{{step.step = 
($index + 1)}}</span>
                         <span class="title">{{step.title}}</span>
                      </li>
                 </ul>
@@ -47,12 +47,12 @@
                             <i class="ace-icon fa fa-arrow-left"></i>
                             Prev
                         </button>
-                        <button id="nextButton" class="btn btn-success 
btn-next" ng-disabled="forms[curStep.form].$invalid" 
ng-click="checkForm()?nextView():''"
+                        <button id="nextButton" class="btn btn-success 
btn-next" ng-disabled="forms[curStep.form].$invalid" 
ng-click="checkForm($index)?nextView():''"
                                 ng-show="curStep.title!='Settings'">
                             Next
                             <i class="ace-icon fa fa-arrow-right 
icon-on-right"></i>
                         </button>
-                        <button class="btn btn-primary"  
ng-click="checkForm()?saveModel():''"
+                        <button class="btn btn-primary"  
ng-click="checkForm($index)?saveModel():''"
                                 ng-if="curStep.title=='Settings' && 
state.mode=='edit'">
                             Save
                         </button>

http://git-wip-us.apache.org/repos/asf/kylin/blob/73b98e89/webapp/app/partials/streaming/streaming_edit.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/streaming/streaming_edit.html 
b/webapp/app/partials/streaming/streaming_edit.html
deleted file mode 100644
index d4b4926..0000000
--- a/webapp/app/partials/streaming/streaming_edit.html
+++ /dev/null
@@ -1,34 +0,0 @@
-<!--
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements.  See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership.  The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
--->
-
-<div class="row">
-    <div class="col-xs-3">
-      <div ng-include src="'partials/models/models_tree.html'" 
ng-controller="ModelsCtrl"></div>
-      <!--<div ng-include src="'partials/tables/source_table_tree.html'" 
ng-controller="SourceMetaCtrl"></div>-->
-    </div>
-    <div class="col-xs-9">
-        <form role="form" name="cube_form" novalidate>
-            <!-- This margin in order to align with table tree in left part -->
-            <div style="margin-top: 20px;" ng-controller="CubeEditCtrl">
-                <div ng-include="'partials/streaming/streaming_schema.html'" 
ng-controller="StreamingSchemaCtrl">
-                </div>
-            </div>
-        </form>
-    </div>
-</div>
-</div>

http://git-wip-us.apache.org/repos/asf/kylin/blob/73b98e89/webapp/app/partials/streaming/streaming_schema.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/streaming/streaming_schema.html 
b/webapp/app/partials/streaming/streaming_schema.html
deleted file mode 100644
index a45904c..0000000
--- a/webapp/app/partials/streaming/streaming_schema.html
+++ /dev/null
@@ -1,63 +0,0 @@
-<!--
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements.  See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership.  The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
--->
-
-<!--hide when view model and no model selected-->
-<div class="box box-primary model-design box-2px" ng-init="model">
-    <div class="box-header widget-header-blue widget-header-flat">
-        <h4 class="box-title text-info">Streaming Designer</h4>
-    </div>
-    <div class="box-body">
-        <div>
-            <ul class="wizard-steps">
-                <li ng-repeat="step in wizardSteps"
-                    class="{{step==curStep?'active':''}} 
{{step.isComplete?'complete':''}}">
-                    <span style="cursor:pointer;" 
ng-click="checkForm()?goToStep($index):''" class="step">{{step.step = ($index + 
1)}}</span>
-                    <span class="title">{{step.title}}</span>
-                </li>
-            </ul>
-        </div>
-        <hr/>
-        <div class="step-content pos-rel" id="step-container">
-            <div ng-include src="curStep.src"></div>
-        </div>
-        <hr/>
-        <div class="wizard-actions">
-            <div class="row">
-                <div class="col-xs-8" style="display:block;">
-                    <div>
-                    </div>
-                </div>
-                <div class="col-xs-4 pull-right">
-                    <button class="btn btn-prev" ng-click="preView()" 
ng-show="curStep.title!='Streaming Config'">
-                        <i class="ace-icon fa fa-arrow-left"></i>
-                        Prev
-                    </button>
-                    <button id="nextButton" class="btn btn-success btn-next" 
ng-disabled="forms[curStep.form].$invalid" ng-click="checkForm()?nextView():''"
-                            ng-show="curStep.title!='Advanced Settings'">
-                        Next
-                        <i class="ace-icon fa fa-arrow-right 
icon-on-right"></i>
-                    </button>
-                    <button class="btn btn-primary"  
ng-click="checkForm()?saveStreaming():''"
-                            ng-if="curStep.title=='Advanced Settings' && 
state.mode=='edit'">
-                        Save
-                    </button>
-                </div>
-            </div>
-        </div>
-    </div>
-</div>

Reply via email to