diff --git a/app/assets/javascripts/activityChart.js b/app/assets/javascripts/activityChart.js index 19d8bcc49..62c1e6e3e 100644 --- a/app/assets/javascripts/activityChart.js +++ b/app/assets/javascripts/activityChart.js @@ -33,30 +33,43 @@ .attr('id', 'tooltip') .style('display', 'none'); } - // Create legend + + // Calculate total messages + const totalMessages = d3.sum(deliveredData) + d3.sum(failedData); + + // Create legend only if there are messages const legendContainer = d3.select('.chart-legend'); legendContainer.selectAll('*').remove(); // Clear any existing legend - const legendData = [ - { label: 'Delivered', color: COLORS.delivered }, - { label: 'Failed', color: COLORS.failed } - ]; + if (totalMessages > 0) { + // Show legend if there are messages + const legendData = [ + { label: 'Delivered', color: COLORS.delivered }, + { label: 'Failed', color: COLORS.failed } + ]; - const legendItem = legendContainer.selectAll('.legend-item') - .data(legendData) - .enter() - .append('div') - .attr('class', 'legend-item'); + const legendItem = legendContainer.selectAll('.legend-item') + .data(legendData) + .enter() + .append('div') + .attr('class', 'legend-item'); - legendItem.append('div') - .attr('class', 'legend-rect') - .style('background-color', d => d.color) - .style('display', 'inline-block') - .style('margin-right', '5px'); + legendItem.append('div') + .attr('class', 'legend-rect') + .style('background-color', d => d.color) + .style('display', 'inline-block') + .style('margin-right', '5px'); - legendItem.append('span') - .attr('class', 'legend-label') - .text(d => d.label); + legendItem.append('span') + .attr('class', 'legend-label') + .text(d => d.label); + + // Ensure the legend is shown + legendContainer.style('display', 'flex'); + } else { + // Hide the legend if there are no messages + legendContainer.style('display', 'none'); + } const x = d3.scaleBand() .domain(labels) diff --git a/app/templates/base.html b/app/templates/base.html index efa6c7408..c535fafe2 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -82,7 +82,7 @@ {% if current_user.is_authenticated %} {% block sessionUserWarning %} - +

diff --git a/app/templates/views/activity/all-activity.html b/app/templates/views/activity/all-activity.html index 1067bc07b..b925a7802 100644 --- a/app/templates/views/activity/all-activity.html +++ b/app/templates/views/activity/all-activity.html @@ -60,7 +60,7 @@

Sent jobs

- +
Table showing all sent jobs for this service
@@ -103,7 +103,10 @@ {{ job.created_by.name }} {% if job.time_left != "Data no longer available" %} - File Download Icon + + + Download report link + {% else %} N/A {% endif %} diff --git a/app/templates/views/dashboard/dashboard.html b/app/templates/views/dashboard/dashboard.html index 6c554d515..41cba8ff2 100644 --- a/app/templates/views/dashboard/dashboard.html +++ b/app/templates/views/dashboard/dashboard.html @@ -38,7 +38,7 @@
@@ -60,6 +60,7 @@