mirror of
https://github.com/ragestudio/relic.git
synced 2025-06-09 10:34:18 +00:00
fix configs missing id
This commit is contained in:
parent
e8bb844df0
commit
d3a752c820
@ -1,6 +1,4 @@
|
|||||||
import React from "react"
|
import React from "react"
|
||||||
import { Icons, Icon } from "components/Icons"
|
|
||||||
|
|
||||||
import * as antd from "antd"
|
import * as antd from "antd"
|
||||||
|
|
||||||
import PKGConfigItem from "../PackageConfigItem"
|
import PKGConfigItem from "../PackageConfigItem"
|
||||||
@ -11,12 +9,12 @@ const InstallConfigAsk = (props) => {
|
|||||||
const { manifest } = props
|
const { manifest } = props
|
||||||
|
|
||||||
const [values, setValues] = React.useState({
|
const [values, setValues] = React.useState({
|
||||||
...manifest.storaged_configs,
|
...Object.entries(manifest.configs).reduce((acc, [key, value]) => {
|
||||||
...Object.keys(manifest.configs).reduce((prev, key) => {
|
acc[key] = value.default
|
||||||
prev[key] = manifest.configs[key].default
|
|
||||||
|
|
||||||
return prev
|
return acc
|
||||||
}, {})
|
}, {}),
|
||||||
|
...manifest.storaged_configs,
|
||||||
})
|
})
|
||||||
|
|
||||||
const [currentStep, setCurrentStep] = React.useState(0)
|
const [currentStep, setCurrentStep] = React.useState(0)
|
||||||
@ -74,10 +72,16 @@ const InstallConfigAsk = (props) => {
|
|||||||
const steps = manifest.install_ask_configs.map((key, index) => {
|
const steps = manifest.install_ask_configs.map((key, index) => {
|
||||||
const config = manifest.configs[key]
|
const config = manifest.configs[key]
|
||||||
|
|
||||||
|
if (!config.id) {
|
||||||
|
config.id = key
|
||||||
|
}
|
||||||
|
|
||||||
|
const storagedConfig = manifest.storaged_configs?.[key] ?? manifest.configs[key].default
|
||||||
|
|
||||||
return <PKGConfigItem
|
return <PKGConfigItem
|
||||||
key={index}
|
key={index}
|
||||||
config={config}
|
config={config}
|
||||||
storagedValue={manifest.storaged_configs[key]}
|
storagedValue={storagedConfig}
|
||||||
onChange={handleChanges}
|
onChange={handleChanges}
|
||||||
/>
|
/>
|
||||||
})
|
})
|
||||||
@ -85,6 +89,8 @@ const InstallConfigAsk = (props) => {
|
|||||||
return steps
|
return steps
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
console.log(values)
|
||||||
|
|
||||||
return <div className="install_config_ask">
|
return <div className="install_config_ask">
|
||||||
<antd.Steps
|
<antd.Steps
|
||||||
size="small"
|
size="small"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user