diff --git a/frontend/src/sections/devices/devices-discovery.js b/frontend/src/sections/devices/devices-discovery.js index 78094fc..918b74c 100644 --- a/frontend/src/sections/devices/devices-discovery.js +++ b/frontend/src/sections/devices/devices-discovery.js @@ -7,6 +7,14 @@ import { List, ListItem, ListItemText, + Box, + Dialog, + DialogActions, + DialogContent, + DialogContentText, + DialogTitle, + TextField, + Button } from '@mui/material'; import CircularProgress from '@mui/material/CircularProgress'; import PlusCircleIcon from '@heroicons/react/24/outline/PlusCircleIcon'; @@ -20,8 +28,19 @@ const AccessType = { WriteOnly: 2, } -function ShowParamsWithValues({x, deviceParametersValue}) { +function ShowParamsWithValues({x, deviceParametersValue, setOpen, setParameter, setParameterValue}) { let paths = x.supported_obj_path.split(".") + + const showDialog = (param, paramvalue) => { + setParameter(param); + if (paramvalue == "\"\"") { + setParameterValue("") + }else{ + setParameterValue(paramvalue); + } + setOpen(true); + } + if(paths[paths.length -2] == "{i}"){ return Object.keys(deviceParametersValue).map((paramKey, h)=>{ return ( @@ -57,7 +76,13 @@ function ShowParamsWithValues({x, deviceParametersValue}) {
{Object.values(param)[0].value} {Object.values(param)[0].access > 0 && - + { + showDialog( + paramKey+Object.keys(param)[0], + Object.values(param)[0].value) + } + }> @@ -96,7 +121,13 @@ function ShowParamsWithValues({x, deviceParametersValue}) {
{deviceParametersValue[y.param_name].value} {deviceParametersValue[y.param_name].access > 0 && - + { + showDialog( + x.supported_obj_path + y.param_name, + deviceParametersValue[y.param_name].value) + } + }> @@ -119,7 +150,10 @@ export const DevicesDiscovery = () => { const router = useRouter() const [deviceParameters, setDeviceParameters] = useState(null) +const [parameter, setParameter] = useState(null) +const [parameterValue, setParameterValue] = useState(null) const [deviceParametersValue, setDeviceParametersValue] = useState({}) +const [open, setOpen] = useState(false) const initialize = async (raw) => { let content = await getDeviceParameters(raw) @@ -497,7 +531,13 @@ const getDeviceParameterInstances = async (raw) =>{ /> { x.supported_params && - + } { x.supported_commands && x.supported_commands.map((y)=>{ @@ -555,6 +595,27 @@ const getDeviceParameterInstances = async (raw) =>{ {showParameters()} + + + + {parameter} + + + + + + + + :