From 479829e287f410d183dab1b5c8eb2de444728933 Mon Sep 17 00:00:00 2001 From: jiazhong Date: Fri, 5 Dec 2014 18:27:34 +0800 Subject: [PATCH 1/3] rm overlay if session out --- webapp/app/js/controllers/job.js | 27 +++++++++++++++++++++------ webapp/app/js/listeners.js | 5 +++-- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/webapp/app/js/controllers/job.js b/webapp/app/js/controllers/job.js index 3663029..0744e9c 100644 --- a/webapp/app/js/controllers/job.js +++ b/webapp/app/js/controllers/job.js @@ -99,29 +99,44 @@ KylinApp }); $scope.resume = function (job) { - if (confirm("Are you sure to resume the job?")) { + SweetAlert.swal({ + title: 'Confirm', + text: 'Are you sure to resume the job?', + type: 'warning', + showCancelButton: true, + confirmButtonColor: '#DD6B55', + confirmButtonText: "Yes", + closeOnConfirm: true + }, function() { JobService.resume({jobId: job.uuid}, {}, function (job) { $scope.jobs[job.uuid] = job; if (angular.isDefined($scope.state.selectedJob)) { $scope.state.selectedJob = $scope.jobs[ $scope.state.selectedJob.uuid]; } // MessageService.sendMsg('Job was resumed successfully', 'success', {}); - SweetAlert.swal('Success!', 'TJob was resumed successfully', 'success'); + SweetAlert.swal('Success!', 'Job was resumed successfully', 'success'); }); - } + }); } $scope.cancel = function (job) { - if (confirm("Are you sure to discard the job?")) { + SweetAlert.swal({ + title: 'Confirm', + text: 'Are you sure to discard the job?', + type: 'warning', + showCancelButton: true, + confirmButtonColor: '#DD6B55', + confirmButtonText: "Yes", + closeOnConfirm: true + }, function() { JobService.cancel({jobId: job.uuid}, {}, function (job) { $scope.jobs[job.uuid] = job; if (angular.isDefined($scope.state.selectedJob)) { $scope.state.selectedJob = $scope.jobs[ $scope.state.selectedJob.uuid]; } -// MessageService.sendMsg('Job was cancelled successfully', 'success', {}); SweetAlert.swal('Success!', 'Job was cancelled successfully', 'success'); }); - } + }); } $scope.openModal = function () { diff --git a/webapp/app/js/listeners.js b/webapp/app/js/listeners.js index d16c2e5..1079d9e 100644 --- a/webapp/app/js/listeners.js +++ b/webapp/app/js/listeners.js @@ -1,4 +1,4 @@ -KylinApp.run(function ($rootScope, $http, $location, UserService, AuthenticationService, MessageService,SweetAlert) { +KylinApp.run(function ($rootScope, $http, $location, UserService, AuthenticationService, MessageService,rainbowBar,loadingRequest,SweetAlert) { $rootScope.permissions = { READ: {name: 'CUBE QUERY', value: 'READ', mask: 1}, @@ -28,8 +28,9 @@ KylinApp.run(function ($rootScope, $http, $location, UserService, Authentication $rootScope.$on('event:loginRequired', function () { $rootScope.requests401 = []; - $location.path('/login'); + rainbowBar.hide(); + loadingRequest.hide(); }); /** From 9b9f2f2afc829c46a58b8b65737de9b9f4104dad Mon Sep 17 00:00:00 2001 From: jiazhong Date: Mon, 8 Dec 2014 16:38:08 +0800 Subject: [PATCH 2/3] depressed use or ng-init in angular,use func in controller instead --- .../main/java/com/kylinolap/rest/controller/TableController.java | 6 +++--- webapp/app/js/controllers/cubes.js | 1 - webapp/app/js/controllers/job.js | 3 +++ webapp/app/js/controllers/page.js | 4 ++++ webapp/app/partials/cubes/cube_json_edit.html | 2 +- webapp/app/partials/cubes/cubes.html | 2 +- webapp/app/partials/jobs/jobs.html | 2 +- webapp/app/partials/login.html | 4 ++-- webapp/app/partials/projects/project_table_tree.html | 6 +++++- webapp/app/partials/query/query.html | 2 +- webapp/app/partials/tables/source_metadata.html | 2 +- 11 files changed, 22 insertions(+), 12 deletions(-) diff --git a/server/src/main/java/com/kylinolap/rest/controller/TableController.java b/server/src/main/java/com/kylinolap/rest/controller/TableController.java index e6cb286..ee4cdb3 100644 --- a/server/src/main/java/com/kylinolap/rest/controller/TableController.java +++ b/server/src/main/java/com/kylinolap/rest/controller/TableController.java @@ -71,7 +71,7 @@ List tables = null; try { tables = cubeMgmtService.getProjectManager().listDefinedTablesInProject(project); - } catch (Exception e) { + } catch (IOException e) { logger.error("Failed to deal with the request.", e); throw new InternalErrorException(e.getLocalizedMessage()); } @@ -129,9 +129,9 @@ public String reloadSourceTable() { cubeMgmtService.syncTableToProject(tables, project); result.put("result", arr); - }catch(Exception e){ + }catch(IOException e){ logger.error("Failed to deal with the request.", e); - throw new InternalErrorException(e.getLocalizedMessage()); + throw new InternalErrorException("Failed to load table,Please check the table name."); } return result; } diff --git a/webapp/app/js/controllers/cubes.js b/webapp/app/js/controllers/cubes.js index 4f6951d..eae1655 100644 --- a/webapp/app/js/controllers/cubes.js +++ b/webapp/app/js/controllers/cubes.js @@ -26,7 +26,6 @@ KylinApp $scope.state = { filterAttr: 'create_time', filterReverse: true, reverseColumn: 'create_time', dimensionFilter: '', measureFilter: ''}; - $scope.list = function (offset, limit) { offset = (!!offset) ? offset : 0; limit = (!!limit) ? limit : 20; diff --git a/webapp/app/js/controllers/job.js b/webapp/app/js/controllers/job.js index 0744e9c..9790e01 100644 --- a/webapp/app/js/controllers/job.js +++ b/webapp/app/js/controllers/job.js @@ -41,6 +41,9 @@ KylinApp }); $scope.list = function (offset, limit) { + + + offset = (!!offset) ? offset : 0; var selectedJob = null; if (angular.isDefined($scope.state.selectedJob)) { diff --git a/webapp/app/js/controllers/page.js b/webapp/app/js/controllers/page.js index df4dab4..49be7e7 100644 --- a/webapp/app/js/controllers/page.js +++ b/webapp/app/js/controllers/page.js @@ -123,9 +123,13 @@ KylinApp.controller('PageCtrl', function ($scope, $q, AccessService,$modal, $loc selectedProject: null }; ProjectService.list({}, function (projects) { + angular.forEach(projects, function(project, index){ $scope.project.projects.push(project.name); }); + + $scope.project.selectedProject=$scope.project.selectedProject!=null?$scope.project.selectedProject:$scope.project.projects[0] + }); $scope.toCreateProj = function () { diff --git a/webapp/app/partials/cubes/cube_json_edit.html b/webapp/app/partials/cubes/cube_json_edit.html index 65d7958..2833f0a 100644 --- a/webapp/app/partials/cubes/cube_json_edit.html +++ b/webapp/app/partials/cubes/cube_json_edit.html @@ -10,7 +10,7 @@