From d887a49e560279ae59ea9b77da35536a9014cc41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anna=20V=C3=B6lker?= Date: Tue, 27 Aug 2024 16:04:45 +0200 Subject: [PATCH] Issue-289: add copy to clipboard button for setup strings --- opendut-lea/src/downloads/cleo_card.rs | 44 +++++++--- .../src/peers/configurator/tabs/setup/mod.rs | 80 ++++++++++++------- 2 files changed, 84 insertions(+), 40 deletions(-) diff --git a/opendut-lea/src/downloads/cleo_card.rs b/opendut-lea/src/downloads/cleo_card.rs index b95af560b..df11d4c6d 100644 --- a/opendut-lea/src/downloads/cleo_card.rs +++ b/opendut-lea/src/downloads/cleo_card.rs @@ -82,26 +82,48 @@ pub fn CleoCard(
- { move || match setup_string.get() { Some(Some(setup_string)) => { + let clipboard_text = setup_string.clone(); view! { -
- +
+
+
+
+ +
+
+
+ +
} } _ => { view! { -
-
- +
+ +
+
+ +
} diff --git a/opendut-lea/src/peers/configurator/tabs/setup/mod.rs b/opendut-lea/src/peers/configurator/tabs/setup/mod.rs index e0a0b375b..190a81991 100644 --- a/opendut-lea/src/peers/configurator/tabs/setup/mod.rs +++ b/opendut-lea/src/peers/configurator/tabs/setup/mod.rs @@ -1,4 +1,4 @@ -use leptos::{component, create_local_resource, IntoView, ReadSignal, RwSignal, SignalGet, SignalSet, use_context, view, WriteSignal}; +use leptos::{component, create_local_resource, IntoView, ReadSignal, RwSignal, SignalGet, SignalSet, use_context, view, WriteSignal, window}; use opendut_auth::public::OptionalAuthData; use opendut_types::peer::PeerId; @@ -41,44 +41,66 @@ pub fn SetupTab(peer_configuration: ReadSignal) -> impl I view! {
- - { - move || match setup_string.get() { - Some(Some(setup_string)) => { - view! { + { + move || match setup_string.get() { + Some(Some(setup_string)) => { + let clipboard_text = setup_string.clone(); + view! { +
+
+
+
+ +
+
- } +
} - _ => { - view! { -
-
-
-
- -
-
-

"After generating a new Setup-String, the peer will ""not be usable in clusters"" until you re-run the setup with the newly generated Setup-String!"

-
+ } + _ => { + view! { +
+ +
+
+
+
+ +
+
+

"After generating a new Setup-String, the peer will ""not be usable in clusters"" until you re-run the setup with the newly generated Setup-String!"

-
- -
- } +
+ +
+
+
} } } -
-

"Setup-Strings may only be used to set up one host. For setting up multiple hosts, you should create a peer for each host."

+ } +
+

"Setup-Strings may only be used to set up one host. For setting up multiple hosts, you should create a peer for each host."

} }