WIP Starting with taking Marc's code to get a rudimentary dashboard for the 301 URL tracker
This commit is contained in:
@@ -40,8 +40,7 @@
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile />
|
||||
<UseIISExpress>true</UseIISExpress>
|
||||
<IISExpressSSLPort>
|
||||
</IISExpressSSLPort>
|
||||
<IISExpressSSLPort>44319</IISExpressSSLPort>
|
||||
<IISExpressAnonymousAuthentication />
|
||||
<IISExpressWindowsAuthentication />
|
||||
<IISExpressUseClassicPipelineMode />
|
||||
@@ -579,6 +578,8 @@
|
||||
<Content Include="App_Plugins\ModelsBuilder\modelsbuilder.controller.js" />
|
||||
<Content Include="App_Plugins\ModelsBuilder\modelsbuilder.htm" />
|
||||
<Content Include="App_Plugins\ModelsBuilder\modelsbuilder.resource.js" />
|
||||
<Content Include="App_Plugins\RedirectUrlDashboard\redirecturlsearch.controller.js" />
|
||||
<Content Include="App_Plugins\RedirectUrlDashboard\redirecturlsearch.html" />
|
||||
<Content Include="Config\grid.editors.config.js" />
|
||||
<Content Include="Config\Lang\cs-CZ.user.xml" />
|
||||
<Content Include="Config\Lang\da-DK.user.xml" />
|
||||
@@ -638,6 +639,7 @@
|
||||
</Content>
|
||||
<Content Include="Umbraco\Install\Views\Web.config" />
|
||||
<Content Include="App_Plugins\ModelsBuilder\package.manifest" />
|
||||
<Content Include="App_Plugins\RedirectUrlDashboard\package.manifest" />
|
||||
<None Include="Config\404handlers.Release.config">
|
||||
<DependentUpon>404handlers.config</DependentUpon>
|
||||
</None>
|
||||
|
||||
@@ -109,4 +109,14 @@
|
||||
</control>
|
||||
</tab>
|
||||
</section>
|
||||
<section alias="RedirectUrlManagement">
|
||||
<areas>
|
||||
<area>developer</area>
|
||||
</areas>
|
||||
<tab caption="Redirect URL Management">
|
||||
<control>
|
||||
/App_Plugins/RedirectUrlDashboard/redirecturlsearch.html
|
||||
</control>
|
||||
</tab>
|
||||
</section>
|
||||
</dashBoard>
|
||||
|
||||
65
src/Umbraco.Web/Redirects/RedirectUrlManagementController.cs
Normal file
65
src/Umbraco.Web/Redirects/RedirectUrlManagementController.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Web.Http;
|
||||
using Umbraco.Web.WebApi;
|
||||
|
||||
namespace Umbraco.Web.Redirects
|
||||
{
|
||||
public class RedirectUrlManagementController : UmbracoAuthorizedApiController
|
||||
{
|
||||
//add paging
|
||||
[HttpGet]
|
||||
public RedirectUrlSearchResult SearchRedirectUrls(string searchTerm, int page = 0)
|
||||
{
|
||||
|
||||
int pageSize = 20;
|
||||
var searchResult = new RedirectUrlSearchResult();
|
||||
var redirectUrlService = Services.RedirectUrlService;
|
||||
long resultCount = 0L;
|
||||
// need endpoint for search functionality
|
||||
// by url, by domain ? it's the url that you want to find them by, that's what you see..
|
||||
|
||||
var redirects = redirectUrlService.GetAllRedirectUrls(page, 20, out resultCount);
|
||||
searchResult.SearchResults = redirects;
|
||||
searchResult.TotalCount = resultCount;
|
||||
searchResult.CurrentPage = page;
|
||||
//hmm how many results 'could there be ?
|
||||
searchResult.PageCount = ((int)resultCount + pageSize - 1) / pageSize;
|
||||
|
||||
searchResult.HasSearchResults = resultCount > 0;
|
||||
searchResult.HasExactMatch = (resultCount == 1);
|
||||
return searchResult;
|
||||
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public HttpResponseMessage GetPublishedUrl(int id)
|
||||
{
|
||||
var publishedUrl = "#";
|
||||
if (id > 0)
|
||||
{
|
||||
publishedUrl = Umbraco.Url(id);
|
||||
}
|
||||
|
||||
return new HttpResponseMessage { Content = new StringContent(publishedUrl, Encoding.UTF8, "text/html") };
|
||||
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public HttpResponseMessage DeleteRedirectUrl(int id)
|
||||
{
|
||||
|
||||
var redirectUrlService = Services.RedirectUrlService;
|
||||
// has the redirect already been deleted ?
|
||||
//var redirectUrl = redirectUrlService.GetById(redirectUrl.Id);
|
||||
//if (redirectUrl== null)
|
||||
//{
|
||||
// return new HttpResponseMessage(System.Net.HttpStatusCode.NotFound);
|
||||
//}
|
||||
redirectUrlService.Delete(id);
|
||||
return new HttpResponseMessage(System.Net.HttpStatusCode.OK);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
16
src/Umbraco.Web/Redirects/RedirectUrlSearchResults.cs
Normal file
16
src/Umbraco.Web/Redirects/RedirectUrlSearchResults.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System.Collections.Generic;
|
||||
using Umbraco.Core.Models;
|
||||
|
||||
namespace Umbraco.Web.Redirects
|
||||
{
|
||||
public class RedirectUrlSearchResult
|
||||
{
|
||||
public string StatusMessage { get; set; }
|
||||
public IEnumerable<IRedirectUrl> SearchResults { get; set; }
|
||||
public bool HasSearchResults { get; set; }
|
||||
public bool HasExactMatch { get; set; }
|
||||
public long TotalCount { get; set; }
|
||||
public int PageCount { get; set; }
|
||||
public int CurrentPage { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -391,6 +391,8 @@
|
||||
<Compile Include="PropertyEditors\ValueConverters\ImageCropDataSetConverter.cs" />
|
||||
<Compile Include="PropertyEditors\ValueConverters\ImageCropperValueConverter.cs" />
|
||||
<Compile Include="Redirects\RedirectTrackingEventHandler.cs" />
|
||||
<Compile Include="Redirects\RedirectUrlManagementController.cs" />
|
||||
<Compile Include="Redirects\RedirectUrlSearchResults.cs" />
|
||||
<Compile Include="RequestLifespanMessagesFactory.cs" />
|
||||
<Compile Include="RouteDataExtensions.cs" />
|
||||
<Compile Include="Routing\ContentFinderByRedirectUrl.cs" />
|
||||
|
||||
Reference in New Issue
Block a user