Forward ticket overview capabilities separately
This commit is contained in:
Binary file not shown.
@@ -112,9 +112,11 @@ namespace C4IT.DataHistoryProvider
|
||||
private class GlobalServerSettings
|
||||
{
|
||||
internal DateTime LastRead = DateTime.MinValue;
|
||||
internal bool TicketAndServiceRequestEnabled = false;
|
||||
internal bool TicketAndServiceRequestEnabled = true;
|
||||
}
|
||||
|
||||
public bool TicketAndServiceRequestsEnabled => _globalServerSettings?.TicketAndServiceRequestEnabled ?? true;
|
||||
|
||||
private static class _OnlineCheckCriticalSection
|
||||
{
|
||||
public static SemaphoreSlim Semaphore = new SemaphoreSlim(1, 1);
|
||||
@@ -1167,6 +1169,21 @@ namespace C4IT.DataHistoryProvider
|
||||
if (!string.IsNullOrWhiteSpace(json))
|
||||
{
|
||||
var root = JsonConvert.DeserializeObject<JObject>(json);
|
||||
var ticketCapability = root?["capabilities"]?["ticketAndServiceRequestsEnabled"];
|
||||
if (ticketCapability != null && ticketCapability.Type != JTokenType.Null)
|
||||
{
|
||||
if (ticketCapability.Type == JTokenType.Boolean)
|
||||
{
|
||||
_globalServerSettings.TicketAndServiceRequestEnabled = ticketCapability.Value<bool>();
|
||||
_globalServerSettings.LastRead = DateTime.UtcNow;
|
||||
}
|
||||
else if (bool.TryParse(ticketCapability.ToString(), out var isEnabled))
|
||||
{
|
||||
_globalServerSettings.TicketAndServiceRequestEnabled = isEnabled;
|
||||
_globalServerSettings.LastRead = DateTime.UtcNow;
|
||||
}
|
||||
}
|
||||
|
||||
var countsToken = root?["counts"] as JObject;
|
||||
var counts = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
|
||||
if (countsToken != null)
|
||||
|
||||
Binary file not shown.
@@ -54,7 +54,14 @@ namespace FasdWebService.Controllers
|
||||
.ToList();
|
||||
|
||||
var counts = await collector.GetTicketOverviewCountsAsync(normalizedKeys, useRoleScope, requestInfo, 1, CancellationToken.None);
|
||||
return Ok(new TicketOverviewCountsResult { Counts = counts });
|
||||
return Ok(new TicketOverviewCountsResult
|
||||
{
|
||||
Counts = counts,
|
||||
Capabilities = new TicketOverviewCapabilities
|
||||
{
|
||||
TicketAndServiceRequestsEnabled = collector.TicketAndServiceRequestsEnabled
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
@@ -118,5 +125,14 @@ namespace FasdWebService.Controllers
|
||||
{
|
||||
[JsonProperty("counts")]
|
||||
public Dictionary<string, int> Counts { get; set; } = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
[JsonProperty("capabilities")]
|
||||
public TicketOverviewCapabilities Capabilities { get; set; } = new TicketOverviewCapabilities();
|
||||
}
|
||||
|
||||
public class TicketOverviewCapabilities
|
||||
{
|
||||
[JsonProperty("ticketAndServiceRequestsEnabled")]
|
||||
public bool TicketAndServiceRequestsEnabled { get; set; } = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user