kylin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kangkai...@apache.org
Subject kylin git commit: KYLIN-2665 Add model JSON edit in web
Date Fri, 09 Jun 2017 10:49:32 GMT
Repository: kylin
Updated Branches:
  refs/heads/master c9ee26bce -> c912949b0


KYLIN-2665 Add model JSON edit in web


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

Branch: refs/heads/master
Commit: c912949b037d590b2c3084ef0ad993d1bd8f0a30
Parents: c9ee26b
Author: kangkaisen <kangkaisen@live.com>
Authored: Tue Jun 6 11:31:02 2017 +0800
Committer: kangkaisen <kangkaisen@live.com>
Committed: Fri Jun 9 18:52:15 2017 +0800

----------------------------------------------------------------------
 webapp/app/js/controllers/modelEdit.js          |  5 +--
 webapp/app/partials/models/model_json_edit.html | 44 ++++++++++++++++++++
 webapp/app/partials/models/model_schema.html    |  4 +-
 webapp/app/partials/models/models_tree.html     |  2 +
 webapp/app/routes.json                          |  8 ++++
 5 files changed, 58 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/c912949b/webapp/app/js/controllers/modelEdit.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/modelEdit.js b/webapp/app/js/controllers/modelEdit.js
index ff85f4f..a8d5c3c 100644
--- a/webapp/app/js/controllers/modelEdit.js
+++ b/webapp/app/js/controllers/modelEdit.js
@@ -81,6 +81,8 @@ KylinApp.controller('ModelEditCtrl', function ($scope, $q, $routeParams,
$locati
       ModelDescService.query({model_name: modelName}, function (model) {
         if (model) {
           modelsManager.selectedModel = model;
+          $scope.state.modelSchema = angular.toJson(model, true);
+
           $scope.FactTable={root:$scope.modelsManager.selectedModel.fact_table};
           $scope.aliasTableMap[VdmUtil.removeNameSpace($scope.modelsManager.selectedModel.fact_table)]=$scope.modelsManager.selectedModel.fact_table;
           $scope.tableAliasMap[$scope.modelsManager.selectedModel.fact_table]=VdmUtil.removeNameSpace($scope.modelsManager.selectedModel.fact_table);
@@ -132,9 +134,6 @@ KylinApp.controller('ModelEditCtrl', function ($scope, $q, $routeParams,
$locati
     };
 
     $scope.saveModel = function () {
-
-        $scope.prepareModel();
-
         try {
             angular.fromJson($scope.state.modelSchema);
         } catch (e) {

http://git-wip-us.apache.org/repos/asf/kylin/blob/c912949b/webapp/app/partials/models/model_json_edit.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/models/model_json_edit.html b/webapp/app/partials/models/model_json_edit.html
new file mode 100644
index 0000000..0764190
--- /dev/null
+++ b/webapp/app/partials/models/model_json_edit.html
@@ -0,0 +1,44 @@
+<!--
+* 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 ng-controller="ModelEditCtrl">
+    <div class="row">
+        <div class="col-xs-3">
+        </div>
+        <div class="col-xs-9">
+            <form role="form" name="model_form" novalidate>
+                <section style="padding-bottom: 20px">
+                    <div style="height: 620px; font-size: 14px;" ui-ace="{
+                                      useWrapMode : true,
+                                      showGutter: true,
+                                      theme:'chrome',
+                                      mode: 'json',
+                                      onLoad: aceLoaded,
+                                      onChange: aceChanged
+                                    }" ng-model="state.modelSchema">
+                    </div>
+                </section>
+                <button class="btn btn-primary" ng-disabled="model_form.$invalid" ng-click="state.project
= projectModel.selectedProject;saveModel()">
+                    Save
+                </button>
+            </form>
+        </div>
+    </div>
+</div>
+
+

http://git-wip-us.apache.org/repos/asf/kylin/blob/c912949b/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 fec9153..3a332de 100644
--- a/webapp/app/partials/models/model_schema.html
+++ b/webapp/app/partials/models/model_schema.html
@@ -52,8 +52,8 @@
                             Next
                             <i class="ace-icon fa fa-arrow-right icon-on-right"></i>
                         </button>
-                        <button class="btn btn-primary"  ng-click="checkForm($index)?saveModel():''"
-                                ng-if="curStep.title=='Settings' && state.mode=='edit'">
+                        <button class="btn btn-primary"  ng-click="prepareModel();saveModel()"
+                                ng-if="curStep.title=='Settings' && state.mode=='edit'
&& checkForm($index)">
                             Save
                         </button>
                     </div>

http://git-wip-us.apache.org/repos/asf/kylin/blob/c912949b/webapp/app/partials/models/models_tree.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/models/models_tree.html b/webapp/app/partials/models/models_tree.html
index eba7d29..c7b55a3 100644
--- a/webapp/app/partials/models/models_tree.html
+++ b/webapp/app/partials/models/models_tree.html
@@ -56,6 +56,8 @@
                   <li><a ng-click="editModel(model)"  title="Edit Model" style="cursor:pointer;margin-right:
8px;" >Edit</a></li>
                   <li><a ng-click="cloneModel(model)" title="Clone Model"  style="cursor:pointer;margin-right:
8px;" >Clone </a></li>
                   <li><a ng-click="dropModel(model)" title="Drop Model"  style="cursor:pointer;margin-right:
8px;">Drop</a></li>
+                  <li ng-if="userService.hasRole('ROLE_ADMIN')">
+                    <a href="models/edit/{{model.name}}/descriptionjson">Edit(JSON)</a></li>
                 </ul>
               </div>
             </div>

http://git-wip-us.apache.org/repos/asf/kylin/blob/c912949b/webapp/app/routes.json
----------------------------------------------------------------------
diff --git a/webapp/app/routes.json b/webapp/app/routes.json
index b4dcced..6729daf 100644
--- a/webapp/app/routes.json
+++ b/webapp/app/routes.json
@@ -104,5 +104,13 @@
       "tab": "models",
       "controller": "ModelEditCtrl"
     }
+  },
+  {
+    "url": "/models/edit/:modelName/descriptionjson",
+    "params": {
+      "templateUrl": "partials/models/model_json_edit.html",
+      "tab": "models",
+      "controller": "ModelEditCtrl"
+    }
   }
 ]


Mime
View raw message