feat(dashboard): make Galaxy browse and watch accessible
This commit is contained in:
@@ -102,4 +102,33 @@ using ZB.MOM.WW.MxGateway.Server.Security.Authorization;
|
||||
authenticationType: "test",
|
||||
nameType: ClaimTypes.Name,
|
||||
roleType: ClaimTypes.Role))));
|
||||
}
|
||||
}
|
||||
// In-memory Galaxy projection and read-only fake values for the actual BrowsePage.
|
||||
internal sealed class FixtureGalaxyCache : ZB.MOM.WW.GalaxyRepository.IGalaxyHierarchyCache
|
||||
{
|
||||
public ZB.MOM.WW.GalaxyRepository.GalaxyHierarchyCacheEntry Current { get; }
|
||||
public FixtureGalaxyCache()
|
||||
{
|
||||
var plant = new ZB.MOM.WW.GalaxyRepository.Grpc.GalaxyObject { GobjectId = 1, TagName = "SyntheticPlant", BrowseName = "SyntheticPlant", IsArea = true };
|
||||
var pump = new ZB.MOM.WW.GalaxyRepository.Grpc.GalaxyObject { GobjectId = 2, ParentGobjectId = 1, TagName = "Pump01", BrowseName = "Pump01" };
|
||||
pump.Attributes.Add(new ZB.MOM.WW.GalaxyRepository.Grpc.GalaxyAttribute { AttributeName = "PV", FullTagReference = "Pump01.PV", DataTypeName = "Float" });
|
||||
pump.Attributes.Add(new ZB.MOM.WW.GalaxyRepository.Grpc.GalaxyAttribute { AttributeName = new string('x', 200), FullTagReference = "Pump01." + new string('x', 200), DataTypeName = "Float" });
|
||||
var sibling = new ZB.MOM.WW.GalaxyRepository.Grpc.GalaxyObject { GobjectId = 3, ParentGobjectId = 1, TagName = "Sibling01", BrowseName = "Sibling01" };
|
||||
sibling.Attributes.Add(new ZB.MOM.WW.GalaxyRepository.Grpc.GalaxyAttribute { AttributeName = "PV", FullTagReference = "Sibling01.PV", DataTypeName = "Float" });
|
||||
ZB.MOM.WW.GalaxyRepository.Grpc.GalaxyObject[] rows = [plant, pump, sibling];
|
||||
Current = ZB.MOM.WW.GalaxyRepository.GalaxyHierarchyCacheEntry.Empty with {
|
||||
Status = ZB.MOM.WW.GalaxyRepository.GalaxyCacheStatus.Healthy, Sequence = 1,
|
||||
Objects = rows, Index = ZB.MOM.WW.GalaxyRepository.GalaxyHierarchyIndex.Build(rows), ObjectCount = rows.Length, AttributeCount = 3,
|
||||
LastSuccessAt = DateTimeOffset.UtcNow,
|
||||
};
|
||||
}
|
||||
public Task RefreshAsync(CancellationToken cancellationToken) => Task.CompletedTask;
|
||||
public Task WaitForFirstLoadAsync(CancellationToken cancellationToken) => Task.CompletedTask;
|
||||
}
|
||||
internal sealed class FixtureLiveData : IDashboardLiveDataService
|
||||
{
|
||||
public Task<DashboardLiveReadResult> ReadAsync(IReadOnlyCollection<string> tagAddresses, CancellationToken cancellationToken) =>
|
||||
Task.FromResult(new DashboardLiveReadResult(tagAddresses.Select(tag => new DashboardTagValue(tag, true, "[redacted]", "Float", 192, true, DateTimeOffset.UnixEpoch, null)).ToArray(), null, "synthetic-no-worker", null));
|
||||
public Task<DashboardAlarmQueryResult> QueryAlarmsAsync(CancellationToken cancellationToken) =>
|
||||
Task.FromResult(new DashboardAlarmQueryResult([], null, null));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user