-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
iot2050-conf-webui: Add support for SM1231-RTD modules
Signed-off-by: Baocheng Su <[email protected]>
- Loading branch information
1 parent
40a0144
commit 47049c7
Showing
8 changed files
with
825 additions
and
0 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
recipes-app/iot2050-conf-webui/files/src/components/ConfigEntry/CheckConfig.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* eslint-disable react/prop-types */ | ||
import * as React from 'react'; | ||
import Checkbox from '@mui/material/Checkbox'; | ||
import FormControlLabel from '@mui/material/FormControlLabel'; | ||
|
||
const doNothing = (id) => {}; | ||
|
||
export default function CheckConfig ({ id, data, updateConfig, disabled = false, postChange = doNothing }) { | ||
const setNewValue = (newValue) => { | ||
data.value = newValue; | ||
postChange(id); | ||
updateConfig(); | ||
}; | ||
|
||
const onChange = (event) => { | ||
setNewValue(event.target.checked); | ||
}; | ||
|
||
/* When disabled, the value should be setting to false */ | ||
React.useEffect(() => { | ||
if (disabled) { | ||
setNewValue(false); | ||
} | ||
}, [disabled]); | ||
|
||
return ( | ||
<FormControlLabel | ||
disabled={disabled} | ||
label={data.label} | ||
control={<Checkbox | ||
checked={data.value} | ||
onChange={onChange} | ||
id={id} | ||
name={id} | ||
/>} | ||
/> | ||
); | ||
} |
17 changes: 17 additions & 0 deletions
17
recipes-app/iot2050-conf-webui/files/src/components/ConfigEntry/ConfigGroupLabel.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* eslint-disable react/prop-types */ | ||
import * as React from 'react'; | ||
import FormLabel from '@mui/material/FormLabel'; | ||
import Typography from '@mui/material/Typography'; | ||
|
||
export default function ConfigGroupLabel ({ label }) { | ||
return ( | ||
<FormLabel> | ||
<Typography | ||
sx={{ fontWeight: 'bold', lineHeight: 2, textTransform: 'uppercase' }} | ||
variant="h6" | ||
> | ||
{label} | ||
</Typography> | ||
</FormLabel> | ||
); | ||
} |
41 changes: 41 additions & 0 deletions
41
...app/iot2050-conf-webui/files/src/components/ExtendedModules/SM1231_RTD/SM1231_4RTDConf.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* eslint-disable camelcase */ | ||
/* eslint-disable react/prop-types */ | ||
import * as React from 'react'; | ||
import SM1231_RTDConf, { channelConfigDefault } from './SM1231_RTDConf'; | ||
import uiString from '@/lib/uiString/SM1231_RTD.json'; | ||
|
||
export const SM1231_4RTDConfDefault = { | ||
mlfb: '6ES7231-5PD32-0XB0', | ||
power_alarm: { | ||
label: uiString.LABEL_POWER_ALARM, | ||
value: true, | ||
disabled: false | ||
}, | ||
integ_time: { | ||
label: uiString.LABEL_INT_TIME, | ||
selection: [ | ||
uiString.INT_TIME_0, | ||
uiString.INT_TIME_1, | ||
uiString.INT_TIME_2, | ||
uiString.INT_TIME_3 | ||
], | ||
value: uiString.INT_TIME_2 | ||
}, | ||
channels: [ | ||
JSON.parse(JSON.stringify(channelConfigDefault)), | ||
JSON.parse(JSON.stringify(channelConfigDefault)), | ||
JSON.parse(JSON.stringify(channelConfigDefault)), | ||
JSON.parse(JSON.stringify(channelConfigDefault)) | ||
] | ||
}; | ||
|
||
export default function SM1231_4RTDConf ({ slotNum, configData, updateConfig }) { | ||
return ( | ||
<SM1231_RTDConf | ||
slotNum={slotNum} | ||
configData={configData} | ||
updateConfig={updateConfig} | ||
chTotal={4} | ||
/> | ||
); | ||
} |
45 changes: 45 additions & 0 deletions
45
...app/iot2050-conf-webui/files/src/components/ExtendedModules/SM1231_RTD/SM1231_8RTDConf.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* eslint-disable camelcase */ | ||
/* eslint-disable react/prop-types */ | ||
import * as React from 'react'; | ||
import SM1231_RTDConf, { channelConfigDefault } from './SM1231_RTDConf'; | ||
import uiString from '@/lib/uiString/SM1231_RTD.json'; | ||
|
||
export const SM1231_8RTDConfDefault = { | ||
mlfb: '6ES7231-5PF32-0XB0', | ||
power_alarm: { | ||
label: uiString.LABEL_POWER_ALARM, | ||
value: true, | ||
disabled: false | ||
}, | ||
integ_time: { | ||
label: uiString.LABEL_INT_TIME, | ||
selection: [ | ||
uiString.INT_TIME_0, | ||
uiString.INT_TIME_1, | ||
uiString.INT_TIME_2, | ||
uiString.INT_TIME_3 | ||
], | ||
value: uiString.INT_TIME_2 | ||
}, | ||
channels: [ | ||
JSON.parse(JSON.stringify(channelConfigDefault)), | ||
JSON.parse(JSON.stringify(channelConfigDefault)), | ||
JSON.parse(JSON.stringify(channelConfigDefault)), | ||
JSON.parse(JSON.stringify(channelConfigDefault)), | ||
JSON.parse(JSON.stringify(channelConfigDefault)), | ||
JSON.parse(JSON.stringify(channelConfigDefault)), | ||
JSON.parse(JSON.stringify(channelConfigDefault)), | ||
JSON.parse(JSON.stringify(channelConfigDefault)) | ||
] | ||
}; | ||
|
||
export default function SM1231_8RTDConf ({ slotNum, configData, updateConfig }) { | ||
return ( | ||
<SM1231_RTDConf | ||
slotNum={slotNum} | ||
configData={configData} | ||
updateConfig={updateConfig} | ||
chTotal={8} | ||
/> | ||
); | ||
} |
Oops, something went wrong.