fix(streamlit): Fix LuCI instance management bugs

- Add ACL permissions for instance RPC methods
- Fix settings page select styling (use st-form-input class)
- Fix memory limit options to match actual config values (1024M)
- Fix app selector dropdown in instances view (proper array handling)
- Bump luci-app-streamlit to r5

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
CyberMind-FR 2026-01-26 12:49:32 +01:00
parent 6fda6e220d
commit c1734c8ea0
4 changed files with 43 additions and 23 deletions

View File

@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-streamlit
PKG_VERSION:=1.0.0
PKG_RELEASE:=3
PKG_RELEASE:=5
PKG_ARCH:=all
PKG_LICENSE:=Apache-2.0

View File

@ -158,9 +158,7 @@ return view.extend({
renderAddInstanceCard: function() {
var self = this;
var apps = (this.appsData.apps || []).map(function(app) {
return E('option', { 'value': app.name + '.py' }, app.name);
});
var appsList = this.appsData.apps || [];
// Calculate next available port
var usedPorts = this.instancesData.map(function(i) { return i.port; });
@ -169,6 +167,16 @@ return view.extend({
nextPort++;
}
// Build select options array
var selectOptions = [E('option', { 'value': '' }, _('-- Select App --'))];
if (appsList.length > 0) {
appsList.forEach(function(app) {
selectOptions.push(E('option', { 'value': app.name + '.py' }, app.name));
});
} else {
selectOptions.push(E('option', { 'disabled': true }, _('No apps available')));
}
return E('div', { 'class': 'st-card' }, [
E('div', { 'class': 'st-card-header' }, [
E('div', { 'class': 'st-card-title' }, [
@ -202,10 +210,7 @@ return view.extend({
'class': 'st-form-input',
'id': 'new-inst-app',
'style': 'height: 42px;'
}, [
E('option', { 'value': '' }, _('-- Select App --')),
apps.length > 0 ? apps : E('option', { 'disabled': true }, _('No apps available'))
])
}, selectOptions)
]),
E('div', { 'class': 'st-form-group' }, [
E('label', { 'class': 'st-form-label' }, _('Port')),

View File

@ -70,8 +70,9 @@ return view.extend({
E('div', { 'class': 'st-form-group' }, [
E('label', { 'class': 'st-form-label' }, _('Enabled')),
E('select', {
'class': 'st-form-select',
'id': 'cfg-enabled'
'class': 'st-form-input',
'id': 'cfg-enabled',
'style': 'height: 42px;'
}, [
E('option', { 'value': '1', 'selected': config.enabled }, _('Enabled')),
E('option', { 'value': '0', 'selected': !config.enabled }, _('Disabled'))
@ -111,13 +112,15 @@ return view.extend({
E('div', { 'class': 'st-form-group' }, [
E('label', { 'class': 'st-form-label' }, _('Memory Limit')),
E('select', {
'class': 'st-form-select',
'id': 'cfg-memory_limit'
'class': 'st-form-input',
'id': 'cfg-memory_limit',
'style': 'height: 42px;'
}, [
E('option', { 'value': '256M', 'selected': config.memory_limit === '256M' }, '256 MB'),
E('option', { 'value': '512M', 'selected': config.memory_limit === '512M' || !config.memory_limit }, '512 MB'),
E('option', { 'value': '1G', 'selected': config.memory_limit === '1G' }, '1 GB'),
E('option', { 'value': '2G', 'selected': config.memory_limit === '2G' }, '2 GB')
E('option', { 'value': '512M', 'selected': config.memory_limit === '512M' }, '512 MB'),
E('option', { 'value': '1024M', 'selected': config.memory_limit === '1024M' || !config.memory_limit }, '1 GB'),
E('option', { 'value': '2048M', 'selected': config.memory_limit === '2048M' }, '2 GB'),
E('option', { 'value': '4096M', 'selected': config.memory_limit === '4096M' }, '4 GB')
])
]),
E('div', { 'class': 'st-form-group' }, [
@ -148,8 +151,9 @@ return view.extend({
E('div', { 'class': 'st-form-group' }, [
E('label', { 'class': 'st-form-label' }, _('Headless Mode')),
E('select', {
'class': 'st-form-select',
'id': 'cfg-headless'
'class': 'st-form-input',
'id': 'cfg-headless',
'style': 'height: 42px;'
}, [
E('option', { 'value': 'true', 'selected': config.headless !== false }, _('Enabled (recommended)')),
E('option', { 'value': 'false', 'selected': config.headless === false }, _('Disabled'))
@ -158,8 +162,9 @@ return view.extend({
E('div', { 'class': 'st-form-group' }, [
E('label', { 'class': 'st-form-label' }, _('Usage Statistics')),
E('select', {
'class': 'st-form-select',
'id': 'cfg-gather_stats'
'class': 'st-form-input',
'id': 'cfg-gather_stats',
'style': 'height: 42px;'
}, [
E('option', { 'value': 'false', 'selected': !config.browser_gather_usage_stats }, _('Disabled (recommended)')),
E('option', { 'value': 'true', 'selected': config.browser_gather_usage_stats }, _('Enabled'))
@ -168,8 +173,9 @@ return view.extend({
E('div', { 'class': 'st-form-group' }, [
E('label', { 'class': 'st-form-label' }, _('Theme Base')),
E('select', {
'class': 'st-form-select',
'id': 'cfg-theme_base'
'class': 'st-form-input',
'id': 'cfg-theme_base',
'style': 'height: 42px;'
}, [
E('option', { 'value': 'dark', 'selected': config.theme_base === 'dark' || !config.theme_base }, _('Dark')),
E('option', { 'value': 'light', 'selected': config.theme_base === 'light' }, _('Light'))

View File

@ -3,13 +3,22 @@
"description": "Grant access to Streamlit Platform management",
"read": {
"ubus": {
"luci.streamlit": ["get_status", "get_config", "get_logs", "list_apps", "get_app", "get_install_progress"]
"luci.streamlit": [
"get_status", "get_config", "get_logs",
"list_apps", "get_app", "get_install_progress",
"list_instances"
]
},
"uci": ["streamlit"]
},
"write": {
"ubus": {
"luci.streamlit": ["save_config", "start", "stop", "restart", "install", "uninstall", "update", "add_app", "remove_app", "set_active_app", "upload_app"]
"luci.streamlit": [
"save_config", "start", "stop", "restart",
"install", "uninstall", "update",
"add_app", "remove_app", "set_active_app", "upload_app",
"add_instance", "remove_instance", "enable_instance", "disable_instance"
]
},
"uci": ["streamlit"]
}