Separate ticket overview capabilities from counts
This commit is contained in:
@@ -120,7 +120,7 @@ namespace C4IT.F4SD
|
|||||||
counts[key] = CountTicketOverviewEntries(source, key);
|
counts[key] = CountTicketOverviewEntries(source, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new TicketOverviewCountsResult { Counts = counts };
|
return CreateTicketOverviewCountsResult(counts);
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -314,15 +314,23 @@ namespace C4IT.F4SD
|
|||||||
"ServiceRequestsCritical",
|
"ServiceRequestsCritical",
|
||||||
"ServiceRequestsNewInfo",
|
"ServiceRequestsNewInfo",
|
||||||
"UnassignedTickets",
|
"UnassignedTickets",
|
||||||
"UnassignedTicketsCritical",
|
"UnassignedTicketsCritical"
|
||||||
"TicketAndServiceRequestsEnabled"
|
};
|
||||||
};
|
|
||||||
|
public class TicketOverviewCapabilities
|
||||||
public class TicketOverviewCountsResult
|
{
|
||||||
{
|
[JsonProperty("ticketAndServiceRequestsEnabled")]
|
||||||
[JsonProperty("counts")]
|
public bool TicketAndServiceRequestsEnabled { get; set; } = true;
|
||||||
public Dictionary<string, int> Counts { get; set; } = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
|
}
|
||||||
}
|
|
||||||
|
public class TicketOverviewCountsResult
|
||||||
|
{
|
||||||
|
[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 TicketOverviewCountsByRoleResult
|
public class TicketOverviewCountsByRoleResult
|
||||||
{
|
{
|
||||||
@@ -409,7 +417,7 @@ namespace C4IT.F4SD
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new TicketOverviewCountsResult { Counts = counts };
|
return CreateTicketOverviewCountsResult(counts);
|
||||||
}
|
}
|
||||||
catch (Exception E)
|
catch (Exception E)
|
||||||
{
|
{
|
||||||
@@ -985,12 +993,21 @@ namespace C4IT.F4SD
|
|||||||
|
|
||||||
private static int CountTicketOverviewEntries(IEnumerable<TicketOverviewEntry> entries, string key)
|
private static int CountTicketOverviewEntries(IEnumerable<TicketOverviewEntry> entries, string key)
|
||||||
{
|
{
|
||||||
if (string.Equals(key?.Trim(), "TicketAndServiceRequestsEnabled", StringComparison.OrdinalIgnoreCase))
|
|
||||||
return ticketAndServiceRequestEnabled() ? 1 : 0;
|
|
||||||
|
|
||||||
return (entries ?? Enumerable.Empty<TicketOverviewEntry>())
|
return (entries ?? Enumerable.Empty<TicketOverviewEntry>())
|
||||||
.Count(entry => MatchesTicketOverviewKey(entry, key));
|
.Count(entry => MatchesTicketOverviewKey(entry, key));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static TicketOverviewCountsResult CreateTicketOverviewCountsResult(Dictionary<string, int> counts)
|
||||||
|
{
|
||||||
|
return new TicketOverviewCountsResult
|
||||||
|
{
|
||||||
|
Counts = counts ?? new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase),
|
||||||
|
Capabilities = new TicketOverviewCapabilities
|
||||||
|
{
|
||||||
|
TicketAndServiceRequestsEnabled = ticketAndServiceRequestEnabled()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
private static bool GetBoolValue(object value)
|
private static bool GetBoolValue(object value)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -393,8 +393,7 @@ namespace C4IT.F4SD
|
|||||||
"ServiceRequestsCritical",
|
"ServiceRequestsCritical",
|
||||||
"ServiceRequestsNewInfo",
|
"ServiceRequestsNewInfo",
|
||||||
"UnassignedTickets",
|
"UnassignedTickets",
|
||||||
"UnassignedTicketsCritical",
|
"UnassignedTicketsCritical"
|
||||||
"TicketAndServiceRequestsEnabled"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
public class cF4SDTicket : cF4SDTicketSummary
|
public class cF4SDTicket : cF4SDTicketSummary
|
||||||
@@ -453,10 +452,19 @@ namespace C4IT.F4SD
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class TicketOverviewCapabilities
|
||||||
|
{
|
||||||
|
[JsonProperty("ticketAndServiceRequestsEnabled")]
|
||||||
|
public bool TicketAndServiceRequestsEnabled { get; set; } = true;
|
||||||
|
}
|
||||||
|
|
||||||
public class TicketOverviewCountsResult
|
public class TicketOverviewCountsResult
|
||||||
{
|
{
|
||||||
[JsonProperty("counts")]
|
[JsonProperty("counts")]
|
||||||
public Dictionary<string, int> Counts { get; set; } = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
|
public Dictionary<string, int> Counts { get; set; } = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
[JsonProperty("capabilities")]
|
||||||
|
public TicketOverviewCapabilities Capabilities { get; set; } = new TicketOverviewCapabilities();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TicketOverviewCountsByRoleResult
|
public class TicketOverviewCountsByRoleResult
|
||||||
@@ -545,7 +553,7 @@ namespace C4IT.F4SD
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new TicketOverviewCountsResult { Counts = counts };
|
return CreateTicketOverviewCountsResult(counts);
|
||||||
}
|
}
|
||||||
catch (Exception E)
|
catch (Exception E)
|
||||||
{
|
{
|
||||||
@@ -601,7 +609,7 @@ namespace C4IT.F4SD
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new TicketOverviewCountsResult { Counts = counts };
|
return CreateTicketOverviewCountsResult(counts);
|
||||||
}
|
}
|
||||||
catch (Exception E)
|
catch (Exception E)
|
||||||
{
|
{
|
||||||
@@ -1424,13 +1432,22 @@ namespace C4IT.F4SD
|
|||||||
|
|
||||||
private static int CountTicketOverviewEntries(IEnumerable<TicketOverviewEntry> entries, string key)
|
private static int CountTicketOverviewEntries(IEnumerable<TicketOverviewEntry> entries, string key)
|
||||||
{
|
{
|
||||||
if (string.Equals(key?.Trim(), "TicketAndServiceRequestsEnabled", StringComparison.OrdinalIgnoreCase))
|
|
||||||
return ticketAndServiceRequestEnabled() ? 1 : 0;
|
|
||||||
|
|
||||||
return (entries ?? Enumerable.Empty<TicketOverviewEntry>())
|
return (entries ?? Enumerable.Empty<TicketOverviewEntry>())
|
||||||
.Count(entry => MatchesTicketOverviewKey(entry, key));
|
.Count(entry => MatchesTicketOverviewKey(entry, key));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static TicketOverviewCountsResult CreateTicketOverviewCountsResult(Dictionary<string, int> counts)
|
||||||
|
{
|
||||||
|
return new TicketOverviewCountsResult
|
||||||
|
{
|
||||||
|
Counts = counts ?? new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase),
|
||||||
|
Capabilities = new TicketOverviewCapabilities
|
||||||
|
{
|
||||||
|
TicketAndServiceRequestsEnabled = ticketAndServiceRequestEnabled()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
private static bool GetBoolValue(object value)
|
private static bool GetBoolValue(object value)
|
||||||
{
|
{
|
||||||
if (value == null || value is DBNull)
|
if (value == null || value is DBNull)
|
||||||
|
|||||||
@@ -119,7 +119,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": "overviewKeys",
|
"key": "overviewKeys",
|
||||||
"value": "TicketsNew,TicketsActive,TicketsCritical,TicketsNewInfo,IncidentNew,IncidentActive,IncidentCritical,IncidentNewInfo,ServiceRequestsNew,ServiceRequestsActive,ServiceRequestsCritical,ServiceRequestsNewInfo,UnassignedTickets,UnassignedTicketsCritical,TicketAndServiceRequestsEnabled"
|
"value": "TicketsNew,TicketsActive,TicketsCritical,TicketsNewInfo,IncidentNew,IncidentActive,IncidentCritical,IncidentNewInfo,ServiceRequestsNew,ServiceRequestsActive,ServiceRequestsCritical,ServiceRequestsNewInfo,UnassignedTickets,UnassignedTicketsCritical"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": "queueOption",
|
"key": "queueOption",
|
||||||
|
|||||||
Reference in New Issue
Block a user