Skip to content

Commit

Permalink
Auto refresh every 15 sec (#18)
Browse files Browse the repository at this point in the history
* Add auto-refresh every 15 sec
  • Loading branch information
vov4uk committed Jun 21, 2022
1 parent 19b6da2 commit dbde545
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Tests/Hik.Web.Tests/Pages/ConfigEditModelTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Hik.Web.Tests.Pages
public class ConfigEditModelTests : ModelTestsBase
{
private readonly CronConfigDto CronConfig = new() { JobName = name, Json = "", Path = "C:\\" };
private const string JsonKey = "Dto.ConfigDTO.Json";
private const string JsonKey = "Dto.Config.Json";

[Theory]
[AutoData]
Expand Down
2 changes: 1 addition & 1 deletion src/Hik.Helpers/DirectoryHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public bool DirExist(string path)
public List<string> EnumerateFiles(string path, string[] extentions)
{
return Directory.EnumerateFiles(path, AllFilter, SearchOption.AllDirectories)
.Where(s => extentions.Any(ext => ext == Path.GetExtension(s)))
.Where(s => extentions.Contains(Path.GetExtension(s)))
.ToList();
}

Expand Down
2 changes: 1 addition & 1 deletion src/Hik.Web/Pages/ConfigEdit.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Hik.Web.Pages
{
public class ConfigEditModel : PageModel
{
private const string JsonKey = "Dto.ConfigDTO.Json";
private const string JsonKey = "Dto.Config.Json";
private readonly IMediator _mediator;

public ConfigEditModel(IMediator mediator)
Expand Down
2 changes: 2 additions & 0 deletions src/Hik.Web/Pages/Dashboard.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

<h2>Dashboard</h2>

@await Html.PartialAsync("_Timer.cshtml")

@if (Model.JobTriggers != null && Model.JobTriggers.Any())
{
@foreach (var className in Model.JobTriggers.Keys.OrderBy(x => x))
Expand Down
2 changes: 2 additions & 0 deletions src/Hik.Web/Pages/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
</div>
</div>

@await Html.PartialAsync("_Timer.cshtml")

<div class="container">
@if(Model.TriggersDtos != null && Model.TriggersDtos.Any())
{
Expand Down
23 changes: 23 additions & 0 deletions src/Hik.Web/Pages/_Timer.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

<script type="text/javascript">
let countDown = 15;
const timer = setInterval(function () {
document.getElementById("timer").innerHTML = countDown + " seconds.";
countDown = countDown - 1;
if (countDown < 0)
{
countDown = 15;
document.location.reload();
}
}, 1000);
</script>

<div class="row">
<div class="col-lg-12 my-3">
<div class="pull-right">
Next refresh in <label id="timer"/>.
</div>
</div>
</div>

6 changes: 3 additions & 3 deletions src/Hik.Web/Properties/GlobalAssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//2022.6.3.2
//2022.6.19.1
using System.Reflection;

[assembly: AssemblyCompany("Hik.Web")]
[assembly: AssemblyProduct("Hik.Web")]
[assembly: AssemblyTitle("Hik.Web")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("2022.6.3.2")]
[assembly: AssemblyVersion("2022.6.3.2")]
[assembly: AssemblyFileVersion("2022.6.19.1")]
[assembly: AssemblyVersion("2022.6.19.1")]

0 comments on commit dbde545

Please sign in to comment.