270 lines
16 KiB
Plaintext
270 lines
16 KiB
Plaintext
@page "/Alarms"
|
|
|
|
@using MP.MONO.Data
|
|
@using MP.MONO.UI.Components
|
|
@using MP.MONO.Core.DTO
|
|
@using MP.MONO.UI.Data
|
|
|
|
@inject CurrentDataService MMDataService
|
|
|
|
<div class="card mb-5" style="box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;">
|
|
<div class="card-header">
|
|
<div class="row">
|
|
<div class="col-12 col-md-6 col-lg-3 d-flex justify-content-between w-100">
|
|
<div class="col-6 d-flex justify-content-between">
|
|
<h5 class="pt-1"><i class="bi bi-exclamation-triangle pe-2" aria-hidden="true"></i> <b>ALARMS</b></h5>
|
|
<div class="input-group-text">
|
|
<div class="form-check form-check-sm form-switch" title="Setup Alarms (mute/unmute)">
|
|
<input class="form-check-input" type="checkbox" id="mySwitch" name="setupAlarms" value="@doSetup" unchecked @onclick="() => CheckAuth()">
|
|
<label class="form-check-label" for="mySwitch">SETUP MODE</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
@*<div class="col-6 d-flex justify-content-end">
|
|
<div class="p-0">
|
|
@if (maxRecordStatus)
|
|
{
|
|
<button class="btn btn-outline-primary btn-sm mx-2" id="liveToastBtn" @onclick="()=>resetMaxRecord()" title="Reset max record"><i class="fa-solid fa-list-ol"></i>   @MaxRecord</button>
|
|
<button class="btn btn-outline-primary btn-sm mx-2" @onclick="()=>resetDate()" title="Reset date"><i class="fa-solid fa-calendar"></i>   @dtRif</button>
|
|
}
|
|
<a class="py-1 text-dark" data-bs-toggle="offcanvas" data-bs-target="#offcanvasRight" aria-controls="offcanvasRight" title="Toggle Filters"><i class="fa-solid fa-bars"></i></a>
|
|
<div class="offcanvas offcanvas-end" tabindex="-1" id="offcanvasRight" aria-labelledby="offcanvasRightLabel">
|
|
<div class="offcanvas-header">
|
|
<h3 class="offcanvas-title" id="paramsFilterExampleLabel"><b>FILTERS</b></h3>
|
|
<button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
|
|
</div>
|
|
<div class="offcanvas-body">
|
|
<div>
|
|
Filter by:
|
|
</div>
|
|
|
|
@if (!maxRecordStatus)
|
|
{
|
|
<div class="small mt-2">
|
|
<label class="px-2" for="maxRecord" title="Max number of record to retrieve">Max record number</label>
|
|
</div>
|
|
<div class="input-group py-1 pt-0 px-2">
|
|
<span class="input-group-text ">Num Records:</span>
|
|
<input class="form-control form-control-sm" id="maxRecord" @bind-value="@MaxRecord" title="Max number of record to retrieve" disabled />
|
|
</div>
|
|
|
|
<div class="small mt-2">
|
|
<label class="px-2" for="DtRefEnd" title="Show alarms from selected date back">Date:</label>
|
|
</div>
|
|
<div class="input-group py-1 pt-0 px-2">
|
|
<label class="input-group-text" title="Analisys: dataset end">Date From:</label>
|
|
<input @bind="@dtRif" id="DtRefEnd" class="form-control" type="datetime-local" title="Show alarms from selected date back" disabled>
|
|
</div>
|
|
}
|
|
else
|
|
{
|
|
<div class="small mt-2">
|
|
<label class="px-2" for="maxRecord" title="Max number of record to retrieve">Max record number</label>
|
|
</div>
|
|
<div class="input-group input-group-sm py-1 pt-0 px-2">
|
|
<span class="input-group-text">Num Records:</span>
|
|
<input class="form-control form-control-sm" id="maxRecord" @bind-value="@MaxRecord" title="Max number of record to retrieve" enabled />
|
|
</div>
|
|
<div class="small mt-2">
|
|
<label class="px-2" for="DtRefEnd" title="Show alarms from selected date back">Date:</label>
|
|
</div>
|
|
<div class="input-group input-group-sm py-1 pt-0 px-2">
|
|
<label class="input-group-text" title="Analisys: dataset end">Date From:</label>
|
|
<input @bind="@dtRif" id="DtRefEnd" class="form-control" type="datetime-local" title="Show alarms from selected date back" enabled>
|
|
</div>
|
|
}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>*@
|
|
|
|
<AlarmsFIlter FilterChanged="updateFilterAlarms" currFilter="@actFilter"></AlarmsFIlter>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="row">
|
|
<div class="col-3 pe-0">
|
|
<AlarmsOverview messageReceived="() => reloadFromMessage()" compMode="false"></AlarmsOverview>
|
|
</div>
|
|
<div class="col-9 ps-1">
|
|
@if (reqPassw)
|
|
{
|
|
<UserAuthCheck checkOk="() => ShowSetup()"></UserAuthCheck>
|
|
}
|
|
else if (doSetup)
|
|
{
|
|
<AlarmsSetup></AlarmsSetup>
|
|
}
|
|
else
|
|
{
|
|
<div class="card">
|
|
<div class="card-header">
|
|
<div class="d-flex justify-content-between">
|
|
|
|
<div class="px-2 col-12 d-flex justify-content-between">
|
|
<div class="col-4">
|
|
<h5 class="py-1">Alarm History</h5>
|
|
</div>
|
|
<div class="col-4 d-flex justify-content-between">
|
|
@if (isActive)
|
|
{
|
|
<ToggleModes FilterChanged="updateFilterToggle"></ToggleModes>
|
|
}
|
|
</div>
|
|
<div class="px-2 col-4 d-flex justify-content-end">
|
|
@if (!liveUpdate)
|
|
{
|
|
<button class="btn btn-secondary" type="button" @onclick="() => toggleUpdate()">
|
|
<small>@lastUpdate</small>
|
|
</button>
|
|
}
|
|
else
|
|
{
|
|
<button class="btn btn-primary" type="button" @onclick="() => toggleUpdate()">
|
|
<span class="spinner-grow spinner-grow-sm" role="status" aria-hidden="true"></span>
|
|
Live update
|
|
</button>
|
|
}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
@if (setLogRec)
|
|
{
|
|
<div class="card-body">
|
|
@if (ListRecordsREC == null)
|
|
{
|
|
<LoadingData></LoadingData>
|
|
}
|
|
else if (totalCount == 0)
|
|
{
|
|
<div class="alert alert-warning text-center display-4">No record found</div>
|
|
}
|
|
else
|
|
{
|
|
<table class="table table-sm table-striped table-responsive-lg small">
|
|
<thead>
|
|
<tr>
|
|
<th>DateTime start</th>
|
|
<th><div class="">Error</div></th>
|
|
<th><div class="">Status</div></th>
|
|
<th><div class="float-end">Duration</div></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach (var record in ListRecordsREC)
|
|
{
|
|
@if (record.DtEnd < record.DtStart)
|
|
{
|
|
<tr class="bg-danger text-warning">
|
|
<td class="text-warning text-wrap textConsensed">
|
|
@record.DtStart.ToString("yyyy.MM.dd HH:mm:ss")
|
|
</td>
|
|
<td class=" text-warning text-wrap textConsensed">
|
|
<div class="">@record.AlarmListNav.FullValue</div>
|
|
</td>
|
|
<td class="text-warning">
|
|
<div class="">ACTIVE</div>
|
|
</td>
|
|
|
|
<td class="text-warning">
|
|
<div class="float-end">--:--:--</div>
|
|
</td>
|
|
</tr>
|
|
}
|
|
else
|
|
{
|
|
<tr>
|
|
<td class="text-wrap textConsensed">
|
|
@record.DtStart.ToString("yyyy.MM.dd HH:mm:ss")
|
|
</td>
|
|
<td>
|
|
<div class="text-success text-wrap textConsensed">@record.AlarmListNav.FullValue</div>
|
|
</td>
|
|
<td>
|
|
<div class="text-success">CLOSED</div>
|
|
</td>
|
|
<td>
|
|
<div class="float-end">@TimeSpan.FromMinutes(@record.Duration).ToString(@"hh\:mm\:ss")</div>
|
|
</td>
|
|
</tr>
|
|
}
|
|
}
|
|
</tbody>
|
|
</table>
|
|
}
|
|
</div>
|
|
}
|
|
else
|
|
{
|
|
@if (isActive)
|
|
{
|
|
|
|
<div class="card-body">
|
|
@if (ListRecords == null)
|
|
{
|
|
<LoadingData></LoadingData>
|
|
}
|
|
else if (totalCount == 0)
|
|
{
|
|
<div class="alert alert-warning text-center display-4">No record found</div>
|
|
}
|
|
else
|
|
{
|
|
<table class="table table-sm table-striped table-responsive-lg small">
|
|
<thead>
|
|
<tr>
|
|
<th>Date - Time</th>
|
|
<th>Memory Area</th>
|
|
<th><div class="float-end">Code</div></th>
|
|
<th><div class="float-end">Status</div></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach (var record in ListRecords)
|
|
{
|
|
<tr>
|
|
<td class="text-wrap textConsensed">
|
|
@record.DtRif.ToString("yyyy.MM.dd HH:mm:ss")
|
|
</td>
|
|
<td><b>@record.MemAddress</b> / @record.Index</td>
|
|
<td>
|
|
<div class="float-end">@record.Status</div>
|
|
</td>
|
|
<td>
|
|
<div class="float-end">
|
|
@if (record.Status == 0)
|
|
{
|
|
<span class="text-success textConsensed text-wrap">@record.ValDecoded <i class="fas fa-certificate"></i></span>
|
|
}
|
|
else
|
|
{
|
|
<span class="text-danger textConsensed text-wrap">@record.ValDecoded <i class="fas fa-exclamation-triangle"></i></span>
|
|
}
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
}
|
|
</tbody>
|
|
</table>
|
|
}
|
|
</div>
|
|
}
|
|
}
|
|
<div class="card-footer py-0">
|
|
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" />
|
|
</div>
|
|
</div>
|
|
}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@*<div class="card-footer p-1">
|
|
</div>*@
|
|
</div>
|
|
|
|
|