diff --git a/frontend/src/components/visually-hidden-input.js b/frontend/src/components/visually-hidden-input.js new file mode 100644 index 0000000..686e6c8 --- /dev/null +++ b/frontend/src/components/visually-hidden-input.js @@ -0,0 +1,13 @@ +import { styled } from '@mui/material/styles'; + +export const VisuallyHiddenInput = styled('input')({ + clip: 'rect(0 0 0 0)', + clipPath: 'inset(50%)', + height: 1, + overflow: 'hidden', + position: 'absolute', + bottom: 0, + left: 0, + whiteSpace: 'nowrap', + width: 1, + }); \ No newline at end of file diff --git a/frontend/src/pages/devices.js b/frontend/src/pages/devices.js index 8b02675..29d0b2f 100644 --- a/frontend/src/pages/devices.js +++ b/frontend/src/pages/devices.js @@ -172,7 +172,8 @@ const Page = () => { } const getDeviceProtocol = (order) => { - if (order.Cwmp != null) { + console.log("order:", order) + if (order.Cwmp == 2) { return "cwmp" } else { return "usp" diff --git a/frontend/src/pages/devices/cwmp/[...id].js b/frontend/src/pages/devices/cwmp/[...id].js index 3e5c605..303f0ad 100644 --- a/frontend/src/pages/devices/cwmp/[...id].js +++ b/frontend/src/pages/devices/cwmp/[...id].js @@ -13,15 +13,12 @@ import { DevicesRPC } from 'src/sections/devices/cwmp/devices-rpc'; import EnvelopeIcon from '@heroicons/react/24/outline/EnvelopeIcon'; import MagnifyingGlassIcon from '@heroicons/react/24/solid/MagnifyingGlassIcon'; import WifiIcon from '@heroicons/react/24/solid/WifiIcon'; -import WrenchScrewDriverIcon from '@heroicons/react/24/solid/WrenchScrewdriverIcon'; +import ServerStackIcon from '@heroicons/react/24/outline/ServerStackIcon'; import SignalIcon from '@heroicons/react/24/solid/SignalIcon'; import DevicePhoneMobile from '@heroicons/react/24/solid/DevicePhoneMobileIcon'; -import { useEffect, useState } from 'react'; +import WrenchScrewDriverIcon from '@heroicons/react/24/outline/WrenchScrewdriverIcon'; +import CommandLineIcon from '@heroicons/react/24/outline/CommandLineIcon'; import { DevicesWiFi } from 'src/sections/devices/cwmp/devices-wifi'; -import { DevicesDiagnostic } from 'src/sections/devices/cwmp/devices-diagnostic'; -import { SiteSurvey } from 'src/sections/devices/cwmp/site-survey'; -import { ConnectedDevices } from 'src/sections/devices/cwmp/connecteddevices'; -import InformactionCircleIcon from '@heroicons/react/24/outline/InformationCircleIcon'; const Page = () => { @@ -29,7 +26,6 @@ const Page = () => { const deviceID = router.query.id[0] const section = router.query.id[1] - const enterpriseVersion = process.env.NEXT_PUBLIC_ENTERPRISE_VERSION === "true" ? true : false; const sectionHandler = () => { switch(section){ @@ -37,20 +33,10 @@ const Page = () => { return case "wifi": return - case "diagnostic": - return - case "connected-devices": - return - case "site-survey": - return default: - return

Hello World

+ router.push(`/devices/cwmp/${deviceID}/wifi`) } } - - useEffect(()=>{ - console.log("deviceid:",deviceID) - }) return( <> @@ -98,23 +84,36 @@ const Page = () => { label="Site Survey" onClick={()=>{router.push(`/devices/cwmp/${deviceID}/site-survey`)}} value={"site-survey"} - disabled={!enterpriseVersion}/> + disabled={true}/> } iconPosition={"end"} label="Connected Devices" + disabled={true} onClick={()=>{router.push(`/devices/cwmp/${deviceID}/connected-devices`)}} value={"connected-devices"} - disabled={!enterpriseVersion} /> - {/* {router.push(`/devices/cwmp/${deviceID}/discovery`)}} icon={} iconPosition={"end"} label="Discover Parameters" /> */} } iconPosition={"end"} label="Diagnostic" onClick={()=>{router.push(`/devices/cwmp/${deviceID}/diagnostic`)}} value={"diagnostic"} - disabled={!enterpriseVersion}/> + disabled={true}/> + } + iconPosition={"end"} + label="Ports" + onClick={()=>{router.push(`/devices/usp/${deviceID}/ports`)}} + disabled={true} + value={"ports"} /> + } + iconPosition={"end"} + label="Actions" + onClick={()=>{router.push(`/devices/usp/${deviceID}/actions`)}} + disabled={true} + value={"actions"} /> {router.push(`/devices/cwmp/${deviceID}/msg`)}} diff --git a/frontend/src/pages/devices/usp/[...id].js b/frontend/src/pages/devices/usp/[...id].js index 9643814..b5fd4b5 100644 --- a/frontend/src/pages/devices/usp/[...id].js +++ b/frontend/src/pages/devices/usp/[...id].js @@ -2,22 +2,32 @@ import Head from 'next/head'; import { Box, Stack, Typography, Container, Unstable_Grid2 as Grid, Tab, Tabs, -SvgIcon } from '@mui/material'; +SvgIcon, +Breadcrumbs, +Link, +CircularProgress, +Tooltip} from '@mui/material'; import { Layout as DashboardLayout } from 'src/layouts/dashboard/layout'; import { useRouter } from 'next/router'; import { DevicesRPC } from 'src/sections/devices/usp/devices-rpc'; import { DevicesDiscovery } from 'src/sections/devices/usp/devices-discovery'; import EnvelopeIcon from '@heroicons/react/24/outline/EnvelopeIcon'; import MagnifyingGlassIcon from '@heroicons/react/24/solid/MagnifyingGlassIcon'; -import WifiIcon from '@heroicons/react/24/solid/WifiIcon'; -import { useEffect, useState } from 'react'; -import { DevicesWiFi } from 'src/sections/devices/usp/devices-wifi'; +import WifiIcon from '@heroicons/react/24/outline/WifiIcon'; +import ServerStackIcon from '@heroicons/react/24/outline/ServerStackIcon'; +import { useState } from 'react'; +import SignalIcon from '@heroicons/react/24/solid/SignalIcon'; +import DevicePhoneMobile from '@heroicons/react/24/solid/DevicePhoneMobileIcon'; +import WrenchScrewDriverIcon from '@heroicons/react/24/outline/WrenchScrewdriverIcon'; +import CommandLineIcon from '@heroicons/react/24/outline/CommandLineIcon'; const Page = () => { const router = useRouter() const deviceID = router.query.id[0] const section = router.query.id[1] + + const [loading, setLoading] = useState(true) const sectionHandler = () => { switch(section){ @@ -25,16 +35,10 @@ const Page = () => { return case "discovery": return - // case "wifi": - // return default: - return

Hello World

+ router.push(`/devices/usp/${deviceID}/discovery`) } } - - useEffect(()=>{ - console.log("deviceid:",deviceID) - }) return( <> @@ -52,18 +56,84 @@ const Page = () => { > + + {[ + Devices + , + + {deviceID} + ]} + - {/* } iconPosition={"end"} label="Wi-Fi" onClick={()=>{router.push(`/devices/usp/${deviceID}/wifi`)}} value={"wifi"}/> */} - {router.push(`/devices/usp/${deviceID}/discovery`)}} icon={} iconPosition={"end"} label="Discover Parameters" /> - {router.push(`/devices/usp/${deviceID}/msg`)}} icon={} iconPosition={"end"} label="Remote Messages" /> + } + iconPosition={"end"} + label="Wi-Fi" + onClick={()=>{router.push(`/devices/usp/${deviceID}/wifi`)}} + disabled={true} + value={"wifi"}/> + } + iconPosition={"end"} + label="Site Survey" + style={{opacity:"0.5"}} + onClick={()=>{router.push(`/devices/usp/${deviceID}/site-survey`)}} + disabled={true} + value={"site-survey"} + /> + } + iconPosition={"end"} + label="Connected Devices" + onClick={()=>{router.push(`/devices/usp/${deviceID}/connected-devices`)}} + disabled={true} + value={"connected-devices"} + /> + } + iconPosition={"end"} + label="Diagnostic" + onClick={()=>{router.push(`/devices/usp/${deviceID}/diagnostic`)}} + disabled={true} + value={"diagnostic"} /> + } + iconPosition={"end"} + label="Ports" + onClick={()=>{router.push(`/devices/usp/${deviceID}/ports`)}} + disabled={true} + value={"ports"} /> + } + iconPosition={"end"} + label="Actions" + onClick={()=>{router.push(`/devices/usp/${deviceID}/actions`)}} + disabled={true} + value={"actions"} /> + {router.push(`/devices/usp/${deviceID}/discovery`)}} + icon={} + iconPosition={"end"} + label="Discover Parameters" /> + {router.push(`/devices/usp/${deviceID}/msg`)}} + icon={} + iconPosition={"end"} + label="Remote Messages" /> - { sectionHandler() } diff --git a/frontend/src/sections/devices/cwmp/connecteddevices.js b/frontend/src/sections/devices/cwmp/connecteddevices.js deleted file mode 100644 index 6d5d859..0000000 --- a/frontend/src/sections/devices/cwmp/connecteddevices.js +++ /dev/null @@ -1,148 +0,0 @@ -import React, { useEffect, useState } from "react"; - -import { Card, CardActions, CardContent, CardHeader, CircularProgress, Divider, Grid, InputLabel, MenuItem, Select, SvgIcon, Tooltip, Typography } from "@mui/material"; -import CpuChipIcon from "@heroicons/react/24/solid/CpuChipIcon"; -import { Stack } from "@mui/system"; -import { useTheme } from "@emotion/react"; -import { useRouter } from "next/router"; -import { set } from "nprogress"; - -export const ConnectedDevices = () => { - - const theme = useTheme(); - const router = useRouter(); - - const [content, setContent] = useState(null); - const [interfaces, setInterfaces] = useState([]); - const [interfaceValue, setInterfaceValue] = useState(null); - - const getConnectionState = (rssi) => { - let connectionStatus = "Signal " - if (rssi > -30) { - return connectionStatus + "Excellent" - } else if (rssi > -60) { - return connectionStatus + "Good" - } else if (rssi > -70) { - return connectionStatus + "Bad" - } else { - return connectionStatus + "Awful" - } - } - - const fetchConnectedDevicesData = async () => { - - var myHeaders = new Headers(); - myHeaders.append("Content-Type", "application/json"); - myHeaders.append("Authorization", localStorage.getItem("token")); - - var requestOptions = { - method: 'GET', - headers: myHeaders, - redirect: 'follow' - }; - - fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT || ""}/api/device/${router.query.id[0]}/connecteddevices`, requestOptions) - .then(response => { - if (response.status === 401) { - router.push("/auth/login") - } - return response.json() - }) - .then(result => { - console.log("connecteddevices content", result) - let interfaces = Object.keys(result) - setInterfaces(interfaces) - setInterfaceValue(interfaces[0]) - setContent(result) - }) - .catch(error => console.log('error', error)); - }; - - useEffect(() => { - fetchConnectedDevicesData(); - }, []) - - return ( - - {content && interfaces.length > 0 ? - - - - Interface - - - { - content[interfaceValue].map((property, index) => ( - - - - - - - - - - - - {property.hostname} - - - - - - IP address: {property.ip_adress} - - - MAC: {property.mac} - - - - - Source: {property.adress_source} - - - { - let rssi = property.rssi - if(rssi == 0){ - return theme.palette.neutral[900] - } else if (rssi > -30) { - return theme.palette.success.main - } else if (rssi > -60) { - return theme.palette.success.main - } else if (rssi > -70) { - return theme.palette.warning.main - } else { - return theme.palette.error.main - } - }}> - - RSSI: - - {property.rssi} dbm - - - - - - - - )) - } - - : ( - content ? No connected devices found : - )} - - ) -} \ No newline at end of file diff --git a/frontend/src/sections/devices/cwmp/devices-diagnostic.js b/frontend/src/sections/devices/cwmp/devices-diagnostic.js deleted file mode 100644 index b796e9d..0000000 --- a/frontend/src/sections/devices/cwmp/devices-diagnostic.js +++ /dev/null @@ -1,239 +0,0 @@ -import { use, useCallback, useEffect, useState } from 'react'; -import { - Button, - Card, - CardActions, - CardContent, - CardHeader, - Stack, - TextField, - SvgIcon, - Dialog, - DialogTitle, - DialogContent, - DialogActions, - Box, - IconButton, - Input, - Typography, - DialogContentText -} from '@mui/material'; -import XMarkIcon from '@heroicons/react/24/outline/XMarkIcon'; -import Check from '@heroicons/react/24/outline/CheckIcon'; -import CircularProgress from '@mui/material/CircularProgress'; -import Backdrop from '@mui/material/Backdrop'; -import { useRouter } from 'next/router'; -import ArrowsUpDownIcon from '@heroicons/react/24/solid/ArrowsUpDownIcon'; -import PaperAirplane from '@heroicons/react/24/solid/PaperAirplaneIcon'; - -export const DevicesDiagnostic = () => { - - const router = useRouter() - - const [content, setContent] = useState(null) - const [applyPing, setApplyPing] = useState(false) - const [pingResponse, setPingResponse] = useState(null) - const [progress, setProgress] = useState(0); - - //TODO: fixme - // useEffect(()=>{ - // let timeout = content?.number_of_repetitions.value * content?.timeout.value - // if (timeout <= 0) return; - - // const increment = 100 / timeout ;// Calculate increment based on the timeout - - // const interval = setInterval(() => { - // setProgress((prevProgress) => ( - // prevProgress >= 100 ? 0 : prevProgress + increment - // )); - // }, 1000); - - // return () => { - // clearInterval(interval); - // }; - // },[content]) - - const fetchPingData = async () => { - - var myHeaders = new Headers(); - myHeaders.append("Content-Type", "application/json"); - myHeaders.append("Authorization", localStorage.getItem("token")); - - var requestOptions = { - method: 'GET', - headers: myHeaders, - redirect: 'follow' - }; - - fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT || ""}/api/device/${router.query.id[0]}/ping`, requestOptions) - .then(response => { - if (response.status === 401) { - router.push("/auth/login") - } - return response.json() - }) - .then(result => { - console.log("ping content", result) - setContent(result) - }) - .catch(error => console.log('error', error)); - }; - - useEffect(()=>{ - fetchPingData() - },[]) - - const handlePing = async () => { - 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: JSON.stringify(content) - }; - - fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT || ""}/api/device/${router.query.id[0]}/ping`, requestOptions) - .then(response => { - if (response.status === 401) { - router.push("/auth/login") - } - return response.json() - }) - .then(result => { - console.log("ping content", result) - setProgress(100) - setApplyPing(false) - setPingResponse(result) - }) - .catch(error => console.log('error', error)); - } - - - return ( content && -
- - - - - - } - /> - - - setContent({...content, host: {value: e.target.value}})} - /> - setContent({...content, number_of_repetitions: {value: e.target.valueAsNumber}})} - /> - setContent({...content, timeout: {value: e.target.valueAsNumber}})} - /> - - - - - - - - {applyPing && - theme.zIndex.drawer + 1 }} - open={applyPing} - > - - - }{ pingResponse && - - - - Ping Result - - - { - setPingResponse(null) - }} - > - - - - - - - - - - {!pingResponse.failure_count && !pingResponse.success_count ? - - Error: {pingResponse} - :
- - - Ping Statistics for {content.host.value} - - - Failure Count: {pingResponse.failure_count} | Success Count: {pingResponse.success_count} - - - Average Time: {pingResponse.average_rtt}s | Minimum Time: {pingResponse.minimum_rtt}s | Maximum Time: {pingResponse.maximum_rtt}s -
- } -
-
-
- - - -
} -
- ) -}; diff --git a/frontend/src/sections/devices/cwmp/site-survey.js b/frontend/src/sections/devices/cwmp/site-survey.js deleted file mode 100644 index dcfb1bb..0000000 --- a/frontend/src/sections/devices/cwmp/site-survey.js +++ /dev/null @@ -1,441 +0,0 @@ -import { - Button, - Card, - CardActions, - CardContent, - CardHeader, - Divider, - SvgIcon, - FormControl, - FormLabel, - Radio, - RadioGroup, - Grid, - FormControlLabel, - Box, - Table, - TableBody, - TableCell, - TableHead, - TableRow, - TableContainer, - CircularProgress, - ToggleButton, - ToggleButtonGroup -} from '@mui/material'; -import { useTheme } from '@mui/material/styles'; -import { Chart } from 'src/components/chart'; -import ChartBarSquareIcon from '@heroicons/react/24/outline/ChartBarSquareIcon'; -import ListBulletIcon from '@heroicons/react/24/outline/ListBulletIcon'; -import { useRouter } from 'next/router'; -import { Stack } from '@mui/system'; -import { useEffect, useState } from 'react'; - -export const SiteSurvey = (props) => { - - // const getMaxChannel = () => { - // if (frequency == "2.4GHz") { - // return 13; - // } else { - // return 128; - // } - // } - - // const geMinChannel = () => { - // if (frequency == "2.4GHz") { - // return 0; - // } else { - // return 36; - // } - // } - - // const getChannelSpacing = () => { - // if (frequency == "2.4GHz") { - // return 1; - // } else { - // return 4; - // } - // } - - // const getChannelAmount = () => { - // if (frequency == "2.4GHz") { - // return 13; - // } else { - // return 20; - // } - // } - - const getCategories = () => { - - } - - const router = useRouter(); - - const [frequency, setFrequency] = useState("2.4GHz"); - const [view, setView] = useState("chart"); - const [content, setContent] = useState(null); - - const getSeries = () => { - let series = [] - content[frequency].map((network) => { - - let data = [] - - if (frequency == "2.4GHz") { - if (Number(network.bandwidth) == 20) { - data.push({"x": Number(network.channel) -2, "y": -100}) - data.push({"x": Number(network.channel), "y": Number(network.signal_level)}) - data.push({"x": Number(network.channel) +2, "y": -100}) - } - if (Number(network.bandwidth) == 40) { - data.push({"x": Number(network.channel) -4, "y": -100}) - data.push({"x": Number(network.channel), "y": Number(network.signal_level)}) - data.push({"x": Number(network.channel) +4, "y": -100}) - } - }else { - if (Number(network.bandwidth) == 20) { - data.push({"x": Number(network.channel) -4, "y": -100}) - data.push({"x": Number(network.channel), "y": Number(network.signal_level)}) - data.push({"x": Number(network.channel) +4, "y": -100}) - } - if (Number(network.bandwidth) == 40) { - data.push({"x": Number(network.channel) -8, "y": -100}) - data.push({"x": Number(network.channel), "y": Number(network.signal_level)}) - data.push({"x": Number(network.channel) +8, "y": -100}) - } - if (Number(network.bandwidth) == 80) { - data.push({"x": Number(network.channel) -16, "y": -100}) - data.push({"x": Number(network.channel), "y": Number(network.signal_level)}) - data.push({"x": Number(network.channel) +16, "y": -100}) - } - if (Number(network.bandwidth) == 160) { - data.push({"x": Number(network.channel) -32, "y": -100}) - data.push({"x": Number(network.channel), "y": Number(network.signal_level)}) - data.push({"x": Number(network.channel) +32, "y": -100}) - } - } - - let ssid = network.ssid - if ( ssid == "") { - ssid = " " - } - return series.push({ - name: ssid, - data: data - }) - }) - return series; - } - - const useChartOptions = () => { - const theme = useTheme(); - - return { - chart: { - background: 'transparent', - stacked: false, - toolbar: { - show: true - }, - zoom: { - enabled: false - }, - }, - title: { - text: 'Site Survey Results', - }, - // markers: { - // size: 5, - // hover: { - // size: 9 - // } - // }, - colors: [ - theme.palette.graphics.dark, - theme.palette.warning.main, - theme.palette.graphics.darkest, - theme.palette.graphics.main, - theme.palette.info.light, - theme.palette.graphics.lightest, - theme.palette.primary.main, - theme.palette.graphics.light, - theme.palette.error.light, - theme.palette.error.dark - ], - dataLabels: { - enabled: false - }, - grid: { - //borderColor: theme.palette.divider, - strokeDashArray: 2, - xaxis: { - lines: { - show: true - } - }, - yaxis: { - lines: { - show: true - }, - }, - }, - legend: { - show: true, - showForSingleSeries: true, - }, - plotOptions: { - area: { - fillTo: 'end', - } - }, - stroke: { - show: true, - curve: 'smooth', - lineCap: 'round', - }, - theme: { - mode: theme.palette.mode - }, - yaxis: { - min: -100, - max: 0, - labels: { - formatter: function (value) { - return value + ' dBm'; - }, - //offsetY: -10, - style: { - //colors: theme.palette.text.secondary - } - }, - }, - // annotations: { - // xaxis: [ - // { - // x: 9, - // x2: 10, - // borderColor: '#0b54ff', - // label: { - // style: { - // color: 'black', - // }, - // text: 'Channel 10', - // offsetX: 45, - // borderColor: 'transparent', - // style: { - // background: 'transparent', - // color: theme.palette.text.secondary, - // fontSize: '17px', - // }, - // } - // } - // ] - // }, - // annotations: { - // points: [{ - // x: 9, - // y: -5, - // label: { - // borderColor: '#775DD0', - // offsetY: 0, - // style: { - // color: '#fff', - // background: '#775DD0', - // }, - // rotate: -45, - // text: 'Bananas are good', - // } - // }] - // }, - xaxis: { - // tickPlacement: 'on', - // tickAmount: getChannelAmount(), - tickPlacement: 'on', - labels: { - show: true, - style: { - //colors: theme.palette.text.secondary - }, - trim: true, - }, - // max: getMaxChannel(), - // min: geMinChannel(), - // stepSize: getChannelSpacing(), - //type: 'category', - //categories: [getCategories()], - type: 'numeric', - decimalsInFloat: 0, - }, - tooltip: { - x: { - show: true, - formatter: (seriesName) => "Channel "+ seriesName, - }, - followCursor: false, - intersect: false, - shared: true, - enabled: true, - onDatasetHover: { - highlightDataSeries: true, - } - } - }; - }; - - const chartOptions = useChartOptions(); - - const fetchSiteSurveyData = async () => { - - var myHeaders = new Headers(); - myHeaders.append("Content-Type", "application/json"); - myHeaders.append("Authorization", localStorage.getItem("token")); - - var requestOptions = { - method: 'GET', - headers: myHeaders, - redirect: 'follow' - }; - - fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT || ""}/api/device/${router.query.id[0]}/sitesurvey`, requestOptions) - .then(response => { - if (response.status === 401) { - router.push("/auth/login") - } - return response.json() - }) - .then(result => { - console.log("sitesurvey content", result) - setContent(result) - }) - .catch(error => console.log('error', error)); - }; - - - useEffect(() => { - fetchSiteSurveyData(); - },[]) - - return ( - - {content ? - - - - { - setView(value) - }} - > - - - - - - - - - - - - - - - - { - setFrequency(e.target.value) - }} - > - - } label="2.4GHz" /> - } label="5GHz" /> - - - - - {view == "list" && - - - - - - - SSID - - - Channel - - - BandWidth - - - Standard - - - Signal Level - - - - - {content[frequency] && content[frequency].map((c) => { - return ( - - - {c.ssid} - - - {c.channel} - - - {c.bandwidth}MHz - - - {c.standard} - - - {c.signal_level} dbm - - - ); - })} - -
-
-
-
} - {view == "chart" && - - - - } -
: } -
- ); -}; \ No newline at end of file diff --git a/frontend/src/sections/devices/usp/devices-discovery.js b/frontend/src/sections/devices/usp/devices-discovery.js index ed003d4..e8b676f 100644 --- a/frontend/src/sections/devices/usp/devices-discovery.js +++ b/frontend/src/sections/devices/usp/devices-discovery.js @@ -464,8 +464,53 @@ const [inputArgsValue, setInputArgsValue] = useState({}) // } const initialize = async (raw) => { - let content = await getDeviceParameters(raw) - setDeviceParameters(content) + // let content = await getDeviceParameters(raw) + // console.log("get device parameters content:", content) + + // let parametersToFetch = () => { + // let paramsToFetch = [] + // for (let i =0; i < supportedParams.length ;i++){ + + // let supported_obj_path = content.req_obj_results[0].supported_objs[0].supported_obj_path.replaceAll("{i}","*") + // let param = supportedParams[i] + + // paramsToFetch.push(supported_obj_path+param.param_name) + + // paramsInfo[param.param_name] = { + // "value_change":param["value_change"], + // "value_type":param["value_type"], + // "access": param["access"], + // "value": "-", + // } + // } + + // if (supportedCommands === undefined){ + // return paramsToFetch + // } + + // for(let i =0; i < supportedCommands.length; i++){ + // let command = supportedCommands[i] + // commandsInfo[command.command_name] = { + // "type":command["command_type"] + // } + // } + + // return paramsToFetch + // } + + // const fetchparameters = parametersToFetch() + // console.log("parameters to fetch: ", fetchparameters) + + // raw = JSON.stringify({ + // "param_paths": fetchparameters, + // "max_depth": 1 + // }) + + // let values = await getDeviceParametersValue(raw), + updateDeviceParameters("Device.") + // setDeviceParametersValue(values) + + // setDeviceParameters(content) //initDeviceCommands(content) } @@ -786,10 +831,10 @@ const getDeviceParameterInstances = async (raw) =>{ } throw new Error('Please check your email and password'); }else if (result.status === 401){ - router.push("/auth/login") -}else{ - return result.json() - } + router.push("/auth/login") + }else{ + return result.json() + } } @@ -1205,12 +1250,12 @@ const getDeviceParameterInstances = async (raw) =>{ }} open={showLoading} > - + : - + ) }; diff --git a/frontend/src/sections/devices/usp/devices-wifi.js b/frontend/src/sections/devices/usp/devices-wifi.js deleted file mode 100644 index 18d8d3c..0000000 --- a/frontend/src/sections/devices/usp/devices-wifi.js +++ /dev/null @@ -1,132 +0,0 @@ -import { useCallback, useEffect, useState } from 'react'; -import { - Button, - Card, - CardActions, - CardContent, - CardHeader, - Divider, - Stack, - TextField, - InputLabel, - MenuItem, - Select, - FormControl, - SvgIcon, - Dialog, - DialogTitle, - DialogContent, - DialogContentText, - DialogActions, - Box, - IconButton, - Icon, - Checkbox, - FormControlLabel -} from '@mui/material'; -import XMarkIcon from '@heroicons/react/24/outline/XMarkIcon'; -import PaperAirplane from '@heroicons/react/24/solid/PaperAirplaneIcon'; -import Check from '@heroicons/react/24/outline/CheckIcon' -import CircularProgress from '@mui/material/CircularProgress'; -import Backdrop from '@mui/material/Backdrop'; -import { useRouter } from 'next/router'; -import GlobeAltIcon from '@heroicons/react/24/outline/GlobeAltIcon'; - - -export const DevicesWiFi = () => { - - return ( - - - - - - } - /> - - - } label="Enabled" /> - - - - - - - - - - - } - /> - - - } label="Enabled" /> - - - Security - - - - - - - - - - - - ); -};