mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-10 01:55:41 -04:00
fixed drop down
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
(function (window) {
|
(function (window) {
|
||||||
|
|
||||||
if (document.getElementById('activityChartContainer')) {
|
if (document.getElementById('activityChartContainer')) {
|
||||||
|
let currentType = 'service';
|
||||||
const COLORS = {
|
const COLORS = {
|
||||||
delivered: '#0076d6',
|
delivered: '#0076d6',
|
||||||
failed: '#fa9441',
|
failed: '#fa9441',
|
||||||
@@ -204,6 +204,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
const fetchData = function(type) {
|
const fetchData = function(type) {
|
||||||
|
|
||||||
var ctx = document.getElementById('weeklyChart');
|
var ctx = document.getElementById('weeklyChart');
|
||||||
if (!ctx) {
|
if (!ctx) {
|
||||||
return;
|
return;
|
||||||
@@ -270,9 +271,10 @@
|
|||||||
})
|
})
|
||||||
.catch(error => console.error('Error fetching daily stats:', error));
|
.catch(error => console.error('Error fetching daily stats:', error));
|
||||||
};
|
};
|
||||||
setInterval(() => fetchData('service'), 10000);
|
setInterval(() => fetchData(currentType), 10000);
|
||||||
const handleDropdownChange = function(event) {
|
const handleDropdownChange = function(event) {
|
||||||
const selectedValue = event.target.value;
|
const selectedValue = event.target.value;
|
||||||
|
currentType = selectedValue;
|
||||||
const subTitle = document.querySelector(`#activityChartContainer .chart-subtitle`);
|
const subTitle = document.querySelector(`#activityChartContainer .chart-subtitle`);
|
||||||
const selectElement = document.getElementById('options');
|
const selectElement = document.getElementById('options');
|
||||||
const selectedText = selectElement.options[selectElement.selectedIndex].text;
|
const selectedText = selectElement.options[selectElement.selectedIndex].text;
|
||||||
@@ -298,7 +300,7 @@
|
|||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
// Initialize activityChart chart and table with service data by default
|
// Initialize activityChart chart and table with service data by default
|
||||||
fetchData('service');
|
fetchData(currentType);
|
||||||
|
|
||||||
// Add event listener to the dropdown
|
// Add event listener to the dropdown
|
||||||
const dropdown = document.getElementById('options');
|
const dropdown = document.getElementById('options');
|
||||||
|
|||||||
Reference in New Issue
Block a user