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:
parent
6fda6e220d
commit
c1734c8ea0
@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
|
|||||||
|
|
||||||
PKG_NAME:=luci-app-streamlit
|
PKG_NAME:=luci-app-streamlit
|
||||||
PKG_VERSION:=1.0.0
|
PKG_VERSION:=1.0.0
|
||||||
PKG_RELEASE:=3
|
PKG_RELEASE:=5
|
||||||
PKG_ARCH:=all
|
PKG_ARCH:=all
|
||||||
|
|
||||||
PKG_LICENSE:=Apache-2.0
|
PKG_LICENSE:=Apache-2.0
|
||||||
|
|||||||
@ -158,9 +158,7 @@ return view.extend({
|
|||||||
|
|
||||||
renderAddInstanceCard: function() {
|
renderAddInstanceCard: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
var apps = (this.appsData.apps || []).map(function(app) {
|
var appsList = this.appsData.apps || [];
|
||||||
return E('option', { 'value': app.name + '.py' }, app.name);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Calculate next available port
|
// Calculate next available port
|
||||||
var usedPorts = this.instancesData.map(function(i) { return i.port; });
|
var usedPorts = this.instancesData.map(function(i) { return i.port; });
|
||||||
@ -169,6 +167,16 @@ return view.extend({
|
|||||||
nextPort++;
|
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' }, [
|
return E('div', { 'class': 'st-card' }, [
|
||||||
E('div', { 'class': 'st-card-header' }, [
|
E('div', { 'class': 'st-card-header' }, [
|
||||||
E('div', { 'class': 'st-card-title' }, [
|
E('div', { 'class': 'st-card-title' }, [
|
||||||
@ -202,10 +210,7 @@ return view.extend({
|
|||||||
'class': 'st-form-input',
|
'class': 'st-form-input',
|
||||||
'id': 'new-inst-app',
|
'id': 'new-inst-app',
|
||||||
'style': 'height: 42px;'
|
'style': 'height: 42px;'
|
||||||
}, [
|
}, selectOptions)
|
||||||
E('option', { 'value': '' }, _('-- Select App --')),
|
|
||||||
apps.length > 0 ? apps : E('option', { 'disabled': true }, _('No apps available'))
|
|
||||||
])
|
|
||||||
]),
|
]),
|
||||||
E('div', { 'class': 'st-form-group' }, [
|
E('div', { 'class': 'st-form-group' }, [
|
||||||
E('label', { 'class': 'st-form-label' }, _('Port')),
|
E('label', { 'class': 'st-form-label' }, _('Port')),
|
||||||
|
|||||||
@ -70,8 +70,9 @@ return view.extend({
|
|||||||
E('div', { 'class': 'st-form-group' }, [
|
E('div', { 'class': 'st-form-group' }, [
|
||||||
E('label', { 'class': 'st-form-label' }, _('Enabled')),
|
E('label', { 'class': 'st-form-label' }, _('Enabled')),
|
||||||
E('select', {
|
E('select', {
|
||||||
'class': 'st-form-select',
|
'class': 'st-form-input',
|
||||||
'id': 'cfg-enabled'
|
'id': 'cfg-enabled',
|
||||||
|
'style': 'height: 42px;'
|
||||||
}, [
|
}, [
|
||||||
E('option', { 'value': '1', 'selected': config.enabled }, _('Enabled')),
|
E('option', { 'value': '1', 'selected': config.enabled }, _('Enabled')),
|
||||||
E('option', { 'value': '0', 'selected': !config.enabled }, _('Disabled'))
|
E('option', { 'value': '0', 'selected': !config.enabled }, _('Disabled'))
|
||||||
@ -111,13 +112,15 @@ return view.extend({
|
|||||||
E('div', { 'class': 'st-form-group' }, [
|
E('div', { 'class': 'st-form-group' }, [
|
||||||
E('label', { 'class': 'st-form-label' }, _('Memory Limit')),
|
E('label', { 'class': 'st-form-label' }, _('Memory Limit')),
|
||||||
E('select', {
|
E('select', {
|
||||||
'class': 'st-form-select',
|
'class': 'st-form-input',
|
||||||
'id': 'cfg-memory_limit'
|
'id': 'cfg-memory_limit',
|
||||||
|
'style': 'height: 42px;'
|
||||||
}, [
|
}, [
|
||||||
E('option', { 'value': '256M', 'selected': config.memory_limit === '256M' }, '256 MB'),
|
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': '512M', 'selected': config.memory_limit === '512M' }, '512 MB'),
|
||||||
E('option', { 'value': '1G', 'selected': config.memory_limit === '1G' }, '1 GB'),
|
E('option', { 'value': '1024M', 'selected': config.memory_limit === '1024M' || !config.memory_limit }, '1 GB'),
|
||||||
E('option', { 'value': '2G', 'selected': config.memory_limit === '2G' }, '2 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' }, [
|
E('div', { 'class': 'st-form-group' }, [
|
||||||
@ -148,8 +151,9 @@ return view.extend({
|
|||||||
E('div', { 'class': 'st-form-group' }, [
|
E('div', { 'class': 'st-form-group' }, [
|
||||||
E('label', { 'class': 'st-form-label' }, _('Headless Mode')),
|
E('label', { 'class': 'st-form-label' }, _('Headless Mode')),
|
||||||
E('select', {
|
E('select', {
|
||||||
'class': 'st-form-select',
|
'class': 'st-form-input',
|
||||||
'id': 'cfg-headless'
|
'id': 'cfg-headless',
|
||||||
|
'style': 'height: 42px;'
|
||||||
}, [
|
}, [
|
||||||
E('option', { 'value': 'true', 'selected': config.headless !== false }, _('Enabled (recommended)')),
|
E('option', { 'value': 'true', 'selected': config.headless !== false }, _('Enabled (recommended)')),
|
||||||
E('option', { 'value': 'false', 'selected': config.headless === false }, _('Disabled'))
|
E('option', { 'value': 'false', 'selected': config.headless === false }, _('Disabled'))
|
||||||
@ -158,8 +162,9 @@ return view.extend({
|
|||||||
E('div', { 'class': 'st-form-group' }, [
|
E('div', { 'class': 'st-form-group' }, [
|
||||||
E('label', { 'class': 'st-form-label' }, _('Usage Statistics')),
|
E('label', { 'class': 'st-form-label' }, _('Usage Statistics')),
|
||||||
E('select', {
|
E('select', {
|
||||||
'class': 'st-form-select',
|
'class': 'st-form-input',
|
||||||
'id': 'cfg-gather_stats'
|
'id': 'cfg-gather_stats',
|
||||||
|
'style': 'height: 42px;'
|
||||||
}, [
|
}, [
|
||||||
E('option', { 'value': 'false', 'selected': !config.browser_gather_usage_stats }, _('Disabled (recommended)')),
|
E('option', { 'value': 'false', 'selected': !config.browser_gather_usage_stats }, _('Disabled (recommended)')),
|
||||||
E('option', { 'value': 'true', 'selected': config.browser_gather_usage_stats }, _('Enabled'))
|
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('div', { 'class': 'st-form-group' }, [
|
||||||
E('label', { 'class': 'st-form-label' }, _('Theme Base')),
|
E('label', { 'class': 'st-form-label' }, _('Theme Base')),
|
||||||
E('select', {
|
E('select', {
|
||||||
'class': 'st-form-select',
|
'class': 'st-form-input',
|
||||||
'id': 'cfg-theme_base'
|
'id': 'cfg-theme_base',
|
||||||
|
'style': 'height: 42px;'
|
||||||
}, [
|
}, [
|
||||||
E('option', { 'value': 'dark', 'selected': config.theme_base === 'dark' || !config.theme_base }, _('Dark')),
|
E('option', { 'value': 'dark', 'selected': config.theme_base === 'dark' || !config.theme_base }, _('Dark')),
|
||||||
E('option', { 'value': 'light', 'selected': config.theme_base === 'light' }, _('Light'))
|
E('option', { 'value': 'light', 'selected': config.theme_base === 'light' }, _('Light'))
|
||||||
|
|||||||
@ -3,13 +3,22 @@
|
|||||||
"description": "Grant access to Streamlit Platform management",
|
"description": "Grant access to Streamlit Platform management",
|
||||||
"read": {
|
"read": {
|
||||||
"ubus": {
|
"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"]
|
"uci": ["streamlit"]
|
||||||
},
|
},
|
||||||
"write": {
|
"write": {
|
||||||
"ubus": {
|
"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"]
|
"uci": ["streamlit"]
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user