diff --git a/FasdCockpitBase/FasdCockpitCommunicationBase.cs b/FasdCockpitBase/FasdCockpitCommunicationBase.cs index 7c1a15b..077cb05 100644 --- a/FasdCockpitBase/FasdCockpitCommunicationBase.cs +++ b/FasdCockpitBase/FasdCockpitCommunicationBase.cs @@ -47,7 +47,7 @@ namespace C4IT.FASD.Cockpit.Communication public abstract Task KeepAliveSession(Guid sessionId); public abstract Task ReportQuickAction(cF4SDQuickActionParameters quickActionParameters); - + public abstract Task CheckCollectorStatusAsync(); public static bool Debug_apiValues = false; public static bool Debug_apiTiming = false; diff --git a/FasdCockpitCommunication/FasdCockpitCommunicationWeb.cs b/FasdCockpitCommunication/FasdCockpitCommunicationWeb.cs index 93f9fe0..c85eeba 100644 --- a/FasdCockpitCommunication/FasdCockpitCommunicationWeb.cs +++ b/FasdCockpitCommunication/FasdCockpitCommunicationWeb.cs @@ -25,6 +25,7 @@ using Newtonsoft.Json.Linq; using static C4IT.Logging.cLogManager; using C4IT.Configuration; +using System.Runtime.InteropServices.WindowsRuntime; namespace C4IT.FASD.Cockpit.Communication { @@ -566,6 +567,38 @@ namespace C4IT.FASD.Cockpit.Communication return false; } + public override async Task CheckCollectorStatusAsync() + { + var CM = MethodBase.GetCurrentMethod(); + LogMethodBegin(CM); + var apiError = 0; + var timeStart = DateTime.UtcNow; + try + { + var http = GetHttpHelper(false); + + var result = await http.GetHttpJson("api/CheckCollectorStatus", 15000, CancellationToken.None); + + if (!result.IsOk) + { + apiError = (int)result.Status; + return null; + } + var strXml = JsonConvert.DeserializeObject(result.Result); + return strXml; + } + catch (Exception E) + { + apiError = E.HResult; + LogException(E); + } + finally + { + if (Debug_apiTiming) SaveApiTimingEntry("Check Collector Status", timeStart, apiError); + LogMethodEnd(CM); + } + return null; + } public override async Task GetConfiguration(enumFasdConfigurationType configType) { @@ -2124,6 +2157,6 @@ namespace C4IT.FASD.Cockpit.Communication return null; } - + } } diff --git a/FasdCockpitCommunicationDemo/F4SDCockpitCommunicationDemo.cs b/FasdCockpitCommunicationDemo/F4SDCockpitCommunicationDemo.cs index 1b0b904..eb313b5 100644 --- a/FasdCockpitCommunicationDemo/F4SDCockpitCommunicationDemo.cs +++ b/FasdCockpitCommunicationDemo/F4SDCockpitCommunicationDemo.cs @@ -1862,5 +1862,9 @@ namespace C4IT.FASD.Cockpit.Communication return null; } + public override Task CheckCollectorStatusAsync() + { + throw new NotImplementedException(); + } } } diff --git a/FasdCockpitCommunicationDemo/MockupTicketOverview/TicketOverviewRelations.json b/FasdCockpitCommunicationDemo/MockupTicketOverview/TicketOverviewRelations.json new file mode 100644 index 0000000..9e557d7 --- /dev/null +++ b/FasdCockpitCommunicationDemo/MockupTicketOverview/TicketOverviewRelations.json @@ -0,0 +1,472 @@ +{ + "TicketsNew": { + "Personal": [ + { + "TicketId": "2e9cb83d-ecb7-c93b-e8e4-08daaa97265f", + "UserId": "42c760d6-90e8-469f-b2fe-ac7d4cc6cb0a", + "DisplayName": "TCK00186", + "Summary": "Mein OneDrive synchronisiert nicht mehr", + "UserDisplayName": "Ticket, Timo", + "UserAccount": "TT007", + "UserDomain": "CONTOSO", + "StatusId": "New" + } + ], + "Role": [ + { + "TicketId": "bb2e4a9d-2c1e-4b32-8f75-6e7c9f99f2d4", + "UserId": "42c760d6-90e8-469f-b2fe-ac7d4cc6cb0a", + "DisplayName": "TCK00761", + "Summary": "VPN-Verbindung bricht nach wenigen Minuten ab", + "UserDisplayName": "Ticket, Timo", + "UserAccount": "TT007", + "UserDomain": "CONTOSO", + "StatusId": "New" + }, + { + "TicketId": "d63e5ea1-0785-4998-82ad-9a9e5a0f8c37", + "UserId": "42c760d6-90e8-469f-b2fe-ac7d4cc6cb0a", + "DisplayName": "TCK00765", + "Summary": "Teams-Benachrichtigungen kommen verzögert an", + "UserDisplayName": "Ticket, Timo", + "UserAccount": "TT007", + "UserDomain": "CONTOSO", + "StatusId": "New" + }, + { + "TicketId": "f7771fde-33ba-421a-8d9b-cdf468e7541c", + "UserId": "a2164ecd-791f-482c-bea3-f089f14bec8a", + "DisplayName": "TCK00403", + "Summary": "Neuer Monitor fuer Hotline Arbeitsplatz", + "UserDisplayName": "Busch, Andrea", + "UserAccount": "AB014", + "UserDomain": "CONTOSO", + "StatusId": "New" + }, + { + "TicketId": "6294eec7-fb80-42f3-8ce8-7f7982ae200c", + "UserId": "436e8d67-1b9b-4b1a-83e9-0b1e8fa0173b", + "DisplayName": "TCK00404", + "Summary": "Monitor flackert seit Firmware Update", + "UserDisplayName": "Anwender, Peter", + "UserAccount": "PA010", + "UserDomain": "CONTOSO", + "StatusId": "New" + } + ] + }, + "TicketsActive": { + "Personal": [ + { + "TicketId": "75e08a29-4103-41d6-962c-009c3342bc46", + "UserId": "6180aa17-ba2d-455a-bf2f-ec4a075c2d64", + "DisplayName": "TCK00406", + "Summary": "CAD Software startet nach Update nicht mehr", + "UserDisplayName": "Kohl, Carlos", + "UserAccount": "CK102", + "UserDomain": "CONTOSO", + "StatusId": "InProgress" + } + ], + "Role": [ + { + "TicketId": "2e9cb83d-ecb7-c93b-e8e4-08daaa97265f", + "UserId": "42c760d6-90e8-469f-b2fe-ac7d4cc6cb0a", + "DisplayName": "TCK00405", + "Summary": "OneDrive Synchronisation bleibt haengen", + "UserDisplayName": "Ticket, Timo", + "UserAccount": "TT007", + "UserDomain": "CONTOSO", + "StatusId": "InProgress" + }, + { + "TicketId": "ff62a3e2-5004-4a8c-b71c-7ebb1877d1a4", + "UserId": "0fad5e21-5a29-44c6-b532-46f862ea8694", + "DisplayName": "TCK00407", + "Summary": "Netzlaufwerk Projekt X nicht erreichbar", + "UserDisplayName": "Hanova, Hans", + "UserAccount": "HH101", + "UserDomain": "CONTOSO", + "StatusId": "InProgress" + } + ] + }, + "TicketsCritical": { + "Personal": [ + { + "TicketId": "1507691c-6d47-4ae3-83b3-ef483d84a246", + "UserId": "deece196-d8b6-4a9c-a2b9-3c2ae9c6d4ec", + "DisplayName": "TCK00408", + "Summary": "VPN Konzentrator in Aussenstelle offline", + "UserDisplayName": "Seifert, Dominik", + "UserAccount": "DS014", + "UserDomain": "CONTOSO", + "StatusId": "InProgress" + }, + { + "TicketId": "5c6d981e-9e67-4fde-b249-8c6288d325a7", + "UserId": "a2164ecd-791f-482c-bea3-f089f14bec8a", + "DisplayName": "TCK00409", + "Summary": "SAP Produktionsauftrag bricht ab", + "UserDisplayName": "Boss, Bernd", + "UserAccount": "BB003", + "UserDomain": "CONTOSO", + "StatusId": "InProgress" + } + ], + "Role": [ + { + "TicketId": "1507691c-6d47-4ae3-83b3-ef483d84a246", + "UserId": "deece196-d8b6-4a9c-a2b9-3c2ae9c6d4ec", + "DisplayName": "TCK00408", + "Summary": "VPN Konzentrator in Aussenstelle offline", + "UserDisplayName": "Seifert, Dominik", + "UserAccount": "DS014", + "UserDomain": "CONTOSO", + "StatusId": "InProgress" + }, + { + "TicketId": "9b7710d4-72da-4b2a-9d0c-be02575d2c52", + "UserId": "a2c35ad1-7cc7-4b2b-9aa5-d03fdaecd155", + "DisplayName": "TCK00410", + "Summary": "WLAN im Lager faellt minutenweise aus", + "UserDisplayName": "Kiefer, Maximilian", + "UserAccount": "MK009", + "UserDomain": "CONTOSO", + "StatusId": "InProgress" + }, + { + "TicketId": "5c6d981e-9e67-4fde-b249-8c6288d325a7", + "UserId": "a2164ecd-791f-482c-bea3-f089f14bec8a", + "DisplayName": "TCK00409", + "Summary": "SAP Produktionsauftrag bricht ab", + "UserDisplayName": "Boss, Bernd", + "UserAccount": "BB003", + "UserDomain": "CONTOSO", + "StatusId": "InProgress" + } + ] + }, + "TicketsNewInfo": { + "Personal": [ + { + "TicketId": "de403992-98cb-4476-9e04-d645ab22e6de", + "UserId": "42c760d6-90e8-469f-b2fe-ac7d4cc6cb0a", + "DisplayName": "TCK00411", + "Summary": "Rueckfrage zur Passwort Ruecksetzung beantworten", + "UserDisplayName": "Ticket, Timo", + "UserAccount": "TT007", + "UserDomain": "CONTOSO", + "StatusId": "OnHold" + }, + { + "TicketId": "7c29dd33-1247-453c-9db6-f7a59107d276", + "UserId": "436e8d67-1b9b-4b1a-83e9-0b1e8fa0173b", + "DisplayName": "TCK00412", + "Summary": "Techniker bittet um Rueckmeldung zum Notebook", + "UserDisplayName": "Anwender, Peter", + "UserAccount": "PA010", + "UserDomain": "CONTOSO", + "StatusId": "OnHold" + } + ], + "Role": [ + { + "TicketId": "de403992-98cb-4476-9e04-d645ab22e6de", + "UserId": "42c760d6-90e8-469f-b2fe-ac7d4cc6cb0a", + "DisplayName": "TCK00411", + "Summary": "Rueckfrage zur Passwort Ruecksetzung beantworten", + "UserDisplayName": "Ticket, Timo", + "UserAccount": "TT007", + "UserDomain": "CONTOSO", + "StatusId": "OnHold" + }, + { + "TicketId": "b207822d-7e1c-42a7-b8c9-4246f711dd18", + "UserId": "deece196-d8b6-4a9c-a2b9-3c2ae9c6d4ec", + "DisplayName": "TCK00413", + "Summary": "Wartungsfenster fuer Firewall verschieben", + "UserDisplayName": "Seifert, Dominik", + "UserAccount": "DS014", + "UserDomain": "CONTOSO", + "StatusId": "OnHold" + } + ] + }, + "IncidentNew": { + "Personal": [ + { + "TicketId": "e0ba7c81-f9b1-4e99-a4d6-efecc5e4312e", + "UserId": "f69dd1a9-591f-4004-b950-264238663bf0", + "DisplayName": "INC00401", + "Summary": "Teams Telefonie ist fuer Standort Sued offline", + "UserDisplayName": "Ottmann, Thomas", + "UserAccount": "TO011", + "UserDomain": "CONTOSO", + "StatusId": "New" + }, + { + "TicketId": "a8deb50d-9f15-4371-9ebc-a28791f27d5c", + "UserId": "76f86d28-862c-4fa2-9062-8367be7fbd92", + "DisplayName": "INC00402", + "Summary": "SharePoint Bereich Vertrieb laedt extrem langsam", + "UserDisplayName": "Virtual, Vera", + "UserAccount": "VV004", + "UserDomain": "CONTOSO", + "StatusId": "New" + } + ], + "Role": [ + { + "TicketId": "fe15284f-f553-4434-8b59-7d8b9f481bf7", + "UserId": "deece196-d8b6-4a9c-a2b9-3c2ae9c6d4ec", + "DisplayName": "INC00403", + "Summary": "Firewall Cluster meldet Sync Fehler", + "UserDisplayName": "Seifert, Dominik", + "UserAccount": "DS014", + "UserDomain": "CONTOSO", + "StatusId": "New" + }, + { + "TicketId": "9cdddacf-9395-476b-811a-09c5f1491d4b", + "UserId": "436e8d67-1b9b-4b1a-83e9-0b1e8fa0173b", + "DisplayName": "INC00404", + "Summary": "CRM Anmeldung liefert Timeout fuer Kundencenter", + "UserDisplayName": "Anwender, Peter", + "UserAccount": "PA010", + "UserDomain": "CONTOSO", + "StatusId": "New" + } + ] + }, + "IncidentActive": { + "Personal": [ + { + "TicketId": "7e852bb9-420b-4caa-b79a-9178d793fc06", + "UserId": "a2c35ad1-7cc7-4b2b-9aa5-d03fdaecd155", + "DisplayName": "INC00405", + "Summary": "Windows Rollout haengt auf mehreren Clients", + "UserDisplayName": "Kiefer, Maximilian", + "UserAccount": "MK009", + "UserDomain": "CONTOSO", + "StatusId": "InProgress" + }, + { + "TicketId": "3c3c70cf-5c60-4ecc-9313-b5f9c1968fc7", + "UserId": "a2164ecd-791f-482c-bea3-f089f14bec8a", + "DisplayName": "INC00406", + "Summary": "Remotedesktop Sitzung trennt nach wenigen Minuten", + "UserDisplayName": "Busch, Andrea", + "UserAccount": "AB014", + "UserDomain": "CONTOSO", + "StatusId": "InProgress" + } + ], + "Role": [ + { + "TicketId": "486df93d-15b6-41d4-b902-2c1e1838c74b", + "UserId": "deece196-d8b6-4a9c-a2b9-3c2ae9c6d4ec", + "DisplayName": "INC00407", + "Summary": "Firewall Cluster meldet weiterhin Sync Fehler", + "UserDisplayName": "Seifert, Dominik", + "UserAccount": "DS014", + "UserDomain": "CONTOSO", + "StatusId": "InProgress" + }, + { + "TicketId": "86da28b0-013b-4542-bcff-175044d5bb02", + "UserId": "a2164ecd-791f-482c-bea3-f089f14bec8a", + "DisplayName": "INC00408", + "Summary": "Produktionslinie meldet keine Sensordaten", + "UserDisplayName": "Zufall, Rainer", + "UserAccount": "RZ011", + "UserDomain": "CONTOSO", + "StatusId": "InProgress" + }, + { + "TicketId": "a1cf6635-a5c4-4401-b4f0-60b9c65b4d75", + "UserId": "0fad5e21-5a29-44c6-b532-46f862ea8694", + "DisplayName": "INC00409", + "Summary": "Exchange Transportdienst setzt Mails in Warteschlange", + "UserDisplayName": "Hanova, Hans", + "UserAccount": "HH101", + "UserDomain": "CONTOSO", + "StatusId": "InProgress" + } + ] + }, + "IncidentCritical": { + "Personal": [ + { + "TicketId": "9aae7eca-39d7-441e-8b33-5fc6f34765c8", + "UserId": "deece196-d8b6-4a9c-a2b9-3c2ae9c6d4ec", + "DisplayName": "INC00410", + "Summary": "Kuehlung im Rechenzentrum U3 ausgefallen", + "UserDisplayName": "Seifert, Dominik", + "UserAccount": "DS014", + "UserDomain": "CONTOSO", + "StatusId": "InProgress" + } + ], + "Role": [ + { + "TicketId": "9aae7eca-39d7-441e-8b33-5fc6f34765c8", + "UserId": "deece196-d8b6-4a9c-a2b9-3c2ae9c6d4ec", + "DisplayName": "INC00410", + "Summary": "Kuehlung im Rechenzentrum U3 ausgefallen", + "UserDisplayName": "Seifert, Dominik", + "UserAccount": "DS014", + "UserDomain": "CONTOSO", + "StatusId": "InProgress" + }, + { + "TicketId": "130ec52f-dac3-427d-803e-e7cf67e4a744", + "UserId": "f69dd1a9-591f-4004-b950-264238663bf0", + "DisplayName": "INC00411", + "Summary": "Kartenzahlung in den Filialen nicht moeglich", + "UserDisplayName": "Ottmann, Thomas", + "UserAccount": "TO011", + "UserDomain": "CONTOSO", + "StatusId": "InProgress" + }, + { + "TicketId": "b7d22b65-c11e-459c-ac31-5b1c08e4118d", + "UserId": "8c3ca0fb-f18c-4893-ad83-290e6e02f352", + "DisplayName": "INC00412", + "Summary": "Datenbank Cluster benoetigt manuellen Failover", + "UserDisplayName": "Perschmann, Paul", + "UserAccount": "PP201", + "UserDomain": "CONTOSO", + "StatusId": "InProgress" + } + ] + }, + "IncidentNewInfo": { + "Personal": [ + { + "TicketId": "d1a2c544-4f59-4f2b-875f-3621a23d4228", + "UserId": "a2164ecd-791f-482c-bea3-f089f14bec8a", + "DisplayName": "INC00413", + "Summary": "Backup Team hat Rueckfrage zur Sicherung", + "UserDisplayName": "Busch, Andrea", + "UserAccount": "AB014", + "UserDomain": "CONTOSO", + "StatusId": "OnHold" + } + ], + "Role": [ + { + "TicketId": "74846c1b-9a97-420f-8bf2-91e88aa0516a", + "UserId": "436e8d67-1b9b-4b1a-83e9-0b1e8fa0173b", + "DisplayName": "INC00415", + "Summary": "Lieferant bittet um Rueckmeldung zu Offsite Backup", + "UserDisplayName": "Anwender, Peter", + "UserAccount": "PA010", + "UserDomain": "CONTOSO", + "StatusId": "OnHold" + }, + { + "TicketId": "1372b3cf-5d87-4099-ab83-ec0cccf7194e", + "UserId": "a2164ecd-791f-482c-bea3-f089f14bec8a", + "DisplayName": "INC00416", + "Summary": "Fernwartung benoetigt Zugangsdaten zur SPS", + "UserDisplayName": "Zufall, Rainer", + "UserAccount": "RZ011", + "UserDomain": "CONTOSO", + "StatusId": "OnHold" + } + ] + }, + "UnassignedTickets": { + "Personal": [ + { + "TicketId": "e2e49f85-1a81-47e8-935b-d76898c155f6", + "UserId": "76f86d28-862c-4fa2-9062-8367be7fbd92", + "DisplayName": "TCK00414", + "Summary": "Pool Notebook fuer Schulungsteilnehmer fehlt", + "UserDisplayName": "Virtual, Vera", + "UserAccount": "VV004", + "UserDomain": "CONTOSO", + "StatusId": "New" + }, + { + "TicketId": "ebe8818e-b197-411e-b56e-40b77b623ae2", + "UserId": "436e8d67-1b9b-4b1a-83e9-0b1e8fa0173b", + "DisplayName": "TCK00415", + "Summary": "Etikettendrucker im Lager meldet Papierstau", + "UserDisplayName": "Anwender, Peter", + "UserAccount": "PA010", + "UserDomain": "CONTOSO", + "StatusId": "New" + } + ], + "Role": [ + { + "TicketId": "e2e49f85-1a81-47e8-935b-d76898c155f6", + "UserId": "76f86d28-862c-4fa2-9062-8367be7fbd92", + "DisplayName": "TCK00414", + "Summary": "Pool Notebook fuer Schulungsteilnehmer fehlt", + "UserDisplayName": "Virtual, Vera", + "UserAccount": "VV004", + "UserDomain": "CONTOSO", + "StatusId": "New" + }, + { + "TicketId": "ebe8818e-b197-411e-b56e-40b77b623ae2", + "UserId": "436e8d67-1b9b-4b1a-83e9-0b1e8fa0173b", + "DisplayName": "TCK00415", + "Summary": "Etikettendrucker im Lager meldet Papierstau", + "UserDisplayName": "Anwender, Peter", + "UserAccount": "PA010", + "UserDomain": "CONTOSO", + "StatusId": "New" + }, + { + "TicketId": "9e1d5d1b-5a22-430e-99ea-59840257caab", + "UserId": "deece196-d8b6-4a9c-a2b9-3c2ae9c6d4ec", + "DisplayName": "TCK00416", + "Summary": "Ueberwachung meldet sporadische Alarme", + "UserDisplayName": "Seifert, Dominik", + "UserAccount": "DS014", + "UserDomain": "CONTOSO", + "StatusId": "New" + } + ] + }, + "UnassignedTicketsCritical": { + "Personal": [ + { + "TicketId": "9e1d5d1b-5a22-430e-99ea-59840257caab", + "UserId": "deece196-d8b6-4a9c-a2b9-3c2ae9c6d4ec", + "DisplayName": "TCK00416", + "Summary": "Ueberwachung meldet sporadische Alarme", + "UserDisplayName": "Seifert, Dominik", + "UserAccount": "DS014", + "UserDomain": "CONTOSO", + "StatusId": "InProgress" + } + ], + "Role": [ + { + "TicketId": "9e1d5d1b-5a22-430e-99ea-59840257caab", + "UserId": "deece196-d8b6-4a9c-a2b9-3c2ae9c6d4ec", + "DisplayName": "TCK00416", + "Summary": "Ueberwachung meldet sporadische Alarme", + "UserDisplayName": "Seifert, Dominik", + "UserAccount": "DS014", + "UserDomain": "CONTOSO", + "StatusId": "InProgress" + }, + { + "TicketId": "d427dc61-9842-4464-b37a-612878d3de0f", + "UserId": "a2164ecd-791f-482c-bea3-f089f14bec8a", + "DisplayName": "TCK00417", + "Summary": "Produktionsroboter steht nach Not Aus", + "UserDisplayName": "Boss, Bernd", + "UserAccount": "BB003", + "UserDomain": "CONTOSO", + "StatusId": "InProgress" + } + ] + } +} \ No newline at end of file diff --git a/FasdCockpitCommunicationDemo/TicketModel.cs b/FasdCockpitCommunicationDemo/TicketModel.cs index a7a272f..726f451 100644 --- a/FasdCockpitCommunicationDemo/TicketModel.cs +++ b/FasdCockpitCommunicationDemo/TicketModel.cs @@ -48,7 +48,7 @@ namespace FasdCockpitCommunicationDemo public string Description { get; set; } public string DescriptionHtml { get; set; } public int Priority { get; set; } - public string Category { get; set; } //todo: replace with tree structure + public string Category { get; set; } public string ActivityType { get; set; } public string Solution { get; set; } public string SolutionHtml { get; set; } diff --git a/FasdCockpitCommunicationDemo/TicketOverviewRelationDefinition.cs b/FasdCockpitCommunicationDemo/TicketOverviewRelationDefinition.cs new file mode 100644 index 0000000..b98e0f6 --- /dev/null +++ b/FasdCockpitCommunicationDemo/TicketOverviewRelationDefinition.cs @@ -0,0 +1,16 @@ +using System; + +namespace FasdCockpitCommunicationDemo +{ + public class TicketOverviewRelationDefinition + { + public Guid TicketId { get; set; } + public Guid UserId { get; set; } + public string DisplayName { get; set; } + public string Summary { get; set; } + public string StatusId { get; set; } + public string UserDisplayName { get; set; } + public string UserAccount { get; set; } + public string UserDomain { get; set; } + } +} diff --git a/FasdDesktopUi/AppStartUp.cs b/FasdDesktopUi/AppStartUp.cs index 67ae888..b656072 100644 --- a/FasdDesktopUi/AppStartUp.cs +++ b/FasdDesktopUi/AppStartUp.cs @@ -669,11 +669,11 @@ namespace FasdDesktopUi { userInfo = cFasdCockpitCommunicationBase.CockpitUserInfo; } - if (!string.IsNullOrEmpty(cCockpitConfiguration.Instance?.m42ServerConfiguration?.Server)) - if (userInfo?.possibleLogons != null) - { - if (userInfo.possibleLogons.Contains(enumAdditionalAuthentication.M42WinLogon)) - { + if (cFasdCockpitConfig.Instance.HasM42Configuration()) + if (userInfo?.possibleLogons != null) + { + if (userInfo.possibleLogons.Contains(enumAdditionalAuthentication.M42WinLogon)) + { if (App.M42OptionMenuItem != null) { App.M42OptionMenuItem.Visible = true; diff --git a/FasdDesktopUi/Basics/Services/SupportCase/Controllers/SupportCaseController.cs b/FasdDesktopUi/Basics/Services/SupportCase/Controllers/SupportCaseController.cs index 6f46f2d..2913f97 100644 --- a/FasdDesktopUi/Basics/Services/SupportCase/Controllers/SupportCaseController.cs +++ b/FasdDesktopUi/Basics/Services/SupportCase/Controllers/SupportCaseController.cs @@ -110,6 +110,9 @@ namespace FasdDesktopUi.Basics.Services.SupportCase.Controllers { try { + if (_focusedRelation == relation) + return; + _selectedHealthcard = _supportCaseProcessor.GetHealthcardFor(relation); HashSet requiredTables = cHealthCard.GetRequiredTables(_selectedHealthcard); _ = Task.Run(async () => await _supportCaseProcessor.LoadSupportCaseDataAsync(relation, requiredTables)); diff --git a/FasdDesktopUi/Basics/Services/SupportCase/SupportCase.cs b/FasdDesktopUi/Basics/Services/SupportCase/SupportCase.cs index 5cc391b..f17c06c 100644 --- a/FasdDesktopUi/Basics/Services/SupportCase/SupportCase.cs +++ b/FasdDesktopUi/Basics/Services/SupportCase/SupportCase.cs @@ -16,6 +16,8 @@ namespace FasdDesktopUi.Basics.Services.SupportCase private readonly Dictionary> _supportCaseDataCache = new Dictionary>(); private readonly Dictionary _rawDataCache = new Dictionary(); // todo remove, currently only used for SupportCaseDataProviderArtifact + private readonly ICollection _relationsCurrentlyLoadingData = new HashSet(); + internal readonly Guid Id; private readonly IRelationService _relationService; public cSupportCaseDataProvider SupportCaseDataProviderArtifact { get; } @@ -65,19 +67,18 @@ namespace FasdDesktopUi.Basics.Services.SupportCase if (relations is null) return; - foreach (var relationType in relations) - { - //TODO Max fragen obs passt! Bug: in den Ticketrelations (Header Ticketauswahl) sind nur zwei Tickets sichtbar anstatt 5 oder mehr.. - if (_caseRelations.TryGetValue(relationType.Key, out var caseRelation)) - _caseRelations[relationType.Key] = caseRelation.Union(relationType).ToList(); - else - _caseRelations.Add(relationType.Key, relationType.ToList()); - - if (SupportCaseDataProviderArtifact?.CaseRelations?.TryGetValue(relationType.Key, out var caseRelations) ?? false) - SupportCaseDataProviderArtifact.CaseRelations[relationType.Key] = caseRelations.Union(relationType).ToList(); - else - SupportCaseDataProviderArtifact?.CaseRelations?.Add(relationType.Key, relationType.ToList()); - } + foreach (var relationType in relations) + { + if (_caseRelations.TryGetValue(relationType.Key, out var caseRelation)) + caseRelation = caseRelation.Union(relationType).ToList(); + else + _caseRelations.Add(relationType.Key, relationType.ToList()); + + if (SupportCaseDataProviderArtifact?.CaseRelations?.TryGetValue(relationType.Key, out var caseRelations) ?? false) + caseRelations = caseRelations.Union(relationType).ToList(); + else + SupportCaseDataProviderArtifact?.CaseRelations?.Add(relationType.Key, relationType.ToList()); + } CaseRelationsAdded?.Invoke(this, new RelationEventArgs() { Relations = relations }); } @@ -91,6 +92,11 @@ namespace FasdDesktopUi.Basics.Services.SupportCase { try { + if (_relationsCurrentlyLoadingData.Contains(relation)) + return; + + _relationsCurrentlyLoadingData.Add(relation); + cF4SDHealthCardRawData rawData = null; // todo this is only a temporary fix. Currently the tablesToLoad contain also detail tables @@ -131,11 +137,17 @@ namespace FasdDesktopUi.Basics.Services.SupportCase .Where(table => table.Key.StartsWith("Computation_") == false) .All(table => !table.Value.IsIncomplete && !table.Value.Columns.Values.Any(c => c.IsIncomplete)) ?? false; } + + SupportCaseDataProviderArtifact.HealthCardDataHelper.LoadingHelper.LastDataRequest = DateTime.Now; } catch (Exception ex) { LogException(ex); } + finally + { + _relationsCurrentlyLoadingData.Remove(relation); + } bool IsRawDataCacheComplete() { @@ -236,12 +248,12 @@ namespace FasdDesktopUi.Basics.Services.SupportCase table.IsIncomplete = true; - foreach (var column in table.Columns.Values) - { - if (column.Values != null && column.Values.Count > 0) - column.Values[0] = null; - column.IsIncomplete = true; - } + foreach (var column in table.Columns.Values) + { + if (column.Values != null && column.Values.Count > 0) + column.Values[0] = null; + column.IsIncomplete = true; + } invalidatedTables.Add(table); } @@ -253,12 +265,12 @@ namespace FasdDesktopUi.Basics.Services.SupportCase { table.IsIncomplete = true; - foreach (var column in table.Columns.Values) - { - if (column.Values != null && column.Values.Count > 0) - column.Values[0] = null; - column.IsIncomplete = true; - } + foreach (var column in table.Columns.Values) + { + if (column.Values != null && column.Values.Count > 0) + column.Values[0] = null; + column.IsIncomplete = true; + } } } catch (Exception ex) diff --git a/FasdDesktopUi/Basics/Services/SupportCase/SupportCaseProcessor.cs b/FasdDesktopUi/Basics/Services/SupportCase/SupportCaseProcessor.cs index 8f55dfa..0f4fd51 100644 --- a/FasdDesktopUi/Basics/Services/SupportCase/SupportCaseProcessor.cs +++ b/FasdDesktopUi/Basics/Services/SupportCase/SupportCaseProcessor.cs @@ -140,6 +140,9 @@ namespace FasdDesktopUi.Basics.Services.SupportCase { var status = enumActualizeStatus.unknown; + if (!agentUserId.HasValue && !agentDeviceId.HasValue) + return status; + try { TimeSpan refreshDelay = TimeSpan.FromMilliseconds(500); diff --git a/FasdDesktopUi/Basics/SupportCaseDataProvider.cs b/FasdDesktopUi/Basics/SupportCaseDataProvider.cs index 5c4bf4b..5146895 100644 --- a/FasdDesktopUi/Basics/SupportCaseDataProvider.cs +++ b/FasdDesktopUi/Basics/SupportCaseDataProvider.cs @@ -6,8 +6,7 @@ using System.Windows; using System.Windows.Documents; using System.Linq; using System.Windows.Input; -using System.Diagnostics; -using System.Windows.Threading; +using System.Diagnostics; using C4IT.FASD.Base; using C4IT.Logging; @@ -103,19 +102,19 @@ namespace FasdDesktopUi.Basics QuickActionProtocollHelper = new cQuickActionProtocollHelper(this); } - public static async Task GetDataProviderForAsync(cF4sdApiSearchResultRelation selectedRelation, IRelationService relationService) - { - try - { - if (selectedRelation == null) - { - Debug.Assert(true, "The selected relation must not be null here!"); - LogEntry("The selected relation must not be null here!", LogLevels.Error); - return null; - } - - // get the identities of the selected relation - var Identities = selectedRelation.Identities.Clone(); + public static async Task GetDataProviderForAsync(cF4sdApiSearchResultRelation selectedRelation, IRelationService relationService) + { + try + { + if (selectedRelation == null) + { + Debug.Assert(true, "The selected relation must not be null here!"); + LogEntry("The selected relation must not be null here!", LogLevels.Error); + return null; + } + + // get the identities of the selected relation + var Identities = selectedRelation.Identities.Clone(); // get the main indentities from all identites (normally this is the user, in a special case, where a computer was searched and found without any user activities, it could be the computer) var MainIdentity = Identities.FirstOrDefault(identity => identity.Class == enumFasdInformationClass.User); @@ -150,17 +149,15 @@ namespace FasdDesktopUi.Basics cSupportCaseDataProvider.CurrentProvider = null; } - if (!DataProviders.TryGetValue(MainIdentity.Id, out var _result)) - { - _result = new cSupportCaseDataProvider(); - DataProviders.Add(MainIdentity.Id, _result); - } - - //await EnsureSupportCasePagesAsync(); - - _result.NamedParameterEntries = new cNamedParameterList(_result); - - _result.StartCase(MainIdentity.Id); + if (!DataProviders.TryGetValue(MainIdentity.Id, out var _result)) + { + _result = new cSupportCaseDataProvider(); + DataProviders.Add(MainIdentity.Id, _result); + } + + _result.NamedParameterEntries = new cNamedParameterList(_result); + + _result.StartCase(MainIdentity.Id); var supportCase = SupportCaseFactory.Get(MainIdentity, relationService, _result); var supportCaseProcessor = SupportCaseProcessorFactory.Get(MainIdentity.Id); @@ -169,14 +166,8 @@ namespace FasdDesktopUi.Basics supportCaseProcessor.SetSupportCase(supportCase); supportCaseController.SetSupportCaseProcessor(supportCaseProcessor, Identities); - if (cSupportCaseDataProvider.detailsPage == null || cSupportCaseDataProvider.slimPage == null) - { - LogEntry("Support case pages are not initialized; aborting case start.", LogLevels.Error); - return null; - } - - cSupportCaseDataProvider.detailsPage.SetSupportCaseController(supportCaseController); - cSupportCaseDataProvider.slimPage.SetSupportCaseController(supportCaseController); + cSupportCaseDataProvider.detailsPage.SetSupportCaseController(supportCaseController); + cSupportCaseDataProvider.slimPage.SetSupportCaseController(supportCaseController); var Status = await _result.SetViewDataAsync(requiredInformationClasses, Identities, true); @@ -204,7 +195,7 @@ namespace FasdDesktopUi.Basics { cSupportCaseDataProvider.slimPage.Show(); cSupportCaseDataProvider.detailsPage?.Hide(); - } + } return _result; } @@ -239,11 +230,11 @@ namespace FasdDesktopUi.Basics return selectedRelation; } - public void StartCase(Guid userId) - { - var CM = MethodBase.GetCurrentMethod(); - LogMethodBegin(CM); - try + public void StartCase(Guid userId) + { + var CM = MethodBase.GetCurrentMethod(); + LogMethodBegin(CM); + try { lock (caseIdLockObject) { @@ -283,28 +274,11 @@ namespace FasdDesktopUi.Basics { LogException(E); } - finally - { - LogMethodEnd(CM); - } - } - - private static async Task EnsureSupportCasePagesAsync() - { - if (detailsPage != null && slimPage != null) - return; - - if (Application.Current == null) - return; - - await Application.Current.Dispatcher.InvokeAsync(() => - { - if (slimPage == null) - slimPage = new Pages.SlimPage.SlimPageView(); - if (detailsPage == null) - detailsPage = new Pages.DetailsPage.DetailsPageView(); - }, DispatcherPriority.Normal); - } + finally + { + LogMethodEnd(CM); + } + } public async Task CloseCaseAsync() { diff --git a/FasdDesktopUi/Basics/UserControls/Badge.xaml b/FasdDesktopUi/Basics/UserControls/Badge.xaml index d726782..c85f5f4 100644 --- a/FasdDesktopUi/Basics/UserControls/Badge.xaml +++ b/FasdDesktopUi/Basics/UserControls/Badge.xaml @@ -10,7 +10,7 @@ d:DesignWidth="40" x:Name="BadgeControl"> - diff --git a/FasdDesktopUi/Basics/UserControls/Badge.xaml.cs b/FasdDesktopUi/Basics/UserControls/Badge.xaml.cs index 0146113..8c095aa 100644 --- a/FasdDesktopUi/Basics/UserControls/Badge.xaml.cs +++ b/FasdDesktopUi/Basics/UserControls/Badge.xaml.cs @@ -1,9 +1,5 @@ -using F4SD_AdaptableIcon; -using FasdDesktopUi.Basics.Helper; -using System; -using System.Windows; +using System.Windows; using System.Windows.Controls; -using static C4IT.Logging.cLogManager; namespace FasdDesktopUi.Basics.UserControls { diff --git a/FasdDesktopUi/Pages/DetailsPage/DetailsPageView.xaml.cs b/FasdDesktopUi/Pages/DetailsPage/DetailsPageView.xaml.cs index 3410c29..8735bda 100644 --- a/FasdDesktopUi/Pages/DetailsPage/DetailsPageView.xaml.cs +++ b/FasdDesktopUi/Pages/DetailsPage/DetailsPageView.xaml.cs @@ -390,6 +390,7 @@ namespace FasdDesktopUi.Pages.DetailsPage BlurInvoker.BlurInvokerVisibilityChanged += (obj, e) => UpdateBlurStatus(obj); NavigationHeadingUc.HeadingIconClickedEvent += NavigationHeadingUc_HeadingIconClickedEvent; + NavigationHeadingUc.EmptySpaceClicked += (obj, e) => BlurBorder_Click(); RefreshControl.RefreshButtonClicked += RefreshButtonClickedEvent; diff --git a/FasdDesktopUi/Pages/DetailsPage/UserControls/DetailsPageNavigationHeading.xaml b/FasdDesktopUi/Pages/DetailsPage/UserControls/DetailsPageNavigationHeading.xaml index 29a91f2..5bb511f 100644 --- a/FasdDesktopUi/Pages/DetailsPage/UserControls/DetailsPageNavigationHeading.xaml +++ b/FasdDesktopUi/Pages/DetailsPage/UserControls/DetailsPageNavigationHeading.xaml @@ -23,6 +23,15 @@ Handler="HeadingIcon_TouchDown" /> + +