-
Notifications
You must be signed in to change notification settings - Fork 3
Add archive stats page and improve run listings #60
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
Merged
+194
−24
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
79a6bee
Add archive stats view and refine run displays
Ulthran 832de20
Sanitized, RO db connection
Ulthran d2791be
Safe db connection
Ulthran 75d5494
Reformat
Ulthran b5c7b4f
Implement copilot review suggestions
Ulthran 946da61
Reduce potential for overflow
Ulthran File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,4 +4,5 @@ website/core.db | |
| build/ | ||
| __pycache__/ | ||
| *.sqlite3 | ||
| *.sqlite | ||
| env | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,7 +13,6 @@ | |
| StandardHostSpecies, | ||
| ) | ||
|
|
||
|
|
||
| STANDARD_TAGS = { | ||
| "SampleType": "sample_type", | ||
| "SubjectID": "subject_id", | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| {% extends 'base.html' %} | ||
|
|
||
| {% block head %} | ||
| <script src="https://cdn.jsdelivr.net/npm/chart.js@4.5.1/dist/chart.umd.min.js" integrity="sha256-SERKgtTty1vsDxll+qzd4Y2cF9swY9BCq62i9wXJ9Uo=" crossorigin="anonymous"></script> | ||
| {% endblock %} | ||
|
|
||
| {% block body %} | ||
| <div class="container mt-4"> | ||
| <div class="row"> | ||
| <div class="col-12"> | ||
| <h2>Archive usage</h2> | ||
| <p class="text-muted">Net archive size grouped by month. Data are gathered directly from the NFS archive paths for each run.</p> | ||
| </div> | ||
| </div> | ||
| <div class="row"> | ||
| <div class="col-12"> | ||
| <canvas id="archiveChart" aria-label="Archive usage chart" role="img"></canvas> | ||
Ulthran marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| </div> | ||
| </div> | ||
| <div class="row mt-3"> | ||
| <div class="col-12"> | ||
| <p> | ||
| <button class="btn btn-link p-0" type="button" data-bs-toggle="collapse" data-bs-target="#warningsCollapse" aria-expanded="true" aria-controls="warningsCollapse"> | ||
| Warnings | ||
| </button> | ||
Ulthran marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| </p> | ||
| <div class="collapse show" id="warningsCollapse"> | ||
| <ul id="warningsList" class="list-group list-group-flush border rounded"></ul> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
|
|
||
| <script> | ||
| const chartElement = document.getElementById('archiveChart'); | ||
| const warningsList = document.getElementById('warningsList'); | ||
|
|
||
| function renderWarnings(warnings) { | ||
| warningsList.innerHTML = ''; | ||
| if (!warnings || warnings.length === 0) { | ||
| const item = document.createElement('li'); | ||
| item.className = 'list-group-item text-muted'; | ||
| item.textContent = 'No warnings to display.'; | ||
| warningsList.appendChild(item); | ||
| return; | ||
| } | ||
|
|
||
| warnings.forEach((warning) => { | ||
| const item = document.createElement('li'); | ||
| item.className = 'list-group-item'; | ||
| item.textContent = warning; | ||
| warningsList.appendChild(item); | ||
Ulthran marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }); | ||
| } | ||
|
|
||
| function renderChart(byMonth) { | ||
| const labels = byMonth.map((entry) => entry.month); | ||
| const data = byMonth.map((entry) => entry.size_bytes / (1024 * 1024 * 1024)); | ||
|
|
||
| new Chart(chartElement.getContext('2d'), { | ||
| type: 'bar', | ||
| data: { | ||
| labels, | ||
| datasets: [ | ||
| { | ||
| label: 'Archive size (GB)', | ||
| data, | ||
| backgroundColor: 'rgba(54, 162, 235, 0.6)', | ||
| borderColor: 'rgba(54, 162, 235, 1)', | ||
| borderWidth: 1, | ||
| }, | ||
| ], | ||
| }, | ||
| options: { | ||
| scales: { | ||
| y: { | ||
| beginAtZero: true, | ||
| title: { | ||
| display: true, | ||
| text: 'Size (GB)', | ||
Ulthran marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }); | ||
| } | ||
|
|
||
| fetch('/api/archive_sizes') | ||
| .then((response) => response.json()) | ||
| .then(({ by_month: byMonth, warnings }) => { | ||
| renderChart(byMonth); | ||
| renderWarnings(warnings); | ||
| }) | ||
| .catch((error) => { | ||
Ulthran marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| renderWarnings([`Error loading archive data: ${error}`]); | ||
| }); | ||
Ulthran marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| </script> | ||
| {% endblock %} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,7 +25,6 @@ | |
| register_host_species, | ||
| ) | ||
|
|
||
|
|
||
| samples = [ | ||
| { | ||
| "SampleID": "abc123", | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.