diff --git a/Hcs.WebApp/Components/Dialogs/ViewRegistryElement.razor b/Hcs.WebApp/Components/Dialogs/ViewRegistryElement.razor
new file mode 100644
index 0000000..24b0b24
--- /dev/null
+++ b/Hcs.WebApp/Components/Dialogs/ViewRegistryElement.razor
@@ -0,0 +1,28 @@
+@using Hcs.WebApp.Services
+@using Newtonsoft.Json
+
+@inject RegistryService RegistryService
+
+
+
+@code {
+ string? content;
+
+ [Parameter]
+ public required RegistryElement RegistryElement { get; set; }
+
+ protected override async Task OnInitializedAsync()
+ {
+ await base.OnInitializedAsync();
+
+ if (string.IsNullOrEmpty(RegistryElement.Json))
+ {
+ RegistryElement.Json = await RegistryService.GetRegistryElementJsonAsync(RegistryElement.Id);
+ }
+
+ if (!string.IsNullOrEmpty(RegistryElement.Json))
+ {
+ content = JsonConvert.SerializeObject(JsonConvert.DeserializeObject(RegistryElement.Json!), Formatting.Indented);
+ }
+ }
+}
diff --git a/Hcs.WebApp/Components/Pages/Management/Users.razor b/Hcs.WebApp/Components/Pages/Management/Users.razor
index 194aef1..c14640a 100644
--- a/Hcs.WebApp/Components/Pages/Management/Users.razor
+++ b/Hcs.WebApp/Components/Pages/Management/Users.razor
@@ -109,8 +109,8 @@
"Редактирование пользователя",
new Dictionary()
{
- { nameof(Dialogs.EditUser.CurrentUserId), currentUserId },
- { nameof(Dialogs.EditUser.UserWithRole), userWithRole }
+ { nameof(EditUser.CurrentUserId), currentUserId },
+ { nameof(EditUser.UserWithRole), userWithRole }
},
new DialogOptions()
{
diff --git a/Hcs.WebApp/Components/Pages/Registry/Common.razor b/Hcs.WebApp/Components/Pages/Registry/Common.razor
index e6b13b4..e062a1d 100644
--- a/Hcs.WebApp/Components/Pages/Registry/Common.razor
+++ b/Hcs.WebApp/Components/Pages/Registry/Common.razor
@@ -134,7 +134,17 @@
async Task ShowElementAsync(RegistryElement registryElement)
{
- // TODO
+ await DialogService.OpenAsync(
+ "Просмотр записи",
+ new Dictionary()
+ {
+ { nameof(ViewRegistryElement.RegistryElement), registryElement }
+ },
+ new DialogOptions()
+ {
+ Width = "420px",
+ Height = "600px"
+ });
}
void ChangeState(CommonPageState state)
diff --git a/Hcs.WebApp/Data/Hcs/RegistryElement.cs b/Hcs.WebApp/Data/Hcs/RegistryElement.cs
index f337b9a..bb172a2 100644
--- a/Hcs.WebApp/Data/Hcs/RegistryElement.cs
+++ b/Hcs.WebApp/Data/Hcs/RegistryElement.cs
@@ -12,6 +12,6 @@
public string GUID { get; set; }
- public virtual string Json { get; set; }
+ public virtual string? Json { get; set; } = null;
}
}
diff --git a/Hcs.WebApp/Services/RegistryService.cs b/Hcs.WebApp/Services/RegistryService.cs
index a3bc1e7..04c571a 100644
--- a/Hcs.WebApp/Services/RegistryService.cs
+++ b/Hcs.WebApp/Services/RegistryService.cs
@@ -61,5 +61,13 @@ namespace Hcs.WebApp.Services
using var context = GetNewContext();
return await context.Elements.Where(x => x.RegistryId == registryId).ToListAsync();
}
+
+ public async Task GetRegistryElementJsonAsync(Guid registryElementId)
+ {
+ using var context = GetNewContext();
+ return await (from registryElement in context.Elements
+ where registryElement.Id == registryElementId
+ select registryElement.Json).FirstOrDefaultAsync();
+ }
}
}