Add ucsdevice message for mobotix video players
This commit is contained in:
@@ -26,6 +26,18 @@
|
||||
<i class="bi-sort-down-alt"></i>
|
||||
</a>
|
||||
</th>
|
||||
@if (hasMessages)
|
||||
{
|
||||
<th>
|
||||
<DisplayName For="@(() => system.Devices.First().Message)" />
|
||||
<a @onclick="@(() => SetSortOrder("message_desc"))" @onclick:preventDefault href="#">
|
||||
<i class="bi-sort-up"></i>
|
||||
</a>
|
||||
<a @onclick="@(() => SetSortOrder("message_asc"))" @onclick:preventDefault href="#">
|
||||
<i class="bi-sort-down-alt"></i>
|
||||
</a>
|
||||
</th>
|
||||
}
|
||||
<th>
|
||||
<DisplayName For="@(() => system.Devices.First().LastStateChange)" />
|
||||
<a @onclick="@(() => SetSortOrder("changed_desc"))" @onclick:preventDefault href="#">
|
||||
@@ -45,6 +57,10 @@
|
||||
<tr class="@(device.State == true ? "table-success" : "table-danger") ">
|
||||
<td>@device.BoxID</td>
|
||||
<td>@device.Name</td>
|
||||
@if (hasMessages)
|
||||
{
|
||||
<td>@device.Message</td>
|
||||
}
|
||||
<td>@device.LastStateChange.FormatDateTime()</td>
|
||||
</tr>
|
||||
}
|
||||
@@ -62,6 +78,8 @@
|
||||
private UCSSystem? system = new UCSSystem();
|
||||
private string? sortOrder;
|
||||
|
||||
private bool hasMessages = false;
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
@@ -85,6 +103,7 @@
|
||||
|
||||
system.Devices = system.Devices.SortTable(sortOrder).ToList();
|
||||
|
||||
hasMessages = system.Devices.Where(m => m.Message != string.Empty).Any();
|
||||
|
||||
this.StateHasChanged();
|
||||
}
|
||||
|
||||
@@ -92,13 +92,14 @@ namespace UCS_Status_Monitor.Extensions
|
||||
{
|
||||
if (sortOrder != null)
|
||||
{
|
||||
|
||||
devices = sortOrder switch
|
||||
{
|
||||
"boxid_asc" => devices.OrderBy(s => s.BoxID).ToList(),
|
||||
"boxid_desc" => [.. devices.OrderByDescending(s => s.BoxID)],
|
||||
"name_asc" => [.. devices.OrderBy(s => s.Name)],
|
||||
"name_desc" => [.. devices.OrderByDescending(s => s.Name)],
|
||||
"message_asc" => [.. devices.OrderBy(s => s.Message)],
|
||||
"message_desc" => [.. devices.OrderByDescending(s => s.Message)],
|
||||
"changed_asc" => [.. devices.OrderBy(s => s.LastStateChange)],
|
||||
"changed_desc" => [.. devices.OrderByDescending(s => s.LastStateChange)],
|
||||
_ => [.. devices.OrderBy(s => s.Id)],
|
||||
|
||||
394
UCS_Status_Monitor/Migrations/20250501063851_AddUCSDeviceMessage.Designer.cs
generated
Normal file
394
UCS_Status_Monitor/Migrations/20250501063851_AddUCSDeviceMessage.Designer.cs
generated
Normal file
@@ -0,0 +1,394 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using UCS_Status_Monitor.Database;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace UCS_Status_Monitor.Migrations
|
||||
{
|
||||
[DbContext(typeof(MonitorDbContext))]
|
||||
[Migration("20250501063851_AddUCSDeviceMessage")]
|
||||
partial class AddUCSDeviceMessage
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "9.0.4");
|
||||
|
||||
modelBuilder.Entity("UCS_Status_Monitor.Models.Database.AxisCam", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<bool>("Connected")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Device")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Location")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("SerialNumber")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("SystemReady")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Temperature")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("Timestamp")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("AxisCams", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UCS_Status_Monitor.Models.Database.EventLogError", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("Index")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Message")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("TimeGenerated")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("UCSSystemId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UCSSystemId");
|
||||
|
||||
b.ToTable("Errors", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UCS_Status_Monitor.Models.Database.Logging", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int?>("AxisCamId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int?>("RouterId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<bool>("State")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int?>("UCSSystemId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AxisCamId");
|
||||
|
||||
b.HasIndex("RouterId");
|
||||
|
||||
b.HasIndex("UCSSystemId");
|
||||
|
||||
b.ToTable("Loggings", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UCS_Status_Monitor.Models.Database.Router", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<bool>("Connected")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Device")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("FirmwareVersion")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Location")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("RSSI")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<float>("Temperature")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<uint>("ThisMonthRX")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<uint>("ThisMonthTX")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime>("Timestamp")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("WanIp")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Routers", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UCS_Status_Monitor.Models.Database.Sensor", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("ComputerName")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Configfile")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<long>("Count")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("TxData")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("TxString")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("UCSId")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Sensors", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UCS_Status_Monitor.Models.Database.UCSDevice", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("BoxID")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("LastStateChange")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Message")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("State")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("UCSSystemId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UCSSystemId");
|
||||
|
||||
b.ToTable("UCSDevices", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UCS_Status_Monitor.Models.Database.UCSSystem", b =>
|
||||
{
|
||||
b.Property<int>("UCSSystemId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("AxisVersion")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("BIOSVersion")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("BoschVersion")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("ComputerModel")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("ComputerName")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("ConfigFileName")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("ConnectionState")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("DotNetVersion")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("LastMessageClient")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("LastMessageTime")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Monitors")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("OSCaption")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("OSVersion")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("PhysicalMemory")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("ProcessorName")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("StartTime")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("SystemUptime")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("UCSVersion")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("USBDisks")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Uptime")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("VideoController")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("UCSSystemId");
|
||||
|
||||
b.HasIndex("ComputerName");
|
||||
|
||||
b.ToTable("UCSSystems", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UCS_Status_Monitor.Models.Database.EventLogError", b =>
|
||||
{
|
||||
b.HasOne("UCS_Status_Monitor.Models.Database.UCSSystem", "UCSSystem")
|
||||
.WithMany("Errors")
|
||||
.HasForeignKey("UCSSystemId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("UCSSystem");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UCS_Status_Monitor.Models.Database.Logging", b =>
|
||||
{
|
||||
b.HasOne("UCS_Status_Monitor.Models.Database.AxisCam", "AxisCam")
|
||||
.WithMany("Loggings")
|
||||
.HasForeignKey("AxisCamId");
|
||||
|
||||
b.HasOne("UCS_Status_Monitor.Models.Database.Router", "Router")
|
||||
.WithMany("Loggings")
|
||||
.HasForeignKey("RouterId");
|
||||
|
||||
b.HasOne("UCS_Status_Monitor.Models.Database.UCSSystem", "UCSSystem")
|
||||
.WithMany("Loggings")
|
||||
.HasForeignKey("UCSSystemId");
|
||||
|
||||
b.Navigation("AxisCam");
|
||||
|
||||
b.Navigation("Router");
|
||||
|
||||
b.Navigation("UCSSystem");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UCS_Status_Monitor.Models.Database.UCSDevice", b =>
|
||||
{
|
||||
b.HasOne("UCS_Status_Monitor.Models.Database.UCSSystem", "UCSSystem")
|
||||
.WithMany("Devices")
|
||||
.HasForeignKey("UCSSystemId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("UCSSystem");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UCS_Status_Monitor.Models.Database.AxisCam", b =>
|
||||
{
|
||||
b.Navigation("Loggings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UCS_Status_Monitor.Models.Database.Router", b =>
|
||||
{
|
||||
b.Navigation("Loggings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("UCS_Status_Monitor.Models.Database.UCSSystem", b =>
|
||||
{
|
||||
b.Navigation("Devices");
|
||||
|
||||
b.Navigation("Errors");
|
||||
|
||||
b.Navigation("Loggings");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace UCS_Status_Monitor.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddUCSDeviceMessage : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Message",
|
||||
table: "UCSDevices",
|
||||
type: "TEXT",
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Message",
|
||||
table: "UCSDevices");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ namespace UCS_Status_Monitor.Migrations
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "8.0.10");
|
||||
modelBuilder.HasAnnotation("ProductVersion", "9.0.4");
|
||||
|
||||
modelBuilder.Entity("UCS_Status_Monitor.Models.Database.AxisCam", b =>
|
||||
{
|
||||
@@ -210,6 +210,10 @@ namespace UCS_Status_Monitor.Migrations
|
||||
b.Property<DateTime>("LastStateChange")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Message")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
@@ -17,6 +17,9 @@ namespace UCS_Status_Monitor.Models.Database
|
||||
|
||||
public Boolean State { get; set; }
|
||||
|
||||
[Display(Name = "Message")]
|
||||
public string Message { get; set; } = string.Empty;
|
||||
|
||||
[Display(Name = "Last message date")]
|
||||
public DateTime LastStateChange { get; set; }
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using UCS_Status_Monitor.Telegram;
|
||||
using System.Globalization;
|
||||
using System.Diagnostics;
|
||||
using UCS_Status_Monitor.Extensions;
|
||||
|
||||
namespace UCS_Status_Monitor.Monitor
|
||||
{
|
||||
@@ -73,11 +74,14 @@ namespace UCS_Status_Monitor.Monitor
|
||||
|
||||
if (message.ComputerInfo?.USBDisks?.Count > 0)
|
||||
{
|
||||
if (system.USBDisks == "No USB disks")
|
||||
if (system.USBDisks != message.ComputerInfo.USBDisks.ListToString())
|
||||
{
|
||||
foreach (string disk in message.ComputerInfo.USBDisks)
|
||||
if(!message.ComputerInfo.USBDisks.ListToString().Contains("No USB disks", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
await _telegramBot.Send($"⚠️ <b>{system.ComputerName} - {system.ConfigFileName}</b>{Environment.NewLine} USB disk {disk} detected", token);
|
||||
foreach (string disk in message.ComputerInfo.USBDisks)
|
||||
{
|
||||
await _telegramBot.Send($"⚠️ <b>{system.ComputerName} - {system.ConfigFileName}</b>{Environment.NewLine} USB disk {disk} detected", token);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -126,6 +130,7 @@ namespace UCS_Status_Monitor.Monitor
|
||||
Name = deviceState.Name ?? "??",
|
||||
BoxID = deviceState.ID,
|
||||
State = deviceState.State ?? false,
|
||||
Message = deviceState.Message ?? string.Empty,
|
||||
UCSSystem = system
|
||||
};
|
||||
|
||||
@@ -144,6 +149,8 @@ namespace UCS_Status_Monitor.Monitor
|
||||
else
|
||||
{
|
||||
dbDevice.Name = deviceState.Name ?? "??";
|
||||
dbDevice.Message = deviceState.Message ?? string.Empty;
|
||||
|
||||
if (dbDevice.State != deviceState.State)
|
||||
{
|
||||
dbDevice.State = deviceState.State ?? false;
|
||||
|
||||
@@ -44,6 +44,7 @@ namespace UCS_Status_Monitor.Telemetry
|
||||
public string? Name { get; set; }
|
||||
public string? ID { get; set; }
|
||||
public bool? State { get; set; }
|
||||
public string? Message { set; get; }
|
||||
public string? LastStateChange { get; set; }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user