Skip to content

Commit

Permalink
#728 fix as comments
Browse files Browse the repository at this point in the history
  • Loading branch information
schoicsiro committed Oct 10, 2023
1 parent 7fa17b9 commit a5cfb6e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ profileEditor.controller('ALAAdminController', function ($http, util, messageSer

function cacheManagement() {
self.loadingCacheManagement = true;
var promise = $http.get(util.contextRoot() + "/admin/cacheManagement/");
var promise = $http.get(util.contextRoot() + "/admin/cacheManagement");
promise.then(function (response) {
self.cacheRegions = response.data || [];
self.loadingCacheManagement = false;
Expand All @@ -241,10 +241,14 @@ profileEditor.controller('ALAAdminController', function ($http, util, messageSer

self.clearCache = function (cache) {
var promise = $http.get(util.contextRoot() + "/admin/clearCache/" + cache);
promise.then(function() {
messageService.success("Job clear cache for " + cache);
promise.then(function(response) {
if (response.data.error) {
messageService.alert(response.data.error);
} else {
messageService.success(response.data.resp);
}
}, function() {
messageService.alert("Failed to clear cache the job");
messageService.alert(response.data.error);
});
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,15 @@ class AdminController extends BaseController {

@Secured(role = Role.ROLE_ADMIN, opusSpecific = false)
def clearCache() {
Map result = [:]
if (params.id) {
grailsCacheManager.getCache(params.id).clear()
result.resp = "Successfully cleared cache - " + params.id
result.statusCode = HttpStatus.SC_OK
} else {
result.error = "Failed to clear cache the job"
result.statusCode = HttpStatus.SC_INTERNAL_SERVER_ERROR
}
render view: "admin.gsp"
success result
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ class UrlMappings {
"/admin/job/$jobType/$jobId" controller: "admin", action: [DELETE: "deleteJob"]
"/admin/job/" controller: "admin", action: [GET: "listPendingJobs"]
"/admin/tag/$tagId?" controller: "admin", action: [GET: "getTag", PUT: "createTag", POST: "updateTag", DELETE: "deleteTag"]
"/admin/cacheManagement/" controller: "admin", action: [GET: "cacheManagement"]
"/admin/clearCache" controller: "admin", action: [GET: "clearCache"]
"/admin/cacheManagement" controller: "admin", action: [GET: "cacheManagement"]
"/admin/clearCache/$id" controller: "admin", action: [GET: "clearCache"]
"/admin/reloadHelpUrls" controller: "admin", action: [POST: "reloadHelpUrls"]
"/admin" controller: "admin", action: [GET: "index"]
"/alaAdmin/index" controller: "admin", action: [GET: "alaIndex"]
Expand Down
6 changes: 4 additions & 2 deletions grails-app/views/admin/admin.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,10 @@
<div class="table-responsive" ng-show="adminCtrl.cacheRegions.length > 0">
<table class="table table-striped">
<thead>
<th>Cache Name</th>
<th>Cache Clear</th>
<tr>
<th>Cache Name</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="cache in adminCtrl.cacheRegions">
Expand Down

0 comments on commit a5cfb6e

Please sign in to comment.