This commit is contained in:
2024-03-29 01:29:30 +01:00
parent db1731fde6
commit 8eb2d69e13
10 changed files with 408 additions and 83 deletions

View File

@ -23,6 +23,7 @@ import {IPCAnswer, WiFiNetwork} from "../IPCConstants";
interface WiFiState {
open: boolean,
currentSelection: string,
selectedSecured: boolean,
foundWiFis: WiFiNetwork[],
scanning: boolean,
status: status
@ -36,6 +37,7 @@ export default class WiFi extends Component<{}, WiFiState> {
this.state = {
open: true,
currentSelection: "pleaseSelect",
selectedSecured: false,
foundWiFis: [],
scanning: false,
status: "NONE",
@ -107,10 +109,20 @@ export default class WiFi extends Component<{}, WiFiState> {
}
onChange = (event: SelectChangeEvent) => {
let isSecured = false;
for(let x of this.state.foundWiFis)
{
if(x.ssid == event.target.value)
isSecured = x.isSecured;
}
this.setState((prevState) => ({
...prevState,
currentSelection: event.target.value
currentSelection: event.target.value,
selectedSecured: isSecured,
}));
}
render() {
@ -151,8 +163,7 @@ export default class WiFi extends Component<{}, WiFiState> {
labelId="wifi-select-label"
id="wifi-select"
value={this.state.currentSelection}
label="Age"
label="WiFi"
disabled={this.state.scanning}
onChange={this.onChange}
>
@ -182,7 +193,7 @@ export default class WiFi extends Component<{}, WiFiState> {
</FormControl>
<FormControl sx={{m: 1, minWidth: '70%'}}>
<TextField id="password" label="Passwort" disabled={this.state.scanning} variant="outlined" />
<TextField id="password" label="Passwort" disabled={this.state.scanning || !this.state.selectedSecured} variant="outlined" />
</FormControl>
@ -210,10 +221,6 @@ export default class WiFi extends Component<{}, WiFiState> {
onClick={() => this.handleClose()}
color="error">Abbrechen</Button>
</FormControl>
</Typography>
</Box>
</Fade>