From d0a8d1b096296d806cd2a7839452aac9c3028a53 Mon Sep 17 00:00:00 2001 From: bogdan Date: Fri, 25 Aug 2023 08:52:50 +0200 Subject: [PATCH] wifi scan dialog implemented --- SelectWiFiDialog.vue | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/SelectWiFiDialog.vue b/SelectWiFiDialog.vue index 6b469e2..fff17da 100644 --- a/SelectWiFiDialog.vue +++ b/SelectWiFiDialog.vue @@ -2,16 +2,15 @@
- - + +
+
Scanning WiFi...
- - + - - +
@@ -23,6 +22,10 @@ import { useDialogPluginComponent } from 'quasar' import { PostData } from "components/webguicomp/network"; import { reactive, ref } from 'vue'; +import { useQuasar } from 'quasar' +import { ShowDelayDialog } from "./helpers"; + +const $q = useQuasar(); defineEmits([ // REQUIRED; need to specify some events that your @@ -38,17 +41,22 @@ const { dialogRef, onDialogHide, onDialogOK, onDialogCancel } = useDialogPluginC // example: onDialogOK({ /*...*/ }) - with payload // onDialogCancel - Function to call to settle dialog with "cancel" outcome -// this is part of our example (so not required) -function onOKClick() { - // on OK, it is REQUIRED to - // call onDialogOK (with optional payload) - onDialogOK() - // or with payload: onDialogOK({ ... }) - // ...and it will also hide the dialog automatically -} function ClickOnRaw(evt, row, index) { - alert(`clicked SSID ${row.ssid}`) + $q.dialog({ + title: 'Enter network key', + message: `Enter key for "${row.ssid}" network`, + prompt: { + model: '', + isValid: val => val.length > 2, // << here is the magic + type: 'text' // optional + }, + cancel: true, + persistent: true + }).onOk(data => { + PostData({ wifi_sta_key: data, wifi_sta_ssid: row.ssid }, 1, 2, ShowDelayDialog('Data saving and reboot...', 10000, null)) + onDialogOK(); + }) } function onDataReady() {