Repository: kylin Updated Branches: refs/heads/2.0-rc 73d61e0b8 -> 25e63506e
minor,UI enable/disable cache status refresh after done Project: http://git-wip-us.apache.org/repos/asf/kylin/repo Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/25e63506 Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/25e63506 Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/25e63506 Branch: refs/heads/2.0-rc Commit: 25e63506ec149f02582b367ea40e4ad4e069c740 Parents: 73d61e0 Author: jian <zhongj...@apache.org> Authored: Mon Jan 18 15:12:27 2016 +0800 Committer: jian <zhongj...@apache.org> Committed: Mon Jan 18 15:12:27 2016 +0800 ---------------------------------------------------------------------- webapp/app/js/controllers/admin.js | 9 ++++++++- webapp/app/js/services/kylinProperties.js | 8 ++++++++ webapp/app/partials/admin/admin.html | 4 ++-- 3 files changed, 18 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kylin/blob/25e63506/webapp/app/js/controllers/admin.js ---------------------------------------------------------------------- diff --git a/webapp/app/js/controllers/admin.js b/webapp/app/js/controllers/admin.js index 6eed2b3..a17eb60 100644 --- a/webapp/app/js/controllers/admin.js +++ b/webapp/app/js/controllers/admin.js @@ -18,10 +18,15 @@ 'use strict'; -KylinApp.controller('AdminCtrl', function ($scope, AdminService, CacheService, TableService, loadingRequest, MessageService, $modal, SweetAlert) { +KylinApp.controller('AdminCtrl', function ($scope, AdminService, CacheService, TableService, loadingRequest, MessageService, $modal, SweetAlert,kylinConfig) { $scope.configStr = ""; $scope.envStr = ""; + $scope.isCacheEnabled = function(){ + console.log("cache enabled?:"+kylinConfig.isCacheEnabled()); + return kylinConfig.isCacheEnabled(); + } + $scope.getEnv = function () { AdminService.env({}, function (env) { $scope.envStr = env.env; @@ -134,6 +139,7 @@ KylinApp.controller('AdminCtrl', function ($scope, AdminService, CacheService, T if (isConfirm) { AdminService.updateConfig({}, {key: 'kylin.query.cache.enabled', value: false}, function () { SweetAlert.swal('Success!', 'Cache disabled successfully!', 'success'); + location.reload(); }, function (e) { if (e.data && e.data.exception) { var message = e.data.exception; @@ -162,6 +168,7 @@ KylinApp.controller('AdminCtrl', function ($scope, AdminService, CacheService, T if (isConfirm) { AdminService.updateConfig({}, {key: 'kylin.query.cache.enabled', value: true}, function () { SweetAlert.swal('Success!', 'Cache enabled successfully!', 'success'); + location.reload(); }, function (e) { if (e.data && e.data.exception) { var message = e.data.exception; http://git-wip-us.apache.org/repos/asf/kylin/blob/25e63506/webapp/app/js/services/kylinProperties.js ---------------------------------------------------------------------- diff --git a/webapp/app/js/services/kylinProperties.js b/webapp/app/js/services/kylinProperties.js index 76b8087..a03403b 100644 --- a/webapp/app/js/services/kylinProperties.js +++ b/webapp/app/js/services/kylinProperties.js @@ -47,6 +47,14 @@ KylinApp.service('kylinConfig', function (AdminService, $log) { return this.timezone; } + this.isCacheEnabled = function(){ + var status = this.getProperty("kylin.query.cache.enabled").trim(); + if(status!=='false'){ + return true; + } + return false; + } + this.getDeployEnv = function () { if (!this.deployEnv) { this.deployEnv = this.getProperty("deploy.env").trim(); http://git-wip-us.apache.org/repos/asf/kylin/blob/25e63506/webapp/app/partials/admin/admin.html ---------------------------------------------------------------------- diff --git a/webapp/app/partials/admin/admin.html b/webapp/app/partials/admin/admin.html index 59fe9ae..25a8577 100644 --- a/webapp/app/partials/admin/admin.html +++ b/webapp/app/partials/admin/admin.html @@ -54,12 +54,12 @@ <label tooltip="Clean unused HDFS and HBASE space" style="cursor: pointer;">Clean Up Storage</label> </button> </div> - <div style="padding-top: 10px;width: 180px;"> + <div style="padding-top: 10px;width: 180px;" ng-if="isCacheEnabled()"> <button class="btn btn-primary btn-lg btn-block" ng-click="disableCache()"> <label tooltip="Disable Query Cache" style="cursor: pointer;">Disable Cache</label> </button> </div> - <div style="padding-top: 10px;width: 180px;"> + <div style="padding-top: 10px;width: 180px;" ng-if="!isCacheEnabled()"> <button class="btn btn-primary btn-lg btn-block" ng-click="enableCache()"> <label tooltip="Enable Query Cache" style="cursor: pointer;">Enable Cache</label> </button>