-
π Performance
+
- Tempo di Risposta Medio
+ Tempo di Risposta Medio
0s
- Richieste al Minuto
+ Richieste al Minuto
0
- Picco Richieste
+ Picco Richieste
0
@@ -444,14 +472,164 @@
// Auto-refresh interval (in milliseconds)
const REFRESH_INTERVAL = 30000; // 30 seconds
+ // Current language
+ let currentLanguage = 'it';
+
+ // Translations
+ const translations = {
+ it: {
+ title: "MaxClaw Agent - Monitoraggio",
+ subtitle: "Dashboard di monitoraggio in tempo reale",
+ refreshBtn: "π Aggiorna Dati",
+ tabDashboard: "Dashboard",
+ tabLogs: "Logs",
+ tabPerformance: "Performance",
+ tabSystem: "Sistema",
+ statsTitle: "π Statistiche Generali",
+ statusLabel: "Stato Sistema",
+ statusOnline: "Online",
+ statusOffline: "Non connesso",
+ uptimeLabel: "Uptime",
+ requestsLabel: "Richieste Totali",
+ errorsLabel: "Errori Totali",
+ errorRateLabel: "Tasso di Errore",
+ providerTitle: "π€ Provider Attivo",
+ providerLabel: "Provider",
+ modelLabel: "Modello",
+ connectionLabel: "Stato Connessione",
+ callsLabel: "Chiamate Provider",
+ toolsTitle: "π§ Utilizzo Strumenti",
+ toolsLoadedLabel: "Strumenti Caricati",
+ pluginsLabel: "Plugin Attivi",
+ resourcesTitle: "π» Risorse di Sistema",
+ cpuLabel: "CPU",
+ memoryLabel: "Memoria",
+ diskLabel: "Disco",
+ logsTitle: "π Logs Recenti",
+ performanceTitle: "π Performance",
+ responseTimeLabel: "Tempo di Risposta Medio",
+ rpmLabel: "Richieste al Minuto",
+ peakLabel: "Picco Richieste",
+ systemInfoTitle: "π₯οΈ Informazioni di Sistema",
+ hostnameLabel: "Hostname",
+ platformLabel: "Piattaforma",
+ architectureLabel: "Architettura",
+ pythonLabel: "Python Version",
+ maxclawLabel: "MaxClaw Version",
+ lastUpdatedLabel: "Ultimo aggiornamento:",
+ alertSuccess: "Dati aggiornati con successo",
+ alertError: "Errore nel caricamento dei dati"
+ },
+ en: {
+ title: "MaxClaw Agent - Monitoring",
+ subtitle: "Real-time monitoring dashboard",
+ refreshBtn: "π Refresh Data",
+ tabDashboard: "Dashboard",
+ tabLogs: "Logs",
+ tabPerformance: "Performance",
+ tabSystem: "System",
+ statsTitle: "π General Statistics",
+ statusLabel: "System Status",
+ statusOnline: "Online",
+ statusOffline: "Offline",
+ uptimeLabel: "Uptime",
+ requestsLabel: "Total Requests",
+ errorsLabel: "Total Errors",
+ errorRateLabel: "Error Rate",
+ providerTitle: "π€ Active Provider",
+ providerLabel: "Provider",
+ modelLabel: "Model",
+ connectionLabel: "Connection Status",
+ callsLabel: "Provider Calls",
+ toolsTitle: "π§ Tool Usage",
+ toolsLoadedLabel: "Loaded Tools",
+ pluginsLabel: "Active Plugins",
+ resourcesTitle: "π» System Resources",
+ cpuLabel: "CPU",
+ memoryLabel: "Memory",
+ diskLabel: "Disk",
+ logsTitle: "π Recent Logs",
+ performanceTitle: "π Performance",
+ responseTimeLabel: "Average Response Time",
+ rpmLabel: "Requests per Minute",
+ peakLabel: "Peak Requests",
+ systemInfoTitle: "π₯οΈ System Information",
+ hostnameLabel: "Hostname",
+ platformLabel: "Platform",
+ architectureLabel: "Architecture",
+ pythonLabel: "Python Version",
+ maxclawLabel: "MaxClaw Version",
+ lastUpdatedLabel: "Last updated:",
+ alertSuccess: "Data refreshed successfully",
+ alertError: "Error loading data"
+ }
+ };
+
// Initialize
document.addEventListener('DOMContentLoaded', function() {
+ // Load saved language preference
+ const savedLanguage = localStorage.getItem('maxclaw-language') || 'it';
+ document.getElementById('language-select').value = savedLanguage;
+ changeLanguage(savedLanguage);
+
refreshData();
// Set up auto-refresh
setInterval(refreshData, REFRESH_INTERVAL);
});
+ // Change language
+ function changeLanguage(language) {
+ currentLanguage = language;
+ localStorage.setItem('maxclaw-language', language);
+
+ const t = translations[language];
+
+ // Update all translatable elements
+ document.getElementById('title').textContent = t.title;
+ document.getElementById('subtitle').textContent = t.subtitle;
+ document.getElementById('refresh-btn').textContent = t.refreshBtn;
+ document.getElementById('tab-dashboard').textContent = t.tabDashboard;
+ document.getElementById('tab-logs').textContent = t.tabLogs;
+ document.getElementById('tab-performance').textContent = t.tabPerformance;
+ document.getElementById('tab-system').textContent = t.tabSystem;
+ document.getElementById('stats-title').textContent = t.statsTitle;
+ document.getElementById('status-label').textContent = t.statusLabel;
+ document.getElementById('status-online').textContent = t.statusOnline;
+ document.getElementById('status-offline').textContent = t.statusOffline;
+ document.getElementById('uptime-label').textContent = t.uptimeLabel;
+ document.getElementById('requests-label').textContent = t.requestsLabel;
+ document.getElementById('errors-label').textContent = t.errorsLabel;
+ document.getElementById('error-rate-label').textContent = t.errorRateLabel;
+ document.getElementById('provider-title').textContent = t.providerTitle;
+ document.getElementById('provider-label').textContent = t.providerLabel;
+ document.getElementById('model-label').textContent = t.modelLabel;
+ document.getElementById('connection-label').textContent = t.connectionLabel;
+ document.getElementById('calls-label').textContent = t.callsLabel;
+ document.getElementById('tools-title').textContent = t.toolsTitle;
+ document.getElementById('tools-loaded-label').textContent = t.toolsLoadedLabel;
+ document.getElementById('plugins-label').textContent = t.pluginsLabel;
+ document.getElementById('resources-title').textContent = t.resourcesTitle;
+ document.getElementById('cpu-label').textContent = t.cpuLabel;
+ document.getElementById('memory-label').textContent = t.memoryLabel;
+ document.getElementById('disk-label').textContent = t.diskLabel;
+ document.getElementById('logs-title').textContent = t.logsTitle;
+ document.getElementById('performance-title').textContent = t.performanceTitle;
+ document.getElementById('response-time-label').textContent = t.responseTimeLabel;
+ document.getElementById('rpm-label').textContent = t.rpmLabel;
+ document.getElementById('peak-label').textContent = t.peakLabel;
+ document.getElementById('system-info-title').textContent = t.systemInfoTitle;
+ document.getElementById('hostname-label').textContent = t.hostnameLabel;
+ document.getElementById('platform-label').textContent = t.platformLabel;
+ document.getElementById('architecture-label').textContent = t.architectureLabel;
+ document.getElementById('python-label').textContent = t.pythonLabel;
+ document.getElementById('maxclaw-label').textContent = t.maxclawLabel;
+ document.getElementById('last-updated-label').textContent = t.lastUpdatedLabel;
+
+ // Update HTML lang attribute
+ document.documentElement.lang = language;
+ }
+
// Switch tabs
function switchTab(tabName) {
// Update tab buttons
@@ -487,23 +665,25 @@
updateLastUpdated();
// Show success alert
- showAlert('Dati aggiornati con successo', 'success');
+ showAlert(translations[currentLanguage].alertSuccess, 'success');
} catch (error) {
console.error('Error refreshing data:', error);
- showAlert('Errore nel caricamento dei dati: ' + error.message, 'danger');
+ showAlert(translations[currentLanguage].alertError + ': ' + error.message, 'danger');
}
}
// Update dashboard
function updateDashboard(healthData, configs, activeConfig) {
+ const t = translations[currentLanguage];
+
// System status
const systemStatus = document.getElementById('system-status');
if (healthData.status === 'healthy') {
- systemStatus.innerHTML = '
Online';
+ systemStatus.innerHTML = `
${t.statusOnline}`;
systemStatus.className = 'metric-value success';
} else {
- systemStatus.innerHTML = '
Offline';
+ systemStatus.innerHTML = `
${t.statusOffline}`;
systemStatus.className = 'metric-value danger';
}
@@ -513,14 +693,14 @@
document.getElementById('active-model').textContent = activeConfig.model_name;
const connectionStatus = document.getElementById('connection-status');
- connectionStatus.innerHTML = '
Connesso';
+ connectionStatus.innerHTML = `
${t.statusOnline}`;
connectionStatus.className = 'metric-value success';
} else {
document.getElementById('active-provider').textContent = 'Nessuno';
document.getElementById('active-model').textContent = 'Nessuno';
const connectionStatus = document.getElementById('connection-status');
- connectionStatus.innerHTML = '
Non connesso';
+ connectionStatus.innerHTML = `
${t.statusOffline}`;
connectionStatus.className = 'metric-value danger';
}
@@ -583,22 +763,35 @@
// Simulate log entries
const logTypes = ['info', 'warning', 'error', 'success'];
- const logMessages = [
- 'Agent initialized successfully',
- 'Configuration loaded: ollama',
- 'Connection test successful',
- 'Tool executed: list_models',
- 'Warning: High memory usage',
- 'Error: Connection timeout',
- 'Plugin loaded: file_tools',
- 'Request processed in 0.245s'
- ];
+ const logMessages = {
+ it: [
+ 'Agente inizializzato con successo',
+ 'Configurazione caricata: ollama',
+ 'Test connessione riuscito',
+ 'Strumento eseguito: list_models',
+ 'Avviso: Alto utilizzo memoria',
+ 'Errore: Timeout connessione',
+ 'Plugin caricato: file_tools',
+ 'Richiesta elaborata in 0.245s'
+ ],
+ en: [
+ 'Agent initialized successfully',
+ 'Configuration loaded: ollama',
+ 'Connection test successful',
+ 'Tool executed: list_models',
+ 'Warning: High memory usage',
+ 'Error: Connection timeout',
+ 'Plugin loaded: file_tools',
+ 'Request processed in 0.245s'
+ ]
+ };
let logsHtml = '';
for (let i = 0; i < 10; i++) {
const type = logTypes[Math.floor(Math.random() * logTypes.length)];
- const message = logMessages[Math.floor(Math.random() * logMessages.length)];
+ const messages = logMessages[currentLanguage];
+ const message = messages[Math.floor(Math.random() * messages.length)];
const timestamp = new Date().toLocaleTimeString();
logsHtml += `
[${timestamp}] ${message}
`;