fix(netdata-dashboard): add missing API methods and aliases

- Added getAllData() method to fetch all system stats in one call
- Added getCpu() alias for getCPU() for consistency with view expectations
- getAllData() returns a combined object with stats, cpu, memory, disk, network, processes, and system data

This resolves "API.getAllData is not a function" and "API.getCpu is not a function" errors
by ensuring the API exports match what the views are calling.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
CyberMind-FR 2025-12-31 11:04:52 +01:00
parent 8b0d75a8d9
commit d1346aae0e

View File

@ -132,6 +132,7 @@ return baseclass.extend({
// System stats
getStats: callStats,
getCPU: callCPU,
getCpu: callCPU, // Alias for consistency
getMemory: callMemory,
getDisk: callDisk,
getNetwork: callNetwork,
@ -149,6 +150,29 @@ return baseclass.extend({
getSecuboxLogs: callSecuboxLogs,
collectDebugSnapshot: callCollectDebug,
// Combined data fetch for dashboard
getAllData: function() {
return Promise.all([
callStats(),
callCPU(),
callMemory(),
callDisk(),
callNetwork(),
callProcesses(),
callSystem()
]).then(function(results) {
return {
stats: results[0] || {},
cpu: results[1] || {},
memory: results[2] || {},
disk: results[3] || {},
network: results[4] || {},
processes: results[5] || {},
system: results[6] || {}
};
});
},
// Utility functions
formatBytes: formatBytes,
formatUptime: formatUptime