2 * ================================================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ================================================================================
20 app.controller('cacheAdminController', function ($scope,$interval,$http,$modal,modalService,AdminService){
22 AdminService.getCacheRegions().then(function(data){
25 $scope.data = JSON.parse(j.data);
26 $scope.regions =$scope.data;
30 console.log("failed");
33 $scope.clearAll = function() {
34 modalService.popupConfirmWin("Confirm",'You are about to clear all of the items for all cache regions. Do you want to continue?',
36 $http.get("jcs_admin/clearAll").success(function(response){$scope.regions=response;});
41 $scope.clearRegion = function(cacheName) {
42 modalService.popupConfirmWin("Confirm",'You are about to clear all of the items in the cache region "' + cacheName + '". Do you want to continue?',
44 $http.get("jcs_admin/clearRegion?cacheName="+cacheName).success(function(response){$scope.regions=response;});
49 $scope.clearItem = function(cacheName,key) {
50 modalService.popupConfirmWin("Confirm",'You are about to clear this item from the cache region "' + cacheName + '". Do you want to continue?',
52 $http.get("jcs_admin/clearItem?keyName="+key+"&cacheName="+cacheName).success(function(response){$scope.regions=response;});
57 $scope.showRegionDetails = function(cacheName) {
58 $http.get("jcs_admin/showRegionDetails?cacheName="+cacheName).success(function(response){modalService.showSuccess('',response);});
61 $scope.showItemDetails = function(cacheName,key) {
62 $http.get("jcs_admin/showItemDetails?keyName="+key+"&cacheName="+cacheName).success(function(response){
63 var message = "CacheName: "+ response.cacheName
64 +"\nkey: "+response.key
65 +"\nIS_SPOOL: "+response.attr.IS_SPOOL
66 +"\nIS_LATERAL: "+response.attr.IS_LATERAL
67 +"\nIS_REMOTE: "+response.attr.IS_REMOTE
68 +"\nIS_ETERNAL: "+response.attr.IS_ETERNAL
69 +"\nversion: "+response.attr.version
70 +"\nmaxLifeSeconds: "+response.attr.maxLifeSeconds
71 +"\nmaxIdleTimeSeconds: "+response.attr.maxIdleTimeSeconds
72 +"\nsize: "+response.attr.size
73 +"\ncreateTime: "+response.attr.createTime
74 +"\nlastAccessTime: "+response.attr.lastAccessTime
75 +"\nidleTime: "+response.attr.idleTime
76 +"\ntimeToLiveSeconds: "+response.attr.timeToLiveSeconds
77 +"\nisSpool: "+response.attr.isSpool
78 +"\nisLateral: "+response.attr.isLateral
79 +"\nisRemote: "+response.attr.isRemote
80 +"\nisEternal: "+response.attr.isEternal;
81 modalService.showSuccess('',message);});