You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by ni...@apache.org on 2019/07/30 07:34:20 UTC
[kylin] branch master updated: KYLIN-4067 optimize the kylin cube
page loading mechanism. (#728)
This is an automated email from the ASF dual-hosted git repository.
nic pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kylin.git
The following commit(s) were added to refs/heads/master by this push:
new 47a7441 KYLIN-4067 optimize the kylin cube page loading mechanism. (#728)
47a7441 is described below
commit 47a744141045bde0455fa0708fda1cfda4ea8177
Author: zhaojintaozhao <49...@users.noreply.github.com>
AuthorDate: Tue Jul 30 15:34:11 2019 +0800
KYLIN-4067 optimize the kylin cube page loading mechanism. (#728)
* KYLIN-4067 optimize the kylin cube page loading mechanism. Get all information of cubes only when adding a new cube.
* format js code.
* formatted code style.
* add a new API to check the duplicate cube name
* KYLIN-4067 delete unused code: .cubeService
---
webapp/app/js/controllers/cubeSchema.js | 52 +++++++++++++++++++--------------
1 file changed, 30 insertions(+), 22 deletions(-)
diff --git a/webapp/app/js/controllers/cubeSchema.js b/webapp/app/js/controllers/cubeSchema.js
index 582873f..a4fdd16 100755
--- a/webapp/app/js/controllers/cubeSchema.js
+++ b/webapp/app/js/controllers/cubeSchema.js
@@ -36,6 +36,7 @@ KylinApp.controller('CubeSchemaCtrl', function ($scope, QueryService, UserServic
];
$scope.curStep = $scope.wizardSteps[0];
+ $scope.allCubeNames = [];
$scope.getTypeVersion=function(typename){
var searchResult=/\[v(\d+)\]/.exec(typename);
@@ -126,11 +127,6 @@ KylinApp.controller('CubeSchemaCtrl', function ($scope, QueryService, UserServic
}
return filterEncoding;
}
-
-
-
- $scope.allCubes = [];
-
$scope.getTypeVersion=function(typename){
var searchResult=/\[v(\d+)\]/.exec(typename);
if(searchResult&&searchResult.length){
@@ -151,27 +147,19 @@ KylinApp.controller('CubeSchemaCtrl', function ($scope, QueryService, UserServic
}
$scope.$watch('cubeMetaFrame', function (newValue, oldValue) {
+ if (($scope.state.mode === "edit") && ($scope.cubeMode == "addNewCube")) {
+ $scope.getAllCubeNames();
+ }
+
if(!newValue){
return;
}
+
if ($scope.cubeMode=="editExistCube"&&newValue && !newValue.project) {
initProject();
}
});
-
- var queryParam = {offset: 0, limit: 65535};
-
- CubeService.list(queryParam, function (all_cubes) {
- if($scope.allCubes.length > 0){
- $scope.allCubes.splice(0,$scope.allCubes.length);
- }
-
- for (var i = 0; i < all_cubes.length; i++) {
- $scope.allCubes.push(all_cubes[i].name.toUpperCase());
- }
- });
-
// ~ public methods
$scope.filterProj = function(project){
return $scope.userService.hasRole('ROLE_ADMIN') || $scope.hasPermission(project,$scope.permissions.ADMINISTRATION.mask);
@@ -184,6 +172,19 @@ KylinApp.controller('CubeSchemaCtrl', function ($scope, QueryService, UserServic
}
};
+ $scope.getAllCubeNames = function () {
+ if ($scope.allCubeNames.length > 0) {
+ $scope.allCubeNames.splice(0, $scope.allCubeNames.length);
+ }
+
+ var queryParam = {offset: 0, limit: 65535};
+ CubeService.list(queryParam, function (all_cubes) {
+ for (var i = 0; i < all_cubes.length; i++) {
+ $scope.allCubeNames.push(all_cubes[i].name.toUpperCase());
+ }
+ });
+ };
+
$scope.open = function ($event) {
$event.preventDefault();
$event.stopPropagation();
@@ -301,11 +302,18 @@ KylinApp.controller('CubeSchemaCtrl', function ($scope, QueryService, UserServic
}
};
- $scope.check_cube_info = function(){
+ $scope.checkDuplicatedCubeName = function (cubeName) {
+ return ($scope.allCubeNames.indexOf(cubeName.toUpperCase())) >= 0;
+ }
- if(($scope.state.mode === "edit") &&$scope.cubeMode=="addNewCube"&&($scope.allCubes.indexOf($scope.cubeMetaFrame.name.toUpperCase()) >= 0)){
- SweetAlert.swal('Oops...', "The cube named [" + $scope.cubeMetaFrame.name.toUpperCase() + "] already exists", 'warning');
- return false;
+ $scope.check_cube_info = function () {
+ if (($scope.state.mode === "edit") && ($scope.cubeMode == "addNewCube")) {
+ // check duplicated cube name when add new cube.
+ var cubeName = $scope.cubeMetaFrame.name;
+ if ($scope.checkDuplicatedCubeName(cubeName)) {
+ SweetAlert.swal('Oops...', "The cube named [" + cubeName.toUpperCase() + "] already exists", 'warning');
+ return false;
+ }
}
// Update storage type according to the streaming table in model
if(TableModel.selectProjectTables.some(function(table) {