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:
parent
8b0d75a8d9
commit
d1346aae0e
@ -132,6 +132,7 @@ return baseclass.extend({
|
|||||||
// System stats
|
// System stats
|
||||||
getStats: callStats,
|
getStats: callStats,
|
||||||
getCPU: callCPU,
|
getCPU: callCPU,
|
||||||
|
getCpu: callCPU, // Alias for consistency
|
||||||
getMemory: callMemory,
|
getMemory: callMemory,
|
||||||
getDisk: callDisk,
|
getDisk: callDisk,
|
||||||
getNetwork: callNetwork,
|
getNetwork: callNetwork,
|
||||||
@ -149,6 +150,29 @@ return baseclass.extend({
|
|||||||
getSecuboxLogs: callSecuboxLogs,
|
getSecuboxLogs: callSecuboxLogs,
|
||||||
collectDebugSnapshot: callCollectDebug,
|
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
|
// Utility functions
|
||||||
formatBytes: formatBytes,
|
formatBytes: formatBytes,
|
||||||
formatUptime: formatUptime
|
formatUptime: formatUptime
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user