From b3be4fa169e08e590538b9c67794628962e3a94d Mon Sep 17 00:00:00 2001 From: Jason Wallace Date: Tue, 27 Aug 2024 15:23:10 +0200 Subject: [PATCH] Direct users to the Network Status dialog (#1831) Resolves https://github.com/tiny-pilot/tinypilot/issues/1826 This PR adds a convenience button that opens the Network Status dialog after a user configures their Wi-Fi credentials. Additionally, we've added a hint to the tooltip of the `` to direct users to the Network Status dialog. Demo video: https://github.com/user-attachments/assets/210fe26e-4e03-475f-9e99-f0e21d75cc20 Review
on CodeApprove --- .../custom-elements/connection-indicator.html | 12 ++++++++---- .../custom-elements/wifi-dialog.html | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/app/templates/custom-elements/connection-indicator.html b/app/templates/custom-elements/connection-indicator.html index 79830d9fa..92a7f8c5b 100644 --- a/app/templates/custom-elements/connection-indicator.html +++ b/app/templates/custom-elements/connection-indicator.html @@ -64,13 +64,17 @@
-
+

Your browser is connected to your TinyPilot device. -

-
+

+

Your browser is currently unable to connect to your TinyPilot device over the network. -

+

+

+ See “System” > “Networking” > “Status” for more + information. +

diff --git a/app/templates/custom-elements/wifi-dialog.html b/app/templates/custom-elements/wifi-dialog.html index 951141180..4af5c9101 100644 --- a/app/templates/custom-elements/wifi-dialog.html +++ b/app/templates/custom-elements/wifi-dialog.html @@ -135,6 +135,12 @@

Wi-Fi Credentials Saved

Your Wi-Fi credentials have been saved. When your TinyPilot device is in range of the wireless network, it will automatically try to connect to it.

+

+ To monitor the Wi-Fi connection status, open the "Network Status" dialog. +

+ @@ -200,6 +206,9 @@

Wi-Fi Credentials Removed

), enableButton: this.shadowRoot.querySelector("#enable-button"), disableButton: this.shadowRoot.querySelector("#disable-button"), + networkStatusButton: this.shadowRoot.querySelector( + "#network-status-button" + ), }; this.addEventListener("overlay-shown", () => this._initialize()); @@ -218,6 +227,16 @@

Wi-Fi Credentials Removed

this._elements.disableButton.addEventListener("click", () => { this._disable(); }); + this._elements.networkStatusButton.addEventListener("click", () => { + this.dispatchEvent(new DialogClosedEvent()); + const menuBar = document.getElementById("menu-bar"); + menuBar.dispatchEvent( + new CustomEvent("network-status-dialog-requested", { + bubbles: true, + composed: true, + }) + ); + }); this.shadowRoot.querySelectorAll(".close-button").forEach((el) => el.addEventListener("click", () => { this.dispatchEvent(new DialogClosedEvent());