Skip to content

Commit

Permalink
Removed configuration link (#510)
Browse files Browse the repository at this point in the history
* Removed configuration link

* Fix to get the right items
  • Loading branch information
samsmithnz committed Aug 10, 2023
1 parent 3ccf7ed commit a4a7449
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 19 deletions.
10 changes: 5 additions & 5 deletions src/RepoGovernance.Core/SummaryItemsDA.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ public static async Task<List<SummaryItem>> GetSummaryItems(
}

public static async Task<SummaryItem?> GetSummaryItem(string connectionString,
string owner, string repo)
string user, string owner, string repo)
{
SummaryItem? result = null;
List<SummaryItem> summaryItems = await GetSummaryItems(connectionString, owner);
List<SummaryItem> summaryItems = await GetSummaryItems(connectionString, user);
if (summaryItems != null)
{
foreach (SummaryItem item in summaryItems)
Expand Down Expand Up @@ -92,7 +92,7 @@ public static async Task<int> 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;
Expand Down Expand Up @@ -328,7 +328,7 @@ public static async Task<int> 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;
Expand Down Expand Up @@ -360,7 +360,7 @@ public static async Task<int> 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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ public async Task<List<SummaryItem>> GetSummaryItems(string user)
/// <param name="repo">the repo</param>
/// <returns></returns>
[HttpGet("GetSummaryItem")]
public async Task<SummaryItem?> GetSummaryItem(string owner, string repo)
public async Task<SummaryItem?> GetSummaryItem(string user, string owner, string repo)
{
return await SummaryItemsDA.GetSummaryItem(
Configuration["AppSettings:CosmosDBConnectionString"],
owner, repo);
Configuration["AppSettings:CosmosDBConnectionString"],

Check warning on line 68 in src/RepoGovernance.Service/Controllers/SummaryItemsController.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'connectionString' in 'Task<SummaryItem?> SummaryItemsDA.GetSummaryItem(string connectionString, string user, string owner, string repo)'.
user, owner, repo);
}


Expand Down
21 changes: 11 additions & 10 deletions src/RepoGovernance.Tests/SummaryItemsControllerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion src/RepoGovernance.Web/Views/Home/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
@if (Model.IsContributor)
{
<a href="@Url.Action("UpdateRow", "Home", new { user = item.User, owner = item.Owner, repo = item.Repo, isContributor = Model.IsContributor })" class="lastUpdatedText">Update metrics</a>
<a href="@Url.Action("Config", "Home", new { user = item.User, owner = item.Owner, repo = item.Repo, isContributor = Model.IsContributor })" class="lastUpdatedText">Update configuration</a>
@* <a href="@Url.Action("Config", "Home", new { user = item.User, owner = item.Owner, repo = item.Repo, isContributor = Model.IsContributor })" class="lastUpdatedText">Update configuration</a> *@
}
</div>
</div>
Expand Down

0 comments on commit a4a7449

Please sign in to comment.