From 50c309e613cef05018be7bb4b192aa2349f91f75 Mon Sep 17 00:00:00 2001 From: Andy Butland Date: Fri, 31 Jan 2020 15:52:08 +0100 Subject: [PATCH] Removed type check for dashboard status URL from published status controller and moved to interface. --- .../PublishedCache/IPublishedSnapshotService.cs | 6 ++++++ .../NuCache/PublishedSnapshotService.cs | 2 ++ .../PublishedSnapshotServiceBase.cs | 2 ++ src/Umbraco.Web/Editors/PublishedStatusController.cs | 11 +++++------ 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/Umbraco.Abstractions/PublishedCache/IPublishedSnapshotService.cs b/src/Umbraco.Abstractions/PublishedCache/IPublishedSnapshotService.cs index 96831e3112..a1894c902c 100644 --- a/src/Umbraco.Abstractions/PublishedCache/IPublishedSnapshotService.cs +++ b/src/Umbraco.Abstractions/PublishedCache/IPublishedSnapshotService.cs @@ -161,8 +161,14 @@ namespace Umbraco.Web.PublishedCache #endregion + #region Status + string GetStatus(); + string StatusUrl { get; } + + #endregion + void Collect(); } } diff --git a/src/Umbraco.Infrastructure.PublishedCache/NuCache/PublishedSnapshotService.cs b/src/Umbraco.Infrastructure.PublishedCache/NuCache/PublishedSnapshotService.cs index 5d99aa6aaa..f4636857b5 100644 --- a/src/Umbraco.Infrastructure.PublishedCache/NuCache/PublishedSnapshotService.cs +++ b/src/Umbraco.Infrastructure.PublishedCache/NuCache/PublishedSnapshotService.cs @@ -1788,6 +1788,8 @@ 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(); diff --git a/src/Umbraco.Infrastructure.PublishedCache/PublishedSnapshotServiceBase.cs b/src/Umbraco.Infrastructure.PublishedCache/PublishedSnapshotServiceBase.cs index c7236f9c54..33ac485a26 100644 --- a/src/Umbraco.Infrastructure.PublishedCache/PublishedSnapshotServiceBase.cs +++ b/src/Umbraco.Infrastructure.PublishedCache/PublishedSnapshotServiceBase.cs @@ -41,6 +41,8 @@ namespace Umbraco.Web.PublishedCache public abstract string GetStatus(); + public virtual string StatusUrl => string.Empty; + public virtual void Collect() { } diff --git a/src/Umbraco.Web/Editors/PublishedStatusController.cs b/src/Umbraco.Web/Editors/PublishedStatusController.cs index 9b408e177e..5ed70c4811 100644 --- a/src/Umbraco.Web/Editors/PublishedStatusController.cs +++ b/src/Umbraco.Web/Editors/PublishedStatusController.cs @@ -17,13 +17,12 @@ namespace Umbraco.Web.Editors [HttpGet] public string GetPublishedStatusUrl() { - return "views/dashboard/settings/nucache.html"; + if (!string.IsNullOrWhiteSpace(_publishedSnapshotService.StatusUrl)) + { + return _publishedSnapshotService.StatusUrl; + } - // TODO: do we need this check? - //if (_publishedSnapshotService is PublishedCache.NuCache.PublishedSnapshotService) - // return "views/dashboard/settings/nucache.html"; - - //throw new NotSupportedException("Not supported: " + _publishedSnapshotService.GetType().FullName); + throw new NotSupportedException("Not supported: " + _publishedSnapshotService.GetType().FullName); } } }