fix(secubox): correct RPC expect parameter for getAppstoreApps
Fixed appstore showing "No applications match the selected filter" by correcting
the RPC declaration expect parameter.
Issue: The RPC declaration had:
expect: { apps: [], categories: {} }
This caused the RPC framework to return only the apps array instead of the full
response object, resulting in:
- data = Array(5) instead of { apps: [...], categories: {...} }
- data.apps = undefined
- data.categories = undefined
Fix: Changed to:
expect: { }
This returns the full response object as-is from the backend, allowing proper
access to both data.apps and data.categories properties.
Also added extensive debug logging to troubleshoot the data flow.
🤖 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
bd032be85f
commit
f08d28d70b
@ -195,7 +195,7 @@ var callRollbackProfile = rpc.declare({
|
||||
var callGetAppstoreApps = rpc.declare({
|
||||
object: 'luci.secubox',
|
||||
method: 'get_appstore_apps',
|
||||
expect: { apps: [], categories: {} }
|
||||
expect: { }
|
||||
});
|
||||
|
||||
var callGetAppstoreApp = rpc.declare({
|
||||
|
||||
@ -44,12 +44,17 @@ return view.extend({
|
||||
refreshData: function() {
|
||||
var self = this;
|
||||
return API.getAppstoreApps().then(function(data) {
|
||||
console.log('getAppstoreApps raw response:', data);
|
||||
if (!data) {
|
||||
console.warn('getAppstoreApps returned empty data');
|
||||
return { apps: [], categories: {} };
|
||||
}
|
||||
console.log('Apps from API:', data.apps);
|
||||
console.log('Categories from API:', data.categories);
|
||||
self.appsData = data.apps || [];
|
||||
self.categoriesData = data.categories || {};
|
||||
console.log('Stored appsData:', self.appsData);
|
||||
console.log('Stored categoriesData:', self.categoriesData);
|
||||
return data;
|
||||
}).catch(function(err) {
|
||||
console.error('Error loading appstore apps:', err);
|
||||
@ -63,6 +68,12 @@ return view.extend({
|
||||
var apps = (data && data.apps) || this.appsData || [];
|
||||
var categories = (data && data.categories) || this.categoriesData || {};
|
||||
|
||||
// Debug logging
|
||||
console.log('Apps render - data:', data);
|
||||
console.log('Apps render - apps array:', apps);
|
||||
console.log('Apps render - apps.length:', apps.length);
|
||||
console.log('Apps render - categories:', categories);
|
||||
|
||||
var defaultFilter = this.currentFilter || 'all';
|
||||
var container = E('div', {
|
||||
'class': 'secubox-apps-page',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user