feat: frontend add virtual matrix key

This commit is contained in:
2025-05-20 17:09:57 +08:00
parent 7b1d1a5e87
commit 1bdcb672ab
15 changed files with 689 additions and 106 deletions

View File

@@ -52,6 +52,7 @@ try
{
options.AddPolicy("Users", policy => policy
.AllowAnyOrigin()
.AllowAnyHeader()
);
});

View File

@@ -26,7 +26,7 @@ public class BoundaryScanRegs
/// </summary>
[JsonProperty("cell_name")]
[JsonRequired]
public string CellName { get; set; }
public string CellName { get; set; } = "UnknownCellName";
/// <summary>
/// [TODO:description]
@@ -146,7 +146,8 @@ public class Parser
/// <returns>[TODO:return]</returns>
public Optional<List<BoundaryScanRegs.CellEntry>> GetBoundaryLogicalPorts()
{
var registers = this.BoundaryRegsDesp["registers"]?.ToList().Where((item)=>{
var registers = this.BoundaryRegsDesp["registers"]?.ToList().Where((item) =>
{
return item["port_id"] is not null;
});
if (registers is null) return new();

View File

@@ -21,7 +21,7 @@ public class MatrixKeyController : ControllerBase
/// <returns>返回操作结果的状态码</returns>
[HttpPost("EnabelMatrixKey")]
[EnableCors("Users")]
[ProducesResponseType(typeof(uint), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(bool), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(Exception), StatusCodes.Status500InternalServerError)]
public async ValueTask<IResult> EnabelMatrixKey(string address, int port)
{
@@ -48,7 +48,7 @@ public class MatrixKeyController : ControllerBase
/// <returns>返回操作结果的状态码</returns>
[HttpPost("DisableMatrixKey")]
[EnableCors("Users")]
[ProducesResponseType(typeof(uint), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(bool), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(Exception), StatusCodes.Status500InternalServerError)]
public async ValueTask<IResult> DisableMatrixKey(string address, int port)
{
@@ -76,7 +76,7 @@ public class MatrixKeyController : ControllerBase
/// <returns>返回操作结果的状态码</returns>
[HttpPost("SetMatrixKeyStatus")]
[EnableCors("Users")]
[ProducesResponseType(typeof(uint), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(bool), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(Exception), StatusCodes.Status500InternalServerError)]
public async ValueTask<IResult> SetMatrixKeyStatus(string address, int port, [FromBody] bool[] keyStates)
{