Removed concrete type checks for back-office published cache details, so now working from interface. Renamed controller and FE assets to more generic name.
This commit is contained in:
@@ -1788,8 +1788,6 @@ AND cmsContentNu.nodeId IS NULL
|
||||
" and " + ms + " snapshot" + (ms > 1 ? "s" : "") + ".";
|
||||
}
|
||||
|
||||
public override string StatusUrl => "views/dashboard/settings/nucache.html";
|
||||
|
||||
public override void Collect()
|
||||
{
|
||||
var contentCollect = _contentStore.CollectAsync();
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Umbraco.Web.PublishedCache
|
||||
|
||||
public abstract string GetStatus();
|
||||
|
||||
public virtual string StatusUrl => string.Empty;
|
||||
public virtual string StatusUrl => "views/dashboard/settings/publishedsnapshotcache.html";
|
||||
|
||||
public virtual void Collect()
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
function nuCacheController($scope, $http, umbRequestHelper, localizationService, overlayService) {
|
||||
function publishedSnapshotCacheController($scope, $http, umbRequestHelper, localizationService, overlayService) {
|
||||
|
||||
var vm = this;
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
if (vm.working) return;
|
||||
vm.working = true;
|
||||
umbRequestHelper.resourcePromise(
|
||||
$http.get(umbRequestHelper.getApiUrl("nuCacheStatusBaseUrl", "Collect")),
|
||||
$http.get(umbRequestHelper.getApiUrl("publishedSnapshotCacheStatusBaseUrl", "Collect")),
|
||||
'Failed to verify the cache.')
|
||||
.then(function (result) {
|
||||
vm.working = false;
|
||||
@@ -47,7 +47,7 @@
|
||||
if (vm.working) return;
|
||||
vm.working = true;
|
||||
umbRequestHelper.resourcePromise(
|
||||
$http.get(umbRequestHelper.getApiUrl("nuCacheStatusBaseUrl", "GetStatus")),
|
||||
$http.get(umbRequestHelper.getApiUrl("publishedSnapshotCacheStatusBaseUrl", "GetStatus")),
|
||||
'Failed to verify the cache.')
|
||||
.then(function (result) {
|
||||
vm.working = false;
|
||||
@@ -83,7 +83,7 @@
|
||||
vm.working = true;
|
||||
|
||||
umbRequestHelper.resourcePromise(
|
||||
$http.post(umbRequestHelper.getApiUrl("nuCacheStatusBaseUrl", "ReloadCache")),
|
||||
$http.post(umbRequestHelper.getApiUrl("publishedSnapshotCacheStatusBaseUrl", "ReloadCache")),
|
||||
'Failed to trigger a cache reload')
|
||||
.then(function (result) {
|
||||
vm.working = false;
|
||||
@@ -94,7 +94,7 @@
|
||||
vm.working = true;
|
||||
|
||||
umbRequestHelper.resourcePromise(
|
||||
$http.post(umbRequestHelper.getApiUrl("nuCacheStatusBaseUrl", "RebuildDbCache")),
|
||||
$http.post(umbRequestHelper.getApiUrl("publishedSnapshotCacheStatusBaseUrl", "RebuildDbCache")),
|
||||
'Failed to rebuild the cache.')
|
||||
.then(function (result) {
|
||||
vm.working = false;
|
||||
@@ -109,4 +109,4 @@
|
||||
|
||||
init();
|
||||
}
|
||||
angular.module("umbraco").controller("Umbraco.Dashboard.NuCacheController", nuCacheController);
|
||||
angular.module("umbraco").controller("Umbraco.Dashboard.PublishedSnapshotCacheController", publishedSnapshotCacheController);
|
||||
@@ -1,4 +1,4 @@
|
||||
<div id="nuCache" style="position: relative;" ng-controller="Umbraco.Dashboard.NuCacheController as vm">
|
||||
<div id="nuCache" style="position: relative;" ng-controller="Umbraco.Dashboard.PublishedSnapshotCacheController as vm">
|
||||
|
||||
<div ng-show="vm.loading || vm.working" style="background: rgba(255, 255, 255, 0.60); position: absolute; left: 0; right: 0; top: 0; bottom: 0;">
|
||||
<umb-load-indicator></umb-load-indicator>
|
||||
@@ -7,8 +7,6 @@
|
||||
$http.get(umbRequestHelper.getApiUrl('publishedStatusBaseUrl', 'GetPublishedStatusUrl')),
|
||||
'Failed to get published status url')
|
||||
.then(function (result) {
|
||||
|
||||
//result = 'views/dashboard/developer/nucache.html'
|
||||
vm.includeUrl = result;
|
||||
});
|
||||
|
||||
|
||||
@@ -286,7 +286,7 @@ namespace Umbraco.Web.Editors
|
||||
controller => controller.DeleteById(int.MaxValue))
|
||||
},
|
||||
{
|
||||
"nuCacheStatusBaseUrl", _urlHelper.GetUmbracoApiServiceBaseUrl<NuCacheStatusController>(
|
||||
"publishedSnapshotCacheStatusBaseUrl", _urlHelper.GetUmbracoApiServiceBaseUrl<PublishedSnapshotCacheStatusController>(
|
||||
controller => controller.GetStatus())
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
using System;
|
||||
using System.Web.Http;
|
||||
using Umbraco.Web.Cache;
|
||||
using Umbraco.Web.Composing;
|
||||
using Umbraco.Web.PublishedCache;
|
||||
using Umbraco.Web.PublishedCache.NuCache;
|
||||
using Umbraco.Web.WebApi;
|
||||
|
||||
namespace Umbraco.Web.Editors
|
||||
{
|
||||
public class NuCacheStatusController : UmbracoAuthorizedApiController
|
||||
{
|
||||
private readonly IPublishedSnapshotService _publishedSnapshotService;
|
||||
|
||||
public NuCacheStatusController(IPublishedSnapshotService publishedSnapshotService)
|
||||
{
|
||||
_publishedSnapshotService = publishedSnapshotService ?? throw new ArgumentNullException(nameof(publishedSnapshotService));
|
||||
}
|
||||
|
||||
private IPublishedSnapshotService PublishedSnapshotService
|
||||
{
|
||||
get
|
||||
{
|
||||
var svc = _publishedSnapshotService as PublishedSnapshotService;
|
||||
if (svc == null)
|
||||
throw new NotSupportedException("Not running NuCache.");
|
||||
return svc;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public string RebuildDbCache()
|
||||
{
|
||||
var service = PublishedSnapshotService;
|
||||
service.Rebuild();
|
||||
return service.GetStatus();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public string GetStatus()
|
||||
{
|
||||
var service = PublishedSnapshotService;
|
||||
return service.GetStatus();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public string Collect()
|
||||
{
|
||||
var service = PublishedSnapshotService;
|
||||
GC.Collect();
|
||||
service.Collect();
|
||||
return service.GetStatus();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void ReloadCache()
|
||||
{
|
||||
Current.DistributedCache.RefreshAllPublishedSnapshot();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Web.Http;
|
||||
using Umbraco.Web.Cache;
|
||||
using Umbraco.Web.Composing;
|
||||
using Umbraco.Web.PublishedCache;
|
||||
using Umbraco.Web.WebApi;
|
||||
|
||||
namespace Umbraco.Web.Editors
|
||||
{
|
||||
public class PublishedSnapshotCacheStatusController : UmbracoAuthorizedApiController
|
||||
{
|
||||
private readonly IPublishedSnapshotService _publishedSnapshotService;
|
||||
|
||||
public PublishedSnapshotCacheStatusController(IPublishedSnapshotService publishedSnapshotService)
|
||||
{
|
||||
_publishedSnapshotService = publishedSnapshotService ?? throw new ArgumentNullException(nameof(publishedSnapshotService));
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public string RebuildDbCache()
|
||||
{
|
||||
_publishedSnapshotService.Rebuild();
|
||||
return _publishedSnapshotService.GetStatus();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public string GetStatus()
|
||||
{
|
||||
return _publishedSnapshotService.GetStatus();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public string Collect()
|
||||
{
|
||||
GC.Collect();
|
||||
_publishedSnapshotService.Collect();
|
||||
return _publishedSnapshotService.GetStatus();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void ReloadCache()
|
||||
{
|
||||
Current.DistributedCache.RefreshAllPublishedSnapshot();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -406,7 +406,7 @@
|
||||
<Compile Include="WebApi\UnhandledExceptionLogger.cs" />
|
||||
<Compile Include="Runtime\WebInitialComponent.cs" />
|
||||
<Compile Include="Editors\PublishedStatusController.cs" />
|
||||
<Compile Include="Editors\NuCacheStatusController.cs" />
|
||||
<Compile Include="Editors\PublishedSnapshotCacheStatusController.cs" />
|
||||
<Compile Include="Trees\TreeAttribute.cs" />
|
||||
<Compile Include="Routing\NotFoundHandlerHelper.cs" />
|
||||
<Compile Include="Models\LocalPackageInstallModel.cs" />
|
||||
|
||||
Reference in New Issue
Block a user