fix: Add missing API functions to resolve module errors
Fixed JavaScript errors in multiple modules by adding missing API functions: 1. auth-guardian: - Added getSessions() alias for listSessions compatibility 2. netifyd-dashboard: - Added getAllData() aggregating status, stats, flows, applications 3. wireguard-dashboard: - Added getAllData() aggregating status, peers, interfaces, traffic 4. network-modes: - Added getAllData() aggregating status, mode, available_modes, interfaces 5. netdata-dashboard: - Fixed ACL permissions: changed ubus object from 'netdata' to 'luci.netdata-dashboard' - Added missing RPC methods to ACL (netdata_status, netdata_alarms, netdata_info) - Added write permissions for service control methods Resolves: - TypeError: api.getSessions is not a function (auth-guardian) - TypeError: api.getAllData is not a function (netifyd, wireguard, network-modes) - RPC error -32002: Access denied (netdata-dashboard) 🤖 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
9a4753e343
commit
0759c748dd
@ -90,6 +90,7 @@ return baseclass.extend({
|
||||
deleteVoucher: callDeleteVoucher,
|
||||
validateVoucher: callValidateVoucher,
|
||||
listSessions: callListSessions,
|
||||
getSessions: callListSessions, // Alias for compatibility
|
||||
revokeSession: callRevokeSession,
|
||||
getLogs: callGetLogs
|
||||
});
|
||||
|
||||
@ -3,14 +3,32 @@
|
||||
"description": "Grant access to LuCI Netdata Dashboard",
|
||||
"read": {
|
||||
"ubus": {
|
||||
"netdata": [ "stats", "cpu", "memory", "disk", "network", "processes", "sensors", "system" ],
|
||||
"luci.netdata-dashboard": [
|
||||
"stats",
|
||||
"cpu",
|
||||
"memory",
|
||||
"disk",
|
||||
"network",
|
||||
"processes",
|
||||
"sensors",
|
||||
"system",
|
||||
"netdata_status",
|
||||
"netdata_alarms",
|
||||
"netdata_info"
|
||||
],
|
||||
"system": [ "info", "board" ],
|
||||
"luci-rpc": [ "getNetdataStats" ],
|
||||
"file": [ "read", "stat" ]
|
||||
},
|
||||
"uci": [ "netdata-dashboard" ]
|
||||
},
|
||||
"write": {
|
||||
"ubus": {
|
||||
"luci.netdata-dashboard": [
|
||||
"restart_netdata",
|
||||
"start_netdata",
|
||||
"stop_netdata"
|
||||
]
|
||||
},
|
||||
"uci": [ "netdata-dashboard" ]
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,5 +61,22 @@ return baseclass.extend({
|
||||
getHosts: callHosts,
|
||||
getProtocols: callProtocols,
|
||||
getStats: callStats,
|
||||
formatBytes: formatBytes
|
||||
formatBytes: formatBytes,
|
||||
|
||||
// Aggregate function for overview page
|
||||
getAllData: function() {
|
||||
return Promise.all([
|
||||
callStatus(),
|
||||
callStats(),
|
||||
callFlows(),
|
||||
callApplications()
|
||||
]).then(function(results) {
|
||||
return {
|
||||
status: results[0] || {},
|
||||
stats: results[1] || {},
|
||||
flows: results[2] || { flows: [] },
|
||||
applications: results[3] || { applications: [] }
|
||||
};
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@ -53,5 +53,22 @@ return baseclass.extend({
|
||||
getAvailableModes: callGetAvailableModes,
|
||||
setMode: callSetMode,
|
||||
getInterfaces: callGetInterfaces,
|
||||
validateConfig: callValidateConfig
|
||||
validateConfig: callValidateConfig,
|
||||
|
||||
// Aggregate function for overview page
|
||||
getAllData: function() {
|
||||
return Promise.all([
|
||||
callStatus(),
|
||||
callGetCurrentMode(),
|
||||
callGetAvailableModes(),
|
||||
callGetInterfaces()
|
||||
]).then(function(results) {
|
||||
return {
|
||||
status: results[0] || {},
|
||||
current_mode: results[1] || { mode: '' },
|
||||
available_modes: results[2] || { modes: [] },
|
||||
interfaces: results[3] || { interfaces: [] }
|
||||
};
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@ -104,5 +104,22 @@ return baseclass.extend({
|
||||
generateConfig: callGenerateConfig,
|
||||
generateQR: callGenerateQR,
|
||||
formatBytes: formatBytes,
|
||||
formatLastHandshake: formatLastHandshake
|
||||
formatLastHandshake: formatLastHandshake,
|
||||
|
||||
// Aggregate function for overview page
|
||||
getAllData: function() {
|
||||
return Promise.all([
|
||||
callStatus(),
|
||||
callGetPeers(),
|
||||
callGetInterfaces(),
|
||||
callGetTraffic()
|
||||
]).then(function(results) {
|
||||
return {
|
||||
status: results[0] || {},
|
||||
peers: results[1] || { peers: [] },
|
||||
interfaces: results[2] || { interfaces: [] },
|
||||
traffic: results[3] || {}
|
||||
};
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user