feat: expand cockpit integrations and support workflows
Add Phoenix remote desktop, action connector, documentation engine, and gamification support. Refactor support-case processing and search/action UI, and update installer assets and dependencies.
This commit is contained in:
@@ -54,7 +54,7 @@
|
||||
param(
|
||||
$ComputerName = "",
|
||||
$AI_Prompt = "how can this be fixed? Answer in german",
|
||||
$AI_Key = "AIzaSyCotStXy-4lkxCc5ii4NtQEG-jJM6Cnzkc"
|
||||
$AI_Key = "AIzaSyBhXz8EU0jTyaZ4e_CLJB5mn7SMPjlJrSw"
|
||||
)
|
||||
$ServerAddress = $env:COMPUTERNAME
|
||||
$ServerPort = 7000
|
||||
@@ -70,22 +70,22 @@
|
||||
|
||||
# get the execution directory
|
||||
$dirExe = $PSScriptRoot
|
||||
if (-not (Test-Path -Path "$dirExe\Phoenix.Viewer\Phoenix.Viewer.exe" -PathType Leaf))
|
||||
if (-not (Test-Path -Path "$env:ProgramFiles\EgoMind\Phoenix\Viewer\Phoenix.Viewer.exe" -PathType Leaf))
|
||||
{
|
||||
$dirExe = (Get-Location).Path
|
||||
$dirExe = "$dirExe\PhoenixDemo"
|
||||
}
|
||||
if (-not (Test-Path -Path "$dirExe\Phoenix.Viewer\Phoenix.Viewer.exe" -PathType Leaf))
|
||||
if (-not (Test-Path -Path "$env:ProgramFiles\EgoMind\Phoenix\Viewer\Phoenix.Viewer.exe" -PathType Leaf))
|
||||
{
|
||||
exit(1)
|
||||
}
|
||||
|
||||
# save server address to config file
|
||||
$jsonConfig = Get-Content "$dirExe\Phoenix.Viewer\appSettings.json" | ConvertFrom-Json
|
||||
$jsonConfig = Get-Content "$env:ProgramFiles\EgoMind\Phoenix\Viewer\appSettings.json" | ConvertFrom-Json
|
||||
$jsonConfig.HostOptions.Host = "http://${ServerAddress}:${ServerPort}"
|
||||
$jsonConfig.AIOptions.Prompt = $AI_Prompt
|
||||
$jsonConfig.AIOptions.ApiKey = $AI_Key
|
||||
$jsonConfig | ConvertTo-Json -depth 100 | Out-File "$dirExe\Phoenix.Viewer\appSettings.json" -Encoding utf8
|
||||
$jsonConfig | ConvertTo-Json -depth 100 | Out-File "$env:ProgramFiles\EgoMind\Phoenix\Viewer\appSettings.json" -Encoding utf8
|
||||
|
||||
# define the argumet list
|
||||
$args = @("--config appSettings.json")
|
||||
@@ -95,7 +95,7 @@
|
||||
}
|
||||
|
||||
# start the viewer
|
||||
$procViewer = Start-Process -WorkingDirectory "$dirExe\Phoenix.Viewer" -WindowStyle Normal -FilePath "$dirExe\Phoenix.Viewer\Phoenix.Viewer.exe" -PassThru -ArgumentList $args
|
||||
$procViewer = Start-Process -WorkingDirectory "$env:ProgramFiles\EgoMind\Phoenix\Viewer" -WindowStyle Normal -FilePath "$env:ProgramFiles\EgoMind\Phoenix\Viewer\Phoenix.Viewer.exe" -PassThru -ArgumentList $args
|
||||
|
||||
# get & resize the viewer main window
|
||||
add-type -typedefinition "using System;`n using System.Runtime.InteropServices;`n public class Windows { [DllImport(`"user32.dll`")] [return: MarshalAs(UnmanagedType.Bool)] public extern static bool MoveWindow(IntPtr handle, int x, int y, int width, int height, bool redraw); }"
|
||||
@@ -500,7 +500,7 @@
|
||||
</QuickAction-Demo>
|
||||
|
||||
|
||||
<QuickAction-Demo InformationClass="VirtuelSession" Name="Session Logoff" Section="Citrix" RunImmediate="false" CheckNamedParameter="VirtualSessionStatus" SimulatedClientConnect="1" SimulatedRuntime="1">
|
||||
<QuickAction-Demo InformationClass="VirtualSession" Name="Session Logoff" Section="Citrix" RunImmediate="false" CheckNamedParameter="VirtualSessionStatus" SimulatedClientConnect="1" SimulatedRuntime="1">
|
||||
<Name Lang="DE">Session abmelden</Name>
|
||||
<Icon IconType="material" Name="ic_vpn_key" />
|
||||
<CheckNamedParameterValues>
|
||||
@@ -508,7 +508,7 @@
|
||||
</CheckNamedParameterValues>
|
||||
<DemoResult Result="finished">[{"":"Erfolgreich von Session abgemeldet"}]</DemoResult>
|
||||
</QuickAction-Demo>
|
||||
<QuickAction-Demo InformationClass="VirtuelSession" Name="Session Hidden" Section="Citrix" RunImmediate="false" CheckNamedParameter="VirtualSessionStatus" SimulatedClientConnect="1" SimulatedRuntime="1">
|
||||
<QuickAction-Demo InformationClass="VirtualSession" Name="Session Hidden" Section="Citrix" RunImmediate="false" CheckNamedParameter="VirtualSessionStatus" SimulatedClientConnect="1" SimulatedRuntime="1">
|
||||
<Name Lang="DE">Session verstecken</Name>
|
||||
<Icon IconType="material" Name="ic_vpn_key" />
|
||||
<CheckNamedParameterValues>
|
||||
@@ -516,7 +516,7 @@
|
||||
</CheckNamedParameterValues>
|
||||
<DemoResult Result="finished">[{"":"Session erfolgreich versteckt"}]</DemoResult>
|
||||
</QuickAction-Demo>
|
||||
<QuickAction-Demo InformationClass="VirtuelSession" Name="Send message to Session" Section="Citrix" RunImmediate="false" CheckNamedParameter="VirtualSessionStatus" SimulatedClientConnect="1" SimulatedRuntime="1">
|
||||
<QuickAction-Demo InformationClass="VirtualSession" Name="Send message to Session" Section="Citrix" RunImmediate="false" CheckNamedParameter="VirtualSessionStatus" SimulatedClientConnect="1" SimulatedRuntime="1">
|
||||
<Name Lang="DE">Sende Nachricht an Session</Name>
|
||||
<Icon IconType="material" Name="ic_vpn_key" />
|
||||
<CheckNamedParameterValues>
|
||||
@@ -526,7 +526,7 @@
|
||||
</QuickAction-Demo>
|
||||
|
||||
|
||||
<QuickAction-Demo InformationClass="VirtuelSession" Name="Session Hidden" Section="Citrix" RunImmediate="false" CheckNamedParameter="VirtualSessionStatus" SimulatedClientConnect="1" SimulatedRuntime="1">
|
||||
<QuickAction-Demo InformationClass="VirtualSession" Name="Session Hidden" Section="Citrix" RunImmediate="false" CheckNamedParameter="VirtualSessionStatus" SimulatedClientConnect="1" SimulatedRuntime="1">
|
||||
<Name Lang="DE">Session verstecken</Name>
|
||||
<Icon IconType="material" Name="ic_vpn_key" />
|
||||
<CheckNamedParameterValues>
|
||||
@@ -534,7 +534,7 @@
|
||||
</CheckNamedParameterValues>
|
||||
<DemoResult Result="finished">[{"":"Session erfolgreich versteckt"}]</DemoResult>
|
||||
</QuickAction-Demo>
|
||||
<QuickAction-Demo InformationClass="VirtuelSession" Name="Send message to Session" Section="Citrix" RunImmediate="false" CheckNamedParameter="VirtualSessionStatus" SimulatedClientConnect="1" SimulatedRuntime="1">
|
||||
<QuickAction-Demo InformationClass="VirtualSession" Name="Send message to Session" Section="Citrix" RunImmediate="false" CheckNamedParameter="VirtualSessionStatus" SimulatedClientConnect="1" SimulatedRuntime="1">
|
||||
<Name Lang="DE">Sende Nachricht an Session</Name>
|
||||
<Icon IconType="material" Name="ic_vpn_key" />
|
||||
<CheckNamedParameterValues>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<xs:enumeration value="User" />
|
||||
<xs:enumeration value="Computer" />
|
||||
<xs:enumeration value="Ticket" />
|
||||
<xs:enumeration value="VirtuelSession" />
|
||||
<xs:enumeration value="VirtualSession" />
|
||||
<xs:enumeration value="MobileDevice" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
@@ -197,6 +197,16 @@
|
||||
</xs:attribute>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:element name="QuickAction-Native" substitutionGroup="QuickAction">
|
||||
<xs:complexType >
|
||||
<xs:complexContent>
|
||||
<xs:extension base="QuickAction">
|
||||
<xs:attribute name="NativeName" type="xs:NCName" use="required" />
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:complexType name="QuickAction-Local" abstract="true">
|
||||
<xs:complexContent>
|
||||
<xs:extension base="QuickAction">
|
||||
@@ -249,7 +259,7 @@
|
||||
<xs:extension base="QuickAction-Remote">
|
||||
<xs:attribute name="Category" use="optional" />
|
||||
<xs:attribute name="Action" use="optional" />
|
||||
<xs:attribute name="ParamaterType" use="optional" />
|
||||
<xs:attribute name="ParameterType" use="optional" />
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.13.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
@@ -73,7 +73,7 @@
|
||||
<Compile Include="F4SDCockpitCommunicationDemo.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="TicketModel.cs" />
|
||||
<Compile Include="TicketOverviewDataStore.cs" />
|
||||
<Compile Include="TicketOverviewDataStore.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\F4SD-Logging\F4SD-Logging.csproj">
|
||||
@@ -115,12 +115,12 @@
|
||||
<SubType>Designer</SubType>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Config\F4SD-MenuSection-Configuration.xml">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Config\F4SD-QuickAction-Configuration.xml">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Config\F4SD-MenuSection-Configuration.xml">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Config\F4SD-QuickAction-Configuration.xml">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<None Include="app.config" />
|
||||
<None Include="Config\F4SD-CopyTemplate-Configuration.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
@@ -164,9 +164,9 @@
|
||||
<None Include="MockupData\Virtuell, Vera.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="MockupTicketOverview\TicketOverviewGeneratedTickets.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="MockupTicketOverview\TicketOverviewGeneratedTickets.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="MockupPickup\M42Wpm-Pickup-ObjectStateReason.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
@@ -245,12 +245,12 @@
|
||||
<None Include="MockupPickup\M42Wpm-Ticket-CloseCase-Services.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="MockupPickup\M42Wpm-Ticket-QuickCalls.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="MockupPickup\M42Wpm-Ticket-Categories.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="MockupPickup\M42Wpm-Ticket-QuickCalls.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="MockupPickup\M42Wpm-Ticket-Categories.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -269,4 +269,4 @@
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>copy "$(ProjectDir)..\..\C4IT FASD\_Common\XmlSchemas\*" "$(ProjectDir)Config"</PreBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
@@ -2,19 +2,19 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading;
|
||||
using System.Diagnostics;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
using FasdCockpitBase.Models;
|
||||
using FasdCockpitCommunicationDemo;
|
||||
using C4IT.FASD.Base;
|
||||
using static C4IT.Logging.cLogManager;
|
||||
using FasdCockpitBase;
|
||||
using C4IT.Logging;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading;
|
||||
using System.Diagnostics;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
using FasdCockpitBase.Models;
|
||||
using FasdCockpitCommunicationDemo;
|
||||
using C4IT.FASD.Base;
|
||||
using static C4IT.Logging.cLogManager;
|
||||
using FasdCockpitBase;
|
||||
using C4IT.Logging;
|
||||
|
||||
|
||||
namespace C4IT.FASD.Cockpit.Communication
|
||||
@@ -23,35 +23,35 @@ namespace C4IT.FASD.Cockpit.Communication
|
||||
{
|
||||
private int ticketCounter = 475;
|
||||
|
||||
private readonly List<cF4SDHealthCardJsonRawData> MockupData = new List<cF4SDHealthCardJsonRawData>();
|
||||
|
||||
private readonly Dictionary<string, cF4SDHealthCardRawData.cHealthCardTable> MockupPickup = new Dictionary<string, cF4SDHealthCardRawData.cHealthCardTable>();
|
||||
|
||||
private readonly Dictionary<string, string> CategoryNameLookup = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
#region Ticketübersicht
|
||||
|
||||
private readonly Dictionary<string, Dictionary<string, List<DemoTicketRecord>>> TicketOverviewRelations =
|
||||
new Dictionary<string, Dictionary<string, List<DemoTicketRecord>>>(StringComparer.OrdinalIgnoreCase);
|
||||
private readonly HashSet<string> _loadedOverviewPlacements = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
private readonly object _demoTicketSync = new object();
|
||||
|
||||
#endregion
|
||||
public cFasdCockpitCommunicationDemo()
|
||||
{
|
||||
if (LoadMockupData(out var loadedData))
|
||||
MockupData = loadedData;
|
||||
|
||||
MockupPickup = LoadMockupPickup();
|
||||
BuildCategoryLookup();
|
||||
LoadGeneratedTickets();
|
||||
}
|
||||
private readonly List<cF4SDHealthCardJsonRawData> MockupData = new List<cF4SDHealthCardJsonRawData>();
|
||||
|
||||
private readonly Dictionary<string, cF4SDHealthCardRawData.cHealthCardTable> MockupPickup = new Dictionary<string, cF4SDHealthCardRawData.cHealthCardTable>();
|
||||
|
||||
private readonly Dictionary<string, string> CategoryNameLookup = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
#region Ticketübersicht
|
||||
|
||||
private readonly Dictionary<string, Dictionary<string, List<DemoTicketRecord>>> TicketOverviewRelations =
|
||||
new Dictionary<string, Dictionary<string, List<DemoTicketRecord>>>(StringComparer.OrdinalIgnoreCase);
|
||||
private readonly HashSet<string> _loadedOverviewPlacements = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
private readonly object _demoTicketSync = new object();
|
||||
|
||||
#endregion
|
||||
public cFasdCockpitCommunicationDemo()
|
||||
{
|
||||
if (LoadMockupData(out var loadedData))
|
||||
MockupData = loadedData;
|
||||
|
||||
MockupPickup = LoadMockupPickup();
|
||||
BuildCategoryLookup();
|
||||
LoadGeneratedTickets();
|
||||
}
|
||||
|
||||
public override bool IsDemo() => true;
|
||||
|
||||
private Dictionary<Guid, cFasdApiSearchResultCollection> SearchCache = new Dictionary<Guid, cFasdApiSearchResultCollection>();
|
||||
|
||||
private Dictionary<string, cF4SDHealthCardRawData.cHealthCardTable> LoadMockupPickup()
|
||||
private Dictionary<string, cF4SDHealthCardRawData.cHealthCardTable> LoadMockupPickup()
|
||||
{
|
||||
var CM = MethodBase.GetCurrentMethod();
|
||||
LogMethodBegin(CM);
|
||||
@@ -64,10 +64,10 @@ namespace C4IT.FASD.Cockpit.Communication
|
||||
|
||||
var sampleDataFiles = Directory.GetFiles(path);
|
||||
|
||||
foreach (var file in sampleDataFiles)
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (var file in sampleDataFiles)
|
||||
{
|
||||
try
|
||||
{
|
||||
string jsonText;
|
||||
using (StreamReader streamReader = new StreamReader(file))
|
||||
{
|
||||
@@ -95,67 +95,67 @@ namespace C4IT.FASD.Cockpit.Communication
|
||||
LogMethodEnd(CM);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void BuildCategoryLookup()
|
||||
{
|
||||
CategoryNameLookup.Clear();
|
||||
|
||||
if (MockupPickup == null || !MockupPickup.TryGetValue("M42Wpm-Ticket-Categories", out var table))
|
||||
return;
|
||||
|
||||
if (table?.Columns == null)
|
||||
return;
|
||||
|
||||
if (!table.Columns.TryGetValue("id", out var idColumn))
|
||||
return;
|
||||
|
||||
if (!table.Columns.TryGetValue("Name", out var nameColumn))
|
||||
return;
|
||||
|
||||
for (int i = 0; i < idColumn.Values.Count; i++)
|
||||
{
|
||||
var id = idColumn.Values[i]?.ToString();
|
||||
if (string.IsNullOrWhiteSpace(id))
|
||||
continue;
|
||||
|
||||
var name = i < nameColumn.Values.Count ? nameColumn.Values[i]?.ToString() : null;
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
continue;
|
||||
|
||||
CategoryNameLookup[id] = name;
|
||||
}
|
||||
}
|
||||
|
||||
private string ResolveCategoryDisplayName(string categoryIdOrName)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(categoryIdOrName))
|
||||
return categoryIdOrName;
|
||||
|
||||
if (!Guid.TryParse(categoryIdOrName, out _))
|
||||
return categoryIdOrName;
|
||||
|
||||
if (CategoryNameLookup.TryGetValue(categoryIdOrName, out var name))
|
||||
return name;
|
||||
|
||||
return categoryIdOrName;
|
||||
}
|
||||
|
||||
#region Ticketübersicht
|
||||
|
||||
private void LoadGeneratedTickets()
|
||||
{
|
||||
try
|
||||
{
|
||||
TicketOverviewRelations.Clear();
|
||||
_loadedOverviewPlacements.Clear();
|
||||
|
||||
var records = TicketOverviewDataStore.LoadTickets();
|
||||
foreach (var record in records)
|
||||
{
|
||||
AppendDemoTicket(record);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void BuildCategoryLookup()
|
||||
{
|
||||
CategoryNameLookup.Clear();
|
||||
|
||||
if (MockupPickup == null || !MockupPickup.TryGetValue("M42Wpm-Ticket-Categories", out var table))
|
||||
return;
|
||||
|
||||
if (table?.Columns == null)
|
||||
return;
|
||||
|
||||
if (!table.Columns.TryGetValue("id", out var idColumn))
|
||||
return;
|
||||
|
||||
if (!table.Columns.TryGetValue("Name", out var nameColumn))
|
||||
return;
|
||||
|
||||
for (int i = 0; i < idColumn.Values.Count; i++)
|
||||
{
|
||||
var id = idColumn.Values[i]?.ToString();
|
||||
if (string.IsNullOrWhiteSpace(id))
|
||||
continue;
|
||||
|
||||
var name = i < nameColumn.Values.Count ? nameColumn.Values[i]?.ToString() : null;
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
continue;
|
||||
|
||||
CategoryNameLookup[id] = name;
|
||||
}
|
||||
}
|
||||
|
||||
private string ResolveCategoryDisplayName(string categoryIdOrName)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(categoryIdOrName))
|
||||
return categoryIdOrName;
|
||||
|
||||
if (!Guid.TryParse(categoryIdOrName, out _))
|
||||
return categoryIdOrName;
|
||||
|
||||
if (CategoryNameLookup.TryGetValue(categoryIdOrName, out var name))
|
||||
return name;
|
||||
|
||||
return categoryIdOrName;
|
||||
}
|
||||
|
||||
#region Ticketübersicht
|
||||
|
||||
private void LoadGeneratedTickets()
|
||||
{
|
||||
try
|
||||
{
|
||||
TicketOverviewRelations.Clear();
|
||||
_loadedOverviewPlacements.Clear();
|
||||
|
||||
var records = TicketOverviewDataStore.LoadTickets();
|
||||
foreach (var record in records)
|
||||
{
|
||||
AppendDemoTicket(record);
|
||||
}
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
@@ -175,49 +175,49 @@ namespace C4IT.FASD.Cockpit.Communication
|
||||
}
|
||||
}
|
||||
|
||||
private void AppendDemoTicket(DemoTicketRecord record)
|
||||
{
|
||||
if (record == null)
|
||||
return;
|
||||
|
||||
lock (_demoTicketSync)
|
||||
{
|
||||
if (record.TicketId == Guid.Empty || string.IsNullOrWhiteSpace(record.TileKey))
|
||||
return;
|
||||
|
||||
var tileKey = record.TileKey.Trim();
|
||||
var scopeKey = record.UseRoleScope ? "Role" : "Personal";
|
||||
var placementKey = $"{record.TicketId:N}|{tileKey}|{scopeKey}";
|
||||
if (!_loadedOverviewPlacements.Add(placementKey))
|
||||
return;
|
||||
|
||||
if (!TicketOverviewRelations.TryGetValue(tileKey, out var scopeDictionary))
|
||||
{
|
||||
scopeDictionary = new Dictionary<string, List<DemoTicketRecord>>(StringComparer.OrdinalIgnoreCase);
|
||||
TicketOverviewRelations[tileKey] = scopeDictionary;
|
||||
}
|
||||
|
||||
if (!scopeDictionary.TryGetValue(scopeKey, out var definitions))
|
||||
{
|
||||
definitions = new List<DemoTicketRecord>();
|
||||
scopeDictionary[scopeKey] = definitions;
|
||||
}
|
||||
|
||||
definitions.Add(record);
|
||||
|
||||
var targetSample = MockupData.FirstOrDefault(data => data.SampleDataId == record.UserId);
|
||||
if (targetSample == null)
|
||||
return;
|
||||
private void AppendDemoTicket(DemoTicketRecord record)
|
||||
{
|
||||
if (record == null)
|
||||
return;
|
||||
|
||||
lock (_demoTicketSync)
|
||||
{
|
||||
if (record.TicketId == Guid.Empty || string.IsNullOrWhiteSpace(record.TileKey))
|
||||
return;
|
||||
|
||||
var tileKey = record.TileKey.Trim();
|
||||
var scopeKey = record.UseRoleScope ? "Role" : "Personal";
|
||||
var placementKey = $"{record.TicketId:N}|{tileKey}|{scopeKey}";
|
||||
if (!_loadedOverviewPlacements.Add(placementKey))
|
||||
return;
|
||||
|
||||
if (!TicketOverviewRelations.TryGetValue(tileKey, out var scopeDictionary))
|
||||
{
|
||||
scopeDictionary = new Dictionary<string, List<DemoTicketRecord>>(StringComparer.OrdinalIgnoreCase);
|
||||
TicketOverviewRelations[tileKey] = scopeDictionary;
|
||||
}
|
||||
|
||||
if (!scopeDictionary.TryGetValue(scopeKey, out var definitions))
|
||||
{
|
||||
definitions = new List<DemoTicketRecord>();
|
||||
scopeDictionary[scopeKey] = definitions;
|
||||
}
|
||||
|
||||
definitions.Add(record);
|
||||
|
||||
var targetSample = MockupData.FirstOrDefault(data => data.SampleDataId == record.UserId);
|
||||
if (targetSample == null)
|
||||
return;
|
||||
|
||||
if (targetSample.Tickets.Any(ticket => ticket.Id == record.TicketId))
|
||||
return;
|
||||
|
||||
var generatedTicket = ConvertToTicket(record);
|
||||
targetSample.Tickets.Add(generatedTicket);
|
||||
}
|
||||
}
|
||||
var generatedTicket = ConvertToTicket(record);
|
||||
targetSample.Tickets.Add(generatedTicket);
|
||||
}
|
||||
}
|
||||
|
||||
private static cF4SDTicket ConvertToTicket(DemoTicketRecord record)
|
||||
private static cF4SDTicketDemo ConvertToTicket(DemoTicketRecord record)
|
||||
{
|
||||
var status = enumTicketStatus.New;
|
||||
if (!string.IsNullOrWhiteSpace(record.StatusId) && Enum.TryParse(record.StatusId, true, out enumTicketStatus parsedStatus))
|
||||
@@ -226,26 +226,26 @@ namespace C4IT.FASD.Cockpit.Communication
|
||||
var detail = record.Detail ?? new DemoTicketDetail();
|
||||
var createdAt = record.CreatedAt == default ? DateTime.UtcNow : record.CreatedAt;
|
||||
|
||||
var ticket = new cF4SDTicket
|
||||
var ticket = new cF4SDTicketDemo
|
||||
{
|
||||
Id = record.TicketId,
|
||||
Name = record.DisplayName,
|
||||
Summary = record.Summary,
|
||||
Status = status,
|
||||
AffectedUser = detail.AffectedUser ?? record.UserDisplayName,
|
||||
Asset = detail.Asset,
|
||||
Category = detail.Category,
|
||||
ActivityType = record.ActivityType,
|
||||
Description = detail.Description,
|
||||
DescriptionHtml = detail.DescriptionHtml,
|
||||
Solution = detail.Solution,
|
||||
SolutionHtml = detail.SolutionHtml,
|
||||
AffectedUser = detail.AffectedUser ?? record.UserDisplayName,
|
||||
Asset = detail.Asset,
|
||||
Category = detail.Category,
|
||||
ActivityType = record.ActivityType,
|
||||
Description = detail.Description,
|
||||
DescriptionHtml = detail.DescriptionHtml,
|
||||
Solution = detail.Solution,
|
||||
SolutionHtml = detail.SolutionHtml,
|
||||
CreationDate = createdAt.ToLocalTime(),
|
||||
CreationDaysSinceNow = Math.Max(0, (int)(DateTime.UtcNow - createdAt).TotalDays),
|
||||
Priority = detail.Priority ?? 0,
|
||||
CreationSource = cF4SDTicket.enumTicketCreationSource.F4SD,
|
||||
CreationSource = cF4SDTicketDemo.enumTicketCreationSource.F4SD,
|
||||
DirectLinks = new Dictionary<string, string>(),
|
||||
JournalItems = new List<cF4SDTicket.cTicketJournalItem>()
|
||||
JournalItems = new List<cF4SDTicketDemo.cTicketJournalItemDemo>()
|
||||
};
|
||||
|
||||
if (detail.Journal != null)
|
||||
@@ -253,7 +253,7 @@ namespace C4IT.FASD.Cockpit.Communication
|
||||
foreach (var entry in detail.Journal)
|
||||
{
|
||||
var journalCreation = entry?.CreationDate ?? createdAt;
|
||||
ticket.JournalItems.Add(new cF4SDTicket.cTicketJournalItem
|
||||
ticket.JournalItems.Add(new cF4SDTicketDemo.cTicketJournalItemDemo
|
||||
{
|
||||
Header = entry.Header,
|
||||
Description = entry.Description,
|
||||
@@ -268,41 +268,41 @@ namespace C4IT.FASD.Cockpit.Communication
|
||||
return ticket;
|
||||
}
|
||||
|
||||
public override Task<Dictionary<string, int>> GetTicketOverviewCounts(IEnumerable<string> keys, bool useRoleScope)
|
||||
{
|
||||
var scopeKey = useRoleScope ? "Role" : "Personal";
|
||||
var comparer = StringComparer.OrdinalIgnoreCase;
|
||||
var result = new Dictionary<string, int>(comparer);
|
||||
|
||||
var requestedKeys = keys == null
|
||||
? TicketOverviewRelations.Keys.ToList()
|
||||
: keys.Where(k => !string.IsNullOrWhiteSpace(k)).Distinct(comparer).ToList();
|
||||
|
||||
if (requestedKeys.Count == 0)
|
||||
requestedKeys.AddRange(TicketOverviewRelations.Keys);
|
||||
|
||||
foreach (var key in requestedKeys)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(key))
|
||||
continue;
|
||||
|
||||
if (TicketOverviewRelations.TryGetValue(key, out var scopeDictionary) &&
|
||||
scopeDictionary != null &&
|
||||
scopeDictionary.TryGetValue(scopeKey, out var definitions) &&
|
||||
definitions != null)
|
||||
{
|
||||
result[key] = definitions.Count;
|
||||
}
|
||||
else
|
||||
{
|
||||
result[key] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return Task.FromResult(result);
|
||||
}
|
||||
|
||||
public override async Task<List<cF4sdApiSearchResultRelation>> GetTicketOverviewRelations(string key, bool useRoleScope, int count)
|
||||
public override Task<Dictionary<string, int>> GetTicketOverviewCounts(IEnumerable<string> keys, bool useRoleScope)
|
||||
{
|
||||
var scopeKey = useRoleScope ? "Role" : "Personal";
|
||||
var comparer = StringComparer.OrdinalIgnoreCase;
|
||||
var result = new Dictionary<string, int>(comparer);
|
||||
|
||||
var requestedKeys = keys == null
|
||||
? TicketOverviewRelations.Keys.ToList()
|
||||
: keys.Where(k => !string.IsNullOrWhiteSpace(k)).Distinct(comparer).ToList();
|
||||
|
||||
if (requestedKeys.Count == 0)
|
||||
requestedKeys.AddRange(TicketOverviewRelations.Keys);
|
||||
|
||||
foreach (var key in requestedKeys)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(key))
|
||||
continue;
|
||||
|
||||
if (TicketOverviewRelations.TryGetValue(key, out var scopeDictionary) &&
|
||||
scopeDictionary != null &&
|
||||
scopeDictionary.TryGetValue(scopeKey, out var definitions) &&
|
||||
definitions != null)
|
||||
{
|
||||
result[key] = definitions.Count;
|
||||
}
|
||||
else
|
||||
{
|
||||
result[key] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return Task.FromResult(result);
|
||||
}
|
||||
|
||||
public override async Task<List<cF4sdApiSearchResultRelation>> GetTicketOverviewRelations(string key, bool useRoleScope, int count)
|
||||
{
|
||||
var CM = MethodBase.GetCurrentMethod();
|
||||
LogMethodBegin(CM);
|
||||
@@ -324,39 +324,39 @@ namespace C4IT.FASD.Cockpit.Communication
|
||||
await SimulateTicketOverviewLatencyAsync(count);
|
||||
return new List<cF4sdApiSearchResultRelation>();
|
||||
}
|
||||
int requestedCount = count <= 0 ? definitions.Count : Math.Min(count, definitions.Count);
|
||||
await SimulateTicketOverviewLatencyAsync(requestedCount);
|
||||
var relations = new List<cF4sdApiSearchResultRelation>(requestedCount);
|
||||
foreach (var definition in definitions.Take(requestedCount))
|
||||
{
|
||||
var detailTicket = FindTicketForOverviewRelation(definition);
|
||||
var summary = definition.Summary ?? string.Empty;
|
||||
if (detailTicket != null && !string.IsNullOrWhiteSpace(detailTicket.Summary))
|
||||
summary = detailTicket.Summary;
|
||||
var activityType = string.IsNullOrWhiteSpace(definition.ActivityType)
|
||||
? null
|
||||
: definition.ActivityType.Trim();
|
||||
|
||||
var relation = new cF4sdApiSearchResultRelation
|
||||
{
|
||||
Type = enumF4sdSearchResultClass.Ticket,
|
||||
DisplayName = definition.DisplayName ?? string.Empty,
|
||||
Name = definition.DisplayName ?? string.Empty,
|
||||
int requestedCount = count <= 0 ? definitions.Count : Math.Min(count, definitions.Count);
|
||||
await SimulateTicketOverviewLatencyAsync(requestedCount);
|
||||
var relations = new List<cF4sdApiSearchResultRelation>(requestedCount);
|
||||
foreach (var definition in definitions.Take(requestedCount))
|
||||
{
|
||||
var detailTicket = FindTicketForOverviewRelation(definition);
|
||||
var summary = definition.Summary ?? string.Empty;
|
||||
if (detailTicket != null && !string.IsNullOrWhiteSpace(detailTicket.Summary))
|
||||
summary = detailTicket.Summary;
|
||||
var activityType = string.IsNullOrWhiteSpace(definition.ActivityType)
|
||||
? null
|
||||
: definition.ActivityType.Trim();
|
||||
|
||||
var relation = new cF4sdApiSearchResultRelation
|
||||
{
|
||||
Type = enumF4sdSearchResultClass.Ticket,
|
||||
DisplayName = definition.DisplayName ?? string.Empty,
|
||||
Name = definition.DisplayName ?? string.Empty,
|
||||
id = definition.TicketId,
|
||||
Status = enumF4sdSearchResultStatus.Active,
|
||||
Infos = new Dictionary<string, string>
|
||||
{
|
||||
["Summary"] = summary,
|
||||
["StatusId"] = definition.StatusId ?? string.Empty,
|
||||
["UserDisplayName"] = definition.UserDisplayName ?? string.Empty,
|
||||
["UserAccount"] = definition.UserAccount ?? string.Empty,
|
||||
["UserDomain"] = definition.UserDomain ?? string.Empty,
|
||||
["ActivityType"] = activityType
|
||||
},
|
||||
Identities = new cF4sdIdentityList
|
||||
{
|
||||
new cF4sdIdentityEntry { Class = enumFasdInformationClass.Ticket, Id = definition.TicketId },
|
||||
new cF4sdIdentityEntry { Class = enumFasdInformationClass.User, Id = definition.UserId }
|
||||
Status = enumF4sdSearchResultStatus.Active,
|
||||
Infos = new Dictionary<string, string>
|
||||
{
|
||||
["Summary"] = summary,
|
||||
["StatusId"] = definition.StatusId ?? string.Empty,
|
||||
["UserDisplayName"] = definition.UserDisplayName ?? string.Empty,
|
||||
["UserAccount"] = definition.UserAccount ?? string.Empty,
|
||||
["UserDomain"] = definition.UserDomain ?? string.Empty,
|
||||
["ActivityType"] = activityType
|
||||
},
|
||||
Identities = new cF4sdIdentityList
|
||||
{
|
||||
new cF4sdIdentityEntry { Class = enumFasdInformationClass.Ticket, Id = definition.TicketId },
|
||||
new cF4sdIdentityEntry { Class = enumFasdInformationClass.User, Id = definition.UserId }
|
||||
}
|
||||
};
|
||||
relations.Add(relation);
|
||||
@@ -370,40 +370,40 @@ namespace C4IT.FASD.Cockpit.Communication
|
||||
}
|
||||
finally
|
||||
{
|
||||
LogMethodEnd(CM);
|
||||
}
|
||||
}
|
||||
|
||||
private cF4SDTicket FindTicketForOverviewRelation(DemoTicketRecord definition)
|
||||
{
|
||||
if (definition == null || definition.TicketId == Guid.Empty)
|
||||
return null;
|
||||
|
||||
if (definition.UserId == Guid.Empty)
|
||||
return null;
|
||||
|
||||
var selectedData = MockupData.FirstOrDefault(data => data.SampleDataId == definition.UserId);
|
||||
if (selectedData?.Tickets == null)
|
||||
return null;
|
||||
|
||||
return selectedData.Tickets.FirstOrDefault(ticket => ticket.Id == definition.TicketId);
|
||||
}
|
||||
|
||||
private static Task SimulateTicketOverviewLatencyAsync(int count)
|
||||
{
|
||||
int baseMs = 420;
|
||||
int perItem = 100;
|
||||
LogMethodEnd(CM);
|
||||
}
|
||||
}
|
||||
|
||||
private cF4SDTicketDemo FindTicketForOverviewRelation(DemoTicketRecord definition)
|
||||
{
|
||||
if (definition == null || definition.TicketId == Guid.Empty)
|
||||
return null;
|
||||
|
||||
if (definition.UserId == Guid.Empty)
|
||||
return null;
|
||||
|
||||
var selectedData = MockupData.FirstOrDefault(data => data.SampleDataId == definition.UserId);
|
||||
if (selectedData?.Tickets == null)
|
||||
return null;
|
||||
|
||||
return selectedData.Tickets.FirstOrDefault(ticket => ticket.Id == definition.TicketId);
|
||||
}
|
||||
|
||||
private static Task SimulateTicketOverviewLatencyAsync(int count)
|
||||
{
|
||||
int baseMs = 420;
|
||||
int perItem = 100;
|
||||
int capped = Math.Max(0, Math.Min(count, 5));
|
||||
int delay = Math.Max(240, Math.Min(baseMs + capped * perItem, 2000));
|
||||
return Task.Delay(delay);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private bool LoadMockupData(out List<cF4SDHealthCardJsonRawData> sampleData)
|
||||
{
|
||||
var CM = MethodBase.GetCurrentMethod();
|
||||
LogMethodBegin(CM);
|
||||
int delay = Math.Max(240, Math.Min(baseMs + capped * perItem, 2000));
|
||||
return Task.Delay(delay);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private bool LoadMockupData(out List<cF4SDHealthCardJsonRawData> sampleData)
|
||||
{
|
||||
var CM = MethodBase.GetCurrentMethod();
|
||||
LogMethodBegin(CM);
|
||||
|
||||
sampleData = new List<cF4SDHealthCardJsonRawData>();
|
||||
|
||||
@@ -663,33 +663,33 @@ namespace C4IT.FASD.Cockpit.Communication
|
||||
return output;
|
||||
}
|
||||
|
||||
public override async Task<cFasdApiSearchResultCollection> GetUserSearchResults(string Name, List<string> SIDs)
|
||||
{
|
||||
var output = new cFasdApiSearchResultCollection();
|
||||
try
|
||||
{
|
||||
foreach (var data in MockupData)
|
||||
{
|
||||
if (!string.Equals(data.SampleDataName, Name, StringComparison.InvariantCultureIgnoreCase))
|
||||
continue;
|
||||
|
||||
//todo: add a field in demo data
|
||||
var searchResultClass = enumF4sdSearchResultClass.User;
|
||||
if (!output.ContainsKey(data.SampleDataName))
|
||||
{
|
||||
output[data.SampleDataName] = new List<cFasdApiSearchResultEntry>()
|
||||
{
|
||||
new cFasdApiSearchResultEntry()
|
||||
{
|
||||
id = data.SampleDataId,
|
||||
Name = data.SampleDataName,
|
||||
DisplayName = data.SampleDataName,
|
||||
Type = searchResultClass
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public override async Task<cFasdApiSearchResultCollection> GetUserSearchResults(string Name, List<string> SIDs)
|
||||
{
|
||||
var output = new cFasdApiSearchResultCollection();
|
||||
try
|
||||
{
|
||||
foreach (var data in MockupData)
|
||||
{
|
||||
if (!string.Equals(data.SampleDataName, Name, StringComparison.InvariantCultureIgnoreCase))
|
||||
continue;
|
||||
|
||||
//todo: add a field in demo data
|
||||
var searchResultClass = enumF4sdSearchResultClass.User;
|
||||
if (!output.ContainsKey(data.SampleDataName))
|
||||
{
|
||||
output[data.SampleDataName] = new List<cFasdApiSearchResultEntry>()
|
||||
{
|
||||
new cFasdApiSearchResultEntry()
|
||||
{
|
||||
id = data.SampleDataId,
|
||||
Name = data.SampleDataName,
|
||||
DisplayName = data.SampleDataName,
|
||||
Type = searchResultClass
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
await Task.CompletedTask;
|
||||
}
|
||||
catch (Exception E)
|
||||
@@ -719,8 +719,8 @@ namespace C4IT.FASD.Cockpit.Communication
|
||||
|
||||
var output = new List<cF4sdApiSearchResultRelation>();
|
||||
|
||||
switch (resultIds.First().ToString())
|
||||
{
|
||||
switch (resultIds.First().ToString())
|
||||
{
|
||||
case constGuidOlliOffline: // Olli Offline
|
||||
output.Add(new cF4sdApiSearchResultRelation() { id = Guid.NewGuid(), Name = "C4-NB005", DisplayName = "C4-NB005", Infos = new Dictionary<string, string>() { ["UserAccountType"] = "AD", ["UserAccount"] = "C4-NB005", ["UserDomain"] = "C4IT" }, LastUsed = DateTime.UtcNow.AddDays(-10), Type = enumF4sdSearchResultClass.Computer, UsingLevel = 1, Identities = new cF4sdIdentityList() { new cF4sdIdentityEntry() { Class = enumFasdInformationClass.Computer, Id = Guid.Parse(constGuidOlliOffline) }, new cF4sdIdentityEntry() { Class = enumFasdInformationClass.Computer, Id = Guid.NewGuid() } } });
|
||||
|
||||
@@ -878,10 +878,10 @@ namespace C4IT.FASD.Cockpit.Communication
|
||||
|
||||
var demoTickets = await GetDemoTicketData(new cF4sdHealthCardRawDataRequest() { Identities = new cF4sdIdentityList() { new cF4sdIdentityEntry() { Class = enumFasdInformationClass.User, Id = Guid.Parse(constGuidTimoTicket) }, new cF4sdIdentityEntry() { Class = enumFasdInformationClass.Computer, Id = Guid.NewGuid() } } });
|
||||
|
||||
foreach (var demoTicket in demoTickets)
|
||||
{
|
||||
output.Add(new cF4sdApiSearchResultRelation() { id = demoTicket.Id, Name = demoTicket.Name, DisplayName = demoTicket.Name, Infos = new Dictionary<string, string>() { ["Summary"] = demoTicket.Summary, ["Status"] = demoTicket.Status.ToString(), ["StatusId"] = ((int)demoTicket.Status).ToString(), ["Asset"] = demoTicket.Asset, ["ActivityType"] = demoTicket.ActivityType }, Type = enumF4sdSearchResultClass.Ticket, Identities = new cF4sdIdentityList() { new cF4sdIdentityEntry() { Class = enumFasdInformationClass.User, Id = Guid.Parse(constGuidTimoTicket) }, new cF4sdIdentityEntry() { Class = enumFasdInformationClass.Ticket, Id = demoTicket.Id } } });
|
||||
}
|
||||
foreach (var demoTicket in demoTickets)
|
||||
{
|
||||
output.Add(new cF4sdApiSearchResultRelation() { id = demoTicket.Id, Name = demoTicket.Name, DisplayName = demoTicket.Name, Infos = new Dictionary<string, string>() { ["Summary"] = demoTicket.Summary, ["Status"] = demoTicket.Status.ToString(), ["StatusId"] = ((int)demoTicket.Status).ToString(), ["Asset"] = demoTicket.Asset, ["ActivityType"] = demoTicket.ActivityType }, Type = enumF4sdSearchResultClass.Ticket, Identities = new cF4sdIdentityList() { new cF4sdIdentityEntry() { Class = enumFasdInformationClass.User, Id = Guid.Parse(constGuidTimoTicket) }, new cF4sdIdentityEntry() { Class = enumFasdInformationClass.Ticket, Id = demoTicket.Id } } });
|
||||
}
|
||||
|
||||
break;
|
||||
case constGuidTimoTicketComputer:
|
||||
@@ -891,68 +891,68 @@ namespace C4IT.FASD.Cockpit.Communication
|
||||
case constGuidComputer: // Computer
|
||||
break;
|
||||
default:
|
||||
output.Add(new cF4sdApiSearchResultRelation() { id = Guid.NewGuid(), Name = "C4IT-007", DisplayName = "C4IT-007", LastUsed = DateTime.UtcNow, Type = enumF4sdSearchResultClass.Computer, UsingLevel = 1, Identities = new cF4sdIdentityList() { new cF4sdIdentityEntry() { Class = enumFasdInformationClass.User, Id = resultIds.First() }, new cF4sdIdentityEntry() { Class = enumFasdInformationClass.Computer, Id = Guid.NewGuid() } } });
|
||||
break;
|
||||
}
|
||||
|
||||
if (resultType == enumF4sdSearchResultClass.User)
|
||||
{
|
||||
foreach (var userId in resultIds)
|
||||
{
|
||||
AppendDemoTicketRelationsForUser(userId, output);
|
||||
}
|
||||
}
|
||||
|
||||
await Task.CompletedTask;
|
||||
|
||||
output = output.OrderByDescending(relation => relation.LastUsed).ToList();
|
||||
return output;
|
||||
}
|
||||
|
||||
private void AppendDemoTicketRelationsForUser(Guid userId, List<cF4sdApiSearchResultRelation> output)
|
||||
{
|
||||
if (userId == Guid.Empty || output == null)
|
||||
return;
|
||||
|
||||
var selectedData = MockupData.FirstOrDefault(data => data?.SampleDataId == userId);
|
||||
if (selectedData?.Tickets == null)
|
||||
return;
|
||||
|
||||
foreach (var demoTicket in selectedData.Tickets)
|
||||
{
|
||||
if (demoTicket == null || demoTicket.Id == Guid.Empty)
|
||||
continue;
|
||||
|
||||
if (output.Any(relation => relation.Type == enumF4sdSearchResultClass.Ticket && relation.id == demoTicket.Id))
|
||||
continue;
|
||||
|
||||
output.Add(new cF4sdApiSearchResultRelation()
|
||||
{
|
||||
id = demoTicket.Id,
|
||||
Name = demoTicket.Name,
|
||||
DisplayName = demoTicket.Name,
|
||||
LastUsed = demoTicket.CreationDate == default ? DateTime.UtcNow : demoTicket.CreationDate.ToUniversalTime(),
|
||||
Type = enumF4sdSearchResultClass.Ticket,
|
||||
UsingLevel = 1,
|
||||
Infos = new Dictionary<string, string>()
|
||||
{
|
||||
["Summary"] = demoTicket.Summary ?? string.Empty,
|
||||
["Status"] = demoTicket.Status.ToString(),
|
||||
["StatusId"] = ((int)demoTicket.Status).ToString(),
|
||||
["Asset"] = demoTicket.Asset ?? string.Empty,
|
||||
["ActivityType"] = demoTicket.ActivityType
|
||||
},
|
||||
Identities = new cF4sdIdentityList()
|
||||
{
|
||||
new cF4sdIdentityEntry() { Class = enumFasdInformationClass.User, Id = userId },
|
||||
new cF4sdIdentityEntry() { Class = enumFasdInformationClass.Ticket, Id = demoTicket.Id }
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public override async Task<cF4SDHealthCardRawData> GetHealthCardData(cF4sdHealthCardRawDataRequest requestData)
|
||||
{
|
||||
output.Add(new cF4sdApiSearchResultRelation() { id = Guid.NewGuid(), Name = "C4IT-007", DisplayName = "C4IT-007", LastUsed = DateTime.UtcNow, Type = enumF4sdSearchResultClass.Computer, UsingLevel = 1, Identities = new cF4sdIdentityList() { new cF4sdIdentityEntry() { Class = enumFasdInformationClass.User, Id = resultIds.First() }, new cF4sdIdentityEntry() { Class = enumFasdInformationClass.Computer, Id = Guid.NewGuid() } } });
|
||||
break;
|
||||
}
|
||||
|
||||
if (resultType == enumF4sdSearchResultClass.User)
|
||||
{
|
||||
foreach (var userId in resultIds)
|
||||
{
|
||||
AppendDemoTicketRelationsForUser(userId, output);
|
||||
}
|
||||
}
|
||||
|
||||
await Task.CompletedTask;
|
||||
|
||||
output = output.OrderByDescending(relation => relation.LastUsed).ToList();
|
||||
return output;
|
||||
}
|
||||
|
||||
private void AppendDemoTicketRelationsForUser(Guid userId, List<cF4sdApiSearchResultRelation> output)
|
||||
{
|
||||
if (userId == Guid.Empty || output == null)
|
||||
return;
|
||||
|
||||
var selectedData = MockupData.FirstOrDefault(data => data?.SampleDataId == userId);
|
||||
if (selectedData?.Tickets == null)
|
||||
return;
|
||||
|
||||
foreach (var demoTicket in selectedData.Tickets)
|
||||
{
|
||||
if (demoTicket == null || demoTicket.Id == Guid.Empty)
|
||||
continue;
|
||||
|
||||
if (output.Any(relation => relation.Type == enumF4sdSearchResultClass.Ticket && relation.id == demoTicket.Id))
|
||||
continue;
|
||||
|
||||
output.Add(new cF4sdApiSearchResultRelation()
|
||||
{
|
||||
id = demoTicket.Id,
|
||||
Name = demoTicket.Name,
|
||||
DisplayName = demoTicket.Name,
|
||||
LastUsed = demoTicket.CreationDate == default ? DateTime.UtcNow : demoTicket.CreationDate.ToUniversalTime(),
|
||||
Type = enumF4sdSearchResultClass.Ticket,
|
||||
UsingLevel = 1,
|
||||
Infos = new Dictionary<string, string>()
|
||||
{
|
||||
["Summary"] = demoTicket.Summary ?? string.Empty,
|
||||
["Status"] = demoTicket.Status.ToString(),
|
||||
["StatusId"] = ((int)demoTicket.Status).ToString(),
|
||||
["Asset"] = demoTicket.Asset ?? string.Empty,
|
||||
["ActivityType"] = demoTicket.ActivityType
|
||||
},
|
||||
Identities = new cF4sdIdentityList()
|
||||
{
|
||||
new cF4sdIdentityEntry() { Class = enumFasdInformationClass.User, Id = userId },
|
||||
new cF4sdIdentityEntry() { Class = enumFasdInformationClass.Ticket, Id = demoTicket.Id }
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public override async Task<cF4SDHealthCardRawData> GetHealthCardData(cF4sdHealthCardRawDataRequest requestData)
|
||||
{
|
||||
var CM = MethodBase.GetCurrentMethod();
|
||||
LogMethodBegin(CM);
|
||||
|
||||
@@ -961,22 +961,22 @@ namespace C4IT.FASD.Cockpit.Communication
|
||||
|
||||
try
|
||||
{
|
||||
await Task.Delay(250);
|
||||
|
||||
var selectedData = MockupData.FirstOrDefault(data => requestData.Identities.Any(identity => identity.Id == data.SampleDataId));
|
||||
|
||||
if (selectedData is null)
|
||||
return output;
|
||||
await Task.Delay(250);
|
||||
|
||||
output = selectedData.GetHealthCardData();
|
||||
var ticketRequest = requestData.Identities.FirstOrDefault(data => data.Class is enumFasdInformationClass.Ticket);
|
||||
if (ticketRequest != null)
|
||||
{
|
||||
var selectedTicket = selectedData.Tickets.FirstOrDefault(ticket => ticket.Id == ticketRequest.Id);
|
||||
|
||||
if (selectedTicket != null)
|
||||
{
|
||||
string ticketStatusString = string.Empty;
|
||||
var selectedData = MockupData.FirstOrDefault(data => requestData.Identities.Any(identity => identity.Id == data.SampleDataId));
|
||||
|
||||
if (selectedData is null)
|
||||
return output;
|
||||
|
||||
output = selectedData.GetHealthCardData();
|
||||
var ticketRequest = requestData.Identities.FirstOrDefault(data => data.Class is enumFasdInformationClass.Ticket);
|
||||
if (ticketRequest != null)
|
||||
{
|
||||
var selectedTicket = selectedData.Tickets.FirstOrDefault(ticket => ticket.Id == ticketRequest.Id);
|
||||
|
||||
if (selectedTicket != null)
|
||||
{
|
||||
string ticketStatusString = string.Empty;
|
||||
switch (selectedTicket.Status)
|
||||
{
|
||||
case enumTicketStatus.Unknown:
|
||||
@@ -1009,15 +1009,15 @@ namespace C4IT.FASD.Cockpit.Communication
|
||||
["AffectedUser"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable) { Values = new List<object>() { selectedTicket.AffectedUser } },
|
||||
["AssetName"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable) { Values = new List<object>() { selectedTicket.Asset } },
|
||||
["CreationDaysSinceNow"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable) { Values = new List<object>() { selectedTicket.CreationDaysSinceNow } },
|
||||
["CreationDate"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable) { Values = new List<object>() { selectedTicket.CreationDate.ToUniversalTime() } },
|
||||
["ClosingDaysSinceNow"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable) { Values = new List<object>() { selectedTicket.ClosingDaysSinceNow } },
|
||||
["ClosingDate"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable) { Values = new List<object>() { selectedTicket.ClosingDate } },
|
||||
["Category"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable) { Values = new List<object>() { ResolveCategoryDisplayName(selectedTicket.Category) } },
|
||||
["CategoryId"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable) { Values = new List<object>() { selectedTicket.Category } },
|
||||
["CreationSource"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable) { Values = new List<object>() { selectedTicket.CreationSource.ToString() } },
|
||||
["Description"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable) { Values = new List<object>() { selectedTicket.Description?.ToString() } },
|
||||
["DescriptionHtml"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable) { Values = new List<object>() { selectedTicket.DescriptionHtml?.ToString() } },
|
||||
["Summary"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable) { Values = new List<object>() { selectedTicket.Summary.ToString() } },
|
||||
["CreationDate"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable) { Values = new List<object>() { selectedTicket.CreationDate.ToUniversalTime() } },
|
||||
["ClosingDaysSinceNow"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable) { Values = new List<object>() { selectedTicket.ClosingDaysSinceNow } },
|
||||
["ClosingDate"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable) { Values = new List<object>() { selectedTicket.ClosingDate } },
|
||||
["Category"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable) { Values = new List<object>() { ResolveCategoryDisplayName(selectedTicket.Category) } },
|
||||
["CategoryId"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable) { Values = new List<object>() { selectedTicket.Category } },
|
||||
["CreationSource"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable) { Values = new List<object>() { selectedTicket.CreationSource.ToString() } },
|
||||
["Description"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable) { Values = new List<object>() { selectedTicket.Description?.ToString() } },
|
||||
["DescriptionHtml"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable) { Values = new List<object>() { selectedTicket.DescriptionHtml?.ToString() } },
|
||||
["Summary"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable) { Values = new List<object>() { selectedTicket.Summary.ToString() } },
|
||||
["Solution"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable) { Values = new List<object>() { selectedTicket.Solution?.ToString() } },
|
||||
["SolutionHtml"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable) { Values = new List<object>() { selectedTicket.SolutionHtml?.ToString() } },
|
||||
};
|
||||
@@ -1470,17 +1470,17 @@ namespace C4IT.FASD.Cockpit.Communication
|
||||
return null;
|
||||
}
|
||||
|
||||
private cF4SDTicket GetTicketFromWriteParameter(cF4SDWriteParameters writeParams)
|
||||
private cF4SDTicketDemo GetTicketFromWriteParameter(cF4SDWriteParameters writeParams)
|
||||
{
|
||||
cF4SDTicket output = null;
|
||||
cF4SDTicketDemo output = null;
|
||||
|
||||
try
|
||||
{
|
||||
output = new cF4SDTicket()
|
||||
output = new cF4SDTicketDemo()
|
||||
{
|
||||
Id = writeParams.id,
|
||||
DirectLinks = new Dictionary<string, string>(),
|
||||
JournalItems = new List<cF4SDTicket.cTicketJournalItem>()
|
||||
JournalItems = new List<cF4SDTicketDemo.cTicketJournalItemDemo>()
|
||||
};
|
||||
|
||||
if (writeParams.Values.TryGetValue("Summary", out var summary))
|
||||
@@ -1498,15 +1498,15 @@ namespace C4IT.FASD.Cockpit.Communication
|
||||
if (writeParams.Values.TryGetValue("Asset", out var asset))
|
||||
output.Asset = asset.ToString();
|
||||
|
||||
if (writeParams.Values.TryGetValue("Category", out var category))
|
||||
output.Category = category.ToString();
|
||||
|
||||
if (writeParams.Values.TryGetValue("ActivityType", out var activityType))
|
||||
output.ActivityType = activityType?.ToString()?.Trim();
|
||||
|
||||
if (writeParams.Values.TryGetValue("CreationSource", out var creationSourceObj))
|
||||
if (Enum.TryParse(creationSourceObj.ToString(), out cF4SDTicket.enumTicketCreationSource creationSource))
|
||||
output.CreationSource = creationSource;
|
||||
if (writeParams.Values.TryGetValue("Category", out var category))
|
||||
output.Category = category.ToString();
|
||||
|
||||
if (writeParams.Values.TryGetValue("ActivityType", out var activityType))
|
||||
output.ActivityType = activityType?.ToString()?.Trim();
|
||||
|
||||
if (writeParams.Values.TryGetValue("CreationSource", out var creationSourceObj))
|
||||
if (Enum.TryParse(creationSourceObj.ToString(), out cF4SDTicketDemo.enumTicketCreationSource creationSource))
|
||||
output.CreationSource = creationSource;
|
||||
|
||||
if (writeParams.Values.TryGetValue("Status", out var statusObj))
|
||||
{
|
||||
@@ -1588,13 +1588,13 @@ namespace C4IT.FASD.Cockpit.Communication
|
||||
return false;
|
||||
}
|
||||
|
||||
private cF4SDTicket.cTicketJournalItem GetJournalItemFromWriteParameter(cF4SDWriteParameters writeParams)
|
||||
private cF4SDTicketDemo.cTicketJournalItemDemo GetJournalItemFromWriteParameter(cF4SDWriteParameters writeParams)
|
||||
{
|
||||
cF4SDTicket.cTicketJournalItem output = null;
|
||||
cF4SDTicketDemo.cTicketJournalItemDemo output = null;
|
||||
|
||||
try
|
||||
{
|
||||
output = new cF4SDTicket.cTicketJournalItem();
|
||||
output = new cF4SDTicketDemo.cTicketJournalItemDemo();
|
||||
|
||||
if (writeParams.Values.TryGetValue("Header", out var header))
|
||||
output.Header = header.ToString();
|
||||
@@ -1681,10 +1681,10 @@ namespace C4IT.FASD.Cockpit.Communication
|
||||
|
||||
public override Task<bool> Matrix42TicketFinalization(cApiM42Ticket ticketData) => Task.FromResult(true);
|
||||
|
||||
private async Task<List<cF4SDTicket>> GetDemoTicketData(cF4sdHealthCardRawDataRequest requestData)
|
||||
private async Task<List<cF4SDTicketDemo>> GetDemoTicketData(cF4sdHealthCardRawDataRequest requestData)
|
||||
{
|
||||
await Task.CompletedTask;
|
||||
var output = new List<cF4SDTicket>();
|
||||
var output = new List<cF4SDTicketDemo>();
|
||||
try
|
||||
{
|
||||
var selectedData = MockupData.FirstOrDefault(data => requestData.Identities.Any(identity => identity.Id == data.SampleDataId));
|
||||
@@ -1702,16 +1702,16 @@ namespace C4IT.FASD.Cockpit.Communication
|
||||
return output;
|
||||
}
|
||||
|
||||
public async Task<List<cF4SDTicketSummary>> GetTicketSummaries(cF4sdHealthCardRawDataRequest requestData)
|
||||
public async Task<List<cF4SDTicketSummaryDemo>> GetTicketSummaries(cF4sdHealthCardRawDataRequest requestData)
|
||||
{
|
||||
|
||||
var output = new List<cF4SDTicketSummary>();
|
||||
var output = new List<cF4SDTicketSummaryDemo>();
|
||||
try
|
||||
{
|
||||
var demoTickets = await GetDemoTicketData(requestData);
|
||||
foreach (var ticket in demoTickets)
|
||||
{
|
||||
output.Add(new cF4SDTicketSummary()
|
||||
output.Add(new cF4SDTicketSummaryDemo()
|
||||
{
|
||||
Id = ticket.Id,
|
||||
Name = ticket.Name,
|
||||
@@ -1738,17 +1738,17 @@ namespace C4IT.FASD.Cockpit.Communication
|
||||
return true;
|
||||
}
|
||||
|
||||
public override async Task<bool> GetCockpitConfiguration()
|
||||
{
|
||||
cCockpitConfiguration.Instance = new cCockpitConfiguration();
|
||||
cCockpitConfiguration.Instance.agentApiConfiguration = new cAgentApiConfiguration() { ApiUrl = "", ClientId = "", ClientSecret = "", LogonUrl = "", OrganizationCode = 0 };
|
||||
cCockpitConfiguration.Instance.m42ServerConfiguration = new cM42ServerConfiguration() { Server = "https://srvwsm001.imagoverum.com" };
|
||||
cCockpitConfiguration.Instance.GlobalConfig = null;
|
||||
await Task.CompletedTask;
|
||||
return true;
|
||||
}
|
||||
|
||||
public override Task<bool> GetAgentOnlineStatus(int AgentDeviceId, int? AgentUserId = null) => Task.FromResult(true);
|
||||
public override async Task<bool> GetCockpitConfiguration()
|
||||
{
|
||||
cCockpitConfiguration.Instance = new cCockpitConfiguration();
|
||||
cCockpitConfiguration.Instance.agentApiConfiguration = new cAgentApiConfiguration() { ApiUrl = "", ClientId = "", ClientSecret = "", LogonUrl = "", OrganizationCode = 0 };
|
||||
cCockpitConfiguration.Instance.m42ServerConfiguration = new cM42ServerConfiguration() { Server = "https://srvwsm001.imagoverum.com" };
|
||||
cCockpitConfiguration.Instance.GlobalConfig = null;
|
||||
await Task.CompletedTask;
|
||||
return true;
|
||||
}
|
||||
|
||||
public override Task<bool> GetAgentOnlineStatus(int AgentDeviceId, int? AgentUserId = null) => Task.FromResult(true);
|
||||
|
||||
public override Task<cF4sdAgentScript> GetQuickActionOfAgent(int ScriptId) => Task.FromResult(new cF4sdAgentScript() { Id = ScriptId, Name = "AgentScript", Type = enumAgentScriptType.user, UserPermissionRequired = false });
|
||||
|
||||
@@ -1793,6 +1793,11 @@ namespace C4IT.FASD.Cockpit.Communication
|
||||
return new cF4sdStagedSearchResultRelations() { Relations = relations };
|
||||
}
|
||||
|
||||
public override Task StopGatheringRelations(Guid id, CancellationToken token)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private async Task DoLocalQuickActionAsync(string ActionPrefix, string ActionNaming)
|
||||
{
|
||||
MethodBase CM = null; if (cLogManager.DefaultLogger.IsDebug) { CM = MethodBase.GetCurrentMethod(); LogMethodBegin(CM); }
|
||||
|
||||
@@ -7,7 +7,7 @@ using C4IT.FASD.Base;
|
||||
|
||||
namespace FasdCockpitCommunicationDemo
|
||||
{
|
||||
public class cF4SDTicketSummary
|
||||
public class cF4SDTicketSummaryDemo
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
@@ -15,7 +15,7 @@ namespace FasdCockpitCommunicationDemo
|
||||
public enumTicketStatus Status { get; set; }
|
||||
}
|
||||
|
||||
public class cF4SDTicket : cF4SDTicketSummary
|
||||
public class cF4SDTicketDemo : cF4SDTicketSummaryDemo
|
||||
{
|
||||
public enum enumTicketCreationSource
|
||||
{
|
||||
@@ -26,7 +26,7 @@ namespace FasdCockpitCommunicationDemo
|
||||
F4SD = 3
|
||||
}
|
||||
|
||||
public class cTicketJournalItem
|
||||
public class cTicketJournalItemDemo
|
||||
{
|
||||
public double CreationDaysSinceNow { get; set; }
|
||||
public DateTime CreationDate { get; set; }
|
||||
@@ -45,16 +45,16 @@ namespace FasdCockpitCommunicationDemo
|
||||
public DateTime? ClosingDate { get; set; }
|
||||
public enumTicketCreationSource CreationSource { get; set; }
|
||||
|
||||
public string Description { get; set; }
|
||||
public string DescriptionHtml { get; set; }
|
||||
public int Priority { get; set; }
|
||||
public string Category { get; set; }
|
||||
public string ActivityType { get; set; }
|
||||
public string Solution { get; set; }
|
||||
public string SolutionHtml { get; set; }
|
||||
public Dictionary<string, string> DirectLinks { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string DescriptionHtml { get; set; }
|
||||
public int Priority { get; set; }
|
||||
public string Category { get; set; }
|
||||
public string ActivityType { get; set; }
|
||||
public string Solution { get; set; }
|
||||
public string SolutionHtml { get; set; }
|
||||
public Dictionary<string, string> DirectLinks { get; set; }
|
||||
|
||||
public List<cTicketJournalItem> JournalItems { get; set; }
|
||||
public List<cTicketJournalItemDemo> JournalItems { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-10.0.0.2" newVersion="10.0.0.2" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-10.0.0.3" newVersion="10.0.0.3" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace C4IT.FASD.Base
|
||||
|
||||
public List<cF4SDHealthCardRawData.cHealthCardDetailsTable> DetailsTables { get; set; }
|
||||
|
||||
public List<cF4SDTicket> Tickets { get; set; } = new List<cF4SDTicket>();
|
||||
public List<cF4SDTicketDemo> Tickets { get; set; } = new List<cF4SDTicketDemo>();
|
||||
|
||||
public cF4SDHealthCardRawData GetHealthCardData()
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="13.0.4" targetFramework="net472" />
|
||||
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net472" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user