You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by zh...@apache.org on 2016/04/18 16:53:53 UTC

kylin git commit: KYLIN-1587 show cube level configuration overwrites properties in CubeDesigner

Repository: kylin
Updated Branches:
  refs/heads/master 205471998 -> 0320d1f78


KYLIN-1587 show cube level configuration overwrites properties in CubeDesigner


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

Branch: refs/heads/master
Commit: 0320d1f78f834bd941c7d531009a9434007254a6
Parents: 2054719
Author: Jason <ji...@163.com>
Authored: Mon Apr 18 22:53:15 2016 +0800
Committer: Jason <ji...@163.com>
Committed: Mon Apr 18 22:53:38 2016 +0800

----------------------------------------------------------------------
 webapp/app/index.html                           |  1 +
 webapp/app/js/controllers/cubeOverwriteProp.js  | 71 ++++++++++++++++++++
 webapp/app/js/controllers/cubeSchema.js         | 49 +++++++-------
 .../cubeDesigner/cubeOverwriteProp.html         | 70 +++++++++++++++++++
 4 files changed, 166 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/0320d1f7/webapp/app/index.html
----------------------------------------------------------------------
diff --git a/webapp/app/index.html b/webapp/app/index.html
index 82cef34..a25f812 100644
--- a/webapp/app/index.html
+++ b/webapp/app/index.html
@@ -179,6 +179,7 @@
 <script src="js/controllers/cubeDimensions.js"></script>
 <script src="js/controllers/cubeRefresh.js"></script>
 <script src="js/controllers/cubeAdvanceSetting.js"></script>
+<script src="js/controllers/cubeOverwriteProp.js"></script>
 <script src="js/controllers/cubeMeasures.js"></script>
 <!--New GUI-->
 <script src="js/controllers/modelSchema.js"></script>

http://git-wip-us.apache.org/repos/asf/kylin/blob/0320d1f7/webapp/app/js/controllers/cubeOverwriteProp.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/cubeOverwriteProp.js b/webapp/app/js/controllers/cubeOverwriteProp.js
new file mode 100644
index 0000000..25e99d5
--- /dev/null
+++ b/webapp/app/js/controllers/cubeOverwriteProp.js
@@ -0,0 +1,71 @@
+/*
+ * 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.
+*/
+
+'use strict';
+
+KylinApp.controller('CubeOverWriteCtrl', function ($scope, $modal,cubeConfig,MetaModel,cubesManager,CubeDescModel) {
+  $scope.cubesManager = cubesManager;
+
+
+  //rowkey
+  $scope.convertedProperties = [];
+
+  for(var key in $scope.cubeMetaFrame.override_kylin_properties){
+    $scope.convertedProperties.push({
+      name:key,
+      value:$scope.cubeMetaFrame.override_kylin_properties[key]
+    });
+  }
+
+
+  $scope.addNewProperty = function () {
+    if($scope.cubeMetaFrame.override_kylin_properties.hasOwnProperty('')){
+      return;
+    }
+    $scope.cubeMetaFrame.override_kylin_properties['']='';
+    $scope.convertedProperties.push({
+      name:'',
+      value:''
+    });
+
+  };
+
+  $scope.refreshPropertiesObj = function(){
+    $scope.cubeMetaFrame.override_kylin_properties = {};
+    angular.forEach($scope.convertedProperties,function(item,index){
+      $scope.cubeMetaFrame.override_kylin_properties[item.name] = item.value;
+    })
+  }
+
+
+  $scope.refreshProperty = function(list,index,item){
+    $scope.convertedProperties[index] = item;
+    $scope.refreshPropertiesObj();
+  }
+
+
+  $scope.removeProperty= function(arr,index,item){
+    if (index > -1) {
+      arr.splice(index, 1);
+    }
+    delete $scope.cubeMetaFrame.override_kylin_properties[item.name];
+  }
+
+
+
+});

http://git-wip-us.apache.org/repos/asf/kylin/blob/0320d1f7/webapp/app/js/controllers/cubeSchema.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/cubeSchema.js b/webapp/app/js/controllers/cubeSchema.js
index 618e14e..f9d9dc1 100755
--- a/webapp/app/js/controllers/cubeSchema.js
+++ b/webapp/app/js/controllers/cubeSchema.js
@@ -35,6 +35,7 @@ KylinApp.controller('CubeSchemaCtrl', function ($scope, QueryService, UserServic
             $scope.wizardSteps.push({title: 'Advanced Setting', src: 'partials/cubeDesigner/advanced_settings.html', isComplete: false,form:'cube_setting_form'});
     }
     //$scope.wizardSteps.push({title: 'Streaming', src: 'partials/cubeDesigner/streamingConfig.html', isComplete: false,form:'cube_streaming_form'});
+    $scope.wizardSteps.push({title: 'Configuration Overwrites ', src: 'partials/cubeDesigner/cubeOverwriteProp.html', isComplete: false,form:'cube_overwrite_prop_form'});
     $scope.wizardSteps.push({title: 'Overview', src: 'partials/cubeDesigner/overview.html', isComplete: false,form:null});
 
     $scope.curStep = $scope.wizardSteps[0];
@@ -200,8 +201,8 @@ KylinApp.controller('CubeSchemaCtrl', function ($scope, QueryService, UserServic
                         break;
                     case 'cube_setting_form':
                         return $scope.check_cube_setting();
-                    case 'cube_streaming_form':
-                        return $scope.kafka_ad_config_form();
+                    case 'cube_overwrite_prop_form':
+                        return $scope.cube_overwrite_prop_check();
                     default:
                         return true;
                         break;
@@ -290,31 +291,29 @@ KylinApp.controller('CubeSchemaCtrl', function ($scope, QueryService, UserServic
         }
     }
 
-  $scope.kafka_ad_config_form = function(){
-    if(!$scope.cubeState.isStreaming){
-      return true;
-    }
-    var errors = [];
-    if(!$scope.kafkaMeta.clusters.length){
-      errors.push("Cluster can't be null");
-    }
-    angular.forEach($scope.kafkaMeta.clusters,function(cluster,index){
-      if(!cluster.brokers.length){
-        errors.push("No broker under Cluster-"+(index+1));
+    $scope.cube_overwrite_prop_check = function(){
+      var errors = [];
+
+      for(var key in $scope.cubeMetaFrame.override_kylin_properties){
+        if(key==''){
+          errors.push("Property name is required.");
+        }
+        if($scope.cubeMetaFrame.override_kylin_properties[key] == ''){
+          errors.push("Property value is required.");
+        }
       }
-    })
-    var errorInfo = "";
-    angular.forEach(errors,function(item){
-      errorInfo+="\n"+item;
-    });
-    if(errors.length){
-      SweetAlert.swal('', errorInfo, 'warning');
-      return false;
-    }else{
-      return true;
-    }
-  }
 
+      var errorInfo = "";
+      angular.forEach(errors,function(item){
+        errorInfo+="\n"+item;
+      });
+      if(errors.length){
+        SweetAlert.swal('', errorInfo, 'warning');
+        return false;
+      }else{
+        return true;
+      }
+    }
 
     // ~ private methods
     function initProject() {

http://git-wip-us.apache.org/repos/asf/kylin/blob/0320d1f7/webapp/app/partials/cubeDesigner/cubeOverwriteProp.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/cubeDesigner/cubeOverwriteProp.html b/webapp/app/partials/cubeDesigner/cubeOverwriteProp.html
new file mode 100644
index 0000000..c1a1648
--- /dev/null
+++ b/webapp/app/partials/cubeDesigner/cubeOverwriteProp.html
@@ -0,0 +1,70 @@
+<!--
+* 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" ng-controller="CubeOverWriteCtrl" style="padding-left:40px;">
+    <div class="col-xs-8">
+        <ng-form name="forms.cube_overwrite_prop_form" novalidate>
+            <!--Project-->
+            <div ng-repeat=" prop in convertedProperties track by $index " class="form-group">
+                <div class="row">
+                  <label class="col-xs-12 col-sm-6 control-label no-padding-right" ng-class="{'has-error':prop.name==''}">
+                    <b ng-if="state.mode=='view'">{{prop.name}}</b>
+                    <input ng-model="prop.name" placeholder="key" ng-change="refreshProperty(convertedProperties,$index,prop)" class="form-control" ng-if="state.mode=='edit'"/>
+                    <small style="font-weight: normal !important;" class="help-block" ng-show="prop.name==''">Property name is required.</small>
+                  </label>
+                  <div class="col-xs-12 col-sm-5" ng-class="{'has-error':prop.value==''}">
+                    <input ng-model="prop.value" placeholder="value" ng-change="refreshProperty(convertedProperties,$index,prop)" class="form-control" ng-if="state.mode=='edit'"/>
+                    <small class="help-block" ng-show="prop.value==''">Property value is required.</small>
+                    <span ng-if="state.mode=='view'">{{prop.value}}</span>
+                  </div>
+                  <div class="col-sm-1" ng-if="state.mode=='edit'">
+                    <button class="btn btn-xs btn-info" ng-click="removeProperty(convertedProperties,$index,prop)"><i class="fa fa-minus"></i>
+                    </button>
+                  </div>
+
+                </div>
+            </div>
+        </ng-form>
+        <!--Add Measures Property-->
+        <div class="form-group">
+          <button class="btn btn-sm btn-info" ng-click="addNewProperty();" ng-show="state.mode=='edit'">
+            <i class="fa fa-plus"></i> Property
+          </button>
+        </div>
+
+    </div>
+
+  <!--Tips-->
+  <div class="col-xs-4">
+    <div class="box box-solid">
+      <div class="box-header widget-header-flat">
+        <h4 class="box-title">Tips</h4>
+      </div>
+      <div class="box-body">
+        <div class="row">
+          <div class="col-xs-12">
+            <ol class="text-info">
+              <li>Cube level properties will overwrite configuration in kylin.prperties</li>
+            </ol>
+          </div>
+        </div>
+      </div>
+    </div>
+  </div>
+
+</div>