New: Interfaces 0.0.0-12 way of doing reporting
This commit is contained in:
@@ -7,8 +7,8 @@
|
|||||||
@inherits ModuleBase
|
@inherits ModuleBase
|
||||||
@inject IBlackBoardService BlackBoardService
|
@inject IBlackBoardService BlackBoardService
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
@inject IReportingHandler ReportingHandler
|
|
||||||
@inject IStringLocalizer<Edit> Localizer
|
@inject IStringLocalizer<Edit> Localizer
|
||||||
|
@inject IReportUI ReportingComponent // TODO
|
||||||
|
|
||||||
<form @ref="form" class="@(validated ? " was-validated" : "needs-validation" )" novalidate>
|
<form @ref="form" class="@(validated ? " was-validated" : "needs-validation" )" novalidate>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
@@ -20,9 +20,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button type="button" class="btn btn-success" @onclick="Save">@Localizer["Save"]</button>
|
<button type="button" class="btn btn-success" @onclick="Save">@Localizer["Save"]</button>
|
||||||
<button type="button" class="btn btn-danger" @onclick="Report">@Localizer["Report"]</button>
|
|
||||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@Localizer["Cancel"]</NavLink>
|
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@Localizer["Cancel"]</NavLink>
|
||||||
<br /><br />
|
|
||||||
|
@if (ReportingComponent != null)
|
||||||
|
{
|
||||||
|
<DynamicComponent Type="@ReportingComponent.ReportType" Parameters="@_parameters"/>
|
||||||
|
}
|
||||||
|
|
||||||
|
<br/><br/>
|
||||||
@if (PageState.Action == "Edit")
|
@if (PageState.Action == "Edit")
|
||||||
{
|
{
|
||||||
<AuditInfo CreatedBy="@_createdby" CreatedOn="@_createdon" ModifiedBy="@_modifiedby" ModifiedOn="@_modifiedon"></AuditInfo>
|
<AuditInfo CreatedBy="@_createdby" CreatedOn="@_createdon" ModifiedBy="@_modifiedby" ModifiedOn="@_modifiedon"></AuditInfo>
|
||||||
@@ -51,6 +56,10 @@
|
|||||||
private string _modifiedby;
|
private string _modifiedby;
|
||||||
private DateTime _modifiedon;
|
private DateTime _modifiedon;
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
private BlackBoard _blackBoard = new BlackBoard();
|
||||||
|
private Dictionary<string, object> _parameters = new Dictionary<string, object>();
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -58,15 +67,16 @@
|
|||||||
if (PageState.Action == "Edit")
|
if (PageState.Action == "Edit")
|
||||||
{
|
{
|
||||||
_id = Int32.Parse(PageState.QueryString["id"]);
|
_id = Int32.Parse(PageState.QueryString["id"]);
|
||||||
BlackBoard BlackBoard = await BlackBoardService.GetBlackBoardAsync(_id, ModuleState.ModuleId);
|
_blackBoard = await BlackBoardService.GetBlackBoardAsync(_id, ModuleState.ModuleId);
|
||||||
if (BlackBoard != null)
|
if (_blackBoard != null)
|
||||||
{
|
{
|
||||||
_name = BlackBoard.Name;
|
_createdby = _blackBoard.CreatedBy;
|
||||||
_createdby = BlackBoard.CreatedBy;
|
_createdon = _blackBoard.CreatedOn;
|
||||||
_createdon = BlackBoard.CreatedOn;
|
_modifiedby = _blackBoard.ModifiedBy;
|
||||||
_modifiedby = BlackBoard.ModifiedBy;
|
_modifiedon = _blackBoard.ModifiedOn;
|
||||||
_modifiedon = BlackBoard.ModifiedOn;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_parameters = ReportingComponent.ConstructParameterList(_blackBoard, RenderModeBoundary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -86,19 +96,16 @@
|
|||||||
{
|
{
|
||||||
if (PageState.Action == "Add")
|
if (PageState.Action == "Add")
|
||||||
{
|
{
|
||||||
BlackBoard BlackBoard = new BlackBoard();
|
_blackBoard.ModuleId = ModuleState.ModuleId;
|
||||||
BlackBoard.ModuleId = ModuleState.ModuleId;
|
_blackBoard = await BlackBoardService.AddBlackBoardAsync(_blackBoard);
|
||||||
BlackBoard.Name = _name;
|
await logger.LogInformation("BlackBoard Added {BlackBoard}", _blackBoard);
|
||||||
BlackBoard = await BlackBoardService.AddBlackBoardAsync(BlackBoard);
|
|
||||||
await logger.LogInformation("BlackBoard Added {BlackBoard}", BlackBoard);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BlackBoard BlackBoard = await BlackBoardService.GetBlackBoardAsync(_id, ModuleState.ModuleId);
|
await BlackBoardService.UpdateBlackBoardAsync(_blackBoard);
|
||||||
BlackBoard.Name = _name;
|
await logger.LogInformation("BlackBoard Updated {BlackBoard}", _blackBoard);
|
||||||
await BlackBoardService.UpdateBlackBoardAsync(BlackBoard);
|
|
||||||
await logger.LogInformation("BlackBoard Updated {BlackBoard}", BlackBoard);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NavigationManager.NavigateTo(NavigateUrl());
|
NavigationManager.NavigateTo(NavigateUrl());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -112,19 +119,4 @@
|
|||||||
AddModuleMessage(Localizer["Message.SaveError"], MessageType.Error);
|
AddModuleMessage(Localizer["Message.SaveError"], MessageType.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task Report()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
BlackBoard BlackBoard = await BlackBoardService.GetBlackBoardAsync(_id, ModuleState.ModuleId);
|
|
||||||
BlackBoard.Name = _name;
|
|
||||||
ReportingHandler.Report(BlackBoard, "Reported by user");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
await logger.LogError(ex, "Error Reporting BlackBoard {BlackBoardId} {Error}", _id, ex.Message);
|
|
||||||
AddModuleMessage(Localizer["Message.ReportError"], MessageType.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Interfaces" Version="0.0.0-12" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="10.0.1" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="10.0.1" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="10.0.1" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="10.0.1" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Localization" Version="10.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Localization" Version="10.0.1" />
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ namespace SZUAbsolventenverein.Module.BlackBoard.Models
|
|||||||
public int BlackBoardId { get; set; }
|
public int BlackBoardId { get; set; }
|
||||||
public int ModuleId { get; set; }
|
public int ModuleId { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
public int ImageID { get; set; }
|
||||||
|
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
public string ModuleName => "BlackBoard";
|
public string ModuleName => "BlackBoard";
|
||||||
@@ -19,5 +20,7 @@ namespace SZUAbsolventenverein.Module.BlackBoard.Models
|
|||||||
public int ModuleID => ModuleId;
|
public int ModuleID => ModuleId;
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
public int EntityID => BlackBoardId;
|
public int EntityID => BlackBoardId;
|
||||||
|
|
||||||
|
[NotMapped] public string UserName => CreatedBy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,12 +13,10 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
||||||
|
<PackageReference Include="Interfaces" Version="0.0.0-12" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Interfaces">
|
|
||||||
<HintPath>..\..\interfaces\Interfaces\bin\Debug\net10.0\Interfaces.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Oqtane.Shared"><HintPath>..\..\oqtane.framework\Oqtane.Server\bin\Debug\net10.0\Oqtane.Shared.dll</HintPath></Reference>
|
<Reference Include="Oqtane.Shared"><HintPath>..\..\oqtane.framework\Oqtane.Server\bin\Debug\net10.0\Oqtane.Shared.dll</HintPath></Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user