all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [yew-devel] [PATCH yew-comp 1/3] http client: include canonical http error with status code
@ 2025-01-08 13:23 Dominik Csapak
  2025-01-08 13:23 ` [yew-devel] [PATCH yew-comp 2/3] login panel: improve message on login error Dominik Csapak
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Dominik Csapak @ 2025-01-08 13:23 UTC (permalink / raw)
  To: yew-devel

e.g. when receiving a 401 error, this will change from

'HTTP status 401' to
'HTTP status 401 Unauthorized'

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/http_client_wasm.rs | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/http_client_wasm.rs b/src/http_client_wasm.rs
index 7f02164..3e5b187 100644
--- a/src/http_client_wasm.rs
+++ b/src/http_client_wasm.rs
@@ -205,7 +205,8 @@ impl HttpClientWasm {
             web_sys_response_to_http_api_response(self.fetch_request(request, None).await?).await?;
 
         if !(response.status >= 200 && response.status < 300) {
-            bail!("HTTP status {}", response.status);
+            let status = http::StatusCode::from_u16(response.status)?;
+            bail!("HTTP status {status}");
         }
 
         let text = String::from_utf8(response.body)?;
-- 
2.39.5



_______________________________________________
yew-devel mailing list
yew-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/yew-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [yew-devel] [PATCH yew-comp 2/3] login panel: improve message on login error
  2025-01-08 13:23 [yew-devel] [PATCH yew-comp 1/3] http client: include canonical http error with status code Dominik Csapak
@ 2025-01-08 13:23 ` Dominik Csapak
  2025-01-08 13:23 ` [yew-devel] [PATCH yew-comp 3/3] login panel: improve layout Dominik Csapak
  2025-01-08 13:36 ` [yew-devel] applied: [PATCH yew-comp 1/3] http client: include canonical http error with status code Dietmar Maurer
  2 siblings, 0 replies; 4+ messages in thread
From: Dominik Csapak @ 2025-01-08 13:23 UTC (permalink / raw)
  To: yew-devel

similar to PVE's error, but with the raw HTTP error included.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/login_panel.rs | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/login_panel.rs b/src/login_panel.rs
index 7aaee9f..c73e859 100644
--- a/src/login_panel.rs
+++ b/src/login_panel.rs
@@ -331,11 +331,10 @@ impl Component for ProxmoxLoginPanel {
             .class("pwt-flex-fill pwt-overflow-auto")
             .with_child(input_panel)
             .with_optional_child(tfa_dialog)
-            .with_optional_child(
-                self.login_error
-                    .as_ref()
-                    .map(|msg| pwt::widget::error_message(msg).padding(2)),
-            )
+            .with_optional_child(self.login_error.as_ref().map(|msg| {
+                pwt::widget::error_message(&tr!("Login failed. Please try again ({0})", msg))
+                    .padding(2)
+            }))
             .with_flex_spacer()
             .with_child(toolbar);
 
-- 
2.39.5



_______________________________________________
yew-devel mailing list
yew-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/yew-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [yew-devel] [PATCH yew-comp 3/3] login panel: improve layout
  2025-01-08 13:23 [yew-devel] [PATCH yew-comp 1/3] http client: include canonical http error with status code Dominik Csapak
  2025-01-08 13:23 ` [yew-devel] [PATCH yew-comp 2/3] login panel: improve message on login error Dominik Csapak
@ 2025-01-08 13:23 ` Dominik Csapak
  2025-01-08 13:36 ` [yew-devel] applied: [PATCH yew-comp 1/3] http client: include canonical http error with status code Dietmar Maurer
  2 siblings, 0 replies; 4+ messages in thread
From: Dominik Csapak @ 2025-01-08 13:23 UTC (permalink / raw)
  To: yew-devel

make the window fix 500px wide, and stretch the inputpanel to the whole
width by resetting the 'width' property.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/login_panel.rs | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/login_panel.rs b/src/login_panel.rs
index c73e859..d979bbb 100644
--- a/src/login_panel.rs
+++ b/src/login_panel.rs
@@ -269,6 +269,7 @@ impl Component for ProxmoxLoginPanel {
 
         let input_panel = InputPanel::new()
             .class(Overflow::Auto)
+            .width("initial") // don't try to minimize size
             .padding(4)
             .with_field(
                 "User name",
@@ -339,6 +340,7 @@ impl Component for ProxmoxLoginPanel {
             .with_child(toolbar);
 
         let form = Form::new()
+            .width(500)
             .class("pwt-overflow-auto")
             .form_context(self.form_ctx.clone())
             .with_child(form_panel);
-- 
2.39.5



_______________________________________________
yew-devel mailing list
yew-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/yew-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [yew-devel] applied: [PATCH yew-comp 1/3] http client: include canonical http error with status code
  2025-01-08 13:23 [yew-devel] [PATCH yew-comp 1/3] http client: include canonical http error with status code Dominik Csapak
  2025-01-08 13:23 ` [yew-devel] [PATCH yew-comp 2/3] login panel: improve message on login error Dominik Csapak
  2025-01-08 13:23 ` [yew-devel] [PATCH yew-comp 3/3] login panel: improve layout Dominik Csapak
@ 2025-01-08 13:36 ` Dietmar Maurer
  2 siblings, 0 replies; 4+ messages in thread
From: Dietmar Maurer @ 2025-01-08 13:36 UTC (permalink / raw)
  To: Yew framework devel list at Proxmox, Dominik Csapak

applied all 3 patches


_______________________________________________
yew-devel mailing list
yew-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/yew-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-01-08 13:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-08 13:23 [yew-devel] [PATCH yew-comp 1/3] http client: include canonical http error with status code Dominik Csapak
2025-01-08 13:23 ` [yew-devel] [PATCH yew-comp 2/3] login panel: improve message on login error Dominik Csapak
2025-01-08 13:23 ` [yew-devel] [PATCH yew-comp 3/3] login panel: improve layout Dominik Csapak
2025-01-08 13:36 ` [yew-devel] applied: [PATCH yew-comp 1/3] http client: include canonical http error with status code Dietmar Maurer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal