Repository: kylin Updated Branches: refs/heads/2.0-rc 6ec2adbbe -> 2679fc2af
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/2679fc2a Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/2679fc2a Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/2679fc2a Branch: refs/heads/2.0-rc Commit: 2679fc2afbe792afc9c0653e3cfb3fd7ceaaa7a9 Parents: 6ec2adb Author: jian <jiazh...@apache.org> Authored: Tue Dec 22 18:07:31 2015 +0800 Committer: jian <jiazh...@apache.org> Committed: Tue Dec 22 18:07:31 2015 +0800 ---------------------------------------------------------------------- webapp/app/js/controllers/admin.js | 29 +++++++++++++++++++++++++++++ webapp/app/partials/admin/admin.html | 7 ++++++- 2 files changed, 35 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kylin/blob/2679fc2a/webapp/app/js/controllers/admin.js ---------------------------------------------------------------------- diff --git a/webapp/app/js/controllers/admin.js b/webapp/app/js/controllers/admin.js index e5d2a67..6eed2b3 100644 --- a/webapp/app/js/controllers/admin.js +++ b/webapp/app/js/controllers/admin.js @@ -149,6 +149,35 @@ 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/2679fc2a/webapp/app/partials/admin/admin.html ---------------------------------------------------------------------- diff --git a/webapp/app/partials/admin/admin.html b/webapp/app/partials/admin/admin.html index c17aba4..addc8ed 100644 --- a/webapp/app/partials/admin/admin.html +++ b/webapp/app/partials/admin/admin.html @@ -59,6 +59,11 @@ <label tooltip="Disable Query Cache" style="cursor: pointer;">Disable Cache</label> </button> </div> + <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> @@ -165,4 +170,4 @@ <button class="btn btn-primary" ng-click="cancel()">Cancel</button> </div> </ng-form> -</script> \ No newline at end of file +</script>