aktueller Stand
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using C4IT.FASD.Base;
|
using C4IT.FASD.Base;
|
||||||
using C4IT.Logging;
|
using C4IT.Logging;
|
||||||
using FasdDesktopUi.Basics;
|
using FasdDesktopUi.Basics;
|
||||||
@@ -19,10 +20,8 @@ namespace FasdDesktopUi.Basics.Helper
|
|||||||
if (ticketConfig == null)
|
if (ticketConfig == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var isIncident = IsIncidentRelation(relation, out var activityType);
|
var activityType = GetActivityType(relation);
|
||||||
var openExternally = isIncident
|
var openExternally = ShouldOpenExternally(ticketConfig, activityType);
|
||||||
? ticketConfig.OpenIncidentsExternally
|
|
||||||
: ticketConfig.OpenTicketsExternally;
|
|
||||||
|
|
||||||
if (!openExternally)
|
if (!openExternally)
|
||||||
return false;
|
return false;
|
||||||
@@ -42,17 +41,75 @@ namespace FasdDesktopUi.Basics.Helper
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static bool IsIncidentRelation(cF4sdApiSearchResultRelation relation, out string activityType)
|
private static string GetActivityType(cF4sdApiSearchResultRelation relation)
|
||||||
{
|
{
|
||||||
activityType = null;
|
|
||||||
|
|
||||||
if (relation?.Infos != null && relation.Infos.TryGetValue("ActivityType", out var activityTypeValue))
|
if (relation?.Infos != null && relation.Infos.TryGetValue("ActivityType", out var activityTypeValue))
|
||||||
activityType = activityTypeValue;
|
return activityTypeValue;
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(activityType))
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool ShouldOpenExternally(cF4sdTicketConfig ticketConfig, string activityType)
|
||||||
|
{
|
||||||
|
if (ticketConfig == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return activityType.IndexOf("Incident", StringComparison.OrdinalIgnoreCase) >= 0;
|
if (TryGetOverride(ticketConfig.OpenActivitiesExternallyOverrides, activityType, out var overrideValue))
|
||||||
|
return overrideValue;
|
||||||
|
|
||||||
|
return ticketConfig.OpenActivitiesExternally;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool TryGetOverride(IEnumerable<string> overrides, string activityType, out bool value)
|
||||||
|
{
|
||||||
|
value = false;
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(activityType) || overrides == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
foreach (var entry in overrides)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(entry))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var parts = entry.Split(new[] { '=' }, 2, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
if (parts.Length != 2)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var typeName = parts[0].Trim();
|
||||||
|
if (!string.Equals(typeName, activityType, StringComparison.OrdinalIgnoreCase))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!TryParseBool(parts[1], out value))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool TryParseBool(string value, out bool result)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
if (string.IsNullOrWhiteSpace(value))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
switch (value.Trim().ToLowerInvariant())
|
||||||
|
{
|
||||||
|
case "true":
|
||||||
|
case "1":
|
||||||
|
case "yes":
|
||||||
|
result = true;
|
||||||
|
return true;
|
||||||
|
case "false":
|
||||||
|
case "0":
|
||||||
|
case "no":
|
||||||
|
result = false;
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return bool.TryParse(value, out result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static string BuildTicketDeepLink(Guid ticketId, string activityType)
|
internal static string BuildTicketDeepLink(Guid ticketId, string activityType)
|
||||||
|
|||||||
@@ -140,8 +140,8 @@ namespace FasdDesktopUi.Basics.Services.SupportCase
|
|||||||
{
|
{
|
||||||
return tablesToLoad.All(t =>
|
return tablesToLoad.All(t =>
|
||||||
_rawDataCache.TryGetValue(relation, out var cachedRawData)
|
_rawDataCache.TryGetValue(relation, out var cachedRawData)
|
||||||
&& cachedRawData.Tables.TryGetValue(t, out var cachedTable)
|
&& (cachedRawData?.Tables?.TryGetValue(t, out var cachedTable) ?? false)
|
||||||
&& !cachedTable.IsIncomplete && !cachedTable.Columns.Values.Any(c => c.IsIncomplete)
|
&& cachedTable != null && !cachedTable.IsIncomplete && !cachedTable.Columns.Values.Any(c => c.IsIncomplete)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ namespace FasdDesktopUi.Basics
|
|||||||
if (relationToFocus is null)
|
if (relationToFocus is null)
|
||||||
return selectedRelation;
|
return selectedRelation;
|
||||||
|
|
||||||
relationToFocus.Identities = selectedRelation.Identities;
|
relationToFocus.Identities = selectedRelation.Identities.Clone();
|
||||||
return relationToFocus;
|
return relationToFocus;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -672,7 +672,6 @@ namespace FasdDesktopUi.Basics
|
|||||||
ComputerRemoved |= relationIdentity.Class == enumFasdInformationClass.Computer;
|
ComputerRemoved |= relationIdentity.Class == enumFasdInformationClass.Computer;
|
||||||
ComputerAdded |= relationIdentity.Class == enumFasdInformationClass.Computer;
|
ComputerAdded |= relationIdentity.Class == enumFasdInformationClass.Computer;
|
||||||
}
|
}
|
||||||
relationIdentity.CopyTo(existingIdentity);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -153,7 +153,7 @@
|
|||||||
|
|
||||||
<UIItem Name="StartUp.SplashScreen.NoAuthorization">
|
<UIItem Name="StartUp.SplashScreen.NoAuthorization">
|
||||||
<Language Lang="EN">User is not authorized for Cockpit usage</Language>
|
<Language Lang="EN">User is not authorized for Cockpit usage</Language>
|
||||||
<Language Lang="DE">Nutzer ist nicht für die Cockpit-Nutzung authorisiert</Language>
|
<Language Lang="DE">Nutzer ist nicht für die Cockpit-Nutzung autorisiert</Language>
|
||||||
</UIItem>
|
</UIItem>
|
||||||
|
|
||||||
<UIItem Name="StartUp.SplashScreen.InitAppComponents">
|
<UIItem Name="StartUp.SplashScreen.InitAppComponents">
|
||||||
@@ -280,7 +280,7 @@
|
|||||||
|
|
||||||
<UIItem Name="Searchbar.Status.Unauthorized">
|
<UIItem Name="Searchbar.Status.Unauthorized">
|
||||||
<Language Lang="EN">Not authorized</Language>
|
<Language Lang="EN">Not authorized</Language>
|
||||||
<Language Lang="DE">Nicht authorisiert</Language>
|
<Language Lang="DE">Nicht autorisiert</Language>
|
||||||
</UIItem>
|
</UIItem>
|
||||||
|
|
||||||
<UIItem Name="Searchbar.Placeholder">
|
<UIItem Name="Searchbar.Placeholder">
|
||||||
|
|||||||
Reference in New Issue
Block a user