You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by zh...@apache.org on 2015/10/23 04:57:50 UTC

incubator-kylin git commit: KYLIN-966, check cube exists before create(patch from @nichunen)

Repository: incubator-kylin
Updated Branches:
  refs/heads/1.x-staging 514fcf709 -> a96c62d42


KYLIN-966, check cube exists before create(patch from @nichunen)


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

Branch: refs/heads/1.x-staging
Commit: a96c62d42dcabe16b6d559886a825953ed6346ab
Parents: 514fcf7
Author: jiazhong <ji...@ebay.com>
Authored: Fri Oct 23 10:56:29 2015 +0800
Committer: jiazhong <ji...@ebay.com>
Committed: Fri Oct 23 10:57:29 2015 +0800

----------------------------------------------------------------------
 webapp/app/js/controllers/cubeSchema.js | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/a96c62d4/webapp/app/js/controllers/cubeSchema.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/cubeSchema.js b/webapp/app/js/controllers/cubeSchema.js
index b7aae59..4c23f74 100755
--- a/webapp/app/js/controllers/cubeSchema.js
+++ b/webapp/app/js/controllers/cubeSchema.js
@@ -18,12 +18,12 @@
 
 'use strict';
 
-KylinApp.controller('CubeSchemaCtrl', function ($scope, QueryService, UserService, ProjectService, AuthenticationService, $filter, ModelService, MetaModel, CubeDescModel, CubeList, TableModel, ProjectModel,SweetAlert) {
+KylinApp.controller('CubeSchemaCtrl', function ($scope, QueryService, UserService, ProjectService, AuthenticationService, $filter, ModelService,CubeService, MetaModel, CubeDescModel, CubeList, TableModel, ProjectModel, SweetAlert) {
 
   $scope.projects = [];
   $scope.newDimension = null;
   $scope.newMeasure = null;
-
+  $scope.allCubes = [];
 
   $scope.wizardSteps = [
     {title: 'Cube Info', src: 'partials/cubeDesigner/info.html', isComplete: false},
@@ -50,6 +50,19 @@ KylinApp.controller('CubeSchemaCtrl', function ($scope, QueryService, UserServic
     $scope.state = {mode: "view"};
   }
 
+  // Add all cube names to avoid name conflict during cube creation.
+  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());
+      }
+  });
+
   $scope.$watch('cube.detail', function (newValue, oldValue) {
     if (!newValue) {
       return;
@@ -196,6 +209,10 @@ KylinApp.controller('CubeSchemaCtrl', function ($scope, QueryService, UserServic
   };
   $scope.nextView = function () {
     var stepIndex = $scope.wizardSteps.indexOf($scope.curStep);
+    if(stepIndex === 0 && $scope.cubeMode=="addNewCube" && ($scope.allCubes.indexOf($scope.cubeMetaFrame.name.toUpperCase()) >= 0)){
+        SweetAlert.swal('Oops...', "The cube named " + $scope.cubeMetaFrame.name.toUpperCase() + " already exists", 'error');
+        return;
+    }
 
     if (stepIndex < ($scope.wizardSteps.length - 1)) {
       $scope.curStep.isComplete = true;