diff --git a/frontend/src/sections/devices/devices-discovery.js b/frontend/src/sections/devices/devices-discovery.js
new file mode 100644
index 0000000..d1822bc
--- /dev/null
+++ b/frontend/src/sections/devices/devices-discovery.js
@@ -0,0 +1,169 @@
+import { useEffect, useState } from 'react';
+import {
+ Card,
+ CardContent,
+ SvgIcon,
+ IconButton,
+ List,
+ ListItem,
+ ListItemText,
+ Collapse,
+ Box,
+ Tabs,
+ Tab
+} from '@mui/material';
+import CircularProgress from '@mui/material/CircularProgress';
+import { useRouter } from 'next/router';
+
+
+export const DevicesDiscovery = () => {
+
+const router = useRouter()
+
+const [deviceParameters, setDeviceParameters] = useState(null)
+
+const initialize = async (raw) => {
+ let content = await getDeviceParameters(raw)
+ setDeviceParameters(content)
+}
+
+const getDeviceParameters = async (raw) =>{
+ var myHeaders = new Headers();
+ myHeaders.append("Content-Type", "application/json");
+ myHeaders.append("Authorization", localStorage.getItem("token"));
+
+ var requestOptions = {
+ method: 'PUT',
+ headers: myHeaders,
+ redirect: 'follow',
+ body: raw
+ };
+
+ let result = await (await fetch(`${process.env.NEXT_PUBLIC_REST_ENPOINT}/device/${router.query.id[0]}/parameters`, requestOptions))
+ if (result.status != 200) {
+ throw new Error('Please check your email and password');
+ }else{
+ return result.json()
+ }
+}
+
+ useEffect(()=> {
+
+ initialize(
+ JSON.stringify({
+ "obj_paths": ["Device."],
+ "first_level_only" : false,
+ "return_commands" : false,
+ "return_events" : false,
+ "return_params" : true
+ })
+ );
+ },[])
+
+//Together with showParameters, this function renders all the device parameters the device supports
+//but you must set req with first_level_only property to false
+// const showPathParameters = (pathParamsList) => {
+// return pathParamsList.map((x,i)=>{
+// return(
+//
+//
+//
+//
+//
+// )
+// })
+// }
+
+// const updateDeviceParameters = async (param,) => {
+
+// let raw = JSON.stringify({
+// "obj_paths": [param],
+// "first_level_only" : true,
+// "return_commands" : false,
+// "return_events" : false,
+// "return_params" : true
+// })
+
+// let content = await getDeviceParameters(raw)
+
+// console.log(content)
+
+// setDeviceParameters(prevState => {
+// return {...prevState, req_obj_results: [
+// {
+// supported_objs:[ ...prevState.req_obj_results[0].
+// supported_objs][index]
+// .supported_params:[]
+// }
+// ]
+// }
+// })
+// }
+
+ const showParameters = () => {
+ console.log(deviceParameters)
+ return deviceParameters.req_obj_results[0].supported_objs.map((x,i)=> {
+ return (
+
+ updateDeviceParameters(x.supported_obj_path, index)}*/>
+ //
+ //
+ //
+ //
+ // }
+ sx={{
+ boxShadow: 'rgba(149, 157, 165, 0.2) 0px 0px 5px;'
+ }}
+ >
+ {x.supported_obj_path}}
+ sx={{fontWeight:'bold'}}
+ />
+
+ { x.supported_params &&
+ x.supported_params.map((y)=>{
+ return
+
+
+
+
+ })
+ }
+
)
+ })
+ }
+
+ return ( deviceParameters ?
+
+
+ {showParameters()}
+
+
+ :
+
+
+
+ )
+};
diff --git a/frontend/src/sections/devices/devices-rpc.js b/frontend/src/sections/devices/devices-rpc.js
index 48d02f4..f1275b0 100644
--- a/frontend/src/sections/devices/devices-rpc.js
+++ b/frontend/src/sections/devices/devices-rpc.js
@@ -84,7 +84,7 @@ const handleOpen = () => {
}
- fetch(`${process.env.NEXT_PUBLIC_REST_ENPOINT}/device/${router.query.id}/${method}`, requestOptions)
+ fetch(`${process.env.NEXT_PUBLIC_REST_ENPOINT}/device/${router.query.id[0]}/${method}`, requestOptions)
.then(response => response.text())
.then(result => {
setOpen(false)
diff --git a/frontend/src/sections/overview/overview-latest-orders.js b/frontend/src/sections/overview/overview-latest-orders.js
index f16c235..cb33731 100644
--- a/frontend/src/sections/overview/overview-latest-orders.js
+++ b/frontend/src/sections/overview/overview-latest-orders.js
@@ -102,7 +102,7 @@ export const OverviewLatestOrders = (props) => {
sx={{cursor:'pointer'}}
onClick={()=>{
if (order.Status !== 2){
- router.push("devices/"+order.SN)
+ router.push("devices/"+order.SN+"/discovery")
}
}
}