Skip to content

Commit 057d7f4

Browse files
committed
Extra toplevel menu item Config in WebUI
1 parent 7239984 commit 057d7f4

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

UnitTests/TestWebUI.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public async Task HomeRedirectsToEndpoints()
7474
"/Tests/RunAll",
7575
"/Tests/RunAllStopOnFirstError",
7676
"/Documentation",
77-
"/Endpoints/ReloadHistory",
77+
"/Endpoints/Config"
7878
};
7979

8080
private string[] RELOAD_URL = new[] { "/Endpoints/ReloadConfig" };

netmockery/Controllers/EndpointsController.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ public ActionResult Index()
2828
return View(_endpointCollection);
2929
}
3030

31+
public ActionResult Config()
32+
{
33+
ViewData["Now"] = DateTime.Now;
34+
ViewData["ReloadTimestamps"] = _endpointCollectionProvider.ReloadTimestamps;
35+
ViewData["SourceDirectory"] = _endpointCollection.SourceDirectory;
36+
return View();
37+
}
38+
3139
public ActionResult EndpointNames()
3240
{
3341
return Json(from e in _endpointCollection.Endpoints select e.Name);
@@ -39,14 +47,7 @@ public ActionResult ReloadConfig()
3947
{
4048
_endpointCollectionProvider.Reload();
4149
_responseRegistry.Clear();
42-
return RedirectToAction("Index");
43-
}
44-
45-
public ActionResult ReloadHistory()
46-
{
47-
ViewData["Now"] = DateTime.Now;
48-
ViewData["ReloadTimestamps"] = _endpointCollectionProvider.ReloadTimestamps;
49-
return View();
50+
return RedirectToAction("Config");
5051
}
5152

5253
public ActionResult EndpointDetails(string name, int highlight = -1)

netmockery/Views/Endpoints/ReloadHistory.cshtml renamed to netmockery/Views/Endpoints/Config.cshtml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55
var now = (DateTime) ViewData["Now"];
66
var reloadTimestamps = (DateTime[])ViewData["ReloadTimestamps"];
77
}
8+
<h2>Configuration</h2>
9+
<p>
10+
Configuration directory: <code>@ViewData["SourceDirectory"]</code>
11+
</p>
12+
<p>
13+
@Html.ActionLink("Reload Configuration", "ReloadConfig", routeValues: null, htmlAttributes: new { @class = "btn btn-default" })
14+
</p>
815

916
<h2>Reload History</h2>
1017
<p>

netmockery/Views/Endpoints/Index.cshtml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,6 @@
66
var responseRegistry = ViewData["responseRegistry"] as ResponseRegistry;
77
}
88

9-
<h2>Configuration</h2>
10-
<p>
11-
Configuration directory: <code>@Model.SourceDirectory</code>
12-
</p>
13-
<p>
14-
@Html.ActionLink("Reload Configuration", "ReloadConfig", routeValues: null, htmlAttributes: new { @class = "btn btn-default" })
15-
@Html.ActionLink("View reload history", "ReloadHistory")
16-
</p>
17-
189
<h2>Endpoints</h2>
1910
<table class="table">
2011
<thead>

netmockery/Views/Shared/Base.cshtml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
<li>@Html.ActionLink("Endpoints", "Index", "Endpoints")</li>
5757
<li>@Html.ActionLink("Responses", "Index", "Responses")</li>
5858
<li>@Html.ActionLink("Tests", "Index", "Tests")</li>
59+
<li>@Html.ActionLink("Configuration", "Config", "Endpoints")</li>
5960
</ul>
6061
<ul class="nav navbar-nav navbar-right">
6162
<li>@Html.ActionLink("Help", "Index", "Documentation")</li>

0 commit comments

Comments
 (0)