Repository: kylin
Updated Branches:
  refs/heads/2.x-staging b502ff2ff -> 1410d9d30


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/1410d9d3
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/1410d9d3
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/1410d9d3

Branch: refs/heads/2.x-staging
Commit: 1410d9d30431bb53cc1852198ef700b43f6de11f
Parents: b502ff2
Author: jian <jiazh...@apache.org>
Authored: Tue Dec 22 18:01:56 2015 +0800
Committer: jian <jiazh...@apache.org>
Committed: Tue Dec 22 18:01:56 2015 +0800

----------------------------------------------------------------------
 webapp/app/js/controllers/admin.js   | 28 ++++++++++++++++++++++++++++
 webapp/app/partials/admin/admin.html |  9 +++++++--
 2 files changed, 35 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/1410d9d3/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/1410d9d3/webapp/app/partials/admin/admin.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/admin/admin.html 
b/webapp/app/partials/admin/admin.html
index c17aba4..3e063a6 100644
--- a/webapp/app/partials/admin/admin.html
+++ b/webapp/app/partials/admin/admin.html
@@ -59,7 +59,12 @@
                 <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>
@@ -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>

Reply via email to