Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Minutes per File Summary #29 #30

Merged
merged 1 commit into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/GitHubCostVisualizer.Web/Models/GithubUsageEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ public class GithubUsageEntry
public string Username { get; set; }
[Name("Notes")]
public string Notes { get; set; }
public string TrimmedWorkflow => ActionWorkflow?.Replace(".github/workflows/", "");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class UsageReportViewModel
public decimal TotalActionMinutesCost { get; set; }
public List<KeyValuePair<string, int>> ActionsSummary { get; set; }
public List<KeyValuePair<string, int>> ActionMinutesByRepository { get; set; }
public List<KeyValuePair<string, int>> ActionMinutesByWorkflow { get; set; }
public decimal AverageDailyStorage { get; set; }
public List<KeyValuePair<DateTime, decimal>> DailyStorageSummary { get; set; }
public List<KeyValuePair<string, decimal>> AverageDailyStorageByRepo { get; set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using GitHubCostVisualizer.Web.Models;

namespace GitHubCostVisualizer.Web.Processor
Expand Down Expand Up @@ -34,7 +35,12 @@ into grp
group x by x.Repository
into grp
select new KeyValuePair<string, int>(grp.Key, grp.Sum(i => (int)i.Quantity))).ToList();

model.ActionMinutesByWorkflow = (from x in entries.Where(i =>
i.Product.Equals(Constants.GitHubProducts.Actions, StringComparison.InvariantCultureIgnoreCase))
group x by new { x.Repository, x.TrimmedWorkflow }
into grp
select new KeyValuePair<string, int>($"{grp.Key.Repository} - {grp.Key.TrimmedWorkflow}",
grp.Sum(i => (int)i.Quantity))).ToList();
model.DailyStorageSummary = (from x in entries.Where(i => i.Product.Equals(Constants.GitHubProducts.SharedStorage, StringComparison.InvariantCultureIgnoreCase))
group x by x.Date
into grp
Expand Down
27 changes: 27 additions & 0 deletions src/GitHubCostVisualizer.Web/Views/Home/_ActionDetail.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@
aria-selected="False">
Chart (By Repo)
</a>
<a class="nav-item nav-link" id="nav-tab-action-workflow-list-tab"
data-toggle="tab"
href="#nav-tab-action-workflow-list"
role="tab"
aria-controls="nav-tab-action-workflow-list"
aria-selected="True">
List (By Workflow)
</a>
<a class="nav-item nav-link"
id="nav-tab-action-system-list-tab"
data-toggle="tab"
Expand Down Expand Up @@ -98,6 +106,25 @@
});
</script>
</div>
<div class="tab-pane" id="nav-tab-action-workflow-list" role="tabpanel" aria-labelledby="nav-tab-action-workflow-list-tab">
<table class="display w-100">
<thead>
<tr>
<th>Workflow (Repository - File)</th>
<th>Minutes</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model.ActionMinutesByWorkflow)
{
<tr>
<td>@item.Key</td>
<td data-sort="@item.Value">@item.Value minutes</td>
</tr>
}
</tbody>
</table>
</div>
<div class="tab-pane fade" id="nav-tab-action-system-list" role="tabpanel" aria-labelledby="nav-tab-action-system-list-tab">
<table class="display w-100">
<thead>
Expand Down
2 changes: 1 addition & 1 deletion src/GitHubCostVisualizer.Web/Views/Shared/_Start.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
View on <a href="https://github.com/IowaComputerGurus/github-cost-visualizer">Github</a>
</p>
<p class="text-center">
<small>This is a free service provided by <a href="https://www.iowacomputergurus.com">IowaComputerGurus, Inc.</a> <a href="https://www.iowacomputergurus.com/privacy">Privacy Policy</a></small>
This is a free service provided by <a href="https://www.iowacomputergurus.com">IowaComputerGurus, Inc.</a> <a href="https://www.iowacomputergurus.com/privacy">Privacy Policy</a>
</p>
</div>
</div>
Expand Down
Loading