Infineon.EAF.Runtime 2.52.0

Infineon.EAF.Runtime 2.49.3
IDescription.GetDescriptions with body
This commit is contained in:
2023-10-07 10:56:15 -07:00
parent 172f45aa67
commit b943a882cb
37 changed files with 710 additions and 199 deletions

View File

@ -11,6 +11,8 @@ public class FIBacklogMesa
string assignedTo,
string secondResource,
string subject,
string epiLine,
string area,
string systemS,
string priority,
string status,
@ -42,6 +44,8 @@ public class FIBacklogMesa
AssignedTo = assignedTo;
SecondResource = secondResource;
Subject = subject;
EpiLine = epiLine;
Area = area;
SystemS = systemS;
Priority = priority;
Status = status;
@ -81,6 +85,10 @@ public class FIBacklogMesa
[JsonPropertyName("Subject - from Requestor")]
public string Subject { get; set; } // { init; get; }
[JsonPropertyName("Epi Line")]
public string EpiLine { get; set; } // { init; get; }
public string Area { get; set; } // { init; get; }
[JsonPropertyName("System(s)")]
public string SystemS { get; set; } // { init; get; }
@ -103,7 +111,7 @@ public class FIBacklogMesa
[JsonPropertyName("UAT as of")]
public string UATAsOf { get; set; } // { init; get; }
[JsonPropertyName("CMP_Date")]
[JsonPropertyName("CMP _Date")]
public string CMPDate { get; set; } // { init; get; }
public string F20 { get; set; } // { init; get; }
public string F21 { get; set; } // { init; get; }

View File

@ -121,7 +121,6 @@ public class FileRead : Shared.FileRead, IFileRead
}
if (_IsEAFHosted)
File.WriteAllText(fileName, json);
File.WriteAllText("D:/Web-sites/Backlog/json/data.json", json);
results = iProcessData.GetResults(this, _Logistics, results.Item4);
}
return results;

View File

@ -107,7 +107,7 @@ public class FileRead : Shared.FileRead, IFileRead
}
#pragma warning disable IDE0060
private void SendData(DateTime dateTime, List<Description> descriptions)
private void SendData(string reportFullPath, DateTime dateTime, List<Description> descriptions)
#pragma warning restore IDE0060
{
if (_OpenInsightMetrologyViewerAPI is null)
@ -135,7 +135,7 @@ public class FileRead : Shared.FileRead, IFileRead
List<Description> descriptions = json.ProcessData.GetDescriptions(jsonElements);
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
SendData(dateTime, descriptions);
SendData(reportFullPath, dateTime, descriptions);
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(pdsf.Item1, tests, jsonElements, new List<FileInfo>());
return results;
}

View File

@ -1,29 +0,0 @@
using Adaptation.FileHandlers.ConvertExcelToJson;
using System.Linq;
using System.Net;
using System.Web.Http;
namespace Adaptation.FileHandlers.json;
public class BacklogController : ApiController
{
#pragma warning disable CA1822
public FIBacklogMesa[] GetAllRecords()
#pragma warning restore CA1822
{
FIBacklogMesa[] results = Helper.GetFIBacklogMesaRecords(FileRead.Json);
return results;
}
#pragma warning disable CA1822
public FIBacklogMesa GetRecordById(string id)
#pragma warning restore CA1822
{
FIBacklogMesa[] fIBacklogMesaRecords = Helper.GetFIBacklogMesaRecords(FileRead.Json);
FIBacklogMesa product = fIBacklogMesaRecords.FirstOrDefault(l => l.Req == id) ??
throw new HttpResponseException(HttpStatusCode.NotFound);
return product;
}
}

View File

@ -8,14 +8,13 @@ using Microsoft.VisualStudio.Services.Common;
using Microsoft.VisualStudio.Services.WebApi;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
//using System.Web.Http;
//using System.Web.Http.SelfHost;
namespace Adaptation.FileHandlers.json;
@ -29,7 +28,8 @@ public class FileRead : Shared.FileRead, IFileRead
private readonly string _Project;
private readonly string _BasePage;
private readonly HttpClient _HttpClient;
//private readonly HttpSelfHostServer _HttpSelfHostServer;
private readonly ReadOnlyDictionary<string, string> _RequestorNameToUser;
private readonly ReadOnlyDictionary<string, string> _AssignedToNameToUser;
private readonly WorkItemTrackingHttpClient _WorkItemTrackingHttpClient;
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
@ -45,6 +45,8 @@ public class FileRead : Shared.FileRead, IFileRead
throw new Exception(cellInstanceConnectionName);
if (!_IsDuplicator)
throw new Exception(cellInstanceConnectionName);
Dictionary<string, string> requestorNameToUser = new();
Dictionary<string, string> assignedToNameToUser = new();
string cellInstanceNamed = string.Concat("CellInstance.", cellInstanceName);
MediaTypeWithQualityHeaderValue mediaTypeWithQualityHeaderValue = new("application/json");
_API = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, $"{cellInstanceNamed}.HttpClient.API");
@ -53,6 +55,14 @@ public class FileRead : Shared.FileRead, IFileRead
_Project = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, $"{cellInstanceNamed}.HttpClient.Project");
string basePage = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, $"{cellInstanceNamed}.HttpClient.BasePage");
string baseAddress = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, $"{cellInstanceNamed}.HttpClient.BaseAddress");
ModelObjectParameterDefinition[] assignedTo = GetProperties(cellInstanceConnectionName, modelObjectParameters, "Assinged.To.");
foreach (ModelObjectParameterDefinition modelObjectParameterDefinition in assignedTo)
assignedToNameToUser.Add(modelObjectParameterDefinition.Name.Split('.')[2], modelObjectParameterDefinition.Value);
_AssignedToNameToUser = new(assignedToNameToUser);
ModelObjectParameterDefinition[] requestor = GetProperties(cellInstanceConnectionName, modelObjectParameters, "Requestor.");
foreach (ModelObjectParameterDefinition modelObjectParameterDefinition in requestor)
requestorNameToUser.Add(modelObjectParameterDefinition.Name.Split('.')[1], modelObjectParameterDefinition.Value);
_RequestorNameToUser = new(requestorNameToUser);
byte[] bytes = Encoding.ASCII.GetBytes($":{pat}");
string base64 = Convert.ToBase64String(bytes);
_HttpClient = new(new HttpClientHandler() { UseDefaultCredentials = true }) { BaseAddress = new(baseAddress) };
@ -62,11 +72,6 @@ public class FileRead : Shared.FileRead, IFileRead
VssConnection connection = new(new(string.Concat(baseAddress, basePage)), credential);
_WorkItemTrackingHttpClient = connection.GetClient<WorkItemTrackingHttpClient>();
_BasePage = basePage;
//string httpSelfHostConfigurationBaseAddress = "http://localhost:5159"; // GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, string.Concat("CellInstance.", cellInstanceName, ".HttpSelfHostConfiguration.BaseAddress"));
//HttpSelfHostConfiguration config = new(httpSelfHostConfigurationBaseAddress);
//_ = config.Routes.MapHttpRoute("API Default", "api/{controller}/{id}", new { id = RouteParameter.Optional });
//_HttpSelfHostServer = new(config);
//_HttpSelfHostServer.OpenAsync().Wait();
}
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception) => Move(extractResults);
@ -143,7 +148,7 @@ public class FileRead : Shared.FileRead, IFileRead
results.Item4.Add(_Logistics.FileInfo);
else
{
IProcessData iProcessData = new ProcessData(this, _Logistics, results.Item4, _HttpClient, _BasePage, _API, _Query, _WorkItemTrackingHttpClient, _Project, json);
IProcessData iProcessData = new ProcessData(this, _Logistics, results.Item4, _HttpClient, _BasePage, _API, _Query, _WorkItemTrackingHttpClient, _Project, _AssignedToNameToUser, _RequestorNameToUser, json);
if (iProcessData is not ProcessData _)
throw new Exception(string.Concat("A) No Data - ", dateTime.Ticks));
if (!iProcessData.Details.Any())

View File

@ -1,21 +0,0 @@
using Adaptation.FileHandlers.ConvertExcelToJson;
using System;
using System.Text.Json;
namespace Adaptation.FileHandlers.json;
public class Helper
{
#nullable enable
internal static FIBacklogMesa[] GetFIBacklogMesaRecords(string json)
{
FIBacklogMesa[]? results;
results = JsonSerializer.Deserialize<FIBacklogMesa[]>(json, new JsonSerializerOptions() { PropertyNameCaseInsensitive = true });
if (results is null)
throw new NullReferenceException();
return results;
}
}

View File

@ -4,10 +4,13 @@ using Adaptation.Shared;
using Adaptation.Shared.Duplicator;
using Adaptation.Shared.Methods;
using Microsoft.TeamFoundation.WorkItemTracking.WebApi;
using Microsoft.TeamFoundation.WorkItemTracking.WebApi.Models;
using Microsoft.VisualStudio.Services.WebApi.Patch;
using Microsoft.VisualStudio.Services.WebApi.Patch.Json;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net.Http;
@ -24,11 +27,11 @@ public class ProcessData : IProcessData
List<object> Shared.Properties.IProcessData.Details => _Details;
public ProcessData(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection, HttpClient httpClient, string basePage, string api, string query, WorkItemTrackingHttpClient workItemTrackingHttpClient, string project, string json)
public ProcessData(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection, HttpClient httpClient, string basePage, string api, string query, WorkItemTrackingHttpClient workItemTrackingHttpClient, string project, ReadOnlyDictionary<string, string> assignedToNameToUser, ReadOnlyDictionary<string, string> requestorNameToUser, string json)
{
fileInfoCollection.Clear();
_Details = new List<object>();
Parse(fileRead, logistics, fileInfoCollection, httpClient, basePage, api, query, workItemTrackingHttpClient, project, json);
Parse(fileRead, logistics, fileInfoCollection, httpClient, basePage, api, query, workItemTrackingHttpClient, project, assignedToNameToUser, requestorNameToUser, json);
}
string IProcessData.GetCurrentReactor(IFileRead fileRead, Logistics logistics, Dictionary<string, string> reactors)
@ -43,7 +46,7 @@ public class ProcessData : IProcessData
private static void AddPatch(JsonPatchDocument document, string path, object value) => document.Add(new JsonPatchOperation { From = null, Operation = Operation.Add, Path = path, Value = value });
private static Dictionary<string, FIBacklogMesa> GetFIBacklogMesaCollection(string json, string keySection)
private static Dictionary<string, FIBacklogMesa> GetFIBacklogMesaCollection(string json)
{
Dictionary<string, FIBacklogMesa> results = new();
string key;
@ -59,7 +62,7 @@ public class ProcessData : IProcessData
continue;
if (string.IsNullOrEmpty(fIBacklogMesa.Requestor))
continue;
key = $"{fIBacklogMesa.Requestor.Split(' ').First()}{keySection}{fIBacklogMesa.Req}";
key = $"{fIBacklogMesa.Req} - ";
if (results.ContainsKey(key))
continue;
results.Add(key, fIBacklogMesa);
@ -109,12 +112,12 @@ public class ProcessData : IProcessData
return results;
}
private static Value[] GetExtra(string keySection, IReadOnlyList<Value> workItems, Dictionary<string, FIBacklogMesa> keyToFIBacklogMesa)
private static Value[] GetExtra(IReadOnlyList<Value> workItems, Dictionary<string, FIBacklogMesa> keyToFIBacklogMesa)
{
List<Value> results = new();
foreach (Value value in workItems)
{
if (!value.Fields.SystemTitle.Contains(keySection))
if (!value.Fields.SystemTitle.Contains(" - "))
continue;
if (keyToFIBacklogMesa.Remove(value.Fields.SystemTitle))
continue;
@ -180,7 +183,188 @@ public class ProcessData : IProcessData
}
}
private void Parse(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection, HttpClient httpClient, string basePage, string api, string query, WorkItemTrackingHttpClient workItemTrackingHttpClient, string project, string json)
private static JsonPatchDocument GetUATDocument(string project, ReadOnlyDictionary<string, string> requestorNameToUser, DateTime dateTime, string key, FIBacklogMesa fiBacklogMesa)
{
JsonPatchDocument result = new();
AddPatch(result, "/fields/System.AreaPath", project);
string description = GetDescription(fiBacklogMesa, dateTime);
AddPatch(result, "/fields/System.IterationPath", project);
AddPatch(result, "/fields/System.Title", key);
AddPatch(result, "/fields/System.Description", description);
if (requestorNameToUser.TryGetValue(fiBacklogMesa.AssignedTo, out string? requestorUser))
AddPatch(result, "/fields/System.AssignedTo", requestorUser);
return result;
}
private static JsonPatchDocument GetBugDocument(string project, ReadOnlyDictionary<string, string> assignedToNameToUser, Task<WorkItem> uatWorkItemTask, FIBacklogMesa fiBacklogMesa)
{
JsonPatchDocument result = new();
if (uatWorkItemTask.Result.Id is null)
throw new NotSupportedException();
AddPatch(result, "/relations/-", new WorkItemRelation() { Rel = "System.LinkTypes.Hierarchy-Forward", Url = uatWorkItemTask.Result.Url });
AddPatch(result, "/fields/System.AreaPath", project);
AddPatch(result, "/fields/System.IterationPath", project);
AddPatch(result, "/fields/System.Title", $"{fiBacklogMesa.Req} - {fiBacklogMesa.Subject}");
if (!string.IsNullOrEmpty(fiBacklogMesa.Definition))
AddPatch(result, "/fields/System.Description", fiBacklogMesa.Definition);
if (assignedToNameToUser.TryGetValue(fiBacklogMesa.Requestor, out string? requestorUser))
AddPatch(result, "/fields/System.AssignedTo", requestorUser);
return result;
}
private static JsonPatchDocument GetDeveloperTaskDocument(string project, ReadOnlyDictionary<string, string> assignedToNameToUser, FIBacklogMesa fiBacklogMesa)
{
JsonPatchDocument result = new();
AddPatch(result, "/fields/System.AreaPath", project);
AddPatch(result, "/fields/System.IterationPath", project);
AddPatch(result, "/fields/System.Title", $"{fiBacklogMesa.Req} - Developer Task");
if (assignedToNameToUser.TryGetValue(fiBacklogMesa.AssignedTo, out string? assignedToUser))
AddPatch(result, "/fields/System.AssignedTo", assignedToUser);
return result;
}
private static JsonPatchDocument GetSecondDeveloperTaskDocument(string project, ReadOnlyDictionary<string, string> assignedToNameToUser, FIBacklogMesa fiBacklogMesa)
{
JsonPatchDocument result = new();
AddPatch(result, "/fields/System.AreaPath", project);
AddPatch(result, "/fields/System.IterationPath", project);
AddPatch(result, "/fields/System.Title", $"{fiBacklogMesa.Req} - Developer Task");
if (assignedToNameToUser.TryGetValue(fiBacklogMesa.SecondResource, out string? assignedToUser))
AddPatch(result, "/fields/System.AssignedTo", assignedToUser);
return result;
}
private static JsonPatchDocument GetUserStoryDocument(string project, ReadOnlyDictionary<string, string> requestorNameToUser, Task<WorkItem> uatWorkItemTask, FIBacklogMesa fiBacklogMesa)
{
JsonPatchDocument result = new();
if (uatWorkItemTask?.Result.Id is null)
throw new NotSupportedException();
AddPatch(result, "/relations/-", new WorkItemRelation() { Rel = "System.LinkTypes.Hierarchy-Forward", Url = uatWorkItemTask.Result.Url });
AddPatch(result, "/fields/System.AreaPath", project);
AddPatch(result, "/fields/System.IterationPath", project);
AddPatch(result, "/fields/System.Title", $"{fiBacklogMesa.Req} - User Story");
if (requestorNameToUser.TryGetValue(fiBacklogMesa.Requestor, out string? requestorUser))
AddPatch(result, "/fields/System.AssignedTo", requestorUser);
return result;
}
private static JsonPatchDocument GetAssignedToRelationDocument(Task<WorkItem> assignedToWorkItemTask)
{
JsonPatchDocument result = new();
if (assignedToWorkItemTask.Result.Id is null)
throw new NotSupportedException();
AddPatch(result, "/relations/-", new WorkItemRelation() { Rel = "System.LinkTypes.Hierarchy-Forward", Url = assignedToWorkItemTask.Result.Url });
return result;
}
private static JsonPatchDocument GetSecondResourceDocument(Task<WorkItem> secondResourceWorkItemTask)
{
JsonPatchDocument result = new();
if (secondResourceWorkItemTask?.Result.Id is null)
throw new NotSupportedException();
AddPatch(result, "/relations/-", new WorkItemRelation() { Rel = "System.LinkTypes.Hierarchy-Forward", Url = secondResourceWorkItemTask.Result.Url });
return result;
}
private static JsonPatchDocument GetFeatureDocument(string project, ReadOnlyDictionary<string, string> requestorNameToUser, List<string> tags, Task<WorkItem>? userStoryWorkItemTask, FIBacklogMesa fiBacklogMesa)
{
JsonPatchDocument result = new();
if (userStoryWorkItemTask?.Result.Id is null)
throw new NotSupportedException();
AddPatch(result, "/relations/-", new WorkItemRelation() { Rel = "System.LinkTypes.Hierarchy-Forward", Url = userStoryWorkItemTask.Result.Url });
AddPatch(result, "/fields/System.AreaPath", project);
if (tags.Count > 0)
{
AddPatch(result, "/fields/System.Tags", tags.Last());
tags.RemoveAt(tags.Count - 1);
}
AddPatch(result, "/fields/System.IterationPath", project);
if (!string.IsNullOrEmpty(fiBacklogMesa.Definition))
AddPatch(result, "/fields/System.Description", fiBacklogMesa.Definition);
if (int.TryParse(fiBacklogMesa.Priority.Substring(0, 1), out int priority) && priority != 0)
AddPatch(result, "/fields/Microsoft.VSTS.Common.Priority", priority);
if (!string.IsNullOrEmpty(fiBacklogMesa.EstEffortDays) && int.TryParse(fiBacklogMesa.EstEffortDays, out int estEffortDays) && estEffortDays != 0)
AddPatch(result, "/fields/Microsoft.VSTS.Scheduling.Effort", estEffortDays);
if (!string.IsNullOrEmpty(fiBacklogMesa.CommitDate) && DateTime.TryParseExact(fiBacklogMesa.CommitDate.Split(' ').First(), "MM/dd/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime commitDate) && commitDate != DateTime.MinValue)
AddPatch(result, "/fields/Microsoft.VSTS.Scheduling.TargetDate", commitDate.AddHours(12).ToUniversalTime());
if (!string.IsNullOrEmpty(fiBacklogMesa.Updates))
AddPatch(result, "/fields/System.History", fiBacklogMesa.Updates);
AddPatch(result, "/fields/System.Title", $"{fiBacklogMesa.Req} - {fiBacklogMesa.Subject}");
if (requestorNameToUser.TryGetValue(fiBacklogMesa.Requestor, out string? requestorUser))
AddPatch(result, "/fields/System.AssignedTo", requestorUser);
// https://tfs.intra.infineon.com/tfs/ManufacturingIT/Mesa_FI/_apis/wit/workitemtypes/feature/fields?api-version=7.0
return result;
}
private static void DoWork(WorkItemTrackingHttpClient workItemTrackingHttpClient, string project, ReadOnlyDictionary<string, string> assignedToNameToUser, ReadOnlyDictionary<string, string> requestorNameToUser, string key, FIBacklogMesa fiBacklogMesa)
{
DateTime dateTime;
List<string> tags = new();
JsonPatchDocument tagDocument;
Task<WorkItem>? secondResourceWorkItemTask = null;
bool isBugFix = fiBacklogMesa.Priority == "0 - BugFix";
if (!DateTime.TryParse(fiBacklogMesa.Submitted, out dateTime))
dateTime = DateTime.MinValue;
foreach (string tag in fiBacklogMesa.SystemS.Split('/'))
{
if (string.IsNullOrEmpty(tag.Trim()))
continue;
tags.Add(tag.Trim());
}
tags.Reverse();
JsonPatchDocument uatDocument = GetUATDocument(project, requestorNameToUser, dateTime, key, fiBacklogMesa);
Task<WorkItem> uatWorkItemTask = workItemTrackingHttpClient.CreateWorkItemAsync(uatDocument, project, "Task");
uatWorkItemTask.Wait();
if (isBugFix)
{
JsonPatchDocument bugDocument = GetBugDocument(project, assignedToNameToUser, uatWorkItemTask, fiBacklogMesa);
Task<WorkItem> bugWorkItemTask = workItemTrackingHttpClient.CreateWorkItemAsync(bugDocument, project, "Bug");
bugWorkItemTask.Wait();
}
if (!isBugFix)
{
JsonPatchDocument developerTaskDocument = GetDeveloperTaskDocument(project, assignedToNameToUser, fiBacklogMesa);
Task<WorkItem> assignedToWorkItemTask = workItemTrackingHttpClient.CreateWorkItemAsync(developerTaskDocument, project, "Task");
assignedToWorkItemTask.Wait();
if (!string.IsNullOrEmpty(fiBacklogMesa.SecondResource))
{
JsonPatchDocument secondDeveloperTaskDocument = GetSecondDeveloperTaskDocument(project, assignedToNameToUser, fiBacklogMesa);
secondResourceWorkItemTask = workItemTrackingHttpClient.CreateWorkItemAsync(secondDeveloperTaskDocument, project, "Task");
secondResourceWorkItemTask.Wait();
}
JsonPatchDocument userStoryDocument = GetUserStoryDocument(project, requestorNameToUser, uatWorkItemTask, fiBacklogMesa);
Task<WorkItem> userStoryWorkItemTask = workItemTrackingHttpClient.CreateWorkItemAsync(userStoryDocument, project, "User Story");
userStoryWorkItemTask.Wait();
if (userStoryWorkItemTask?.Result.Id is null)
throw new NotSupportedException();
JsonPatchDocument assignedToRelationDocument = GetAssignedToRelationDocument(assignedToWorkItemTask);
userStoryWorkItemTask = workItemTrackingHttpClient.UpdateWorkItemAsync(assignedToRelationDocument, userStoryWorkItemTask.Result.Id.Value);
userStoryWorkItemTask.Wait();
if (secondResourceWorkItemTask is not null)
{
if (userStoryWorkItemTask.Result.Id is null)
throw new NotSupportedException();
JsonPatchDocument secondResourceDocument = GetSecondResourceDocument(secondResourceWorkItemTask);
userStoryWorkItemTask = workItemTrackingHttpClient.UpdateWorkItemAsync(secondResourceDocument, userStoryWorkItemTask.Result.Id.Value);
userStoryWorkItemTask.Wait();
}
JsonPatchDocument featureDocument = GetFeatureDocument(project, requestorNameToUser, tags, userStoryWorkItemTask, fiBacklogMesa);
Task<WorkItem> featureWorkItemTask = workItemTrackingHttpClient.CreateWorkItemAsync(featureDocument, project, "Feature");
featureWorkItemTask.Wait();
for (int i = tags.Count - 1; i > -1; i--)
{
if (featureWorkItemTask.Result.Id is null)
throw new NotSupportedException();
tagDocument = new();
AddPatch(tagDocument, "/fields/System.Tags", tags[i]);
tags.RemoveAt(i);
featureWorkItemTask = workItemTrackingHttpClient.UpdateWorkItemAsync(tagDocument, featureWorkItemTask.Result.Id.Value);
featureWorkItemTask.Wait();
}
}
}
private void Parse(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection, HttpClient httpClient, string basePage, string api, string query, WorkItemTrackingHttpClient workItemTrackingHttpClient, string project, ReadOnlyDictionary<string, string> assignedToNameToUser, ReadOnlyDictionary<string, string> requestorNameToUser, string json)
{
if (fileRead is null)
throw new NullReferenceException();
@ -189,24 +373,17 @@ public class ProcessData : IProcessData
if (fileInfoCollection is null)
throw new NullReferenceException();
int counter = 0;
DateTime dateTime;
string description;
string keySection = " UAT for ";
string? directory = Path.GetDirectoryName(fileRead.ReportFullPath);
if (directory is null)
throw new Exception();
string? directory = Path.GetDirectoryName(fileRead.ReportFullPath) ?? throw new Exception();
string[] checkFiles = Directory.GetFiles(directory, "*.csv", SearchOption.TopDirectoryOnly);
if (checkFiles.Any())
UpdateIds(httpClient, basePage, api, checkFiles);
else
{
JsonPatchDocument document;
string ids = GetIds(httpClient, basePage, api, query);
Value[] workItems = GetWorkItems(httpClient, basePage, api, ids);
Task<Microsoft.TeamFoundation.WorkItemTracking.WebApi.Models.WorkItem> workItemTask;
Dictionary<string, FIBacklogMesa> keyToFIBacklogMesa = GetFIBacklogMesaCollection(json, keySection);
Dictionary<string, FIBacklogMesa> keyToFIBacklogMesa = GetFIBacklogMesaCollection(json);
Value[] workItems = string.IsNullOrEmpty(ids) ? Array.Empty<Value>() : GetWorkItems(httpClient, basePage, api, ids);
int count = keyToFIBacklogMesa.Count;
Value[] extra = GetExtra(keySection, workItems, keyToFIBacklogMesa);
Value[] extra = GetExtra(workItems, keyToFIBacklogMesa);
if (count != extra.Length)
{ }
if (count != keyToFIBacklogMesa.Count)
@ -216,33 +393,10 @@ public class ProcessData : IProcessData
{
if (counter > 5)
break;
document = new();
if (!DateTime.TryParse(keyValuePair.Value.Submitted, out dateTime))
dateTime = DateTime.MinValue;
AddPatch(document, "/fields/System.AreaPath", project);
description = GetDescription(keyValuePair.Value, dateTime);
AddPatch(document, "/fields/System.IterationPath", project);
AddPatch(document, "/fields/System.Title", keyValuePair.Key);
AddPatch(document, "/fields/System.Description", description);
// AddPatch(document, "/fields/System.AssignedTo", "Mike.Phares@infineon.com");
if (!fileRead.IsEAFHosted)
continue;
workItemTask = workItemTrackingHttpClient.CreateWorkItemAsync(document, project, "Task");
workItemTask.Wait();
DoWork(workItemTrackingHttpClient, project, assignedToNameToUser, requestorNameToUser, keyValuePair.Key, keyValuePair.Value);
counter++;
if (workItemTask.Result is null)
continue;
if (keyValuePair.Value.Priority == "0 - BugFix")
{
document = new();
AddPatch(document, "/fields/System.AreaPath", project);
AddPatch(document, "/fields/System.IterationPath", project);
AddPatch(document, "/fields/System.Title", keyValuePair.Value.Subject);
AddPatch(document, "/fields/System.Description", $"{description}<br />{keyValuePair.Value.Definition}");
// AddPatch(document, "/fields/System.AssignedTo", "Mike.Phares@infineon.com");
workItemTask = workItemTrackingHttpClient.CreateWorkItemAsync(document, project, "Bug");
workItemTask.Wait();
}
}
}
}

View File

@ -5,14 +5,14 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>FI Backlog Mesa</title>
<link href="/igniteui/css/themes/bootstrap3/default/infragistics.theme.css?v=2023-06-09-16-27" rel="stylesheet" />
<link href="/igniteui/css/structure/infragistics.css?v=2023-06-09-16-27" rel="stylesheet" />
<script src="/js/jquery-3.6.0.min.js?v=2023-06-09-16-27" type="text/javascript"></script>
<script src="/js/jquery-ui.min.js?v=2023-06-09-16-27" type="text/javascript"></script>
<script src="/js/site.js?v=2023-06-09-16-27" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.core.js?v=2023-06-09-16-27" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.lob.js?v=2023-06-09-16-27" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.dv.js?v=2023-06-09-16-27" type="text/javascript"></script>
<link href="/igniteui/css/themes/bootstrap3/default/infragistics.theme.css?v=2023-06-09-15-01" rel="stylesheet" />
<link href="/igniteui/css/structure/infragistics.css?v=2023-06-09-15-01" rel="stylesheet" />
<script src="/js/jquery-3.6.0.min.js?v=2023-06-09-15-01" type="text/javascript"></script>
<script src="/js/jquery-ui.min.js?v=2023-06-09-15-01" type="text/javascript"></script>
<script src="/js/site.js?v=2023-06-09-15-01" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.core.js?v=2023-06-09-15-01" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.lob.js?v=2023-06-09-15-01" type="text/javascript"></script>
<script src="/igniteui/js/infragistics.dv.js?v=2023-06-09-15-01" type="text/javascript"></script>
</head>
<body>
<h2>FI Backlog Mesa</h2>

View File

@ -1,12 +1,10 @@
function compareFunction(a, b) {
return a.Priority[0] - b.Priority[0] || a.Req.length - b.Req.length || a.Req - b.Req;
return a['Priority'][0] - b['Priority'][0] || a['Req '].length - b['Req '].length || a['Req '] - b['Req '];
}
function initIndex(url) {
$.getJSON(url, function (data) {
for (var i = data.length - 1; i > -1; i--) {
if (data[i]['Subject - from Requestor'].length > 255)
data[i]['Subject - from Requestor'] = data[i]['Subject - from Requestor'].substring(0, 255) + '...';
if (data[i].Submitted !== '')
continue;
data.splice(i, 1);
@ -23,7 +21,8 @@ function initIndex(url) {
{ key: "Requestor", dataType: "string" },
{ key: "Assigned To", dataType: "string" },
{ key: "Second Resource", dataType: "string" },
{ key: "Subject - from Requestor", dataType: "string", width: "30%" },
{ key: "Subject - from Requestor", dataType: "string" },
{ key: "System(s)", dataType: "string" },
{ key: "Priority", dataType: "string" },
],
features: [