Files
logviewer/Pages/ReportsList.razor

155 lines
5.7 KiB
Plaintext

@page "/ReportsList"
<PageTitle>Lista Report suddivia per giorni settimane mesi</PageTitle>
@using LogViewer.Data
@using System.IO
@using Microsoft.AspNetCore.Hosting;
@inject IConfiguration Configuration
@inject ReportFileService RfService
<h1>Lista Report</h1>
<p>Pagina principale che raggruppa i report gionalieri, settimanali e mensili</p>
<div class="modal-body row">
<div class="col-md-4 text-center">
<div>Day</div>
<div class="col-4 bg-light p-2">
<div>
<table class="table table-sm table-striped table-responsive-lg">
<thead>
<tr>
<th>Nome File</th>
</tr>
</thead>
<tbody>
@foreach (var record in FileList)
{
<tr>
<td>
@*<button @onclick="() => DownloadFileFromURL(record.OriginalName, record.FullStoragePath)"> @record.OriginalName</button>*@
<a href="@(Configuration["baseUrl"]+"/"+"reports/day"+"/"+@record.Key)" target="_blank">@record.Key</a>
@*<a href="C:\reports\day"+"/"+@record.Key)" target="_blank">@record.Key</a>*@
@*<a @onclick="() => DownloadFileFromURL(record.OriginalName, record.FullStoragePath)"> @record.OriginalName</a>*@
</td>
</tr>
}
</tbody>
</table>
@* <button @onclick="DownloadFileFromURL">
Download File From URL
</button>*@
</div>
</div>
</div>
<div class="col-md-4 text-center">
<div>Week</div>
<div class="col-4 bg-light p-2">
<div>
<table class="table table-sm table-striped table-responsive-lg">
<thead>
<tr>
<th>Nome File</th>
</tr>
</thead>
<tbody>
@foreach (var record in FileListWeek)
{
<tr>
<td>
@*<button @onclick="() => DownloadFileFromURL(record.OriginalName, record.FullStoragePath)"> @record.OriginalName</button>*@
<a href="@(Configuration["baseUrl"]+"/"+"reports/week"+"/"+@record.Key)" target="_blank">@record.Key</a>
@*<a @onclick="() => DownloadFileFromURL(record.OriginalName, record.FullStoragePath)"> @record.OriginalName</a>*@
</td>
</tr>
}
</tbody>
</table>
@* <button @onclick="DownloadFileFromURL">
Download File From URL
</button>*@
</div>
</div>
</div>
<div class="col-md-4 text-center">
<div>Month</div>
<div class="col-4 bg-light p-2">
<div>
<table class="table table-sm table-striped table-responsive-lg">
<thead>
<tr>
<th>Nome File</th>
</tr>
</thead>
<tbody>
@foreach (var record in FileListMonth)
{
<tr>
<td>
@*<button @onclick="() => DownloadFileFromURL(record.OriginalName, record.FullStoragePath)"> @record.OriginalName</button>*@
<a href="@(Configuration["baseUrl"]+"/"+"reports/month"+"/"+@record.Key)" target="_blank">@record.Key</a>
@*<a @onclick="() => DownloadFileFromURL(record.OriginalName, record.FullStoragePath)"> @record.OriginalName</a>*@
</td>
</tr>
}
</tbody>
</table>
@* <button @onclick="DownloadFileFromURL">
Download File From URL
</button>*@
</div>
</div>
</div>
</div>
@code {
//private static IConfiguration _configuration;
protected Dictionary<string, string> FileList { get; set; } = new Dictionary<string, string>();
protected Dictionary<string, string> FileListWeek { get; set; } = new Dictionary<string, string>();
protected Dictionary<string, string> FileListMonth { get; set; } = new Dictionary<string, string>();
//string relDir = _configuration["basePath"];
//string pathd = Path.Combine(relDir, "day");
protected override async Task OnInitializedAsync()
{
FileList = await RfService.getDayReport();
FileListWeek = await RfService.getWeekReport();
FileListMonth = await RfService.getMonthReport();
//return base.OnInitializedAsync();
}
// private readonly IWebHostEnvironment webHostEnvironment;
//public IndexModel(IWebHostEnvironment webHostEnvironment)
//{
// this.webHostEnvironment = webHostEnvironment;
//}
// public IActionResult OnGet()
//{
// var provider = new PhysicalFileProvider(webHostEnvironment.WebRootPath);
// var contents = provider.GetDirectoryContents(Path.Combine("uploadedfiles", "images"));
// var objFiles = contents.OrderBy(m => m.LastModified);
// return new JsonResult(objFiles);
}