Skip to content

Commit 64ee464

Browse files
committed
Added test project and fixed v0.5 admin routing updates.
1 parent 9a5e1ab commit 64ee464

File tree

14 files changed

+186
-25
lines changed

14 files changed

+186
-25
lines changed

src/Cofoundry.Plugins.ErrorLogging.Admin/Cofoundry.Plugins.ErrorLogging.Admin.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
</PropertyGroup>
1616

1717
<ItemGroup>
18-
<PackageReference Include="Cofoundry.Web.Admin" Version="0.4.1" />
18+
<PackageReference Include="Cofoundry.Web.Admin" Version="0.5.0-beta0004" />
1919
</ItemGroup>
2020

2121
<ItemGroup>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using Cofoundry.Web;
2+
using Microsoft.AspNetCore.Routing;
3+
using System;
4+
using System.Collections.Generic;
5+
using System.Text;
6+
using Cofoundry.Web.Admin;
7+
8+
namespace Cofoundry.Plugins.ErrorLogging.Admin
9+
{
10+
public class ErrorLoggingApiRouteRegistration : IOrderedRouteRegistration
11+
{
12+
public int Ordering => (int)RouteRegistrationOrdering.Early;
13+
14+
public void RegisterRoutes(IRouteBuilder routeBuilder)
15+
{
16+
routeBuilder
17+
.ForAdminApiController<ErrorsApiController>("plugins/errors")
18+
.MapGet()
19+
.MapGetById("{errorId:int}")
20+
;
21+
}
22+
}
23+
}

src/Cofoundry.Plugins.ErrorLogging.Admin/Plugins/Admin/Api/Errors/ErrorsApiController.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
namespace Cofoundry.Plugins.ErrorLogging.Admin
1212
{
13-
[Route(RouteConstants.PluginApiRoutePrefix + "/Errors")]
1413
public class ErrorsApiController : BaseAdminApiController
1514
{
1615
private const string ID_ROUTE = "{errorId:int}";
@@ -27,7 +26,6 @@ IApiResponseHelper apiResponseHelper
2726
_apiResponseHelper = apiResponseHelper;
2827
}
2928

30-
[HttpGet]
3129
public async Task<IActionResult> Get([FromQuery] SearchErrorSummariesQuery query)
3230
{
3331
if (query == null) query = new SearchErrorSummariesQuery();
@@ -36,8 +34,7 @@ public async Task<IActionResult> Get([FromQuery] SearchErrorSummariesQuery query
3634
return _apiResponseHelper.SimpleQueryResponse(this, results);
3735
}
3836

39-
[HttpGet(ID_ROUTE)]
40-
public async Task<IActionResult> Get(int errorId)
37+
public async Task<IActionResult> GetById(int errorId)
4138
{
4239
var query = new GetErrorDetailsByIdQuery(errorId);
4340
var result = await _queryExecutor.ExecuteAsync(query);

src/Cofoundry.Plugins.ErrorLogging.Admin/Plugins/Admin/Modules/Errors/Bootstrap/ErrorsModuleRegistration.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ namespace Cofoundry.Plugins.ErrorLogging.Admin
99
{
1010
public class ErrorsModuleRegistration : IPluginAngularModuleRegistration
1111
{
12+
private readonly AdminSettings _adminSettings;
13+
14+
public ErrorsModuleRegistration(AdminSettings adminSettings)
15+
{
16+
_adminSettings = adminSettings;
17+
}
18+
1219
public AdminModule GetModule()
1320
{
1421
var module = new AdminModule()
@@ -18,7 +25,7 @@ public AdminModule GetModule()
1825
Description = "View the site error logs.",
1926
MenuCategory = AdminModuleMenuCategory.Settings,
2027
PrimaryOrdering = AdminModuleMenuPrimaryOrdering.Tertiary,
21-
Url = new ErrorsRouteLibrary().List(),
28+
Url = new ErrorsRouteLibrary(_adminSettings).List(),
2229
RestrictedToPermission = new ErrorLogReadPermission()
2330
};
2431

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Cofoundry.Web.Admin;
1+
using Cofoundry.Domain;
2+
using Cofoundry.Web.Admin;
23
using System;
34
using System.Collections.Generic;
45
using System.Linq;
@@ -7,23 +8,13 @@ namespace Cofoundry.Plugins.ErrorLogging.Admin
78
{
89
public class ErrorsRouteLibrary : ModuleRouteLibrary
910
{
10-
#region statics
11-
1211
public const string RoutePrefix = "errors";
1312

14-
#endregion
15-
16-
#region constructor
17-
18-
public ErrorsRouteLibrary()
19-
: base(RoutePrefix, RouteConstants.PluginModuleResourcePathPrefix)
13+
public ErrorsRouteLibrary(AdminSettings adminSetting)
14+
: base(adminSetting, RoutePrefix, RouteConstants.PluginModuleResourcePathPrefix)
2015
{
2116
}
2217

23-
#endregion
24-
25-
#region routes
26-
2718
public string List()
2819
{
2920
return AngularRoute();
@@ -33,7 +24,5 @@ public string Details(int id)
3324
{
3425
return AngularRoute(id.ToString());
3526
}
36-
37-
#endregion
3827
}
3928
}

src/Cofoundry.Plugins.ErrorLogging.Admin/Plugins/Admin/Modules/Errors/Content/js/errors_min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Cofoundry.Plugins.ErrorLogging.sln

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 15
44
VisualStudioVersion = 15.0.26430.13
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cofoundry.Plugins.ErrorLogging", "Cofoundry.Plugins.ErrorLogging\Cofoundry.Plugins.ErrorLogging.csproj", "{770CBAB8-61A8-4B87-8A03-B142BB61599A}"
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cofoundry.Plugins.ErrorLogging", "Cofoundry.Plugins.ErrorLogging\Cofoundry.Plugins.ErrorLogging.csproj", "{770CBAB8-61A8-4B87-8A03-B142BB61599A}"
77
EndProject
8-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cofoundry.Plugins.ErrorLogging.Admin", "Cofoundry.Plugins.ErrorLogging.Admin\Cofoundry.Plugins.ErrorLogging.Admin.csproj", "{6C9E6D5E-2591-4F1C-966D-31E2E3FF84CB}"
8+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cofoundry.Plugins.ErrorLogging.Admin", "Cofoundry.Plugins.ErrorLogging.Admin\Cofoundry.Plugins.ErrorLogging.Admin.csproj", "{6C9E6D5E-2591-4F1C-966D-31E2E3FF84CB}"
9+
EndProject
10+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{FA681052-563E-46F8-8346-48E1E6747041}"
11+
EndProject
12+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ErrorLoggingExample", "ErrorLoggingExample\ErrorLoggingExample.csproj", "{73C1E2F0-B848-4EEB-A1A6-36CD96F2CE62}"
913
EndProject
1014
Global
1115
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -21,8 +25,18 @@ Global
2125
{6C9E6D5E-2591-4F1C-966D-31E2E3FF84CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
2226
{6C9E6D5E-2591-4F1C-966D-31E2E3FF84CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
2327
{6C9E6D5E-2591-4F1C-966D-31E2E3FF84CB}.Release|Any CPU.Build.0 = Release|Any CPU
28+
{73C1E2F0-B848-4EEB-A1A6-36CD96F2CE62}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
29+
{73C1E2F0-B848-4EEB-A1A6-36CD96F2CE62}.Debug|Any CPU.Build.0 = Debug|Any CPU
30+
{73C1E2F0-B848-4EEB-A1A6-36CD96F2CE62}.Release|Any CPU.ActiveCfg = Release|Any CPU
31+
{73C1E2F0-B848-4EEB-A1A6-36CD96F2CE62}.Release|Any CPU.Build.0 = Release|Any CPU
2432
EndGlobalSection
2533
GlobalSection(SolutionProperties) = preSolution
2634
HideSolutionNode = FALSE
2735
EndGlobalSection
36+
GlobalSection(NestedProjects) = preSolution
37+
{73C1E2F0-B848-4EEB-A1A6-36CD96F2CE62} = {FA681052-563E-46F8-8346-48E1E6747041}
38+
EndGlobalSection
39+
GlobalSection(ExtensibilityGlobals) = postSolution
40+
SolutionGuid = {03096141-C2F9-4E8F-BCA8-3DDC89D62D1D}
41+
EndGlobalSection
2842
EndGlobal

src/Cofoundry.Plugins.ErrorLogging/Cofoundry.Plugins.ErrorLogging.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
</PropertyGroup>
1616

1717
<ItemGroup>
18-
<PackageReference Include="Cofoundry.Web" Version="0.4.1" />
18+
<PackageReference Include="Cofoundry.Web" Version="0.5.0-beta0004" />
1919
</ItemGroup>
2020

2121
<ItemGroup>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using Microsoft.AspNetCore.Mvc;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Threading.Tasks;
6+
7+
namespace ErrorLoggingExample.Controllers
8+
{
9+
public class TestController : Controller
10+
{
11+
[Route("test")]
12+
public IActionResult Index()
13+
{
14+
throw new Exception("Test Exception.");
15+
}
16+
}
17+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netcoreapp2.1</TargetFramework>
5+
</PropertyGroup>
6+
7+
<ItemGroup>
8+
<Folder Include="wwwroot\" />
9+
</ItemGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Cofoundry.Web.Admin" Version="0.5.0-beta0004" />
13+
<PackageReference Include="Microsoft.AspNetCore.App" />
14+
</ItemGroup>
15+
16+
<ItemGroup>
17+
<ProjectReference Include="..\Cofoundry.Plugins.ErrorLogging.Admin\Cofoundry.Plugins.ErrorLogging.Admin.csproj" />
18+
<ProjectReference Include="..\Cofoundry.Plugins.ErrorLogging\Cofoundry.Plugins.ErrorLogging.csproj" />
19+
</ItemGroup>
20+
21+
</Project>

0 commit comments

Comments
 (0)