Repository: kylin Updated Branches: refs/heads/master 04c76e0c5 -> 0af27cdf9
KYLIN-3076: Make kylin remember the choices we have made in the "Monitor>Jobs" page Project: http://git-wip-us.apache.org/repos/asf/kylin/repo Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/0af27cdf Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/0af27cdf Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/0af27cdf Branch: refs/heads/master Commit: 0af27cdf981a95c0ccadf6223afbdfc357f5e61d Parents: 04c76e0 Author: peng.jianhua <peng.jian...@zte.com.cn> Authored: Thu Dec 14 18:39:53 2017 +0800 Committer: chenzhx <c...@apache.org> Committed: Sun Dec 17 19:23:20 2017 +0800 ---------------------------------------------------------------------- webapp/app/js/controllers/job.js | 17 ++++++++++++++--- webapp/app/js/controllers/page.js | 3 ++- webapp/app/js/model/jobListModel.js | 13 +++++++++++++ 3 files changed, 29 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kylin/blob/0af27cdf/webapp/app/js/controllers/job.js ---------------------------------------------------------------------- diff --git a/webapp/app/js/controllers/job.js b/webapp/app/js/controllers/job.js index 8e460fa..51de787 100644 --- a/webapp/app/js/controllers/job.js +++ b/webapp/app/js/controllers/job.js @@ -24,15 +24,23 @@ KylinApp $scope.jobList = JobList; JobList.removeAll(); $scope.jobConfig = jobConfig; - $scope.cubeName = null; + $scope.cubeName = JobList.jobFilter.cubeName; //$scope.projects = []; $scope.action = {}; - $scope.timeFilter = jobConfig.timeFilter[1]; + $scope.timeFilter = jobConfig.timeFilter[JobList.jobFilter.timeFilterId]; if ($routeParams.jobTimeFilter) { $scope.timeFilter = jobConfig.timeFilter[$routeParams.jobTimeFilter]; } $scope.status = []; + for(var i in JobList.jobFilter.statusIds){ + for(var j in jobConfig.allStatus){ + if(JobList.jobFilter.statusIds[i] == jobConfig.allStatus[j].value){ + $scope.status.push(jobConfig.allStatus[j]); + break; + } + } + } $scope.toggleSelection = function toggleSelection(current) { var idx = $scope.status.indexOf(current); if (idx > -1) { @@ -71,7 +79,10 @@ KylinApp statusIds.push(statusObj.value); }); - $scope.cubeName=$scope.cubeName == ""?null:$scope.cubeName; + $scope.cubeName=$scope.cubeName == ""?null:$scope.cubeName; + JobList.jobFilter.cubeName = $scope.cubeName; + JobList.jobFilter.timeFilterId = $scope.timeFilter.value; + JobList.jobFilter.statusIds = statusIds; var jobRequest = { cubeName: $scope.cubeName, http://git-wip-us.apache.org/repos/asf/kylin/blob/0af27cdf/webapp/app/js/controllers/page.js ---------------------------------------------------------------------- diff --git a/webapp/app/js/controllers/page.js b/webapp/app/js/controllers/page.js index 0b5ded7..8008225 100644 --- a/webapp/app/js/controllers/page.js +++ b/webapp/app/js/controllers/page.js @@ -18,7 +18,7 @@ 'use strict'; -KylinApp.controller('PageCtrl', function ($scope, $q, AccessService, $modal, $location, $rootScope, $routeParams, $http, UserService, ProjectService, SweetAlert, $cookieStore, $log, kylinConfig, ProjectModel, TableModel) { +KylinApp.controller('PageCtrl', function ($scope, $q, AccessService, $modal, $location, $rootScope, $routeParams, $http, UserService, ProjectService, SweetAlert, $cookieStore, $log, kylinConfig, ProjectModel, TableModel, JobList) { //init kylinConfig to get kylin.Propeties kylinConfig.init().$promise.then(function (data) { @@ -49,6 +49,7 @@ KylinApp.controller('PageCtrl', function ($scope, $q, AccessService, $modal, $lo // Set up common methods $scope.logout = function () { ProjectModel.clear(); + JobList.clearJobFilter(); $rootScope.userAction.islogout = true; var logoutURL = Config.service.base; if(kylinConfig.getProperty('kylin.security.profile') === 'saml') { http://git-wip-us.apache.org/repos/asf/kylin/blob/0af27cdf/webapp/app/js/model/jobListModel.js ---------------------------------------------------------------------- diff --git a/webapp/app/js/model/jobListModel.js b/webapp/app/js/model/jobListModel.js index 95e0be3..45948d6 100755 --- a/webapp/app/js/model/jobListModel.js +++ b/webapp/app/js/model/jobListModel.js @@ -23,6 +23,19 @@ KylinApp.service('JobList',function(JobService,$q){ var _this = this; this.jobs={}; + this.jobFilter = { + cubeName : null, + timeFilterId : 1, + statusIds: [] + }; + + this.clearJobFilter = function(){ + this.jobFilter = { + cubeName : null, + timeFilterId : 1, + statusIds: [] + }; + }; this.list = function(jobRequest){ var defer = $q.defer();