diff --git a/frontend/src/sections/devices/cwmp/devices-wifi.js b/frontend/src/sections/devices/cwmp/devices-wifi.js
index e9047f2..f0ed7e5 100644
--- a/frontend/src/sections/devices/cwmp/devices-wifi.js
+++ b/frontend/src/sections/devices/cwmp/devices-wifi.js
@@ -1,31 +1,31 @@
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,
- SnackbarContent,
- Snackbar,
- Checkbox,
- FormControlLabel,
- useTheme,
+ Button,
+ Card,
+ CardActions,
+ CardContent,
+ CardHeader,
+ Divider,
+ Stack,
+ TextField,
+ InputLabel,
+ MenuItem,
+ Select,
+ FormControl,
+ SvgIcon,
+ Dialog,
+ DialogTitle,
+ DialogContent,
+ DialogContentText,
+ DialogActions,
+ Box,
+ IconButton,
+ Icon,
+ SnackbarContent,
+ Snackbar,
+ Checkbox,
+ FormControlLabel,
+ useTheme,
} from '@mui/material';
import XMarkIcon from '@heroicons/react/24/outline/XMarkIcon';
import Check from '@heroicons/react/24/outline/CheckIcon';
@@ -52,44 +52,44 @@ export const DevicesWiFi = () => {
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", localStorage.getItem("token"));
-
+
var requestOptions = {
- method: 'GET',
- headers: myHeaders,
- redirect: 'follow'
+ method: 'GET',
+ headers: myHeaders,
+ redirect: 'follow'
};
fetch(`${process.env.NEXT_PUBLIC_REST_ENDPOINT || ""}/api/device/${router.query.id[0]}/wifi`, requestOptions)
- .then(response => {
- if (response.status === 401) {
- router.push("/auth/login")
- }
- return response.json()
- })
- .then(result => {
- console.log("wifi content", result)
- result.map((item) => {
- let contentToApply = {
- hasChanges: false,
- path: item.path,
+ .then(response => {
+ if (response.status === 401) {
+ router.push("/auth/login")
}
- setApplyContent(oldValue => [...oldValue, contentToApply])
+ return response.json()
})
- setContent(result)
- })
- .catch(error => console.log('error', error));
+ .then(result => {
+ console.log("wifi content", result)
+ result.map((item) => {
+ let contentToApply = {
+ hasChanges: false,
+ path: item.path,
+ }
+ setApplyContent(oldValue => [...oldValue, contentToApply])
+ })
+ setContent(result)
+ })
+ .catch(error => console.log('error', error));
};
- useEffect(()=>{
+ useEffect(() => {
fetchWifiData()
- },[])
+ }, [])
return (
-
{content.length > 1 ?
(content.map((item, index) => {
@@ -99,25 +99,25 @@ export const DevicesWiFi = () => {
title={item.name.value}
avatar={
-
+
}
/>
- { item.enable.value != null &&
- {
- let enable = item.enable.value == 1 ? "0" : "1"
- console.log(enable)
- applyContent[index].hasChanges = true
- applyContent[index].enable = {
- value : enable
- }
- setApplyContent([...applyContent])
- item.enable.value = enable
- }}/>}
- label="Enabled" />}
+ {item.enable.value != null &&
+ {
+ let enable = item.enable.value == 1 ? "0" : "1"
+ console.log(enable)
+ applyContent[index].hasChanges = true
+ applyContent[index].enable = {
+ value: enable
+ }
+ setApplyContent([...applyContent])
+ item.enable.value = enable
+ }} />}
+ label="Enabled" />}
{item.ssid.value != null && {
onChange={(e) => {
applyContent[index].hasChanges = true
applyContent[index].ssid = {
- value : e.target.value
+ value: e.target.value
}
setApplyContent([...applyContent])
item.ssid.value = e.target.value
}}
/>}
{item.securityCapabilities &&
- }
+ }
{item.password.value != null &&
- {
- if (e.target.value.length >= 8) {
- applyContent[index].hasChanges = true
- }else{
- applyContent[index].hasChanges = false
- }
- applyContent[index].password = {
- value : e.target.value
- }
- setApplyContent([...applyContent])
- item.password.value = e.target.value
- console.log("applyContent: ", applyContent)
- }}
- />}
+ {
+ if (e.target.value.length >= 8) {
+ applyContent[index].hasChanges = true
+ } else {
+ applyContent[index].hasChanges = false
+ }
+ applyContent[index].password = {
+ value: e.target.value
+ }
+ setApplyContent([...applyContent])
+ item.password.value = e.target.value
+ console.log("applyContent: ", applyContent)
+ }}
+ />}
+ {item.channel?.value != null && item.possibleChannels?.value != null &&
+
+ Channel
+
+
+ }
{item.standard.value != null &&
- {
- applyContent[index].hasChanges = true
- applyContent[index].standard = {
- value : e.target.value
- }
- setApplyContent([...applyContent])
- item.standard.value = e.target.value
- }}
- />}
+ {
+ applyContent[index].hasChanges = true
+ applyContent[index].standard = {
+ value: e.target.value
+ }
+ setApplyContent([...applyContent])
+ item.standard.value = e.target.value
+ }}
+ />}
-
-
)
- })):
+ })) :
}
@@ -239,44 +263,44 @@ export const DevicesWiFi = () => {
>
-
-
- );
+
+
+
+ {
+ setErrorModalText("")
+ setErrorModal(false)
+ }}>OK
+
+
+
+ );
};