diff --git a/AzureDevOpsTeamMembersVelocity/AzureDevOpsTeamMembersVelocity.csproj b/AzureDevOpsTeamMembersVelocity/AzureDevOpsTeamMembersVelocity.csproj index 675b64a..e4fc799 100644 --- a/AzureDevOpsTeamMembersVelocity/AzureDevOpsTeamMembersVelocity.csproj +++ b/AzureDevOpsTeamMembersVelocity/AzureDevOpsTeamMembersVelocity.csproj @@ -1,7 +1,8 @@  - net8.0 + 2.0.0 + net9.0 enable true Documentation.xml @@ -9,34 +10,31 @@ - - - - - - - - - - + + + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - + + + + + - + diff --git a/AzureDevOpsTeamMembersVelocity/Extensions/JsonExtension.cs b/AzureDevOpsTeamMembersVelocity/Extensions/JsonExtension.cs index e78ec9a..1af42a7 100644 --- a/AzureDevOpsTeamMembersVelocity/Extensions/JsonExtension.cs +++ b/AzureDevOpsTeamMembersVelocity/Extensions/JsonExtension.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json.Linq; +using System.Text.Json; namespace AzureDevOpsTeamMembersVelocity.Extensions { @@ -10,10 +10,9 @@ public static class JsonExtension /// /// Transform a string a formatted JSON string /// - /// public static string FormatJson(this string json) { - return JObject.Parse(json).ToString(Newtonsoft.Json.Formatting.Indented); + return JsonSerializer.Serialize(JsonSerializer.Deserialize(json), new JsonSerializerOptions { WriteIndented = true }); } } } diff --git a/AzureDevOpsTeamMembersVelocity/Model/GitPullRequest.cs b/AzureDevOpsTeamMembersVelocity/Model/GitPullRequest.cs new file mode 100644 index 0000000..16db99b --- /dev/null +++ b/AzureDevOpsTeamMembersVelocity/Model/GitPullRequest.cs @@ -0,0 +1,39 @@ +using System; + +namespace AzureDevOpsTeamMembersVelocity.Model; + +/// +/// GitPullRequest +/// +public class GitPullRequest +{ + /// + /// PullRequestId + /// + public int? PullRequestId { get; set; } + + /// + /// Title + /// + public string? Title { get; set; } + + /// + /// CreatedBy + /// + public UserObj CreatedBy { get; set; } = new UserObj(); + + /// + /// CreationDate + /// + public DateTimeOffset CreationDate { get; set; } + + /// + /// Url + /// + public string Url { get; set; } = string.Empty; + + /// + /// Git Repository + /// + public GitRepository Repository { get; set; } = new GitRepository(); +} diff --git a/AzureDevOpsTeamMembersVelocity/Model/GitPullRequestCommentThread.cs b/AzureDevOpsTeamMembersVelocity/Model/GitPullRequestCommentThread.cs new file mode 100644 index 0000000..4138d60 --- /dev/null +++ b/AzureDevOpsTeamMembersVelocity/Model/GitPullRequestCommentThread.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; + +namespace AzureDevOpsTeamMembersVelocity.Model; + +/// +/// GitPullRequestCommentThread +/// +public class GitPullRequestCommentThread +{ + public List Comments { get; set; } +} + +public class PRComment +{ + public UserObj Author { get; set; } = new UserObj(); + + public string? Content { get; set; } +} \ No newline at end of file diff --git a/AzureDevOpsTeamMembersVelocity/Model/GitRepository.cs b/AzureDevOpsTeamMembersVelocity/Model/GitRepository.cs index b9d7b6b..8c7513d 100644 --- a/AzureDevOpsTeamMembersVelocity/Model/GitRepository.cs +++ b/AzureDevOpsTeamMembersVelocity/Model/GitRepository.cs @@ -1,16 +1,32 @@ -using System.Text.Json.Serialization; +using System; +using System.Text.Json.Serialization; namespace AzureDevOpsTeamMembersVelocity.Model { /// /// Represent a git repository from the Azure DevOps REST API /// - public class GitRepository : Microsoft.TeamFoundation.SourceControl.WebApi.GitRepository + public class GitRepository { + /// + /// Id + /// + public Guid Id { get; set; } + + /// + /// Name + /// + public string? Name { get; set; } + + /// + /// Url + /// + public string? Url { get; set; } + /// /// Links of resources related to the GitRepository /// [JsonPropertyName("_links")] - public new GitRepositoryLinks? Links { get; set; } + public GitRepositoryLinks? Links { get; set; } } } diff --git a/AzureDevOpsTeamMembersVelocity/Model/PropertyCollection.cs b/AzureDevOpsTeamMembersVelocity/Model/PropertyCollection.cs new file mode 100644 index 0000000..3b719f2 --- /dev/null +++ b/AzureDevOpsTeamMembersVelocity/Model/PropertyCollection.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; + +namespace AzureDevOpsTeamMembersVelocity.Model; + +/// +/// PropertyCollection +/// +public class PropertiesCollection : Dictionary +{ +} diff --git a/AzureDevOpsTeamMembersVelocity/Model/Release.cs b/AzureDevOpsTeamMembersVelocity/Model/Release.cs new file mode 100644 index 0000000..90edc14 --- /dev/null +++ b/AzureDevOpsTeamMembersVelocity/Model/Release.cs @@ -0,0 +1,12 @@ +namespace AzureDevOpsTeamMembersVelocity.Model; + +/// +/// Release +/// +public class Release +{ + /// + /// Name + /// + public string? Name { get; set; } +} diff --git a/AzureDevOpsTeamMembersVelocity/Model/ReleaseDefinition.cs b/AzureDevOpsTeamMembersVelocity/Model/ReleaseDefinition.cs new file mode 100644 index 0000000..c18bd0d --- /dev/null +++ b/AzureDevOpsTeamMembersVelocity/Model/ReleaseDefinition.cs @@ -0,0 +1,12 @@ +namespace AzureDevOpsTeamMembersVelocity.Model; + +/// +/// ReleaseDefinition +/// +public class ReleaseDefinition +{ + /// + /// Name + /// + public string? Name { get; set; } +} diff --git a/AzureDevOpsTeamMembersVelocity/Model/Sprint.cs b/AzureDevOpsTeamMembersVelocity/Model/Sprint.cs index 6dfdd48..ad1fffe 100644 --- a/AzureDevOpsTeamMembersVelocity/Model/Sprint.cs +++ b/AzureDevOpsTeamMembersVelocity/Model/Sprint.cs @@ -63,7 +63,7 @@ public double GetTotalDays() /// List of working days /// TeamDaysOff information /// GetTotalDays() - days off - public double GetTotalWorkingDays(DayOfWeek[]? workingDays, Microsoft.TeamFoundation.Work.WebApi.TeamSettingsDaysOff? teamDaysOff) + public double GetTotalWorkingDays(DayOfWeek[]? workingDays, TeamSettingsDaysOff? teamDaysOff) { var initial = GetTotalDays(); diff --git a/AzureDevOpsTeamMembersVelocity/Model/SubjectDescriptor.cs b/AzureDevOpsTeamMembersVelocity/Model/SubjectDescriptor.cs new file mode 100644 index 0000000..dda32a6 --- /dev/null +++ b/AzureDevOpsTeamMembersVelocity/Model/SubjectDescriptor.cs @@ -0,0 +1,9 @@ +namespace AzureDevOpsTeamMembersVelocity.Model; + +public struct SubjectDescriptor +{ + public SubjectDescriptor(string one, string two) + { + + } +} diff --git a/AzureDevOpsTeamMembersVelocity/Model/TeamMemberCapacityIdentityRef.cs b/AzureDevOpsTeamMembersVelocity/Model/TeamMemberCapacityIdentityRef.cs new file mode 100644 index 0000000..5425737 --- /dev/null +++ b/AzureDevOpsTeamMembersVelocity/Model/TeamMemberCapacityIdentityRef.cs @@ -0,0 +1,50 @@ +using System.Collections.Generic; + +namespace AzureDevOpsTeamMembersVelocity.Model; + +/// +/// TeamMemberCapacityIdentityRef +/// +public class TeamMemberCapacityIdentityRef +{ + /// + /// TeamMember + /// + public TeamMember? TeamMember { get; set; } + + /// + /// Activity + /// + public List? Activities { get; set; } + + /// + /// DaysOff + /// + public DayOff[]? DaysOff { get; set; } +} + +/// +/// TeamMember +/// +public class TeamMember +{ + /// + /// DisplayName + /// + public string? DisplayName { get; set; } +} + +/// +/// Activity +/// +public class Activity +{ + /// + /// CapacityPerDay + /// + public double? CapacityPerDay { get; set; } + /// + /// Name + /// + public string? Name { get; set; } +} \ No newline at end of file diff --git a/AzureDevOpsTeamMembersVelocity/Model/TeamSetting.cs b/AzureDevOpsTeamMembersVelocity/Model/TeamSetting.cs new file mode 100644 index 0000000..b4f9117 --- /dev/null +++ b/AzureDevOpsTeamMembersVelocity/Model/TeamSetting.cs @@ -0,0 +1,14 @@ +using System; + +namespace AzureDevOpsTeamMembersVelocity.Model; + +/// +/// TeamSetting +/// +public class TeamSetting +{ + /// + /// WorkingDays of a week + /// + public DayOfWeek[]? WorkingDays { get; set; } +} diff --git a/AzureDevOpsTeamMembersVelocity/Model/TeamSettingsDaysOff.cs b/AzureDevOpsTeamMembersVelocity/Model/TeamSettingsDaysOff.cs new file mode 100644 index 0000000..66647bb --- /dev/null +++ b/AzureDevOpsTeamMembersVelocity/Model/TeamSettingsDaysOff.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; + +namespace AzureDevOpsTeamMembersVelocity.Model; + +public class TeamSettingsDaysOff +{ + public List? DaysOff { get; set; } +} + +public class DayOff +{ + public DateTimeOffset Start { get; set; } + public DateTimeOffset End { get; set; } +} \ No newline at end of file diff --git a/AzureDevOpsTeamMembersVelocity/Model/WebApiTeam.cs b/AzureDevOpsTeamMembersVelocity/Model/WebApiTeam.cs new file mode 100644 index 0000000..105d38e --- /dev/null +++ b/AzureDevOpsTeamMembersVelocity/Model/WebApiTeam.cs @@ -0,0 +1,12 @@ +namespace AzureDevOpsTeamMembersVelocity.Model; + +/// +/// WebApiTeam +/// +public class WebApiTeam +{ + /// + /// Name + /// + public string? Name { get; set; } +} diff --git a/AzureDevOpsTeamMembersVelocity/Model/WorkItem.cs b/AzureDevOpsTeamMembersVelocity/Model/WorkItem.cs index 96c84dc..9caabfd 100644 --- a/AzureDevOpsTeamMembersVelocity/Model/WorkItem.cs +++ b/AzureDevOpsTeamMembersVelocity/Model/WorkItem.cs @@ -1,12 +1,19 @@ -using System.Text.Json.Serialization; +using System.Collections.Generic; +using System.Text.Json.Serialization; namespace AzureDevOpsTeamMembersVelocity.Model { - /// - public class WorkItem : Microsoft.TeamFoundation.WorkItemTracking.WebApi.Models.WorkItem + /// + /// WorkItem + /// + public class WorkItem { - /// + public Dictionary Fields { get; set; } = new Dictionary(); + + /// + /// Links + /// [JsonPropertyName("_links")] - public new WorkItemLinks? Links { get; set; } + public WorkItemLinks? Links { get; set; } } } diff --git a/AzureDevOpsTeamMembersVelocity/Model/WorkItemFieldUpdate.cs b/AzureDevOpsTeamMembersVelocity/Model/WorkItemFieldUpdate.cs new file mode 100644 index 0000000..2b7ce39 --- /dev/null +++ b/AzureDevOpsTeamMembersVelocity/Model/WorkItemFieldUpdate.cs @@ -0,0 +1,17 @@ +namespace AzureDevOpsTeamMembersVelocity.Model; + +/// +/// WorkItemFieldUpdate +/// +public class WorkItemFieldUpdate +{ + /// + /// OldValue + /// + public object? OldValue { get; set; } + + /// + /// NewValue + /// + public object NewValue { get; set; } = new object(); +} diff --git a/AzureDevOpsTeamMembersVelocity/Model/WorkItemUpdate.cs b/AzureDevOpsTeamMembersVelocity/Model/WorkItemUpdate.cs index fd4299a..148ffe4 100644 --- a/AzureDevOpsTeamMembersVelocity/Model/WorkItemUpdate.cs +++ b/AzureDevOpsTeamMembersVelocity/Model/WorkItemUpdate.cs @@ -1,9 +1,12 @@ using System; +using System.Collections.Generic; namespace AzureDevOpsTeamMembersVelocity.Model { - /// - public class WorkItemUpdate : Microsoft.TeamFoundation.WorkItemTracking.WebApi.Models.WorkItemUpdate, IComparable + /// + /// WorkItemUpdate + /// + public class WorkItemUpdate : IComparable { /// /// The title of the associate WorkItem. @@ -14,6 +17,31 @@ public class WorkItemUpdate : Microsoft.TeamFoundation.WorkItemTracking.WebApi.M /// public string? RelatedTaskTitle { get; set; } + /// + /// The date of the last update of the WorkItem + /// + public DateTimeOffset RevisedDate { get; set; } + + /// + /// RevisedBy + /// + public UserObj? RevisedBy { get; set; } + + /// + /// Url + /// + public string Url { get; set; } = string.Empty; + + /// + /// CreationDate + /// + public DateTimeOffset CreationDate { get; set; } + + /// + /// Fields + /// + public Dictionary? Fields { get; set; } + /// /// Compare a WorkItemUpdate base on the RelatedTaskTitle and if the save /// the RevisedDate @@ -32,4 +60,15 @@ public int CompareTo(WorkItemUpdate? other) return initial; } } + + /// + /// UserObj + /// + public class UserObj + { + /// + /// DisplayName + /// + public string? DisplayName { get; set; } + } } diff --git a/AzureDevOpsTeamMembersVelocity/Model/WorkItems.cs b/AzureDevOpsTeamMembersVelocity/Model/WorkItems.cs index b884baa..571ad5a 100644 --- a/AzureDevOpsTeamMembersVelocity/Model/WorkItems.cs +++ b/AzureDevOpsTeamMembersVelocity/Model/WorkItems.cs @@ -1,5 +1,4 @@ -using Microsoft.TeamFoundation.WorkItemTracking.WebApi.Models; -using System.Collections.Generic; +using System.Collections.Generic; namespace AzureDevOpsTeamMembersVelocity.Model { @@ -18,4 +17,31 @@ public class WorkItems /// public List? WorkItemRelations { get; set; } } + + /// + /// WorkItemLink + /// + public class WorkItemLink + { + /// + /// Source + /// + public UrlObj Source { get; set; } = new UrlObj(); + + /// + /// Target + /// + public UrlObj Target { get; set; } = new UrlObj(); + } + + /// + /// UrlObj + /// + public class UrlObj + { + /// + /// Url + /// + public string Url { get; set; } = string.Empty; + } } diff --git a/AzureDevOpsTeamMembersVelocity/Pages/CodeBot.razor b/AzureDevOpsTeamMembersVelocity/Pages/CodeBot.razor deleted file mode 100644 index eef0af6..0000000 --- a/AzureDevOpsTeamMembersVelocity/Pages/CodeBot.razor +++ /dev/null @@ -1,55 +0,0 @@ -@page "/CodeBot" -@using AutoCode -@inject ILogger Logger -@attribute [Authorize] - -@if (Error != null) -{ -
    -
  • @Error
  • -
-} - - - -

CodeBot

-
- - - Add comments - - -
- -@switch (Function) -{ - case "AddComments": - - break; -} - -
- -@code { - public string? Error { get; set; } - - public string? Function { get; set; } = "AddComments"; - - public void UpdateView(IEnumerable function) - { - try - { - Function = function.SingleOrDefault(); - StateHasChanged(); - } - catch (Exception e) - { - Error = e.Message; - } - } -} \ No newline at end of file diff --git a/AzureDevOpsTeamMembersVelocity/Pages/Git.razor b/AzureDevOpsTeamMembersVelocity/Pages/Git.razor index 59f472a..a4156a1 100644 --- a/AzureDevOpsTeamMembersVelocity/Pages/Git.razor +++ b/AzureDevOpsTeamMembersVelocity/Pages/Git.razor @@ -72,9 +72,9 @@ public GitRepository? Repository { get; set; } - public List? PullRequests { get; set; } + public List? PullRequests { get; set; } - public Microsoft.TeamFoundation.SourceControl.WebApi.GitPullRequest? PullRequest { get; set; } + public GitPullRequest? PullRequest { get; set; } private bool _loading; @@ -118,7 +118,7 @@ if (PullRequests == null) { - PullRequests = new List(); + PullRequests = new List(); } foreach (var repo in GitSettings.SelectedRepositories ?? Array.Empty()) @@ -141,7 +141,7 @@ { if (PullRequests == null) { - PullRequests = new List(); + PullRequests = new List(); } PullRequests.AddRange(pullRequests.Value); diff --git a/AzureDevOpsTeamMembersVelocity/Pages/Index.razor b/AzureDevOpsTeamMembersVelocity/Pages/Index.razor index f6fd1c1..b4dec8e 100644 --- a/AzureDevOpsTeamMembersVelocity/Pages/Index.razor +++ b/AzureDevOpsTeamMembersVelocity/Pages/Index.razor @@ -251,7 +251,7 @@ Welcome to the team members velocity app. } } - public List? Teams { get; set; } = new(); + public List? Teams { get; set; } = new(); public async Task GetTeams() { diff --git a/AzureDevOpsTeamMembersVelocity/Pages/Login.cshtml b/AzureDevOpsTeamMembersVelocity/Pages/Login.cshtml index 1c551c1..265d6ec 100644 --- a/AzureDevOpsTeamMembersVelocity/Pages/Login.cshtml +++ b/AzureDevOpsTeamMembersVelocity/Pages/Login.cshtml @@ -25,7 +25,7 @@ -
+
diff --git a/AzureDevOpsTeamMembersVelocity/Pages/PullRequest.razor b/AzureDevOpsTeamMembersVelocity/Pages/PullRequest.razor index 438ef58..2b9d61d 100644 --- a/AzureDevOpsTeamMembersVelocity/Pages/PullRequest.razor +++ b/AzureDevOpsTeamMembersVelocity/Pages/PullRequest.razor @@ -40,9 +40,9 @@ @code { public string? Error { get; set; } - public Microsoft.TeamFoundation.SourceControl.WebApi.GitPullRequest? PullRequestModel { get; set; } + public GitPullRequest? PullRequestModel { get; set; } - public List? Comments { get; set; } + public List? Comments { get; set; } protected override async Task OnInitializedAsync() { @@ -62,7 +62,7 @@ } } - private async Task GetComments(Microsoft.TeamFoundation.SourceControl.WebApi.GitPullRequest pr) + private async Task GetComments(GitPullRequest pr) { var settings = await UserSettings.GetAsync(); diff --git a/AzureDevOpsTeamMembersVelocity/Pages/Releases.razor b/AzureDevOpsTeamMembersVelocity/Pages/Releases.razor index 5989e14..8836e5b 100644 --- a/AzureDevOpsTeamMembersVelocity/Pages/Releases.razor +++ b/AzureDevOpsTeamMembersVelocity/Pages/Releases.razor @@ -50,9 +50,9 @@ @code { - List? ReleasesList { get; set; } + List? ReleasesList { get; set; } - List? DefinitionList { get; set; } + List? DefinitionList { get; set; } ListDefinitionFilter ListDefinitionFilter { get; set; } = new ListDefinitionFilter(); diff --git a/AzureDevOpsTeamMembersVelocity/Pages/Shared/_Layout.cshtml b/AzureDevOpsTeamMembersVelocity/Pages/Shared/_Layout.cshtml index 49b1ed8..bbfd1ac 100644 --- a/AzureDevOpsTeamMembersVelocity/Pages/Shared/_Layout.cshtml +++ b/AzureDevOpsTeamMembersVelocity/Pages/Shared/_Layout.cshtml @@ -46,7 +46,7 @@
- © 2021 - AzureDevOpsTeamMembersVelocity - Privacy + © 2024 - AzureDevOpsTeamMembersVelocity - Privacy
diff --git a/AzureDevOpsTeamMembersVelocity/Pages/SprintAnalysis.razor b/AzureDevOpsTeamMembersVelocity/Pages/SprintAnalysis.razor index c3caada..3af3b8d 100644 --- a/AzureDevOpsTeamMembersVelocity/Pages/SprintAnalysis.razor +++ b/AzureDevOpsTeamMembersVelocity/Pages/SprintAnalysis.razor @@ -123,11 +123,11 @@ else public Sprint? Sprint { get; set; } - public List? Capacities { get; set; } + public List? Capacities { get; set; } - public Microsoft.TeamFoundation.Work.WebApi.TeamSetting? TeamSettings { get; set; } + public TeamSetting? TeamSettings { get; set; } - public Microsoft.TeamFoundation.Work.WebApi.TeamSettingsDaysOff? TeamDaysOff { get; set; } + public TeamSettingsDaysOff? TeamDaysOff { get; set; } public HashSet? MembersVelocities { get; set; } diff --git a/AzureDevOpsTeamMembersVelocity/Serialization/JsonSubjectDescriptorConverterFactory.cs b/AzureDevOpsTeamMembersVelocity/Serialization/JsonSubjectDescriptorConverterFactory.cs index f840c22..8253cd5 100644 --- a/AzureDevOpsTeamMembersVelocity/Serialization/JsonSubjectDescriptorConverterFactory.cs +++ b/AzureDevOpsTeamMembersVelocity/Serialization/JsonSubjectDescriptorConverterFactory.cs @@ -1,4 +1,4 @@ -using Microsoft.VisualStudio.Services.Common; +using AzureDevOpsTeamMembersVelocity.Model; using System; using System.Text.Json; using System.Text.Json.Serialization; diff --git a/AzureDevOpsTeamMembersVelocity/Serialization/PropertyCollectionConverter.cs b/AzureDevOpsTeamMembersVelocity/Serialization/PropertyCollectionConverter.cs index 57998df..6363933 100644 --- a/AzureDevOpsTeamMembersVelocity/Serialization/PropertyCollectionConverter.cs +++ b/AzureDevOpsTeamMembersVelocity/Serialization/PropertyCollectionConverter.cs @@ -1,4 +1,4 @@ -using Microsoft.VisualStudio.Services.WebApi; +using AzureDevOpsTeamMembersVelocity.Model; using System; using System.Collections.Generic; using System.Text.Json; @@ -7,9 +7,9 @@ namespace AzureDevOpsTeamMembersVelocity.Serialization { /// - /// Converter for the object + /// Converter for the PropertyCollection object /// - public class PropertyCollectionConverter : JsonConverter + public class PropertyCollectionConverter : JsonConverter { /// public override PropertiesCollection? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) @@ -31,8 +31,7 @@ public class PropertyCollectionConverter : JsonConverter /// URL of team days off to fetch - public Task<(Microsoft.TeamFoundation.Work.WebApi.TeamSettingsDaysOff?, string?)> TeamDaysOff(string teamIterationDaysOffUrl) + public Task<(TeamSettingsDaysOff?, string?)> TeamDaysOff(string teamIterationDaysOffUrl) { - return _proxy.GetAsync( + return _proxy.GetAsync( $"{teamIterationDaysOffUrl}?api-version=6.0"); } @@ -69,9 +68,9 @@ public DevOpsService(IDevOpsProxy proxy) /// /// The teamSettings full URL without the api-version /// The teamSetting instance - public Task<(Microsoft.TeamFoundation.Work.WebApi.TeamSetting?, string?)> TeamSettings(string teamSettingsUrl) + public Task<(TeamSetting?, string?)> TeamSettings(string teamSettingsUrl) { - return _proxy.GetAsync( + return _proxy.GetAsync( $"{teamSettingsUrl}?api-version=6.0"); } @@ -109,9 +108,9 @@ public DevOpsService(IDevOpsProxy proxy) /// /// The full URL of the capacity information. /// The list of capacities - public Task<(ListResponse?, string?)> Capacities(string capacityUrl) + public Task<(ListResponse?, string?)> Capacities(string capacityUrl) { - return _proxy.GetAsync>( + return _proxy.GetAsync>( $"{capacityUrl}?api-version=6.0"); } diff --git a/AzureDevOpsTeamMembersVelocity/Services/GitService.cs b/AzureDevOpsTeamMembersVelocity/Services/GitService.cs index 2163184..39ca8bf 100644 --- a/AzureDevOpsTeamMembersVelocity/Services/GitService.cs +++ b/AzureDevOpsTeamMembersVelocity/Services/GitService.cs @@ -46,18 +46,18 @@ public GitService(IDevOpsProxy proxy) ///
/// The pull request url from a GitRepositoryUrl /// A task that list pull requests - public Task<(ListResponse?,string?)> GetPullRequests(string pullRequestUrl) + public Task<(ListResponse?,string?)> GetPullRequests(string pullRequestUrl) { - return _proxy.GetAsync>($"{pullRequestUrl}?api-version=6.0"); + return _proxy.GetAsync>($"{pullRequestUrl}?api-version=6.0"); } /// /// List all pull request of a repository /// /// A task that list pull requests - public Task<(ListResponse?, string?)> GetPullRequests(string organization, Guid teamProjectId, Guid repositoryId) + public Task<(ListResponse?, string?)> GetPullRequests(string organization, Guid teamProjectId, Guid repositoryId) { - return _proxy.GetAsync>( + return _proxy.GetAsync>( $"https://dev.azure.com/{organization}/{teamProjectId}/_apis/git/repositories/{repositoryId}/pullRequests?api-version=6.0"); } @@ -66,9 +66,9 @@ public GitService(IDevOpsProxy proxy) /// /// The pull request url /// A PR and an error if any - public Task<(Microsoft.TeamFoundation.SourceControl.WebApi.GitPullRequest?, string?)> GetPullRequest(string pullRequestUrl) + public Task<(GitPullRequest?, string?)> GetPullRequest(string pullRequestUrl) { - return _proxy.GetAsync($"{pullRequestUrl}?api-version=6.0"); + return _proxy.GetAsync($"{pullRequestUrl}?api-version=6.0"); } /// @@ -78,9 +78,9 @@ public GitService(IDevOpsProxy proxy) /// /// /// - public Task<(ListResponse?, string?)> GetComments(string organization, Guid repositoryId, int? pullRequestId) + public Task<(ListResponse?, string?)> GetComments(string organization, Guid repositoryId, int? pullRequestId) { - return _proxy.GetAsync>( + return _proxy.GetAsync>( $"https://dev.azure.com/{organization}/_apis/git/repositories/{repositoryId}/pullRequests/{pullRequestId}/threads?api-version=6.0"); } } diff --git a/AzureDevOpsTeamMembersVelocity/Services/ReleasesService.cs b/AzureDevOpsTeamMembersVelocity/Services/ReleasesService.cs index 70ccf58..517568c 100644 --- a/AzureDevOpsTeamMembersVelocity/Services/ReleasesService.cs +++ b/AzureDevOpsTeamMembersVelocity/Services/ReleasesService.cs @@ -1,6 +1,7 @@ using AzureDevOpsTeamMembersVelocity.Settings; using AzureDevOpsTeamMembersVelocity.Proxy; using System.Threading.Tasks; +using AzureDevOpsTeamMembersVelocity.Model; namespace AzureDevOpsTeamMembersVelocity.Services { @@ -29,9 +30,9 @@ public ReleasesService(IDevOpsProxy proxy) /// /// /// - public Task<(ListResponse?, string?)> ListReleases(string organization, string teamProject) + public Task<(ListResponse?, string?)> ListReleases(string organization, string teamProject) { - return _proxy.GetAsync>( + return _proxy.GetAsync>( $"https://vsrm.dev.azure.com/{organization}/{teamProject}/_apis/release/releases?api-version=6.0"); } @@ -41,7 +42,7 @@ public ReleasesService(IDevOpsProxy proxy) /// /// Microsoft documentation: https://docs.microsoft.com/en-us/rest/api/azure/devops/release/definitions/list?view=azure-devops-rest-6.0 /// - public Task<(ListResponse?, string?)> ListDefinition(string organization, string teamProject, ListDefinitionFilter? listDefinitionFilter = default) + public Task<(ListResponse?, string?)> ListDefinition(string organization, string teamProject, ListDefinitionFilter? listDefinitionFilter = default) { string releaseDefinitionUrl = $"https://vsrm.dev.azure.com/{organization}/{teamProject}/_apis/release/definitions?api-version=6.0"; @@ -50,7 +51,7 @@ public ReleasesService(IDevOpsProxy proxy) releaseDefinitionUrl = listDefinitionFilter.AppendParameterToQueryString(releaseDefinitionUrl); } - return _proxy.GetAsync>(releaseDefinitionUrl); + return _proxy.GetAsync>(releaseDefinitionUrl); } } } diff --git a/AzureDevOpsTeamMembersVelocity/Services/VelocityService.cs b/AzureDevOpsTeamMembersVelocity/Services/VelocityService.cs index 0aad065..4093124 100644 --- a/AzureDevOpsTeamMembersVelocity/Services/VelocityService.cs +++ b/AzureDevOpsTeamMembersVelocity/Services/VelocityService.cs @@ -39,7 +39,7 @@ public VelocityService(DevOpsService devOpsService, IVelocityRepository velocity /// Team settings is use to enhance result and do the right calculation /// Indicate if the value can be get from memory or the results is calculated /// - public async IAsyncEnumerable MemberVelocities(string sprintUrl, List? capacities = null, Sprint? sprint = null, Microsoft.TeamFoundation.Work.WebApi.TeamSettingsDaysOff? teamDaysOff = null, Microsoft.TeamFoundation.Work.WebApi.TeamSetting? teamSettings = null, bool useCache = true) + public async IAsyncEnumerable MemberVelocities(string sprintUrl, List? capacities = null, Sprint? sprint = null, TeamSettingsDaysOff? teamDaysOff = null, TeamSetting? teamSettings = null, bool useCache = true) { if (useCache && _repo.TryGet(sprintUrl, out IEnumerable? memberVelocities) && memberVelocities != null) { @@ -69,7 +69,7 @@ public async IAsyncEnumerable MemberVelocities(string sprintUrl, } } - private static MemberVelocity EnhanceMemberVolocityInfo(MemberVelocity velocity, List? capacities = null, Sprint? sprint = null, Microsoft.TeamFoundation.Work.WebApi.TeamSettingsDaysOff? teamDaysOff = null, Microsoft.TeamFoundation.Work.WebApi.TeamSetting? teamSettings = null) + private static MemberVelocity EnhanceMemberVolocityInfo(MemberVelocity velocity, List? capacities = null, Sprint? sprint = null, TeamSettingsDaysOff? teamDaysOff = null, TeamSetting? teamSettings = null) { if (capacities != default) { @@ -119,7 +119,7 @@ private static double Parse(string sx) return 0.0; } - private async IAsyncEnumerable<(WorkItem, List?)> GetWorksAndHistory(List items) + private async IAsyncEnumerable<(WorkItem, List?)> GetWorksAndHistory(List items) { foreach (var item in items) { @@ -139,7 +139,7 @@ private static double Parse(string sx) } } - private async Task GetWorkItem(Microsoft.TeamFoundation.WorkItemTracking.WebApi.Models.WorkItemLink workItem) + private async Task GetWorkItem(WorkItemLink workItem) { if (workItem.Source != null && workItem.Target != null) { @@ -176,7 +176,7 @@ public static void GroupByPerson(Dictionary groupByPerso groupByPerson.Add(person, velocity); } - var remaningWork = update?.Fields?.MaybeGet + var remaningWork = update?.Fields?.MaybeGet ("Microsoft.VSTS.Scheduling.RemainingWork"); if (remaningWork?.OldValue != null) diff --git a/AzureDevOpsTeamMembersVelocity/Shared/CodeBotFunction/AddComments.razor b/AzureDevOpsTeamMembersVelocity/Shared/CodeBotFunction/AddComments.razor deleted file mode 100644 index 4e1fc55..0000000 --- a/AzureDevOpsTeamMembersVelocity/Shared/CodeBotFunction/AddComments.razor +++ /dev/null @@ -1,72 +0,0 @@ -@using AutoCode -@inject ILogger Logger - -
-
- - -
-
- - -
-
- -
- -
- -@code { - public string? Code { get; set; } - - public string Template - { - get => Comment.CommentTemplate; - set - { - Comment.CommentTemplate = value; - } - } - - public string? Error { get; set; } - - private Comment Comment { get; set; } = new Comment(); - - private List loadedFiles = new(); - private long maxFileSize = 1024 * 30; - private int maxAllowedFiles = 1; - - private async Task LoadFiles(InputFileChangeEventArgs e) - { - loadedFiles.Clear(); - - foreach (var file in e.GetMultipleFiles(maxAllowedFiles)) - { - try - { - loadedFiles.Add(file); - - using var sr = new StreamReader(file.OpenReadStream(maxFileSize)); - - var code = await sr.ReadToEndAsync(); - - try - { - Code = Comment.Apply(code); - } - catch (Exception exception) - { - Code = exception.Message; - } - - Error = default; - } - catch (Exception ex) - { - Error = ex.Message; - - Logger.LogError("File: {Filename} Error: {Error}", file.Name, ex.Message); - } - } - } -} diff --git a/AzureDevOpsTeamMembersVelocity/Shared/NavMenu.razor b/AzureDevOpsTeamMembersVelocity/Shared/NavMenu.razor index 2c9578a..4b532cf 100644 --- a/AzureDevOpsTeamMembersVelocity/Shared/NavMenu.razor +++ b/AzureDevOpsTeamMembersVelocity/Shared/NavMenu.razor @@ -1,55 +1,5 @@ @inject AzureDevOpsTeamMembersVelocity.Services.TokenProvider TokenProvider @inject AuthUrlPagesProvider AuthUrlProvider -@* - -
- -
*@