#163 start regenerating stats pages from UI
This commit is contained in:
parent
b02fa8db92
commit
cb93ba0f10
@ -163,3 +163,5 @@
|
||||
|
||||
|
||||
<p><a role="button" onclick="rebuildSitemap()" class="actionlink" title="بازسازی نقشهٔ سایت">بازسازی نقشهٔسایت</a></p>
|
||||
|
||||
<p><a role="button" onclick="rebuildStats()" class="actionlink" title="بازسازی صفحات آمار و اوزان عروضی">بازسازی صفحات آمار و اوزان عروضی</a></p>
|
||||
|
||||
@ -177,5 +177,19 @@ namespace GanjooRazor.Areas.Admin.Pages
|
||||
}
|
||||
return new OkObjectResult(false);
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnPostRebuildStatsAsync()
|
||||
{
|
||||
using (HttpClient secureClient = new HttpClient())
|
||||
{
|
||||
if (await GanjoorSessionChecker.PrepareClient(secureClient, Request, Response))
|
||||
{
|
||||
HttpResponseMessage response = await secureClient.PutAsync($"{APIRoot.Url}/api/ganjoor/rebuild/stats", null);
|
||||
response.EnsureSuccessStatusCode();
|
||||
return new OkObjectResult(true);
|
||||
}
|
||||
}
|
||||
return new OkObjectResult(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -204,6 +204,26 @@
|
||||
}
|
||||
|
||||
|
||||
function rebuildStats() {
|
||||
if (!confirm('آیا از بازسازی صفحات آمار اطمینان دارید؟'))
|
||||
return;
|
||||
|
||||
var url = '?handler=RebuildStats';
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: url,
|
||||
error: function () {
|
||||
alert('خطا رخ داد.')
|
||||
},
|
||||
success: function () {
|
||||
alert('فرایند بازسازی صفحات آمار شروع شد.')
|
||||
},
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
|
||||
@ -1468,7 +1468,7 @@ namespace RMuseum.Controllers
|
||||
/// regenerate stats page
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPut("regen/statspage")]
|
||||
[HttpPut("rebuild/stats")]
|
||||
[Authorize(Policy = RMuseumSecurableItem.GanjoorEntityShortName + ":" + SecurableItem.ModifyOperationShortName)]
|
||||
[ProducesResponseType((int)HttpStatusCode.OK)]
|
||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user