KYLIN-1211 Add 'Enable Cache' button in System page
Project: http://git-wip-us.apache.org/repos/asf/kylin/repo Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/41d1974f Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/41d1974f Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/41d1974f Branch: refs/heads/1.x-HBase1.1.3 Commit: 41d1974f054ba30f35640e04cc770d2901d3fd2d Parents: 11946ae Author: jian <jiazh...@apache.org> Authored: Tue Dec 22 17:52:50 2015 +0800 Committer: jian <jiazh...@apache.org> Committed: Tue Dec 22 17:53:13 2015 +0800 ---------------------------------------------------------------------- webapp/app/js/controllers/admin.js | 28 ++++++++++++++++++++++++++++ webapp/app/partials/admin/admin.html | 10 ++++++++-- 2 files changed, 36 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kylin/blob/41d1974f/webapp/app/js/controllers/admin.js ---------------------------------------------------------------------- diff --git a/webapp/app/js/controllers/admin.js b/webapp/app/js/controllers/admin.js index e5d2a67..aa231df 100644 --- a/webapp/app/js/controllers/admin.js +++ b/webapp/app/js/controllers/admin.js @@ -149,6 +149,34 @@ KylinApp.controller('AdminCtrl', function ($scope, AdminService, CacheService, T } + $scope.enableCache = function () { + SweetAlert.swal({ + title: '', + text: 'Are you sure to enable query cache?', + type: '', + showCancelButton: true, + confirmButtonColor: '#DD6B55', + confirmButtonText: "Yes", + closeOnConfirm: true + }, function (isConfirm) { + if (isConfirm) { + AdminService.updateConfig({}, {key: 'kylin.query.cache.enabled', value: true}, function () { + SweetAlert.swal('Success!', 'Cache enabled successfully!', 'success'); + }, function (e) { + if (e.data && e.data.exception) { + var message = e.data.exception; + var msg = !!(message) ? message : 'Failed to take action.'; + SweetAlert.swal('Oops...', msg, 'error'); + } else { + SweetAlert.swal('Oops...', "Failed to take action.", 'error'); + } + }); + } + + }); + + } + $scope.toSetConfig = function () { $modal.open({ templateUrl: 'updateConfig.html', http://git-wip-us.apache.org/repos/asf/kylin/blob/41d1974f/webapp/app/partials/admin/admin.html ---------------------------------------------------------------------- diff --git a/webapp/app/partials/admin/admin.html b/webapp/app/partials/admin/admin.html index c7b23f0..8e32409 100644 --- a/webapp/app/partials/admin/admin.html +++ b/webapp/app/partials/admin/admin.html @@ -59,7 +59,13 @@ <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;"> + <button class="btn btn-primary btn-lg btn-block" ng-click="enableCache()"> + <label tooltip="Disable Query Cache" style="cursor: pointer;">Enable Cache</label> + </button> + </div> + + <div style="padding-top: 10px;width: 180px;"> <button class="btn btn-primary btn-lg btn-block" ng-click="toSetConfig()"> <label tooltip="Update Server Config" style="cursor: pointer;">Set Config</label> </button> @@ -168,4 +174,4 @@ <button class="btn btn-primary" ng-click="cancel()">Cancel</button> </div> </ng-form> -</script> \ No newline at end of file +</script>