feat(uns): equipment detail page shell + Details tab + create-redirect
This commit is contained in:
@@ -266,6 +266,33 @@ public sealed class UnsTreeService(IDbContextFactory<OtOpcUaConfigDbContext> dbF
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<EquipmentPickContext> LoadEquipmentPickContextAsync(string? lineId, CancellationToken ct = default)
|
||||
{
|
||||
var empty = new EquipmentPickContext(Array.Empty<(string, string)>(), Array.Empty<(string, string)>());
|
||||
if (string.IsNullOrEmpty(lineId)) return empty;
|
||||
|
||||
await using var db = await dbFactory.CreateDbContextAsync(ct);
|
||||
|
||||
// line -> area -> clusterId
|
||||
var clusterId = await (from l in db.UnsLines.AsNoTracking()
|
||||
join a in db.UnsAreas.AsNoTracking() on l.UnsAreaId equals a.UnsAreaId
|
||||
where l.UnsLineId == lineId
|
||||
select a.ClusterId).FirstOrDefaultAsync(ct);
|
||||
if (string.IsNullOrEmpty(clusterId)) return empty;
|
||||
|
||||
// all lines in that cluster (for the line <select>)
|
||||
var lines = await (from l in db.UnsLines.AsNoTracking()
|
||||
join a in db.UnsAreas.AsNoTracking() on l.UnsAreaId equals a.UnsAreaId
|
||||
where a.ClusterId == clusterId
|
||||
orderby l.Name
|
||||
select new { l.UnsLineId, l.Name }).ToListAsync(ct);
|
||||
|
||||
var lineOptions = lines.Select(x => (x.UnsLineId, x.Name)).ToList();
|
||||
var drivers = await LoadDriversForClusterAsync(clusterId, ct);
|
||||
return new EquipmentPickContext(lineOptions, drivers);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<UnsMutationResult> CreateAreaAsync(
|
||||
string clusterId,
|
||||
|
||||
Reference in New Issue
Block a user