generalbots/botui/ui/suite/monitoring/metrics.js
Rodrigo Rodriguez (Pragmatismo) 037db5c381 feat: Major workspace reorganization and documentation update
- Add comprehensive documentation in botbook/ with 12 chapters
- Add botapp/ Tauri desktop application
- Add botdevice/ IoT device support
- Add botlib/ shared library crate
- Add botmodels/ Python ML models service
- Add botplugin/ browser extension
- Add botserver/ reorganized server code
- Add bottemplates/ bot templates
- Add bottest/ integration tests
- Add botui/ web UI server
- Add CI/CD workflows in .forgejo/workflows/
- Add AGENTS.md and PROD.md documentation
- Add dependency management scripts (DEPENDENCIES.sh/ps1)
- Remove legacy src/ structure and migrations
- Clean up temporary and backup files
2026-04-19 08:14:25 -03:00

54 lines
1.6 KiB
JavaScript

/* Metrics page JavaScript */
function updateMetricsRange(range) {
localStorage.setItem('metrics-time-range', range);
refreshMetrics();
}
function refreshMetrics() {
// Refresh all metric components
htmx.trigger('.key-metrics', 'refresh');
htmx.trigger('#requests-chart', 'refresh');
htmx.trigger('#latency-chart', 'refresh');
htmx.trigger('#errors-chart', 'refresh');
htmx.trigger('#throughput-chart', 'refresh');
}
function updateChartType(chart, type) {
// This would update the chart visualization type
console.log(`Updating ${chart} chart to ${type} type`);
// Implementation depends on charting library
}
function filterMetrics(query) {
const rows = document.querySelectorAll('.metrics-table tbody tr');
const lowerQuery = query.toLowerCase();
rows.forEach(row => {
const text = row.textContent.toLowerCase();
row.style.display = text.includes(lowerQuery) ? '' : 'none';
});
}
function filterByCategory(category) {
const rows = document.querySelectorAll('.metrics-table tbody tr');
rows.forEach(row => {
if (category === 'all') {
row.style.display = '';
} else {
const rowCategory = row.dataset.category || '';
row.style.display = rowCategory === category ? '' : 'none';
}
});
}
// Initialize on page load
document.addEventListener('DOMContentLoaded', function() {
// Restore time range preference
const savedRange = localStorage.getItem('metrics-time-range');
if (savedRange) {
const select = document.getElementById('metrics-time-range');
if (select) select.value = savedRange;
}
});