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

feat: ILS usage graphs #91

Merged
merged 21 commits into from
Jul 23, 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
26 changes: 12 additions & 14 deletions code/web/interface/themes/responsive/ILS/dashboard.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
<div id="main-content" class="col-sm-12">
<h1>{translate text="ILS Usage Dashboard" isAdminFacing=true}</h1>
{include file="Admin/selectInterfaceForm.tpl"}

{foreach from=$profiles item=profileName key=profileId}
<h1>{translate text="Selected Profile" isAdminFacing=true} - {$profileName}</h1>
<div class="row">
<div class="dashboardCategory col-sm-6">
<div class="row">
<div class="col-sm-10 col-sm-offset-1">
<h2 class="dashboardCategoryLabel">{translate text="User Logins" isAdminFacing=true}</h2>
<h2 class="dashboardCategoryLabel">{translate text="User Logins" isAdminFacing=true} <a href="/ILS/UsageGraphs?stat=userLogins&instance={$selectedInstance}" title="{translate text="Show User Logins Graph" inAttribute="true"}"><i class="fas fa-chart-line"></i></a></h2>
</div>
</div>
<div class="row">
Expand All @@ -31,11 +30,11 @@
</div>
</div>
</div>

<div class="dashboardCategory col-sm-6">
<div class="row">
<div class="col-sm-10 col-sm-offset-1">
<h2 class="dashboardCategoryLabel">{translate text="Self Registrations" isAdminFacing=true}</h2>
<h2 class="dashboardCategoryLabel">{translate text="Self Registrations" isAdminFacing=true} <a href="/ILS/UsageGraphs?stat=selfRegistrations&instance={$selectedInstance}" title="{translate text="Show User Logins Graph" inAttribute="true"}"><i class="fas fa-chart-line"></i></a></h2>
</div>
</div>
<div class="row">
Expand All @@ -61,7 +60,7 @@
<div class="dashboardCategory col-sm-6">
<div class="row">
<div class="col-sm-10 col-sm-offset-1">
<h2 class="dashboardCategoryLabel">{translate text="Users who placed at least one hold" isAdminFacing=true}</h2>
<h2 class="dashboardCategoryLabel">{translate text="Users who placed at least one hold" isAdminFacing=true} <a href="/ILS/UsageGraphs?stat=usersWithHolds&instance={$selectedInstance}" title="{translate text="Show User Logins Graph" inAttribute="true"}"><i class="fas fa-chart-line"></i></a></h2>
</div>
</div>
<div class="row">
Expand All @@ -87,7 +86,7 @@
<div class="dashboardCategory col-sm-6">
<div class="row">
<div class="col-sm-10 col-sm-offset-1">
<h2 class="dashboardCategoryLabel">{translate text="Records Held" isAdminFacing=true}</h2>
<h2 class="dashboardCategoryLabel">{translate text="Records Held" isAdminFacing=true} <a href="/ILS/UsageGraphs?stat=recordsHeld&instance={$selectedInstance}" title="{translate text="Show User Logins Graph" inAttribute="true"}"><i class="fas fa-chart-line"></i></a></h2>
</div>
</div>
<div class="row">
Expand All @@ -113,7 +112,7 @@
<div class="dashboardCategory col-sm-6">
<div class="row">
<div class="col-sm-10 col-sm-offset-1">
<h2 class="dashboardCategoryLabel">{translate text="Total Holds" isAdminFacing=true}</h2>
<h2 class="dashboardCategoryLabel">{translate text="Total Holds" isAdminFacing=true} <a href="/ILS/UsageGraphs?stat=totalHolds&instance={$selectedInstance}" title="{translate text="Show User Logins Graph" inAttribute="true"}"><i class="fas fa-chart-line"></i></a></h2>
</div>
</div>
<div class="row">
Expand All @@ -136,11 +135,10 @@
</div>
</div>


<div class="dashboardCategory col-sm-6">
<div class="row">
<div class="col-sm-10 col-sm-offset-1">
<h2 class="dashboardCategoryLabel">{translate text="Users who downloaded at least one PDF" isAdminFacing=true}</h2>
<h2 class="dashboardCategoryLabel">{translate text="Users who downloaded at least one PDF" isAdminFacing=true} <a href="/ILS/UsageGraphs?stat=usersWithPdfDownloads&instance={$selectedInstance}" title="{translate text="Show User Logins Graph" inAttribute="true"}"><i class="fas fa-chart-line"></i></a></h2>
</div>
</div>
<div class="row">
Expand All @@ -166,7 +164,7 @@
<div class="dashboardCategory col-sm-6">
<div class="row">
<div class="col-sm-10 col-sm-offset-1">
<h2 class="dashboardCategoryLabel">{translate text="Users who viewed at least one PDF" isAdminFacing=true}</h2>
<h2 class="dashboardCategoryLabel">{translate text="Users who viewed at least one PDF" isAdminFacing=true} <a href="/ILS/UsageGraphs?stat=usersWithPdfViews&instance={$selectedInstance}" title="{translate text="Show User Logins Graph" inAttribute="true"}"><i class="fas fa-chart-line"></i></a></h2>
</div>
</div>
<div class="row">
Expand All @@ -192,7 +190,7 @@
<div class="dashboardCategory col-sm-6">
<div class="row">
<div class="col-sm-10 col-sm-offset-1">
<h2 class="dashboardCategoryLabel">{translate text="PDFs Downloaded" isAdminFacing=true}</h2>
<h2 class="dashboardCategoryLabel">{translate text="PDFs Downloaded" isAdminFacing=true} <a href="/ILS/UsageGraphs?stat=pdfsDownloaded&instance={$selectedInstance}" title="{translate text="Show User Logins Graph" inAttribute="true"}"><i class="fas fa-chart-line"></i></a></h2>
</div>
</div>
<div class="row">
Expand All @@ -218,7 +216,7 @@
<div class="dashboardCategory col-sm-6">
<div class="row">
<div class="col-sm-10 col-sm-offset-1">
<h2 class="dashboardCategoryLabel">{translate text="PDFs Viewed" isAdminFacing=true}</h2>
<h2 class="dashboardCategoryLabel">{translate text="PDFs Viewed" isAdminFacing=true} <a href="/ILS/UsageGraphs?stat=pdfsViewed&instance={$selectedInstance}" title="{translate text="Show User Logins Graph" inAttribute="true"}"><i class="fas fa-chart-line"></i></a></h2>
</div>
</div>
<div class="row">
Expand All @@ -244,7 +242,7 @@
<div class="dashboardCategory col-sm-6">
<div class="row">
<div class="col-sm-10 col-sm-offset-1">
<h2 class="dashboardCategoryLabel">{translate text="Users who downloaded at least one Supplemental File" isAdminFacing=true}</h2>
<h2 class="dashboardCategoryLabel">{translate text="Users who downloaded at least one Supplemental File" isAdminFacing=true} <a href="/ILS/UsageGraphs?stat=usersWithSupplementalFileDownloads&instance={$selectedInstance}" title="{translate text="Show User Logins Graph" inAttribute="true"}"><i class="fas fa-chart-line"></i></a></h2>
</div>
</div>
<div class="row">
Expand All @@ -270,7 +268,7 @@
<div class="dashboardCategory col-sm-6">
<div class="row">
<div class="col-sm-10 col-sm-offset-1">
<h2 class="dashboardCategoryLabel">{translate text="Supplemental Files Downloaded" isAdminFacing=true}</h2>
<h2 class="dashboardCategoryLabel">{translate text="Supplemental Files Downloaded" isAdminFacing=true} <a href="/ILS/UsageGraphs?stat=supplementalFilesDownloaded&instance={$selectedInstance}" title="{translate text="Show User Logins Graph" inAttribute="true"}"><i class="fas fa-chart-line"></i></a></h2>
</div>
</div>
<div class="row">
Expand Down
85 changes: 85 additions & 0 deletions code/web/interface/themes/responsive/ILS/usage-graph.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{strip}
<div id="main-content" class="col-sm-12">
<h1>{translate text=$graphTitle isAdminFacing=true}</h1>
<div class="chart-container" style="position: relative; height:50%; width:100%">
<canvas id="chart"></canvas>
</div>

<h2>{translate text="Raw Data" isAdminFacing=true}</h2>
<div class="adminTableRegion fixed-height-table">
<table class="adminTable table table-responsive table-striped table-bordered table-condensed smallText table-sticky">
<thead>
<tr>
<th>{translate text="Date" isAdminFacing=true}</th>
{foreach from=$dataSeries key=seriesLabel item=seriesData}
<th>{if !empty($translateDataSeries)}{translate text=$seriesLabel isAdminFacing=true}{else}{$seriesLabel}{/if}</th>
{/foreach}
</tr>
</thead>
<tbody>
{foreach from=$columnLabels item=label}
<tr>
<td>{if !empty($translateColumnLabels)}{translate text=$label isAdminFacing=true}{else}{$label}{/if}</td>
{foreach from=$dataSeries item=seriesData}
<td>{if (empty($seriesData.data.$label))}0{else}{$seriesData.data.$label|number_format}{/if}</td>
{/foreach}
</tr>
{/foreach}
</tbody>
</table>
</div>
</div>
{/strip}
{literal}
<script>
var ctx = document.getElementById('chart');
var myChart = new Chart(ctx, {
type: 'line',
data: {
labels: [
{/literal}
{foreach from=$columnLabels item=columnLabel}
'{$columnLabel}',
{/foreach}
{literal}
],
datasets: [
{/literal}
{foreach from=$dataSeries key=seriesLabel item=seriesData}
{ldelim}
label: "{translate text=$seriesLabel isAdminFacing=true}",
data: [
{foreach from=$seriesData.data item=curValue}
{$curValue},
{/foreach}
],
borderWidth: 1,
borderColor: '{$seriesData.borderColor}',
backgroundColor: '{$seriesData.backgroundColor}',
{rdelim},
{/foreach}
{literal}
]
},
options: {
scales: {
yAxes: [{
ticks: {
beginAtZero: true
}
}],
xAxes: [{
type: 'category',
labels: [
{/literal}
{foreach from=$columnLabels item=columnLabel}
'{$columnLabel}',
{/foreach}
{literal}
]
}]
}
}
});
</script>
{/literal}
5 changes: 5 additions & 0 deletions code/web/release_notes/24.08.00.MD
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ To generate the passkey file, the following command should be run (as root):

// other

// chloe
### Other Updates
- Add usage graphs and raw data tables for ILS Integration. These can be accessed through the ILS Integration Dashboard

## This release includes code contributions from
- ByWater Solutions
- Mark Noble (MDN)
Expand All @@ -71,6 +75,7 @@ To generate the passkey file, the following command should be run (as root):
- Pedro Amorim (PA)
- Alexander Blanchard (AB)
- Jacob O'Mara (JOM)
- Chloe Zermatten (CZ)

- Theke Solutions
- Lucas Montoya (LM)
Loading