Fix Settings for Direct SD connection show wrong data

Add depend feature to field group
This commit is contained in:
Luc
2024-04-07 10:31:45 +08:00
parent 215d342b9e
commit 76f590a0ea
3 changed files with 31 additions and 1 deletions

View File

@@ -18,8 +18,23 @@
*/
import { h } from "preact"
import {
useUiContext,
useUiContextFn,
useSettingsContext,
} from "../../contexts"
import {
generateDependIds,
connectionDepend,
settingsDepend,
} from "../Helpers"
const FieldGroup = ({ className, children, label, id }) => {
const FieldGroup = ({ className, children, label, id, depend }) => {
const { connectionSettings } = useSettingsContext()
const canshow = connectionDepend(depend, connectionSettings.current)
if (!canshow) {
return null
}
return (
<fieldset
class={

View File

@@ -400,6 +400,9 @@ const InterfaceTab = () => {
label={T(
fieldData.label
)}
depend={
fieldData.depend
}
>
{Object.keys(
fieldData.value

View File

@@ -105,6 +105,10 @@
"id": "sd",
"value": true
},
{
"connection_id": "SDConnection",
"value": "!='direct'"
},
{
"id": "showfilespanel",
"value": true
@@ -122,6 +126,10 @@
"id": "sd",
"value": true
},
{
"connection_id": "SDConnection",
"value": "!='direct'"
},
{
"id": "showfilespanel",
"value": true
@@ -257,6 +265,10 @@
{
"id": "sd",
"value": true
},
{
"connection_id": "SDConnection",
"value": "!='direct'"
}
],
"value": [