mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-25 19:17:13 +08:00
Updating Warmup UI++
--HG-- branch : 1.x
This commit is contained in:
@@ -61,8 +61,11 @@ namespace Orchard.Warmup.Controllers {
|
||||
using (var urlReader = new StringReader(viewModel.Settings.Urls)) {
|
||||
string relativeUrl;
|
||||
while (null != (relativeUrl = urlReader.ReadLine())) {
|
||||
if(String.IsNullOrWhiteSpace(relativeUrl)) {
|
||||
continue;
|
||||
}
|
||||
if (!Uri.IsWellFormedUriString(relativeUrl, UriKind.Relative) || !(relativeUrl.StartsWith("/"))) {
|
||||
AddModelError("Urls", T("{0} is an invalid warmup url.", relativeUrl));
|
||||
AddModelError("Urls", T("\"{0}\" is an invalid warmup url.", relativeUrl));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -75,14 +78,15 @@ namespace Orchard.Warmup.Controllers {
|
||||
}
|
||||
}
|
||||
|
||||
if (ModelState.IsValid) {
|
||||
Services.Notifier.Information(T("Warmup updated successfully."));
|
||||
}
|
||||
if (ModelState.IsValid) {
|
||||
_warmupUpdater.Generate();
|
||||
Services.Notifier.Information(T("Warmup updated successfully."));
|
||||
}
|
||||
else {
|
||||
Services.TransactionManager.Cancel();
|
||||
}
|
||||
|
||||
return RedirectToAction("Index");
|
||||
return Index();
|
||||
}
|
||||
|
||||
bool IUpdateModel.TryUpdateModel<TModel>(TModel model, string prefix, string[] includeProperties, string[] excludeProperties) {
|
||||
|
||||
@@ -117,6 +117,10 @@ namespace Orchard.Warmup.Services {
|
||||
using (var urlReader = new StringReader(part.Urls)) {
|
||||
string relativeUrl;
|
||||
while (null != (relativeUrl = urlReader.ReadLine())) {
|
||||
if (String.IsNullOrWhiteSpace(relativeUrl)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
string url = null;
|
||||
relativeUrl = relativeUrl.Trim();
|
||||
|
||||
|
||||
@@ -7,10 +7,12 @@
|
||||
Layout.Title = T("Performance").ToString();
|
||||
}
|
||||
|
||||
<p>The urls below will be requested using @Html.Link(WorkContext.CurrentSite.BaseUrl, WorkContext.CurrentSite.BaseUrl) as a base url. You can change it on the @Html.ActionLink(T("General Settings page").Text, "Index", new { controller = "Admin", area = "Settings" }).</p>
|
||||
|
||||
@using (Html.BeginFormAntiForgeryPost()) {
|
||||
@Html.ValidationSummary()
|
||||
|
||||
<p>@T("The paths below will be requested using {0} as a base url. You can change the base url on the {0}. ", @Html.Link(WorkContext.CurrentSite.BaseUrl, WorkContext.CurrentSite.BaseUrl), @Html.ActionLink(T("General Settings page").Text, "Index", new { controller = "Admin", area = "Settings" }))</p>
|
||||
|
||||
<fieldset>
|
||||
<div>
|
||||
@Html.TextAreaFor(m => m.Settings.Urls, new { @class = "textMedium" })
|
||||
@@ -33,13 +35,10 @@
|
||||
<label class="forcheckbox" for="@Html.FieldIdFor(m => m.Settings.OnPublish)">@T("Generate warmup pages any time some content is published")</label>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<button class="primaryAction" name="submit" value="@T("Save")" type="submit">@T("Save")</button>
|
||||
</fieldset>
|
||||
}
|
||||
|
||||
if (Model.ReportEntries.Any()) {
|
||||
<fieldset>
|
||||
<label>@T("Report")</label>
|
||||
<h3>@T("Status")</h3>
|
||||
<table class="items" summary="@T("This is a table of the reports in your application")">
|
||||
<colgroup>
|
||||
<col id="Col1" />
|
||||
@@ -49,9 +48,9 @@
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">@T("Url")</th>
|
||||
<th scope="col">@T("Path")</th>
|
||||
<th scope="col">@T("Status")</th>
|
||||
<th scope="col">@T("Date")</th>
|
||||
<th scope="col">@T("Date generated")</th>
|
||||
<th scope="col"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -70,3 +69,8 @@
|
||||
}
|
||||
</table>
|
||||
</fieldset>
|
||||
}
|
||||
<fieldset>
|
||||
<button class="primaryAction" name="submit" value="@T("Save")" type="submit">@T("Save")</button>
|
||||
</fieldset>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user