diff --git a/src/RepoGovernance.Core/SummaryItemsDA.cs b/src/RepoGovernance.Core/SummaryItemsDA.cs index 8a032677..8c2e4efa 100644 --- a/src/RepoGovernance.Core/SummaryItemsDA.cs +++ b/src/RepoGovernance.Core/SummaryItemsDA.cs @@ -44,10 +44,10 @@ public static async Task> GetSummaryItems( } public static async Task GetSummaryItem(string connectionString, - string owner, string repo) + string user, string owner, string repo) { SummaryItem? result = null; - List summaryItems = await GetSummaryItems(connectionString, owner); + List summaryItems = await GetSummaryItems(connectionString, user); if (summaryItems != null) { foreach (SummaryItem item in summaryItems) @@ -92,7 +92,7 @@ public static async Task UpdateSummaryItem(string? clientId, if (azureDeployment == null && connectionString != null) { //check to make sure there isn't data in the table already for Azure deployments, and pull it out to save it - SummaryItem? existingItem = await GetSummaryItem(connectionString, owner, repo); + SummaryItem? existingItem = await GetSummaryItem(connectionString, user, owner, repo); if (existingItem != null && existingItem.AzureDeployment != null) { azureDeployment = existingItem.AzureDeployment; @@ -328,7 +328,7 @@ public static async Task UpdateSummaryItem(string? clientId, else if (summaryItem != null && repoLanguages == null && connectionString != null) { //If we couldn't find languages last time - lets pull up the existing summary item and use that - SummaryItem? summaryItem2 = await GetSummaryItem(connectionString, owner, repo); + SummaryItem? summaryItem2 = await GetSummaryItem(connectionString, user, owner, repo); if (summaryItem2 != null && summaryItem2.RepoLanguages != null) { summaryItem.RepoLanguages = summaryItem2.RepoLanguages; @@ -360,7 +360,7 @@ public static async Task UpdateSummaryItem(string? clientId, string message = ex.ToString(); if (connectionString != null) { - summaryItem = await GetSummaryItem(connectionString, owner, repo); + summaryItem = await GetSummaryItem(connectionString, user, owner, repo); if (summaryItem != null) { summaryItem.LastUpdatedMessage = "Error at " + DateTime.Now.ToString() + ": " + ex.ToString(); diff --git a/src/RepoGovernance.Service/Controllers/SummaryItemsController.cs b/src/RepoGovernance.Service/Controllers/SummaryItemsController.cs index e2e1401f..af7f4716 100644 --- a/src/RepoGovernance.Service/Controllers/SummaryItemsController.cs +++ b/src/RepoGovernance.Service/Controllers/SummaryItemsController.cs @@ -62,11 +62,11 @@ public async Task> GetSummaryItems(string user) /// the repo /// [HttpGet("GetSummaryItem")] - public async Task GetSummaryItem(string owner, string repo) + public async Task GetSummaryItem(string user, string owner, string repo) { return await SummaryItemsDA.GetSummaryItem( - Configuration["AppSettings:CosmosDBConnectionString"], - owner, repo); + Configuration["AppSettings:CosmosDBConnectionString"], + user, owner, repo); } diff --git a/src/RepoGovernance.Tests/SummaryItemsControllerTests.cs b/src/RepoGovernance.Tests/SummaryItemsControllerTests.cs index b1ff318d..2919441f 100644 --- a/src/RepoGovernance.Tests/SummaryItemsControllerTests.cs +++ b/src/RepoGovernance.Tests/SummaryItemsControllerTests.cs @@ -53,16 +53,17 @@ public async Task UpdateDevOpsMetricsSummaryItemTest() string user = "samsmithnz"; string owner = "DeveloperMetrics"; string repo = "DevOpsMetrics"; - AzureDeployment azureDeployment = new() - { - DeployedURL = "https://devops-prod-eu-web.azurewebsites.net//", - AppRegistrations = new() - { - new AzureAppRegistration() { Name = "DeveloperMetricsOrgSP2023" }, - new AzureAppRegistration() { Name = "DevOpsMetrics" }, - new AzureAppRegistration() { Name = "DevOpsMetricsServicePrincipal2022" } - } - }; + AzureDeployment azureDeployment = null; + //AzureDeployment azureDeployment = new() + //{ + // DeployedURL = "https://devops-prod-eu-web.azurewebsites.net//", + // AppRegistrations = new() + // { + // new AzureAppRegistration() { Name = "DeveloperMetricsOrgSP2023" }, + // new AzureAppRegistration() { Name = "DevOpsMetrics" }, + // new AzureAppRegistration() { Name = "DevOpsMetricsServicePrincipal2022" } + // } + //}; //Act - runs a repo in about 4s int itemsUpdated = await SummaryItemsDA.UpdateSummaryItem( diff --git a/src/RepoGovernance.Web/Views/Home/Index.cshtml b/src/RepoGovernance.Web/Views/Home/Index.cshtml index 9378ce3a..2c8297e7 100644 --- a/src/RepoGovernance.Web/Views/Home/Index.cshtml +++ b/src/RepoGovernance.Web/Views/Home/Index.cshtml @@ -174,7 +174,7 @@ @if (Model.IsContributor) { Update metrics - Update configuration + @* Update configuration *@ }