You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by bo...@apache.org on 2019/08/02 12:30:37 UTC
[kylin] branch master updated: optimize the request to get the cube
name
This is an automated email from the ASF dual-hosted git repository.
boblu 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 d449335 optimize the request to get the cube name
d449335 is described below
commit d449335d68f01270aa0b6a8093ca12daff4b74bd
Author: ClausClaus <we...@gmail.com>
AuthorDate: Thu Aug 1 18:25:02 2019 +0800
optimize the request to get the cube name
---
webapp/app/js/controllers/cubeSchema.js | 24 +++++++++++++++---------
webapp/app/js/services/cubes.js | 5 +++--
2 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/webapp/app/js/controllers/cubeSchema.js b/webapp/app/js/controllers/cubeSchema.js
index a4fdd16..ff83180 100755
--- a/webapp/app/js/controllers/cubeSchema.js
+++ b/webapp/app/js/controllers/cubeSchema.js
@@ -18,7 +18,7 @@
'use strict';
-KylinApp.controller('CubeSchemaCtrl', function ($scope, QueryService, UserService,modelsManager, ProjectService, AuthenticationService,$filter,ModelService,MetaModel,CubeDescModel,CubeList,TableModel,ProjectModel,ModelDescService,SweetAlert,cubesManager,StreamingService,CubeService,VdmUtil,tableConfig) {
+KylinApp.controller('CubeSchemaCtrl', function ($scope, QueryService, UserService,modelsManager, ProjectService, AuthenticationService,$filter,ModelService,MetaModel,CubeDescModel,CubeList,TableModel,ProjectModel,ModelDescService,SweetAlert,cubesManager,StreamingService,CubeService,VdmUtil,tableConfig,$q) {
$scope.modelsManager = modelsManager;
$scope.cubesManager = cubesManager;
$scope.projects = [];
@@ -261,7 +261,7 @@ KylinApp.controller('CubeSchemaCtrl', function ($scope, QueryService, UserServic
});
- $scope.checkCubeForm = function(stepIndex){
+ $scope.checkCubeForm = async function(stepIndex){
// do not check for Prev Step
if (stepIndex + 1 < $scope.curStep.step) {
return true;
@@ -282,7 +282,10 @@ KylinApp.controller('CubeSchemaCtrl', function ($scope, QueryService, UserServic
//business rule check
switch($scope.curStep.form){
case 'cube_info_form':
- return $scope.check_cube_info();
+ var result = await $scope.check_cube_info().then(function(res){
+ return res.data
+ });
+ return result
break;
case 'cube_dimension_form':
return $scope.check_cube_dimension();
@@ -307,13 +310,16 @@ KylinApp.controller('CubeSchemaCtrl', function ($scope, QueryService, UserServic
}
$scope.check_cube_info = function () {
- if (($scope.state.mode === "edit") && ($scope.cubeMode == "addNewCube")) {
- // check duplicated cube name when add new cube.
+ if ($scope.state.mode === "edit" && $scope.cubeMode === "addNewCube") {
var cubeName = $scope.cubeMetaFrame.name;
- if ($scope.checkDuplicatedCubeName(cubeName)) {
- SweetAlert.swal('Oops...', "The cube named [" + cubeName.toUpperCase() + "] already exists", 'warning');
- return false;
- }
+ var defer = $q.defer();
+ CubeService.getAllCubes({cubeName: cubeName}, {}, function (res) {
+ if (!res.data) {
+ SweetAlert.swal('Oops...', "The cube named [" + cubeName.toUpperCase() + "] already exists", 'warning');
+ }
+ defer.resolve(res.data)
+ })
+ return defer.promise
}
// Update storage type according to the streaming table in model
if(TableModel.selectProjectTables.some(function(table) {
diff --git a/webapp/app/js/services/cubes.js b/webapp/app/js/services/cubes.js
index 537e5c1..0b0958d 100644
--- a/webapp/app/js/services/cubes.js
+++ b/webapp/app/js/services/cubes.js
@@ -36,7 +36,7 @@ KylinApp.factory('CubeService', ['$resource', function ($resource, config) {
iterator(data.root, data.root.row_count);
return cuboids;
};
- return $resource(Config.service.url + 'cubes/:cubeId/:propName/:propValue/:action', {}, {
+ return $resource(Config.service.url + 'cubes/:cubeId/:propName/:propValue/:action/:cubeName', {}, {
list: {method: 'GET', params: {}, isArray: true},
getValidEncodings: {method: 'GET', params: {action:"validEncodings"}, isArray: false},
getCube: {method: 'GET', params: {}, isArray: false},
@@ -80,6 +80,7 @@ KylinApp.factory('CubeService', ['$resource', function ($resource, config) {
},
optimize: {method: 'PUT', params: {action: 'optimize'}, isArray: false},
autoMigrate: {method: 'POST', params: {action: 'migrate'}, isArray: false},
- lookupRefresh: {method: 'PUT', params: {action: 'refresh_lookup'}, isArray: false}
+ lookupRefresh: {method: 'PUT', params: {action: 'refresh_lookup'}, isArray: false},
+ getAllCubes: {method: 'GET', params: {action: 'validate'}, isArray: false}
});
}]);