You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by li...@apache.org on 2015/03/03 11:08:09 UTC
[13/26] incubator-kylin git commit: refactor source_table_tree & add
'model Json format info' to cube wizard
refactor source_table_tree & add 'model Json format info' to cube wizard
Project: http://git-wip-us.apache.org/repos/asf/incubator-kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-kylin/commit/d804e602
Tree: http://git-wip-us.apache.org/repos/asf/incubator-kylin/tree/d804e602
Diff: http://git-wip-us.apache.org/repos/asf/incubator-kylin/diff/d804e602
Branch: refs/heads/streaming
Commit: d804e602ad64b41bfa7c4843ed5fb2874c8497c5
Parents: 4b65f02
Author: jiazhong <ji...@ebay.com>
Authored: Sat Feb 28 17:40:18 2015 +0800
Committer: jiazhong <ji...@ebay.com>
Committed: Sat Feb 28 17:40:18 2015 +0800
----------------------------------------------------------------------
webapp/app/js/controllers/sourceMeta.js | 37 +++-----
webapp/app/js/model/tableModel.js | 92 +++++++++++---------
webapp/app/js/services/tables.js | 0
webapp/app/partials/cubes/cube_detail.html | 10 ++-
webapp/app/partials/tables/source_metadata.html | 44 +++++-----
.../app/partials/tables/source_table_tree.html | 6 +-
6 files changed, 97 insertions(+), 92 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/d804e602/webapp/app/js/controllers/sourceMeta.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/sourceMeta.js b/webapp/app/js/controllers/sourceMeta.js
old mode 100644
new mode 100755
index e2f166c..6f14e83
--- a/webapp/app/js/controllers/sourceMeta.js
+++ b/webapp/app/js/controllers/sourceMeta.js
@@ -21,14 +21,13 @@
KylinApp
.controller('SourceMetaCtrl', function ($scope,$cacheFactory, $q, $window, $routeParams, CubeService, $modal, TableService,$route,loadingRequest,SweetAlert,tableConfig,TableModel) {
var $httpDefaultCache = $cacheFactory.get('$http');
- $scope.selectedSrcDb = [];
- $scope.selectedSrcTable = {};
+ $scope.tableModel = TableModel;
+ $scope.tableModel.selectedSrcDb = [];
+ $scope.tableModel.selectedSrcTable = {};
$scope.window = 0.68 * $window.innerHeight;
$scope.tableConfig = tableConfig;
- $scope.hiveTbLoad={
- status:"init"
- }
+
$scope.state = { filterAttr: 'id', filterReverse:false, reverseColumn: 'id',
dimensionFilter: '', measureFilter: ''};
@@ -42,7 +41,7 @@ KylinApp
};
$scope.aceSrcTbLoaded = function (forceLoad) {
- $scope.selectedSrcDb = [];
+ $scope.tableModel.selectedSrcDb = [];
$scope.treeOptions = {
nodeChildren: "columns",
injectClasses: {
@@ -57,7 +56,7 @@ KylinApp
}
};
- $scope.selectedSrcTable = {};
+ $scope.tableModel.selectedSrcTable = {};
var defer = $q.defer();
$scope.loading = true;
@@ -93,9 +92,10 @@ KylinApp
obj.sort(innerSort);
}
+ $scope.tableModel.selectedSrcDb = [];
for (var key in tableMap) {
var tables = tableMap[key];
- $scope.selectedSrcDb.push({
+ $scope.tableModel.selectedSrcDb.push({
"name": key,
"columns": tables
});
@@ -112,25 +112,20 @@ KylinApp
$scope.aceSrcTbLoaded();
});
- $scope.$watch('hiveTbLoad.status', function (newValue, oldValue) {
- if(newValue=="success"){
- $scope.aceSrcTbLoaded(true);
- }
- });
$scope.showSelected = function (obj) {
if (obj.uuid) {
- $scope.selectedSrcTable = obj;
+ $scope.tableModel.selectedSrcTable = obj;
}
else if(obj.datatype) {
- $scope.selectedSrcTable.selectedSrcColumn = obj;
+ $scope.tableModel.selectedSrcTable.selectedSrcColumn = obj;
}
};
$scope.aceSrcTbChanged = function () {
- $scope.selectedSrcDb = [];
- $scope.selectedSrcTable = {};
+ $scope.tableModel.selectedSrcDb = [];
+ $scope.tableModel.selectedSrcTable = {};
$scope.aceSrcTbLoaded(true);
};
@@ -146,9 +141,6 @@ KylinApp
projectName:function(){
return $scope.projectModel.selectedProject;
},
- hiveTbLoad:function(){
- return $scope.hiveTbLoad;
- },
scope: function () {
return $scope;
}
@@ -156,7 +148,7 @@ KylinApp
});
};
- var ModalInstanceCtrl = function ($scope,$location, $modalInstance, tableNames, MessageService,projectName,hiveTbLoad) {
+ var ModalInstanceCtrl = function ($scope,$location, $modalInstance, tableNames, MessageService,projectName,scope) {
$scope.tableNames = "";
$scope.projectName = projectName;
$scope.cancel = function () {
@@ -195,8 +187,8 @@ KylinApp
SweetAlert.swal('Partial loaded!','The following table(s) have been successfully synchronized: ' + loadTableInfo+"\n\n Failed to synchronize following table(s):" + unloadedTableInfo, 'warning');
}
loadingRequest.hide();
+ scope.aceSrcTbLoaded(true);
- hiveTbLoad.status="success";
},function(e){
if(e.data&& e.data.exception){
var message =e.data.exception;
@@ -206,7 +198,6 @@ KylinApp
SweetAlert.swal('Oops...', "Failed to take action.", 'error');
}
loadingRequest.hide();
- hiveTbLoad.status="init";
})
}
};
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/d804e602/webapp/app/js/model/tableModel.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/model/tableModel.js b/webapp/app/js/model/tableModel.js
old mode 100644
new mode 100755
index 3f734a1..a3bc820
--- a/webapp/app/js/model/tableModel.js
+++ b/webapp/app/js/model/tableModel.js
@@ -1,43 +1,49 @@
-/*
- * 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.
-*/
-
-KylinApp.service('TableModel', function() {
-
-
- this.selectProjectTables = [];
-
- this.initTables = function(){
- this.selectProjectTables = [];
- }
-
- this.addTable = function(table){
- this.selectProjectTables.push(table);
- }
-
- this.setSelectedProjectTables = function(tables) {
- this.selectProjectTables = tables;
- }
-
-
- this.selectedSrcDb = [];
-
- this.selectedSrcTable = {};
-
-
-});
-
+/*
+ * 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.
+*/
+
+KylinApp.service('TableModel', function() {
+
+
+ //for tables in cubeDesigner
+ this.selectProjectTables = [];
+
+ this.initTables = function(){
+ this.selectProjectTables = [];
+ }
+
+ this.addTable = function(table){
+ this.selectProjectTables.push(table);
+ }
+
+ this.setSelectedProjectTables = function(tables) {
+ this.selectProjectTables = tables;
+ }
+
+
+ // for load table page
+ this.selectedSrcDb = [];
+ this.selectedSrcTable = {};
+
+ this.init = function(){
+ this.selectedSrcDb = [];
+ this.selectedSrcTable = {};
+ }
+
+
+});
+
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/d804e602/webapp/app/js/services/tables.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/services/tables.js b/webapp/app/js/services/tables.js
old mode 100644
new mode 100755
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/d804e602/webapp/app/partials/cubes/cube_detail.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/cubes/cube_detail.html b/webapp/app/partials/cubes/cube_detail.html
index 6668b8d..59f2d69 100755
--- a/webapp/app/partials/cubes/cube_detail.html
+++ b/webapp/app/partials/cubes/cube_detail.html
@@ -29,8 +29,12 @@
</li>
<li class="{{cube.visiblePage=='json'? 'active':''}}"
ng-if="userService.hasRole('ROLE_ADMIN') || hasPermission(cube, 16) && !newAccess">
- <a href="" ng-click="cube.visiblePage='json';">JSON</a>
+ <a href="" ng-click="cube.visiblePage='json';">JSON(Cube)</a>
</li>
+ <li class="{{cube.visiblePage=='json_model'? 'active':''}}"
+ ng-if="userService.hasRole('ROLE_ADMIN') || hasPermission(cube, 16) && !newAccess">
+ <a href="" ng-click="cube.visiblePage='json_model';">JSON(Model)</a>
+ </li>
<li class="{{cube.visiblePage=='access'? 'active':''}}">
<a href="" ng-click="cube.visiblePage='access';listAccess(cube, 'CubeInstance');">Access</a>
</li>
@@ -64,6 +68,10 @@
style="background-color: white;border: 0px">{{angular.toJson(cleanStatus(cube.detail), true)}}</pre>
</div>
+ <div ng-show="cube.visiblePage=='json_model'" class="cube-detail">
+ <pre ng-if="!state.jsonEdit"
+ style="background-color: white;border: 0px">{{angular.toJson(cleanStatus(cube.model), true)}}</pre>
+ </div>
<div ng-show="cube.visiblePage=='graph'" id="cube_graph_{{cube.name}}" class="cube-detail cube_graph">
</div>
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/d804e602/webapp/app/partials/tables/source_metadata.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/tables/source_metadata.html b/webapp/app/partials/tables/source_metadata.html
old mode 100644
new mode 100755
index e77185a..62b4d0f
--- a/webapp/app/partials/tables/source_metadata.html
+++ b/webapp/app/partials/tables/source_metadata.html
@@ -45,7 +45,7 @@
</div>
<!--Tab-->
<div class="col-xs-9">
- <h3 class="text-info">Table Schema:{{ selectedSrcTable.name}}</h3>
+ <h3 class="text-info">Table Schema:{{ tableModel.selectedSrcTable.name}}</h3>
<div class="tabbable nav-tabs-custom">
<ul class="nav nav-tabs">
<li class="active">
@@ -58,52 +58,52 @@
<div class="tab-content">
<!--Schema-->
<div id="schema" class="tab-pane">
- <div ng-if="selectedSrcTable.uuid" class="table-responsive">
+ <div ng-if="tableModel.selectedSrcTable.uuid" class="table-responsive">
<table class="table">
<tbody>
<tr>
<th style="width:20%">NAME</th>
- <td>{{ selectedSrcTable.name}}</td>
+ <td>{{ tableModel.selectedSrcTable.name}}</td>
</tr>
<tr>
<th>Hive DATABASE</th>
- <td>{{selectedSrcTable.database}}</td>
+ <td>{{tableModel.selectedSrcTable.database}}</td>
</tr>
<tr>
<th>SNAPSHOT TIME</th>
- <td>{{selectedSrcTable.exd.lastUpdateTime | utcToConfigTimeZone}}</td>
+ <td>{{tableModel.selectedSrcTable.exd.lastUpdateTime | utcToConfigTimeZone}}</td>
</tr>
<tr>
<th>LOCATION</th>
- <td>{{selectedSrcTable.exd.location}}</td>
+ <td>{{tableModel.selectedSrcTable.exd.location}}</td>
</tr>
<tr>
<th>INPUT FORMAT</th>
- <td>{{selectedSrcTable.exd.inputformat}}</td>
+ <td>{{tableModel.selectedSrcTable.exd.inputformat}}</td>
</tr>
<tr>
<th>OUTPUT FORMAT</th>
- <td>{{selectedSrcTable.exd.outputformat}}</td>
+ <td>{{tableModel.selectedSrcTable.exd.outputformat}}</td>
</tr>
<tr>
<th>OWNER</th>
- <td><a href="mailto:{{selectedSrcTable.exd.owner}}">{{selectedSrcTable.exd.owner}}</a></td>
+ <td><a href="mailto:{{tableModel.selectedSrcTable.exd.owner}}">{{tableModel.selectedSrcTable.exd.owner}}</a></td>
</tr>
<tr>
<th>TOTAL FILE NUMBER</th>
- <td>{{selectedSrcTable.exd.totalNumberFiles}}</td>
+ <td>{{tableModel.selectedSrcTable.exd.totalNumberFiles}}</td>
</tr>
<tr>
<th>TOTAL FILE SIZE</th>
- <td>{{selectedSrcTable.exd.totalFileSize}}</td>
+ <td>{{tableModel.selectedSrcTable.exd.totalFileSize}}</td>
</tr>
<tr>
<th>PARTITIONED</th>
- <td>{{selectedSrcTable.exd.partitioned}}</td>
+ <td>{{tableModel.selectedSrcTable.exd.partitioned}}</td>
</tr>
<tr>
<th>PARTITION COLUMNS</th>
- <td>{{selectedSrcTable.exd.partitionColumns}}</td>
+ <td>{{tableModel.selectedSrcTable.exd.partitionColumns}}</td>
</tr>
</tbody>
</table>
@@ -120,7 +120,7 @@
</span>
</div>
<div class="space-6"></div>
- <div ng-if="(selectedSrcTable.columns | filter: columnName).length>0">
+ <div ng-if="(tableModel.selectedSrcTable.columns | filter: columnName).length>0">
<table class="table table-hover table-striped list">
<thead>
<tr style="cursor: pointer">
@@ -137,26 +137,26 @@
</tr>
</thead>
- <tr ng-repeat="column in selectedSrcTable.columns | filter: columnName | orderObjectBy:state.filterAttr:state.filterReverse">
- <td style="{{(selectedSrcTable.selectedSrcColumn.id == column.id)? 'background-color:#EBF9FE':''}}">
+ <tr ng-repeat="column in tableModel.selectedSrcTable.columns | filter: columnName | orderObjectBy:state.filterAttr:state.filterReverse">
+ <td style="{{(tableModel.selectedSrcTable.selectedSrcColumn.id == column.id)? 'background-color:#EBF9FE':''}}">
{{ column.id}}
</td>
- <td style="{{(selectedSrcTable.selectedSrcColumn.id == column.id)? 'background-color:#EBF9FE':''}}">
+ <td style="{{(tableModel.selectedSrcTable.selectedSrcColumn.id == column.id)? 'background-color:#EBF9FE':''}}">
{{ column.name}}
</td>
- <td style="{{(selectedSrcTable.selectedSrcColumn.id == column.id)? 'background-color:#EBF9FE':''}}">
+ <td style="{{(tableModel.selectedSrcTable.selectedSrcColumn.id == column.id)? 'background-color:#EBF9FE':''}}">
{{ column.datatype}}
</td>
- <td style="{{(selectedSrcTable.selectedSrcColumn.id == column.id)? 'background-color:#EBF9FE':''}}">
- <!--{{ selectedSrcTable.cardinality[column.name]}}-->
+ <td style="{{(tableModel.selectedSrcTable.selectedSrcColumn.id == column.id)? 'background-color:#EBF9FE':''}}">
+ <!--{{ tableModel.selectedSrcTable.cardinality[column.name]}}-->
{{column.cardinality}}
</td>
</tr>
</table>
</div>
- <div ng-if="(selectedSrcTable.columns | filter: columnName).length == 0" no-result
+ <div ng-if="(tableModel.selectedSrcTable.columns | filter: columnName).length == 0" no-result
text="No Matched Table Column."></div>
- <div ng-if="!!!selectedSrcTable.uuid">
+ <div ng-if="!!!tableModel.selectedSrcTable.uuid">
<div no-result text="No Table Selected."></div>
</div>
</div>
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/d804e602/webapp/app/partials/tables/source_table_tree.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/tables/source_table_tree.html b/webapp/app/partials/tables/source_table_tree.html
old mode 100644
new mode 100755
index 972e996..f2cd7ed
--- a/webapp/app/partials/tables/source_table_tree.html
+++ b/webapp/app/partials/tables/source_table_tree.html
@@ -34,12 +34,12 @@
<div class="space-4"></div>
<!--tree-->
<div style="width:100%; height:{{window}}px; overflow:auto;">
- <treecontrol ng-if="selectedSrcDb.length > 0" class="tree-light"
+ <treecontrol ng-if="tableModel.selectedSrcDb.length > 0" class="tree-light"
dirSelection="true"
- tree-model="selectedSrcDb"
+ tree-model="tableModel.selectedSrcDb"
options="treeOptions"
on-selection="showSelected(node)"
- selected-node="selectedSrcTable">
+ selected-node="tableModel.selectedSrcTable">
{{node.name}} {{!!(node.datatype)?'(' + trimType(node.datatype) + ')' : ''}}
</treecontrol>
</div>