Remove: Reporting System tests

This commit is contained in:
2026-04-11 18:10:50 +02:00
parent bdf54ef5ae
commit f1bc1b53a5
3 changed files with 6 additions and 41 deletions

View File

@@ -14,22 +14,20 @@
<div class="row mb-1 align-items-center"> <div class="row mb-1 align-items-center">
<Label Class="col-sm-3" For="betreff" HelpText="Gib einen Betreff ein" ResourceKey="Betreff">Betreff: </Label> <Label Class="col-sm-3" For="betreff" HelpText="Gib einen Betreff ein" ResourceKey="Betreff">Betreff: </Label>
<div class="col-sm-9"> <div class="col-sm-9">
<input id="betreff" class="form-control" @bind="@_betreff" required /> <input id="betreff" class="form-control" @bind="@_adminModules.Name" required />
</div> </div>
</div> </div>
<div class="row mb-1 align-items-center"> <div class="row mb-1 align-items-center">
<Label Class="col-sm-3" For="Body" HelpText="Enter a body" ResourceKey="Body">Body: </Label> <Label Class="col-sm-3" For="Body" HelpText="Enter a body" ResourceKey="Body">Body: </Label>
<RichTextEditor id="content" class="form-control" Content="@_richText" @ref="@RichTextEditorHtml" required /> <RichTextEditor id="content" class="form-control" Content="@_adminModules.Content" @ref="@RichTextEditorHtml" required />
</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>
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@Localizer["Cancel"]</NavLink> <NavLink class="btn btn-secondary" href="@NavigateUrl()">@Localizer["Cancel"]</NavLink>
<br /><br /> <br /><br />
<ReportComponent ReportableEntity="@AdminModules" RenderModeBoundary="@RenderModeBoundary" />
<br /><br />
@if (PageState.Action == "Edit") @if (PageState.Action == "Edit")
{ {
<AuditInfo CreatedBy="@_createdby" CreatedOn="@_createdon" ModifiedBy="@_modifiedby" ModifiedOn="@_modifiedon"></AuditInfo> <AuditInfo CreatedBy="@_adminModules.CreatedBy" CreatedOn="@_adminModules.CreatedOn" ModifiedBy="@_adminModules.ModifiedBy" ModifiedOn="@_adminModules.ModifiedOn"></AuditInfo>
} }
</form> </form>
@@ -50,14 +48,7 @@
private bool validated = false; private bool validated = false;
private int _id; private int _id;
private string _betreff; private AdminModules _adminModules;
private string _richText;
private string _createdby;
private DateTime _createdon;
private string _modifiedby;
private DateTime _modifiedon;
private AdminModules AdminModules;
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
@@ -69,13 +60,7 @@
AdminModules AdminModules = await AdminModulesService.GetAdminModulesAsync(_id, ModuleState.ModuleId); AdminModules AdminModules = await AdminModulesService.GetAdminModulesAsync(_id, ModuleState.ModuleId);
if (AdminModules != null) if (AdminModules != null)
{ {
_betreff = AdminModules.Name; _adminModules = AdminModules;
_richText = AdminModules.Content;
_createdby = AdminModules.CreatedBy;
_createdon = AdminModules.CreatedOn;
_modifiedby = AdminModules.ModifiedBy;
_modifiedon = AdminModules.ModifiedOn;
this.AdminModules = AdminModules;
} }
} }
} }
@@ -102,7 +87,6 @@
{ {
AdminModules AdminModules = new AdminModules(); AdminModules AdminModules = new AdminModules();
AdminModules.ModuleId = ModuleState.ModuleId; AdminModules.ModuleId = ModuleState.ModuleId;
AdminModules.Name = _betreff;
AdminModules.Content = content; AdminModules.Content = content;
AdminModules = await AdminModulesService.AddAdminModulesAsync(AdminModules); AdminModules = await AdminModulesService.AddAdminModulesAsync(AdminModules);
await logger.LogInformation("AdminModules Added {AdminModules}", AdminModules); await logger.LogInformation("AdminModules Added {AdminModules}", AdminModules);
@@ -110,7 +94,6 @@
else else
{ {
AdminModules AdminModules = await AdminModulesService.GetAdminModulesAsync(_id, ModuleState.ModuleId); AdminModules AdminModules = await AdminModulesService.GetAdminModulesAsync(_id, ModuleState.ModuleId);
AdminModules.Name = _betreff;
AdminModules.Content = content; AdminModules.Content = content;
await AdminModulesService.UpdateAdminModulesAsync(AdminModules); await AdminModulesService.UpdateAdminModulesAsync(AdminModules);
await logger.LogInformation("AdminModules Updated {AdminModules}", AdminModules); await logger.LogInformation("AdminModules Updated {AdminModules}", AdminModules);

View File

@@ -7,7 +7,6 @@
@inject IAdminModulesService AdminModulesService @inject IAdminModulesService AdminModulesService
@inject NavigationManager NavigationManager @inject NavigationManager NavigationManager
@inject IStringLocalizer<Index> Localizer @inject IStringLocalizer<Index> Localizer
@inject IReportingHandler ReportingHandler;
@if (_AdminModuless == null) @if (_AdminModuless == null)
{ {
@@ -25,13 +24,11 @@ else
<th style="width: 1px;">&nbsp;</th> <th style="width: 1px;">&nbsp;</th>
<th style="width: 1px;">&nbsp;</th> <th style="width: 1px;">&nbsp;</th>
<th style="width: 1px;">&nbsp;</th> <th style="width: 1px;">&nbsp;</th>
<th style="width: 1px;">&nbsp;</th>
<th>@Localizer["Name"]</th> <th>@Localizer["Name"]</th>
</Header> </Header>
<Row> <Row>
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.AdminModulesId.ToString())" ResourceKey="Edit" /></td> <td><ActionLink Action="Edit" Parameters="@($"id=" + context.AdminModulesId.ToString())" ResourceKey="Edit" /></td>
<td><ActionDialog Header="Delete AdminModules" Message="Are You Sure You Wish To Delete This AdminModules?" Action="Delete" Security="SecurityAccessLevel.Edit" Class="btn btn-danger" OnClick="@(() => Delete(context))" ResourceKey="Delete" Id="@("Delete-"+context.AdminModulesId)" /></td> <td><ActionDialog Header="Delete AdminModules" Message="Are You Sure You Wish To Delete This AdminModules?" Action="Delete" Security="SecurityAccessLevel.Edit" Class="btn btn-danger" OnClick="@(() => Delete(context))" ResourceKey="Delete" Id="@("Delete-"+context.AdminModulesId)" /></td>
<td><ActionDialog Header="Report AdminModules" Message="Are You Sure You Wish To Report This AdminModules?" Action="Report" Security="SecurityAccessLevel.Edit" Class="btn btn-danger" OnClick="@(() => Report(context))" ResourceKey="Report" Id="@("Report-"+context.AdminModulesId)" /></td>
<td><ActionLink Action="Send" Parameters="@($"id=" + context.AdminModulesId.ToString())" ResourceKey="Send" /></td> <td><ActionLink Action="Send" Parameters="@($"id=" + context.AdminModulesId.ToString())" ResourceKey="Send" /></td>
<td>@context.Name</td> <td>@context.Name</td>
</Row> </Row>
@@ -82,19 +79,4 @@ else
AddModuleMessage(Localizer["Message.DeleteError"], MessageType.Error); AddModuleMessage(Localizer["Message.DeleteError"], MessageType.Error);
} }
} }
private async Task Report(AdminModules AdminModules)
{
try
{
ReportingHandler.Report(AdminModules, "Reported by User");
await logger.LogInformation("AdminModules Reported {AdminModules}", AdminModules);
StateHasChanged();
}
catch (Exception ex)
{
await logger.LogError(ex, "Error Reportign AdminModules {AdminModules} {Error}", AdminModules, ex.Message);
AddModuleMessage(Localizer["Message.DeleteError"], MessageType.Error);
}
}
} }

View File

@@ -33,7 +33,7 @@ else
<td>@context.CreatedBy</td> <td>@context.CreatedBy</td>
<td>@context.CreatedOn</td> <td>@context.CreatedOn</td>
<td>@context.ModuleId</td> <td>@context.ModuleId</td>
<td>@context.ReportingID</td> <td>@context.EntityId</td>
<td>@context.Note</td> <td>@context.Note</td>
<td>@context.Reason</td> <td>@context.Reason</td>
</Row> </Row>