From 898ecbd48a93cd3b258f9d7225bad6e64932348c Mon Sep 17 00:00:00 2001 From: jiazhong Date: Fri, 5 Dec 2014 13:46:04 +0800 Subject: [PATCH 1/2] add force refresh after load table successfully --- webapp/app/js/controllers/sourceMeta.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/webapp/app/js/controllers/sourceMeta.js b/webapp/app/js/controllers/sourceMeta.js index 5fbfcb6..69d25e8 100644 --- a/webapp/app/js/controllers/sourceMeta.js +++ b/webapp/app/js/controllers/sourceMeta.js @@ -14,6 +14,9 @@ KylinApp {attr: 'datatype', name: 'Data Type'}, {attr: 'cardinality', name: 'Cardinality'} ]; + $scope.hiveTbLoad={ + status:"init" + } $scope.state = { filterAttr: 'id', filterReverse:false, reverseColumn: 'id', dimensionFilter: '', measureFilter: ''}; @@ -160,9 +163,11 @@ KylinApp SweetAlert.swal('Success!','Below tables were synced successfully: ' + result['result'].join() , 'success'); rainbowBar.hide(); loadingRequest.hide(); + hiveTbLoad.status="success"; },function(){ rainbowBar.hide(); loadingRequest.hide(); + hiveTbLoad.status="init"; }) } }; From 0a04800b04d98d223a415e9dbae12f57ffd84412 Mon Sep 17 00:00:00 2001 From: jiazhong Date: Fri, 5 Dec 2014 15:25:44 +0800 Subject: [PATCH 2/2] modify config for sweetalert --- webapp/app/js/controllers/access.js | 2 +- webapp/app/js/controllers/admin.js | 8 ++--- webapp/app/js/controllers/cubes.js | 62 +++++++++++++++++++++-------------- webapp/app/js/controllers/projects.js | 4 +-- 4 files changed, 43 insertions(+), 33 deletions(-) diff --git a/webapp/app/js/controllers/access.js b/webapp/app/js/controllers/access.js index af66ce2..e097265 100644 --- a/webapp/app/js/controllers/access.js +++ b/webapp/app/js/controllers/access.js @@ -65,7 +65,7 @@ KylinApp.controller('AccessCtrl', function ($scope,AccessService, MessageService showCancelButton: true, confirmButtonColor: '#DD6B55', confirmButtonText: "Yes", - closeOnConfirm: false + closeOnConfirm: true }, function() { var revokeRequst = { type: type, diff --git a/webapp/app/js/controllers/admin.js b/webapp/app/js/controllers/admin.js index fe2662f..d44297d 100644 --- a/webapp/app/js/controllers/admin.js +++ b/webapp/app/js/controllers/admin.js @@ -27,7 +27,7 @@ KylinApp.controller('AdminCtrl', function ($scope,AdminService, CacheService, Ta showCancelButton: true, confirmButtonColor: '#DD6B55', confirmButtonText: "Yes", - closeOnConfirm: false + closeOnConfirm: true }, function(isConfirm) { if(isConfirm){ CacheService.clean({}, function () { @@ -61,7 +61,7 @@ KylinApp.controller('AdminCtrl', function ($scope,AdminService, CacheService, Ta showCancelButton: true, confirmButtonColor: '#DD6B55', confirmButtonText: "Yes", - closeOnConfirm: false + closeOnConfirm: true }, function(isConfirm) { if(isConfirm){ AdminService.cleanStorage({}, function () { @@ -79,7 +79,7 @@ KylinApp.controller('AdminCtrl', function ($scope,AdminService, CacheService, Ta showCancelButton: true, confirmButtonColor: '#DD6B55', confirmButtonText: "Yes", - closeOnConfirm: false + closeOnConfirm: true }, function(isConfirm) { if(isConfirm){ AdminService.updateConfig({}, {key: 'kylin.query.cache.enabled',value:false}, function () { @@ -134,7 +134,7 @@ KylinApp.controller('AdminCtrl', function ($scope,AdminService, CacheService, Ta showCancelButton: true, confirmButtonColor: '#DD6B55', confirmButtonText: "Yes", - closeOnConfirm: false + closeOnConfirm: true }, function(isConfirm) { if(isConfirm){ AdminService.updateConfig({}, {key: $scope.state.key, value: $scope.state.value}, function (result) { diff --git a/webapp/app/js/controllers/cubes.js b/webapp/app/js/controllers/cubes.js index 83398e8..4f6951d 100644 --- a/webapp/app/js/controllers/cubes.js +++ b/webapp/app/js/controllers/cubes.js @@ -143,7 +143,7 @@ KylinApp showCancelButton: true, confirmButtonColor: '#DD6B55', confirmButtonText: "Yes", - closeOnConfirm: false + closeOnConfirm: true }, function(isConfirm) { if(isConfirm){ CubeService.purge({cubeId: cube.name}, {}, function (result) { @@ -164,7 +164,7 @@ KylinApp showCancelButton: true, confirmButtonColor: '#DD6B55', confirmButtonText: "Yes", - closeOnConfirm: false + closeOnConfirm: true }, function(isConfirm) { if(isConfirm){ CubeService.disable({cubeId: cube.name}, {}, function (result) { @@ -185,7 +185,7 @@ KylinApp showCancelButton: true, confirmButtonColor: '#DD6B55', confirmButtonText: "Yes", - closeOnConfirm: false + closeOnConfirm: true }, function(isConfirm) { if(isConfirm){ CubeService.drop({cubeId: cube.name}, {}, function (result) { @@ -228,7 +228,7 @@ KylinApp showCancelButton: true, confirmButtonColor: '#DD6B55', confirmButtonText: "Yes", - closeOnConfirm: false + closeOnConfirm: true }, function(isConfirm) { if(isConfirm){ CubeService.rebuildCube( @@ -293,7 +293,7 @@ KylinApp } }); -var jobSubmitCtrl = function ($scope, $modalInstance, CubeService, MessageService, $location, cube, buildType) { +var jobSubmitCtrl = function ($scope, $modalInstance, CubeService, MessageService, $location, cube, buildType,SweetAlert) { $scope.cube = cube; $scope.jobBuildRequest = { @@ -304,29 +304,41 @@ var jobSubmitCtrl = function ($scope, $modalInstance, CubeService, MessageServic $scope.message = ""; $scope.rebuild = function () { - if (confirm("Are you sure to rebuild the cube?")) { - $scope.message = null; - $scope.jobBuildRequest.startTime = new Date($scope.jobBuildRequest.startTime).getTime(); - $scope.jobBuildRequest.endTime = new Date($scope.jobBuildRequest.endTime).getTime(); - - if ($scope.jobBuildRequest.startTime >= $scope.jobBuildRequest.endTime) { - $scope.message = "WARNING: End time should be later than the start time."; - return; - } - CubeService.rebuildCube({cubeId: cube.name}, $scope.jobBuildRequest, function (job) { - $modalInstance.dismiss('cancel'); - MessageService.sendMsg('Rebuild job was submitted successfully', 'success', { - cancel: { - label: 'View Jobs', - action: function () { - $location.path('/jobs'); - $scope.$apply(); + SweetAlert.swal({ + title: '', + text: "Are you sure to rebuild the cube? ", + type: 'warning', + showCancelButton: true, + confirmButtonColor: '#DD6B55', + confirmButtonText: "Yes", + closeOnConfirm: true + }, function(isConfirm) { + if(isConfirm){ + $scope.message = null; + $scope.jobBuildRequest.startTime = new Date($scope.jobBuildRequest.startTime).getTime(); + $scope.jobBuildRequest.endTime = new Date($scope.jobBuildRequest.endTime).getTime(); + + if ($scope.jobBuildRequest.startTime >= $scope.jobBuildRequest.endTime) { + $scope.message = "WARNING: End time should be later than the start time."; + return; + } + + CubeService.rebuildCube({cubeId: cube.name}, $scope.jobBuildRequest, function (job) { + $modalInstance.dismiss('cancel'); + MessageService.sendMsg('Rebuild job was submitted successfully', 'success', { + cancel: { + label: 'View Jobs', + action: function () { + $location.path('/jobs'); + $scope.$apply(); + } } - } + }); }); - }); - } + } + + }); }; // used by cube segment refresh diff --git a/webapp/app/js/controllers/projects.js b/webapp/app/js/controllers/projects.js index 7145d7a..69e5308 100644 --- a/webapp/app/js/controllers/projects.js +++ b/webapp/app/js/controllers/projects.js @@ -55,8 +55,7 @@ KylinApp showCancelButton: true, confirmButtonColor: '#DD6B55', confirmButtonText: "Yes, delete it!", -// timer:0, - closeOnConfirm: false + closeOnConfirm: true }, function(isConfirm) { if(isConfirm){ ProjectService.delete({projecId: project.name}, function(){ @@ -64,7 +63,6 @@ KylinApp if (pIndex > -1) { $scope.projects.splice(pIndex, 1); } -// MessageService.sendMsg("Project " + project.name + " deleted successfully!", 'success'); SweetAlert.swal('Success!',"Project " + project.name + " deleted successfully!", 'success'); }); }