Repository: kylin
Updated Branches:
  refs/heads/v1.5.3-release 55f5ea3ff -> 53face5a4


KYLIN-1848 web fix sort cubes issue

Signed-off-by: Jason <jiat...@163.com>


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

Branch: refs/heads/v1.5.3-release
Commit: 53face5a4eac5666a951e90db7b1b8e3405bccfc
Parents: 55f5ea3
Author: zx chen <346839...@qq.com>
Authored: Tue Jul 19 13:50:42 2016 +0800
Committer: Jason <jiat...@163.com>
Committed: Tue Jul 19 14:07:12 2016 +0800

----------------------------------------------------------------------
 webapp/app/js/config.js              |  4 +++
 webapp/app/js/controllers/cubes.js   | 41 +++++++++++--------------------
 webapp/app/partials/cubes/cubes.html | 18 +++++++-------
 3 files changed, 28 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/53face5a/webapp/app/js/config.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/config.js b/webapp/app/js/config.js
index 46fdecd..c4a693f 100644
--- a/webapp/app/js/config.js
+++ b/webapp/app/js/config.js
@@ -116,6 +116,10 @@ KylinApp.config(function ($routeProvider, $httpProvider, 
$locationProvider, $log
   });
 
 // This runs when all code has loaded, and loads the config and route json 
manifests, before bootstrapping angular.
+
+
+
+
 window.onload = function () {
 
   // Files to load initially.

http://git-wip-us.apache.org/repos/asf/kylin/blob/53face5a/webapp/app/js/controllers/cubes.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/cubes.js 
b/webapp/app/js/controllers/cubes.js
index c103e54..85c7825 100644
--- a/webapp/app/js/controllers/cubes.js
+++ b/webapp/app/js/controllers/cubes.js
@@ -185,7 +185,7 @@ KylinApp.controller('CubesCtrl', function ($scope, $q, 
$routeParams, $location,
     };
 
 //    Cube Action
-    $scope.enable = function (cube, cubeIndex) {
+    $scope.enable = function (cube) {
       SweetAlert.swal({
         title: '',
         text: 'Are you sure to enable the cube? Please note: if cube schema is 
changed in the disabled period, all segments of the cube will be discarded due 
to data and schema mismatch.',
@@ -203,7 +203,7 @@ KylinApp.controller('CubesCtrl', function ($scope, $q, 
$routeParams, $location,
             loadingRequest.hide();
             $scope.refreshCube(cube).then(function(_cube){
               if(_cube && _cube.name){
-                $scope.cubeList.cubes[cubeIndex] = _cube;
+                $scope.cubeList.cubes[$scope.cubeList.cubes.indexOf(cube)] = 
_cube;
               }
             });
             SweetAlert.swal('Success!', 'Enable job was submitted 
successfully', 'success');
@@ -222,7 +222,7 @@ KylinApp.controller('CubesCtrl', function ($scope, $q, 
$routeParams, $location,
       });
     };
 
-    $scope.purge = function (cube, cubeIndex) {
+    $scope.purge = function (cube) {
       SweetAlert.swal({
         title: '',
         text: 'Are you sure to purge the cube? ',
@@ -239,9 +239,9 @@ KylinApp.controller('CubesCtrl', function ($scope, $q, 
$routeParams, $location,
 
             loadingRequest.hide();
             $scope.refreshCube(cube).then(function(_cube){
-              if(_cube && _cube.name){
-                $scope.cubeList.cubes[cubeIndex] = _cube;
-              }
+             if(_cube && _cube.name){
+                $scope.cubeList.cubes[$scope.cubeList.cubes.indexOf(cube)] = 
_cube;
+             }
             });
             SweetAlert.swal('Success!', 'Purge job was submitted 
successfully', 'success');
           },function(e){
@@ -258,7 +258,7 @@ KylinApp.controller('CubesCtrl', function ($scope, $q, 
$routeParams, $location,
       });
     }
 
-    $scope.disable = function (cube, cubeIndex) {
+    $scope.disable = function (cube) {
 
       SweetAlert.swal({
         title: '',
@@ -277,7 +277,7 @@ KylinApp.controller('CubesCtrl', function ($scope, $q, 
$routeParams, $location,
             loadingRequest.hide();
             $scope.refreshCube(cube).then(function(_cube){
               if(_cube && _cube.name){
-                $scope.cubeList.cubes[cubeIndex] = _cube;
+                $scope.cubeList.cubes[$scope.cubeList.cubes.indexOf(cube)] = 
_cube;
               }
             });
             SweetAlert.swal('Success!', 'Disable job was submitted 
successfully', 'success');
@@ -297,9 +297,7 @@ KylinApp.controller('CubesCtrl', function ($scope, $q, 
$routeParams, $location,
       });
     };
 
-
-
-    $scope.dropCube = function (cube, cubeIndex) {
+    $scope.dropCube = function (cube) {
 
       SweetAlert.swal({
         title: '',
@@ -316,7 +314,7 @@ KylinApp.controller('CubesCtrl', function ($scope, $q, 
$routeParams, $location,
           CubeService.drop({cubeId: cube.name}, {}, function (result) {
             loadingRequest.hide();
             SweetAlert.swal('Success!', 'Cube drop is done successfully', 
'success');
-            $scope.cubeList.cubes.splice(cubeIndex,1);
+            
$scope.cubeList.cubes.splice($scope.cubeList.cubes.indexOf(cube),1);
           },function(e){
 
             loadingRequest.hide();
@@ -333,7 +331,7 @@ KylinApp.controller('CubesCtrl', function ($scope, $q, 
$routeParams, $location,
       });
     };
 
-    $scope.startJobSubmit = function (cube, cubeIndex) {
+    $scope.startJobSubmit = function (cube) {
       $scope.loadDetail(cube);
       // for streaming cube build tip
       if(cube.streaming){
@@ -366,9 +364,6 @@ KylinApp.controller('CubesCtrl', function ($scope, $q, 
$routeParams, $location,
               },
               scope:function(){
                 return $scope;
-              },
-              cubeIndex:function(){
-                return cubeIndex;
               }
             }
           });
@@ -417,7 +412,7 @@ KylinApp.controller('CubesCtrl', function ($scope, $q, 
$routeParams, $location,
       }
     };
 
-    $scope.startRefresh = function (cube, cubeIndex) {
+    $scope.startRefresh = function (cube) {
       $scope.metaModel={
         model:modelsManager.getModelByCube(cube.name)
       };
@@ -436,9 +431,6 @@ KylinApp.controller('CubesCtrl', function ($scope, $q, 
$routeParams, $location,
           },
           scope:function(){
             return $scope;
-          },
-          cubeIndex:function(){
-            return cubeIndex;
           }
         }
       });
@@ -464,7 +456,7 @@ KylinApp.controller('CubesCtrl', function ($scope, $q, 
$routeParams, $location,
     $scope.cubeEdit = function (cube) {
       $location.path("cubes/edit/" + cube.name);
     }
-    $scope.startMerge = function (cube, cubeIndex) {
+    $scope.startMerge = function (cube) {
       $scope.metaModel={
         model:modelsManager.getModelByCube(cube.name)
       };
@@ -483,9 +475,6 @@ KylinApp.controller('CubesCtrl', function ($scope, $q, 
$routeParams, $location,
           },
           scope:function(){
             return $scope;
-          },
-          cubeIndex:function(){
-            return cubeIndex;
           }
         }
       });
@@ -550,7 +539,7 @@ var cubeCloneCtrl = function ($scope, $modalInstance, 
CubeService, MessageServic
 }
 
 
-var jobSubmitCtrl = function ($scope, $modalInstance, CubeService, 
MessageService, $location, cube, metaModel, buildType, SweetAlert, 
loadingRequest, scope, cubeIndex, CubeList) {
+var jobSubmitCtrl = function ($scope, $modalInstance, CubeService, 
MessageService, $location, cube, metaModel, buildType, SweetAlert, 
loadingRequest, scope, CubeList) {
   $scope.cubeList = CubeList;
   $scope.cube = cube;
   $scope.metaModel = metaModel;
@@ -578,7 +567,7 @@ var jobSubmitCtrl = function ($scope, $modalInstance, 
CubeService, MessageServic
       $modalInstance.dismiss('cancel');
       SweetAlert.swal('Success!', 'Rebuild job was submitted successfully', 
'success');
       scope.refreshCube(cube).then(function(_cube){
-          $scope.cubeList.cubes[cubeIndex] = _cube;
+          $scope.cubeList.cubes[$scope.cubeList.cubes.indexOf(cube)] = _cube;
         });
     }, function (e) {
 

http://git-wip-us.apache.org/repos/asf/kylin/blob/53face5a/webapp/app/partials/cubes/cubes.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/cubes/cubes.html 
b/webapp/app/partials/cubes/cubes.html
index 6f33ed7..72a3222 100644
--- a/webapp/app/partials/cubes/cubes.html
+++ b/webapp/app/partials/cubes/cubes.html
@@ -49,7 +49,7 @@
         </tr>
         </thead>
         <!--Body-->
-        <tbody ng-repeat="cube in cubeList.cubes track by $index| 
orderObjectBy:state.filterAttr:state.filterReverse">
+        <tbody ng-repeat="cube in cubeList.cubes | 
orderObjectBy:state.filterAttr:state.filterReverse ">
         <tr ng-class="{accordion:true}" style="cursor: pointer"  
ng-click="cube.showDetail=!cube.showDetail;loadDetail(cube)">
             <td>
                 <i ng-show="!cube.showDetail" class="fa 
fa-chevron-circle-right blue"></i>
@@ -81,16 +81,16 @@
                     </button>
                     <ul class="dropdown-menu" role="menu">
                         <li ng-if="cube.status=='DISABLED' && 
userService.hasRole('ROLE_ADMIN') ">
-                            <a ng-click="dropCube(cube, $index)" tooltip="Drop 
the cube, related jobs and data permanently.">Drop</a></li>
+                            <a ng-click="dropCube(cube)" tooltip="Drop the 
cube, related jobs and data permanently.">Drop</a></li>
                         <li ng-if="cube.status=='DISABLED' && 
(userService.hasRole('ROLE_ADMIN') || hasPermission(cube, 
permissions.ADMINISTRATION.mask, permissions.MANAGEMENT.mask))">
                             <a ng-click="cubeEdit(cube);">Edit</a></li>
-                      <li ng-if="cube.streaming && cube.status=='DISABLED' && 
(userService.hasRole('ROLE_ADMIN') || hasPermission(cube, 
permissions.ADMINISTRATION.mask, permissions.MANAGEMENT.mask))">
-                        <li><a ng-click="startJobSubmit(cube, 
$index);">Build</a></li>
-                        <li><a ng-click="startRefresh(cube, 
$index)">Refresh</a></li>
-                        <li><a ng-click="startMerge(cube, 
$index)">Merge</a></li>
-                        <li ng-if="cube.status!='DISABLED'"><a 
ng-click="disable(cube, $index)">Disable</a></li>
-                        <li ng-if="cube.status=='DISABLED'"><a 
ng-click="enable(cube, $index)">Enable</a></li>
-                        <li ng-if="cube.status=='DISABLED'"><a 
ng-click="purge(cube, $index)">Purge</a></li>
+                      <li ng-if="cube.streaming && cube.status=='DISABLED' && 
(userService.hasRole('ROLE_ADMIN') || hasPermission(cube, 
permissions.ADMINISTRATION.mask, permissions.MANAGEMENT.mask))"></li>
+                        <li><a ng-click="startJobSubmit(cube);">Build</a></li>
+                        <li><a ng-click="startRefresh(cube)">Refresh</a></li>
+                        <li><a ng-click="startMerge(cube)">Merge</a></li>
+                        <li ng-if="cube.status!='DISABLED'"><a 
ng-click="disable(cube)">Disable</a></li>
+                        <li ng-if="cube.status=='DISABLED'"><a 
ng-click="enable(cube)">Enable</a></li>
+                        <li ng-if="cube.status=='DISABLED'"><a 
ng-click="purge(cube)">Purge</a></li>
                         <li><a ng-click="cloneCube(cube)">Clone</a></li>
 
                     </ul>

Reply via email to