-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
42 changed files
with
365 additions
and
189 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,8 @@ | |
|
||
namespace ABLog; | ||
|
||
|
||
|
||
/// <summary> | ||
/// Ïîëüçîâàòåëè | ||
/// </summary> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
//////////////////////////////////////////////// | ||
// © https://github.com/badhitman | ||
//////////////////////////////////////////////// | ||
|
||
using SharedLib; | ||
|
||
namespace RazorLib; | ||
|
||
/// <summary> | ||
/// О программе | ||
/// </summary> | ||
public class AboutRefitService : IAboutService | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
//////////////////////////////////////////////// | ||
// © https://github.com/badhitman | ||
//////////////////////////////////////////////// | ||
|
||
using SharedLib; | ||
using Refit; | ||
|
||
namespace RazorLib; | ||
|
||
/// <summary> | ||
/// О программе | ||
/// </summary> | ||
[Headers("Content-Type: application/json")] | ||
public interface IRefitAboutService | ||
{ | ||
/// <summary> | ||
/// Получить все доступные камеры | ||
/// </summary> | ||
[Get($"/api/{GlobalStatic.Routes.About}/{GlobalStatic.Routes.GET}")] | ||
public Task<ApiResponse<EntriesSortingResponseModel>> About(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
@using MudBlazor; | ||
@using SharedLib; | ||
|
||
@inject ISnackbar _snackbar; | ||
@inject IAboutService _about; | ||
|
||
@inherits BlazorBusyComponentBaseModel | ||
|
||
@if (IsBusyProgress) | ||
{ | ||
<div class="text-center"> | ||
<div class="spinner-border" role="status"> | ||
<span class="visually-hidden">Загрузка...</span> | ||
</div> | ||
</div> | ||
} | ||
else | ||
{ | ||
|
||
} | ||
|
||
@code { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,25 @@ | ||
using Microsoft.AspNetCore.Components; | ||
//////////////////////////////////////////////// | ||
// © https://github.com/badhitman | ||
//////////////////////////////////////////////// | ||
|
||
namespace RazorLib | ||
using Microsoft.AspNetCore.Components; | ||
|
||
namespace RazorLib; | ||
|
||
/// <summary> | ||
/// Базовый компонент с поддержкой состояния "занят". Компоненты, которые выполняют запросы | ||
/// на время обработки переходят в состояние "IsBusyProgress" с целью обеспечения визуализации смены этого изменения | ||
/// </summary> | ||
public abstract class BlazorBusyComponentBaseModel : ComponentBase | ||
{ | ||
/// <summary> | ||
/// Базовый компонент с поддержкой состояния "занят". Компоненты, которые выполняют запросы | ||
/// на время обработки переходят в состояние "IsBusyProgress" с целью обеспечения визуализации смены этого изменения | ||
/// Компонент занят отправкой REST запроса и обработки ответа | ||
/// </summary> | ||
public abstract class BlazorBusyComponentBaseModel : ComponentBase | ||
{ | ||
/// <summary> | ||
/// Компонент занят отправкой REST запроса и обработки ответа | ||
/// </summary> | ||
public bool IsBusyProgress { get; protected set; } = false; | ||
public bool IsBusyProgress { get; protected set; } = false; | ||
|
||
/// <summary> | ||
/// Уведомляет компонент об изменении его состояния. | ||
/// Когда применимо, это вызовет повторную визуализацию компонента. | ||
/// </summary> | ||
public virtual void StateHasChangedCall() => StateHasChanged(); | ||
} | ||
/// <summary> | ||
/// Уведомляет компонент об изменении его состояния. | ||
/// Когда применимо, это вызовет повторную визуализацию компонента. | ||
/// </summary> | ||
public virtual void StateHasChangedCall() => StateHasChanged(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,110 +1,113 @@ | ||
using Microsoft.AspNetCore.Components; | ||
//////////////////////////////////////////////// | ||
// © https://github.com/badhitman | ||
//////////////////////////////////////////////// | ||
|
||
using Microsoft.AspNetCore.Components; | ||
using RazorLib.Shared.hardwares; | ||
using RazorLib.Shared; | ||
using SharedLib; | ||
using MudBlazor; | ||
|
||
namespace RazorLib | ||
namespace RazorLib; | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
public abstract class ReloadPageComponentBaseModel : BlazorBusyComponentBaseModel | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
public abstract class ReloadPageComponentBaseModel : BlazorBusyComponentBaseModel | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
[Inject] | ||
protected IHardwaresService _hardwares { get; set; } = default!; | ||
[Inject] | ||
protected IHardwaresService _hardwares { get; set; } = default!; | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
[Inject] | ||
protected ISnackbar _snackbar { get; set; } = default!; | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
[Inject] | ||
protected ISnackbar _snackbar { get; set; } = default!; | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
[CascadingParameter, EditorRequired] | ||
public int Id { get; set; } | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
[CascadingParameter, EditorRequired] | ||
public int Id { get; set; } | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
[Parameter] | ||
public string PagePath { get; set; } = default!; | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
[Parameter] | ||
public string PagePath { get; set; } = default!; | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
protected ShowMessagesComponent? showMessages; | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
protected ShowMessagesComponent? showMessages; | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
protected HardwaresNavPillsComponent? refHtmlRoot; | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
protected HardwaresNavPillsComponent? refHtmlRoot; | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
protected string? HtmlSource; | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
protected string? HtmlSource; | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
protected void ReloadPage() | ||
{ | ||
InvokeAsync(async () => await GetData()); | ||
} | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
protected void ReloadPage() | ||
{ | ||
InvokeAsync(async () => await GetData()); | ||
} | ||
|
||
bool IsUpdated = false; | ||
bool IsUpdated = false; | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
protected async Task GetData() | ||
{ | ||
if (Id <= 0) | ||
return; | ||
IsUpdated = false; | ||
IsBusyProgress = true; | ||
StateHasChanged(); | ||
HttpResponseModel rest = await _hardwares.GetHardwareHtmlPage(new HardwareGetHttpRequestModel() { HardwareId = Id, Path = PagePath }); | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
protected async Task GetData() | ||
{ | ||
if (Id <= 0) | ||
return; | ||
IsUpdated = false; | ||
IsBusyProgress = true; | ||
StateHasChanged(); | ||
HttpResponseModel rest = await _hardwares.GetHardwareHtmlPage(new HardwareGetHttpRequestModel() { HardwareId = Id, Path = PagePath }); | ||
|
||
if (!rest.IsSuccess) | ||
if (!rest.IsSuccess) | ||
{ | ||
if (showMessages is null) | ||
{ | ||
if (showMessages is null) | ||
Severity _style; | ||
foreach (ResultMessage m in rest.Messages) | ||
{ | ||
Severity _style; | ||
foreach (ResultMessage m in rest.Messages) | ||
_style = m.TypeMessage switch | ||
{ | ||
_style = m.TypeMessage switch | ||
{ | ||
ResultTypeEnum.Success => Severity.Success, | ||
ResultTypeEnum.Info => Severity.Info, | ||
ResultTypeEnum.Warning => Severity.Warning, | ||
ResultTypeEnum.Error => Severity.Error, | ||
_ => Severity.Normal | ||
}; | ||
_snackbar.Add(m.Text, _style, opt => opt.DuplicatesBehavior = SnackbarDuplicatesBehavior.Allow); | ||
} | ||
ResultTypeEnum.Success => Severity.Success, | ||
ResultTypeEnum.Info => Severity.Info, | ||
ResultTypeEnum.Warning => Severity.Warning, | ||
ResultTypeEnum.Error => Severity.Error, | ||
_ => Severity.Normal | ||
}; | ||
_snackbar.Add(m.Text, _style, opt => opt.DuplicatesBehavior = SnackbarDuplicatesBehavior.Allow); | ||
} | ||
else | ||
showMessages?.ShowMessages(rest.Messages); | ||
IsBusyProgress = false; | ||
StateHasChanged(); | ||
return; | ||
} | ||
|
||
HtmlSource = rest.TextPayload; | ||
else | ||
showMessages?.ShowMessages(rest.Messages); | ||
IsBusyProgress = false; | ||
StateHasChanged(); | ||
if (!IsUpdated && refHtmlRoot?.refHtmlRoot is not null) | ||
{ | ||
IsUpdated = true; | ||
refHtmlRoot.refHtmlRoot.StateHasChangedCall(HtmlSource); | ||
} | ||
return; | ||
} | ||
|
||
HtmlSource = rest.TextPayload; | ||
IsBusyProgress = false; | ||
StateHasChanged(); | ||
if (!IsUpdated && refHtmlRoot?.refHtmlRoot is not null) | ||
{ | ||
IsUpdated = true; | ||
refHtmlRoot.refHtmlRoot.StateHasChangedCall(HtmlSource); | ||
} | ||
} | ||
} |
Oops, something went wrong.