Skip to content

Commit

Permalink
Merge pull request #1879 from GSA/main
Browse files Browse the repository at this point in the history
Production Deploy 8/19/2024
  • Loading branch information
ccostino authored Aug 19, 2024
2 parents 77e8609 + 5a3f3e5 commit 1a9931a
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 5 deletions.
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,16 @@ updates:
directory: "/" # Location of package manifests
schedule:
interval: "daily"
assignees:
- "A-Shumway42"
reviewers:
- "A-Shumway42"
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"
versioning-strategy: increase
assignees:
- "alexjanousekGSA"
reviewers:
- "alexjanousekGSA"
33 changes: 31 additions & 2 deletions app/assets/javascripts/activityChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@
deliveredData = [];
failedData = [];

let totalMessages = 0;

for (var dateString in data) {
if (data.hasOwnProperty(dateString)) {
const dateParts = dateString.split('-');
Expand All @@ -209,11 +211,38 @@
labels.push(formattedDate);
deliveredData.push(data[dateString].sms.delivered);
failedData.push(data[dateString].sms.failure);

// Calculate the total number of messages
totalMessages += data[dateString].sms.delivered + data[dateString].sms.failure;
}
}

createChart('#weeklyChart', labels, deliveredData, failedData);
createTable('weeklyTable', 'activityChart', labels, deliveredData, failedData);
// Check if there are no messages sent
const subTitle = document.querySelector(`#activityChartContainer .chart-subtitle`);
if (totalMessages === 0) {
// Remove existing chart and render the alert message
d3.select('#weeklyChart').selectAll('*').remove();
d3.select('#weeklyChart')
.append('div')
.html(`
<div class="usa-alert usa-alert--info usa-alert--slim">
<div class="usa-alert__body">
<p class="usa-alert__text">
No messages sent in the last 7 days
</p>
</div>
</div>
`);
// Hide the subtitle
if (subTitle) {
subTitle.style.display = 'none';
}
} else {
// If there are messages, create the chart and table
createChart('#weeklyChart', labels, deliveredData, failedData);
createTable('weeklyTable', 'activityChart', labels, deliveredData, failedData);
}

return data;
})
.catch(error => console.error('Error fetching daily stats:', error));
Expand Down
3 changes: 3 additions & 0 deletions app/assets/sass/uswds/_data-visualization.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ $failed: color('gray-cool-20');
&.usage {
height: units(4);
}
svg {
overflow: visible;
}
}

#totalMessageChartContainer {
Expand Down
4 changes: 2 additions & 2 deletions app/templates/views/activity/all-activity.html
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ <h2 class="margin-top-4 margin-bottom-1">Sent jobs</h2>
<td class="table-field report">
{% if job.time_left != "Data no longer available" %}
<a href="{{ job.download_link }}"><img src="{{ url_for('static', filename='img/material-icons/file_download.svg') }}" alt="File Download Icon"></a>
{% elif job %}
{% else %}
<span>N/A</span>
{% endif %}
</td>
Expand All @@ -122,7 +122,7 @@ <h2 class="margin-top-4 margin-bottom-1">Sent jobs</h2>
<tr class="table-row">
<td class="table-empty-message" colspan="10">No batched job messages found (messages are kept for {{ service_data_retention_days }} days).</td>
</tr>
{% endif %}
{% endif %}
</tbody>
</table>
<div class="usa-sr-only usa-table__announcement-region" aria-live="polite"></div>
Expand Down
1 change: 0 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1a9931a

Please sign in to comment.