Repository: kylin Updated Branches: refs/heads/master 09377224c -> c880db0d7
KYLIN-2222 web ui uses rest api to decide which dim encoding is valid for different typed columns Signed-off-by: Hongbin Ma <mahong...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/kylin/repo Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/c880db0d Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/c880db0d Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/c880db0d Branch: refs/heads/master Commit: c880db0d7af2271c49f1465c1de229d7d52444ea Parents: 0937722 Author: luguosheng <550175...@qq.com> Authored: Tue Feb 14 18:25:58 2017 +0800 Committer: Hongbin Ma <mahong...@apache.org> Committed: Wed Feb 15 23:02:34 2017 +0800 ---------------------------------------------------------------------- webapp/app/index.html | 7 +- webapp/app/js/controllers/cubeAdvanceSetting.js | 39 +++---- webapp/app/js/controllers/cubeEdit.js | 117 +++++++++++-------- webapp/app/js/controllers/cubeMeasures.js | 44 ++----- webapp/app/js/model/cubeConfig.js | 3 +- webapp/app/js/model/tableConfig.js | 100 +++++++++++++++- webapp/app/js/model/tableModel.js | 51 +++++++- webapp/app/js/services/encodings.js | 8 ++ webapp/app/js/utils/utils.js | 40 ++++--- webapp/app/partials/cubeDesigner/measures.html | 2 +- 10 files changed, 280 insertions(+), 131 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kylin/blob/c880db0d/webapp/app/index.html ---------------------------------------------------------------------- diff --git a/webapp/app/index.html b/webapp/app/index.html index 13b54c8..407f179 100644 --- a/webapp/app/index.html +++ b/webapp/app/index.html @@ -22,6 +22,11 @@ <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> + <!-- HTTP 1.1 --> + <meta http-equiv="pragma" content="no-cache"> + <!-- HTTP 1.0 --> + <meta http-equiv="cache-control" content="no-cache"> + <meta name="format-detection" content="telephone=no"> <base href="/kylin/"> <link rel="icon" href="image/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="image/favicon.ico" type="image/x-icon"> @@ -128,7 +133,7 @@ <script src="js/services/auth.js"></script> <script src="js/services/cubeDesc.js"></script> <script src="js/services/model.js"></script> - +<script src="js/services/encodings.js"></script> <script src="js/services/cubes.js"></script> <script src="js/services/streaming.js"></script> <script src="js/services/graph.js"></script> http://git-wip-us.apache.org/repos/asf/kylin/blob/c880db0d/webapp/app/js/controllers/cubeAdvanceSetting.js ---------------------------------------------------------------------- diff --git a/webapp/app/js/controllers/cubeAdvanceSetting.js b/webapp/app/js/controllers/cubeAdvanceSetting.js index 7cdb1cd..7aaa604 100644 --- a/webapp/app/js/controllers/cubeAdvanceSetting.js +++ b/webapp/app/js/controllers/cubeAdvanceSetting.js @@ -18,41 +18,34 @@ 'use strict'; -KylinApp.controller('CubeAdvanceSettingCtrl', function ($scope, $modal,cubeConfig,MetaModel,cubesManager,CubeDescModel,SweetAlert) { +KylinApp.controller('CubeAdvanceSettingCtrl', function ($scope, $modal,cubeConfig,MetaModel,cubesManager,CubeDescModel,SweetAlert,VdmUtil) { $scope.cubesManager = cubesManager; - $scope.getTypeVersion=function(typename){ - var searchResult=/\s*\(v(\d+)\)/.exec(typename); - if(searchResult&&searchResult.length){ - return searchResult.length&&searchResult[1]||1; - }else{ - return 1; - } - } - $scope.removeVersion=function(typename){ - if(typename){ - return typename.replace(/\s*\(v\d+\)/g,""); - } - return ""; - } - var needLengthKeyList=['fixed_length','fixed_length_hex','int','integer']; - //rowkey + + var needLengthKeyList=cubeConfig.needSetLengthEncodingList; $scope.convertedRowkeys = []; angular.forEach($scope.cubeMetaFrame.rowkey.rowkey_columns,function(item){ item.encoding=$scope.removeVersion(item.encoding); - var _encoding = item.encoding; - var _valueLength ; + var _valueLength; + var tableName=VdmUtil.getNameSpaceTopName(item.column); + var databaseName=$scope.getDatabaseByColumnName(item.column); var baseKey=item.encoding.replace(/:\d+/,''); - if(needLengthKeyList.indexOf(baseKey)!=-1){ + if(needLengthKeyList.indexOf(baseKey)>-1){ var result=/:(\d+)/.exec(item.encoding); _valueLength=result?result[1]:0; } - _encoding=baseKey; + var _encoding=baseKey; var rowkeyObj = { column:item.column, - encoding:_encoding+(item.encoding_version?" (v"+item.encoding_version+")":" (v1)"), + encoding:_encoding+(item.encoding_version?"[v"+item.encoding_version+"]":"[v1]"), + encodingName:_encoding, valueLength:_valueLength, isShardBy:item.isShardBy, - encoding_version:item.encoding_version||1 + encoding_version:item.encoding_version||1, + table:tableName, + database:databaseName + } + if(item.index){ + rowkeyObj.index=item.index; } $scope.convertedRowkeys.push(rowkeyObj); http://git-wip-us.apache.org/repos/asf/kylin/blob/c880db0d/webapp/app/js/controllers/cubeEdit.js ---------------------------------------------------------------------- diff --git a/webapp/app/js/controllers/cubeEdit.js b/webapp/app/js/controllers/cubeEdit.js index da19b22..32c630c 100755 --- a/webapp/app/js/controllers/cubeEdit.js +++ b/webapp/app/js/controllers/cubeEdit.js @@ -39,81 +39,99 @@ KylinApp.controller('CubeEditCtrl', function ($scope, $q, $routeParams, $locatio return; } - + $scope.getTypeVersion=function(typename){ + var searchResult=/\[v(\d+)\]/.exec(typename); + if(searchResult&&searchResult.length){ + return searchResult.length&&searchResult[1]||1; + }else{ + return 1; + } + } + $scope.removeVersion=function(typename){ + if(typename){ + return typename.replace(/\[v\d+\]/g,""); + } + return ""; + } //init encoding list $scope.store = { - supportedEncoding:[] + supportedEncoding:[], + encodingMaps:{} } + TableModel.getColumnTypeEncodingMap().then(function(data){ + $scope.store.encodingMaps=data; + }); CubeService.getValidEncodings({}, function (encodings) { if(encodings){ - delete encodings.$promise; - delete encodings.$resolved; for(var i in encodings) - if(encodings.hasOwnProperty(i)){ + if(VdmUtil.isNotExtraKey(encodings,i)){ var value = i var name = value; - var typeVersion=+encodings[i]; - if(value=="int"){ - name = "int (deprecated)"; - } - if(/\d+/.test(""+typeVersion)&&typeVersion>1){ - for(var s=1;s<=typeVersion;s++){ - $scope.store.supportedEncoding.push({ - "name":name+" (v"+s+","+(s==typeVersion&&typeVersion>1?"suggest)":")"), - "value":value+" (v"+s+")", - "version":typeVersion, - "baseValue":value, - "suggest":s==typeVersion - - }); + var typeVersion=+encodings[i]||1; + var suggest=false,selecttips=''; + if(/\d+/.test(""+typeVersion)&&typeVersion>=1){ + for(var s=1;s<=typeVersion;s++){ + if(s==typeVersion){ + suggest=true; } - }else { - $scope.store.supportedEncoding.push({ - "name": name, - "value": value+" (v1)", - "encoding_version":1, - "version":typeVersion, - "baseValue":value, - "suggest":true - }); + if(value=="int"){ + name = "int (deprecated)"; + suggest=false; + } + if(typeVersion>1){ + selecttips="(v"+s; + if(s==typeVersion){ + selecttips=",suggest)" + } + selecttips=')'; + } + $scope.store.supportedEncoding.push({ + "name":name+selecttips, + "value":value+"[v"+s+"]", + "version":typeVersion, + "baseValue":value, + "suggest":suggest + }); + } } } - } + } },function(e){ $scope.store.supportedEncoding = $scope.cubeConfig.encodings; }) - $scope.createFilter=function(type){ - if(type.indexOf("varchar")==-1){ - return ['fixed_length_hex']; - }else if(type!="date"){ - return ['date']; - }else if(type!="time"&&type!="datetime"&&type!="timestamp"){ - return ['time']; - }else{ - return []; - } + + $scope.getDatabaseByColumnName=function(column){ + return VdmUtil.getNameSpaceTopName($scope.aliasTableMap[VdmUtil.getNameSpaceTopName(column)]) + } + $scope.getColumnTypeByAliasName=function(column){ + return TableModel.columnNameTypeMap[$scope.aliasTableMap[VdmUtil.getNameSpaceTopName(column)]+'.'+VdmUtil.removeNameSpace(column)]; } $scope.getEncodings =function (name){ var filterName=name; - var type = TableModel.columnNameTypeMap[filterName]||''; + var columnType= $scope.getColumnTypeByAliasName(filterName); + var matchList=VdmUtil.getObjValFromLikeKey($scope.store.encodingMaps,columnType); var encodings =$scope.store.supportedEncoding,filterEncoding; - var filerList=$scope.createFilter(type); if($scope.isEdit){ - if($scope.cubeMetaFrame.rowkey.rowkey_columns&&name){ - for(var s=0;s<$scope.cubeMetaFrame.rowkey.rowkey_columns.length;s++){ - if(filterName==$scope.cubeMetaFrame.rowkey.rowkey_columns[s].column){ - var version=$scope.cubeMetaFrame.rowkey.rowkey_columns[s].encoding_version; - filterEncoding=VdmUtil.getFilterObjectListByOrFilterVal(encodings,'value',$scope.cubeMetaFrame.rowkey.rowkey_columns[s].encoding.replace(/:\d+/,"")+(version?" (v"+version+")":" (v1)"),'suggest',true) + var rowkey_columns=$scope.cubeMetaFrame.rowkey.rowkey_columns; + if(rowkey_columns&&filterName){ + for(var s=0;s<rowkey_columns.length;s++){ + var database=$scope.getDatabaseByColumnName(rowkey_columns[s].column); + if(filterName==rowkey_columns[s].column){ + var version=rowkey_columns[s].encoding_version; + var noLenEncoding=rowkey_columns[s].encoding.replace(/:\d+/,""); + filterEncoding=VdmUtil.getFilterObjectListByOrFilterVal(encodings,'value',noLenEncoding+(version?"[v"+version+"]":"[v1]"),'suggest',true) + matchList.push(noLenEncoding); + filterEncoding=VdmUtil.getObjectList(filterEncoding,'baseValue',matchList); + break; } } }else{ filterEncoding=VdmUtil.getFilterObjectListByOrFilterVal(encodings,'suggest',true); + filterEncoding=VdmUtil.getObjectList(filterEncoding,'baseValue',matchList) } }else{ filterEncoding=VdmUtil.getFilterObjectListByOrFilterVal(encodings,'suggest',true); - } - for(var f=0;f<filerList.length;f++){ - filterEncoding=VdmUtil.removeFilterObjectList(filterEncoding,'baseValue',filerList[f]); + filterEncoding=VdmUtil.getObjectList(filterEncoding,'baseValue',matchList) } return filterEncoding; } @@ -782,6 +800,7 @@ KylinApp.controller('CubeEditCtrl', function ($scope, $q, $routeParams, $locatio }; if (newValue) { TableModel.initTables(); + TableModel.getcolumnNameTypeMap(); TableService.list(param, function (tables) { angular.forEach(tables, function (table) { table.name = table.database + "." + table.name; http://git-wip-us.apache.org/repos/asf/kylin/blob/c880db0d/webapp/app/js/controllers/cubeMeasures.js ---------------------------------------------------------------------- diff --git a/webapp/app/js/controllers/cubeMeasures.js b/webapp/app/js/controllers/cubeMeasures.js index 91c38f2..fc146ba 100644 --- a/webapp/app/js/controllers/cubeMeasures.js +++ b/webapp/app/js/controllers/cubeMeasures.js @@ -18,7 +18,7 @@ 'use strict'; -KylinApp.controller('CubeMeasuresCtrl', function ($scope, $modal,MetaModel,cubesManager,CubeDescModel,SweetAlert,VdmUtil,TableModel) { +KylinApp.controller('CubeMeasuresCtrl', function ($scope, $modal,MetaModel,cubesManager,CubeDescModel,SweetAlert,VdmUtil,TableModel,cubeConfig) { $scope.num=0; $scope.convertedColumns=[]; $scope.groupby=[]; @@ -29,48 +29,24 @@ KylinApp.controller('CubeMeasuresCtrl', function ($scope, $modal,MetaModel,cubes } }; $scope.initUpdateMeasureStatus(); - var needLengthKeyList=['fixed_length','fixed_length_hex','int','integer']; - $scope.removeVersion=function(typename){ - if(typename){ - return typename.replace(/\s*\(v\d+\)/g,""); - } - return ""; - } - $scope.getTypeVersion=function(typename){ - var searchResult=/\s*\(v(\d+)\)/.exec(typename); - if(searchResult&&searchResult.length){ - return searchResult.length&&searchResult[1]||1; - }else{ - return 1; - } - } - $scope.createFilter=function(type){ - if(type.indexOf("varchar")==-1){ - return ['fixed_length_hex']; - }else if(type!="date"){ - return ['date']; - }else if(type!="time"&&type!="datetime"&&type!="timestamp"){ - return ['time']; - }else{ - return []; - } - } + var needLengthKeyList=cubeConfig.needSetLengthEncodingList; $scope.getEncodings =function (name){ - var type = TableModel.columnNameTypeMap[name]||''; + var columnType = $scope.getColumnTypeByAliasName(name); var encodings =$scope.store.supportedEncoding,filterEncoding=[]; - var filerList=$scope.createFilter(type); + var matchList=VdmUtil.getObjValFromLikeKey($scope.store.encodingMaps,columnType); if($scope.isEdit) { if (name && $scope.newMeasure.function.configuration&&$scope.newMeasure.function.configuration['topn.encoding.' + name]) { var version = $scope.newMeasure.function.configuration['topn.encoding_version.' + name] || 1; - filterEncoding = VdmUtil.getFilterObjectListByOrFilterVal(encodings, 'value', $scope.newMeasure.function.configuration['topn.encoding.' + name].replace(/:\d+/, "") + (version ? " (v" + version + ")" : " (v1)"), 'suggest', true); + filterEncoding = VdmUtil.getFilterObjectListByOrFilterVal(encodings, 'value', $scope.newMeasure.function.configuration['topn.encoding.' + name].replace(/:\d+/, "") + (version ? "[v" + version + "]" : "[v1]"), 'suggest', true); + matchList.push($scope.newMeasure.function.configuration['topn.encoding.' + name].replace(/:\d+/, "")); + filterEncoding=VdmUtil.getObjectList(filterEncoding,'baseValue',matchList); }else{ filterEncoding=VdmUtil.getFilterObjectListByOrFilterVal(encodings,'suggest', true); + filterEncoding=VdmUtil.getObjectList(filterEncoding,'baseValue',matchList); } }else{ filterEncoding=VdmUtil.getFilterObjectListByOrFilterVal(encodings,'suggest', true); - } - for(var f=0;f<filerList.length;f++){ - filterEncoding=VdmUtil.removeFilterObjectList(filterEncoding,'baseValue',filerList[f]); + filterEncoding=VdmUtil.getObjectList(filterEncoding,'baseValue',matchList); } return filterEncoding; } @@ -121,7 +97,7 @@ KylinApp.controller('CubeMeasuresCtrl', function ($scope, $modal,MetaModel,cubes _encoding=baseKey; $scope.GroupBy = { name:_name, - encoding:_encoding+(version?" (v"+version+")":" (v1)"), + encoding: _encoding + (version ? "[v" + version + "]" : "[v1]"), valueLength:_valueLength, encoding_version:version||1 } http://git-wip-us.apache.org/repos/asf/kylin/blob/c880db0d/webapp/app/js/model/cubeConfig.js ---------------------------------------------------------------------- diff --git a/webapp/app/js/model/cubeConfig.js b/webapp/app/js/model/cubeConfig.js index dc5ff7a..47d0f46 100644 --- a/webapp/app/js/model/cubeConfig.js +++ b/webapp/app/js/model/cubeConfig.js @@ -111,5 +111,6 @@ KylinApp.constant('cubeConfig', { statusNeedNofity:['ERROR', 'DISCARDED', 'SUCCEED'], buildDictionaries:[ {name:"Global Dictionary", value:"org.apache.kylin.dict.GlobalDictionaryBuilder"} - ] + ], + needSetLengthEncodingList:['fixed_length','fixed_length_hex','int','integer'] }); http://git-wip-us.apache.org/repos/asf/kylin/blob/c880db0d/webapp/app/js/model/tableConfig.js ---------------------------------------------------------------------- diff --git a/webapp/app/js/model/tableConfig.js b/webapp/app/js/model/tableConfig.js index 2198018..3989531 100644 --- a/webapp/app/js/model/tableConfig.js +++ b/webapp/app/js/model/tableConfig.js @@ -24,8 +24,104 @@ KylinApp.constant('tableConfig', { {attr: 'cardinality', name: 'Cardinality'}, {attr: 'comment', name: 'Comment'} ], - dataTypes:["tinyint","smallint","int","bigint","float","double","decimal","timestamp","date","string","varchar(256)","char","boolean","binary"] - + dataTypes:["tinyint","smallint","int","bigint","float","double","decimal","timestamp","date","string","varchar(256)","char","boolean","binary"], + columnTypeEncodingMap:{ + "numeric": [ + "dict" + ], + "bigint": [ + "boolean", + "date", + "time", + "dict", + "integer" + ], + "char": [ + "boolean", + "date", + "time", + "dict", + "fixed_length", + "fixed_length_hex", + "integer" + ], + "integer": [ + "boolean", + "date", + "time", + "dict", + "integer" + ], + "int4": [ + "boolean", + "date", + "time", + "dict", + "integer" + ], + "tinyint": [ + "boolean", + "date", + "time", + "dict", + "integer" + ], + "double": [ + "dict" + ], + "date": [ + "date", + "time", + "dict" + ], + "float": [ + "dict" + ], + "decimal": [ + "dict" + ], + "timestamp": [ + "date", + "time", + "dict" + ], + "real": [ + "dict" + ], + "time": [ + "date", + "time", + "dict" + ], + "long8": [ + "boolean", + "date", + "time", + "dict", + "integer" + ], + "datetime": [ + "date", + "time", + "dict" + ], + "smallint": [ + "boolean", + "date", + "time", + "dict", + "integer" + ], + "varchar": [ + "boolean", + "date", + "time", + "dict", + "fixed_length", + "fixed_length_hex", + "integer" + ] + } }); http://git-wip-us.apache.org/repos/asf/kylin/blob/c880db0d/webapp/app/js/model/tableModel.js ---------------------------------------------------------------------- diff --git a/webapp/app/js/model/tableModel.js b/webapp/app/js/model/tableModel.js index 87c9b9d..11aecaf 100755 --- a/webapp/app/js/model/tableModel.js +++ b/webapp/app/js/model/tableModel.js @@ -16,7 +16,7 @@ * limitations under the License. */ -KylinApp.service('TableModel', function(ProjectModel,$q,TableService,$log) { +KylinApp.service('TableModel', function(ProjectModel,$q,TableService,$log,EncodingService,tableConfig) { var _this = this; @@ -26,6 +26,7 @@ KylinApp.service('TableModel', function(ProjectModel,$q,TableService,$log) { //for tables in cubeDesigner this.selectProjectTables = []; this.columnNameTypeMap = {}; + this.columnTypeEncodingMap={}; this.initTables = function(){ this.selectProjectTables = []; @@ -48,7 +49,30 @@ KylinApp.service('TableModel', function(ProjectModel,$q,TableService,$log) { this.selectedSrcDb = []; this.selectedSrcTable = {}; }; - + this.getcolumnNameTypeMap=function(callback){ + var param = { + ext: true, + project:ProjectModel.selectedProject + }; + if(angular.equals({}, _this.columnNameTypeMap)) { + TableService.list(param, function (tables) { + + angular.forEach(tables, function (table) { + angular.forEach(table.columns, function (column) { + var tableName=table.database+"."+table.name; + _this.columnNameTypeMap[tableName+'.'+column.name] = column.datatype; + }); + }); + if(typeof callback=='function'){ + callback(_this.columnNameTypeMap); + } + }); + }else{ + if(typeof callback=='function'){ + callback(_this.columnNameTypeMap); + } + } + } this.aceSrcTbLoaded = function (forceLoad) { _this.selectedSrcDb = []; _this.loading = true; @@ -69,7 +93,7 @@ KylinApp.service('TableModel', function(ProjectModel,$q,TableService,$log) { TableService.list(param, function (tables) { var tableMap = []; angular.forEach(tables, function (table) { - + var tableName=table.database+"."+table.name; var tableData = []; if (!tableMap[table.database]) { @@ -82,7 +106,7 @@ KylinApp.service('TableModel', function(ProjectModel,$q,TableService,$log) { column.cardinality = null; } column.id = parseInt(column.id); - _this.columnNameTypeMap[column.name] = column.datatype; + _this.columnNameTypeMap[tableName+'.'+column.name] = column.datatype; }); tableMap[table.database].push(table); }); @@ -153,7 +177,26 @@ KylinApp.service('TableModel', function(ProjectModel,$q,TableService,$log) { return defer.promise; }; + this.getColumnTypeEncodingMap=function(){ + var _this=this; + var defer = $q.defer(); + if(!angular.equals({},_this.columnTypeEncodingMap)){ + defer.resolve(_this.columnTypeEncodingMap); + } + EncodingService.getEncodingMap({},{},function(result){ + if(result&&result.data){ + _this.columnTypeEncodingMap=result.data; + }else{ + _this.columnTypeEncodingMap=tableConfig.columnTypeEncodingMap; + } + defer.resolve(_this.columnTypeEncodingMap); + },function(){ + _this.columnTypeEncodingMap=tableConfig.columnTypeEncodingMap; + defer.resolve(_this.columnTypeEncodingMap); + }) + return defer.promise; + } this.getColumnType = function(_column,_table){ var columns = _this.getColumnsByTable(_table); var type; http://git-wip-us.apache.org/repos/asf/kylin/blob/c880db0d/webapp/app/js/services/encodings.js ---------------------------------------------------------------------- diff --git a/webapp/app/js/services/encodings.js b/webapp/app/js/services/encodings.js new file mode 100644 index 0000000..99bb091 --- /dev/null +++ b/webapp/app/js/services/encodings.js @@ -0,0 +1,8 @@ +/** + * Created by luguosheng on 17/2/9. + */ +KylinApp.factory('EncodingService', ['$resource', function ($resource, config) { + return $resource(Config.service.url + 'encodings/valid_encodings', {}, { + getEncodingMap: {method: 'GET', params: {}, isArray: false} + }); +}]); http://git-wip-us.apache.org/repos/asf/kylin/blob/c880db0d/webapp/app/js/utils/utils.js ---------------------------------------------------------------------- diff --git a/webapp/app/js/utils/utils.js b/webapp/app/js/utils/utils.js index 1da840e..30ad261 100644 --- a/webapp/app/js/utils/utils.js +++ b/webapp/app/js/utils/utils.js @@ -84,21 +84,6 @@ KylinApp.factory('VdmUtil', function ($modal, $timeout, $location, $anchorScroll } return resultValue; }, - getFilterObjectListByAndFilterVal:function(objList,key,value,matchkey,matchval){ - var len=objList&&objList.length|| 0,newArr=[]; - for(var i=0;i<len;i++){ - if(!key||value===objList[i][key]||(angular.isArray(value)&&value.indexOf(objList[i][key])>-1)){ - if(matchkey){ - if(matchval==objList[i][matchkey]||(angular.isArray(matchval)&&value.indexOf(objList[i][matchkey])>-1)){ - newArr.push(objList[i]) - } - }else{ - newArr.push(objList[i]) - } - } - } - return newArr; - }, getFilterObjectListByOrFilterVal:function(objList,key,val,orKey,orVal){ var len=objList&&objList.length|| 0,newArr=[]; for(var i=0;i<len;i++){ @@ -108,7 +93,7 @@ KylinApp.factory('VdmUtil', function ($modal, $timeout, $location, $anchorScroll } return newArr; }, - removeFilterObjectList:function(objList,key,val,orKey,orVal){ + removeFilterObjectList:function(objList,key,val){ var len=objList&&objList.length|| 0,newArr=[]; for(var i=0;i<len;i++){ if(key&&val!=objList[i][key]){ @@ -141,6 +126,26 @@ KylinApp.factory('VdmUtil', function ($modal, $timeout, $location, $anchorScroll } return angular.toJson(filterData(newObj),true); }, + getObjectList:function(objList,key,valueList){ + var len=objList&&objList.length|| 0,newArr=[]; + for(var i=0;i<len;i++){ + if(angular.isArray(valueList)&&valueList.indexOf(objList[i][key])>-1){ + newArr.push(objList[i]); + } + } + return newArr; + }, + getObjValFromLikeKey:function(obj,key){ + if(!key){ + return []; + } + for(var i in obj){ + if(key.startsWith(i)){ + return angular.copy(obj[i]); + } + } + return []; + }, removeNameSpace:function(str){ if(str){ return str.replace(/([^.\s]+\.)+/,''); @@ -162,5 +167,8 @@ KylinApp.factory('VdmUtil', function ($modal, $timeout, $location, $anchorScroll return ''; } }, + isNotExtraKey:function(obj,key){ + return obj&&key&&key!="$promise"&&key!='$resolved'&&obj.hasOwnProperty(key); + } } }); http://git-wip-us.apache.org/repos/asf/kylin/blob/c880db0d/webapp/app/partials/cubeDesigner/measures.html ---------------------------------------------------------------------- diff --git a/webapp/app/partials/cubeDesigner/measures.html b/webapp/app/partials/cubeDesigner/measures.html index b7475b6..5ca43fe 100755 --- a/webapp/app/partials/cubeDesigner/measures.html +++ b/webapp/app/partials/cubeDesigner/measures.html @@ -256,7 +256,7 @@ </td> <!--Column Encoding --> <td> - <select ng-if="state.mode=='edit'" + <select ng-if="state.mode=='edit'" style="width: 100%" chosen ng-model="groupby_column.encoding" ng-change="refreshGroupBy(convertedColumns,$index,groupby_column)" ng-options="dt.value as dt.name for dt in getEncodings(groupby_column.name)">