aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.TFS
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2020-08-23 01:55:05 +0300
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2020-08-23 01:55:05 +0300
commit67770063ff1a1c5c522e3bc29f442c42eb6dc521 (patch)
treebb2f775112958751e0eede6fb4d1a588e0d6ce37 /Software/Visual_Studio/Tango.TFS
parente0fd99bf52fbf63b16d7b6fa7c577face4998d28 (diff)
downloadTango-67770063ff1a1c5c522e3bc29f442c42eb6dc521.tar.gz
Tango-67770063ff1a1c5c522e3bc29f442c42eb6dc521.zip
Fixed issue with Bson DateTime serialization.
Added bug reports insights annotations.
Diffstat (limited to 'Software/Visual_Studio/Tango.TFS')
-rw-r--r--Software/Visual_Studio/Tango.TFS/TeamFoundationServiceClient.cs48
-rw-r--r--Software/Visual_Studio/Tango.TFS/WorkItem.cs2
2 files changed, 50 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.TFS/TeamFoundationServiceClient.cs b/Software/Visual_Studio/Tango.TFS/TeamFoundationServiceClient.cs
index 766f2da1e..27e92b740 100644
--- a/Software/Visual_Studio/Tango.TFS/TeamFoundationServiceClient.cs
+++ b/Software/Visual_Studio/Tango.TFS/TeamFoundationServiceClient.cs
@@ -37,6 +37,7 @@ namespace Tango.TFS
public const String EMBEDDED_VERSION = "Custom.EmbeddedVersion";
public const String MACHINE_SN = "Custom.MachineSN";
public const String ENVIRONMENT = "Custom.Environment";
+ public const String LOGGED_IN_USER = "Custom.LoggedInUser";
}
#endregion
@@ -415,6 +416,16 @@ namespace Tango.TFS
});
}
+ if (workItem.LoggedInUser != null)
+ {
+ patchDocument.Add(new JsonPatchOperation
+ {
+ Operation = Operation.Add,
+ Path = GetExtensionFieldNameForWrite(ExtensionFields.LOGGED_IN_USER),
+ Value = workItem.LoggedInUser,
+ });
+ }
+
var resultWorkItem = witClient.CreateWorkItemAsync(patchDocument, project.Name, workItem.Type.ToString(), bypassRules: true).Result;
workItem.ID = resultWorkItem.Id.Value;
@@ -544,6 +555,28 @@ namespace Tango.TFS
});
}
+ public Task<List<WorkItem>> GetWorkItemsForMachine(Project project, String serialNumber)
+ {
+ return Task.Factory.StartNew<List<WorkItem>>(() =>
+ {
+ var connection = CreateConnection();
+
+ var projCollection = new TfsTeamProjectCollection(new Uri(CollectionURL), connection.Credentials);
+ var store = projCollection.GetService<WorkItemStore>();
+
+ WorkItemCollection queryResults = store.Query($"Select [Id] From WorkItems Where {ExtensionFields.MACHINE_SN} = '{serialNumber}' And [Work Item Type] = 'Bug'");
+ var ids = queryResults.OfType<Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem>().Where(x => x.Project.Name == project.Name).ToList().Select(x => x.Id).ToList();
+
+ if (ids.Count == 0) return new List<WorkItem>();
+
+ WorkItemTrackingHttpClient witClient = connection.GetClient<WorkItemTrackingHttpClient>();
+
+ var items = witClient.GetWorkItemsAsync(ids).Result;
+
+ return items.Select(x => ConvertToWorkItem(project, x)).ToList();
+ });
+ }
+
/// <summary>
/// Sets the state of the work item.
/// </summary>
@@ -789,6 +822,21 @@ namespace Tango.TFS
workItem.SystemInformation = TryGetField(item.Fields, ExtensionFields.SYSTEM_INFO).ToString();
}
+ if (item.Fields.ContainsKey(ExtensionFields.LOGGED_IN_USER))
+ {
+ workItem.LoggedInUser = TryGetField(item.Fields, ExtensionFields.LOGGED_IN_USER).ToString();
+ }
+
+ if (item.Fields.ContainsKey(ExtensionFields.MACHINE_SN))
+ {
+ workItem.MachineSerialNumber = TryGetField(item.Fields, ExtensionFields.MACHINE_SN).ToString();
+ }
+
+ if (item.Fields.ContainsKey(ExtensionFields.ENVIRONMENT))
+ {
+ workItem.Environment = TryGetField(item.Fields, ExtensionFields.ENVIRONMENT).ToString();
+ }
+
workItem.Comment = TryGetField(item.Fields, GetFieldNameForRead(CoreField.History)).ToString();
return workItem;
diff --git a/Software/Visual_Studio/Tango.TFS/WorkItem.cs b/Software/Visual_Studio/Tango.TFS/WorkItem.cs
index ef80fc217..35c2f8669 100644
--- a/Software/Visual_Studio/Tango.TFS/WorkItem.cs
+++ b/Software/Visual_Studio/Tango.TFS/WorkItem.cs
@@ -197,6 +197,8 @@ namespace Tango.TFS
set { _comment = value; RaisePropertyChangedAuto(); }
}
+ public String LoggedInUser { get; set; }
+
public bool IsBuildVersionValid
{
get