diff --git a/app/index.html b/app/index.html index 4faaedd..b83fc53 100644 --- a/app/index.html +++ b/app/index.html @@ -5,7 +5,18 @@ LLDAP Administration - + + + + diff --git a/app/src/components/add_user_to_group.rs b/app/src/components/add_user_to_group.rs index bfbae08..44bf6a1 100644 --- a/app/src/components/add_user_to_group.rs +++ b/app/src/components/add_user_to_group.rs @@ -195,8 +195,9 @@ impl Component for AddUserToGroupComponent { - diff --git a/app/src/components/app.rs b/app/src/components/app.rs index c0fc593..313e898 100644 --- a/app/src/components/app.rs +++ b/app/src/components/app.rs @@ -93,7 +93,7 @@ impl Component for App { let link = self.link.clone(); let is_admin = self.is_admin(); html! { -
+

{ "LLDAP" }

render = Router::render(move |switch: AppRoute| { @@ -111,7 +111,7 @@ impl Component for App {
- {"Create a user"} + {"Create a user"}
}, AppRoute::UserDetails(username) => html! { diff --git a/app/src/components/create_user.rs b/app/src/components/create_user.rs index 5060dac..905c89e 100644 --- a/app/src/components/create_user.rs +++ b/app/src/components/create_user.rs @@ -53,9 +53,9 @@ impl CreateUserForm { email: get_element("email") .filter(not_empty) .ok_or_else(|| anyhow!("Missing email"))?, - displayName: get_element("displayname").filter(not_empty), - firstName: get_element("firstname").filter(not_empty), - lastName: get_element("lastname").filter(not_empty), + displayName: get_element("display-name").filter(not_empty), + firstName: get_element("first-name").filter(not_empty), + lastName: get_element("last-name").filter(not_empty), }, }; self._task = Some(HostService::graphql_query::( @@ -175,39 +175,107 @@ impl Component for CreateUserForm { fn view(&self) -> Html { html! { -
-
- - + <> + +
+ +
+
-
- - +
+
+ +
+
-
- - +
+
+ +
+ +
+
+
+ +
+
-
- - +
+
+ +
+
-
- - -
-
- - -
- -
- { if let Some(e) = &self.error { - html! { e.to_string() } - } else { html! {} } - } +
+
+ +
+
+
+
+ +
+ { if let Some(e) = &self.error { + html! { +
+ {e.to_string() } +
+ } + } else { html! {} } + } + } } } diff --git a/app/src/components/login.rs b/app/src/components/login.rs index 2a18a11..81e5f27 100644 --- a/app/src/components/login.rs +++ b/app/src/components/login.rs @@ -142,17 +142,45 @@ impl Component for LoginForm { fn view(&self) -> Html { html! { -
-
- - + +
+
+ + + +
+
-
- - +
+
+ + + +
+
- -
+
+ +
+
{ if let Some(e) = &self.error { html! { e.to_string() } } else { html! {} } diff --git a/app/src/components/logout.rs b/app/src/components/logout.rs index b770860..13320a9 100644 --- a/app/src/components/logout.rs +++ b/app/src/components/logout.rs @@ -65,7 +65,11 @@ impl Component for LogoutButton { fn view(&self) -> Html { html! { - + } } } diff --git a/app/src/components/remove_user_from_group.rs b/app/src/components/remove_user_from_group.rs index 765de9c..d961508 100644 --- a/app/src/components/remove_user_from_group.rs +++ b/app/src/components/remove_user_from_group.rs @@ -102,7 +102,13 @@ impl Component for RemoveUserFromGroupComponent { <> {&group.display_name} { if self.props.is_admin { html! { - + + + }} else { html!{} } } diff --git a/app/src/components/router.rs b/app/src/components/router.rs index d76e90c..89b04c9 100644 --- a/app/src/components/router.rs +++ b/app/src/components/router.rs @@ -7,10 +7,10 @@ use yew_router::{ pub enum AppRoute { #[to = "/login"] Login, - #[to = "/users"] - ListUsers, #[to = "/users/create"] CreateUser, + #[to = "/users"] + ListUsers, #[to = "/user/{user_id}/password"] ChangePassword(String), #[to = "/user/{user_id}"] diff --git a/app/src/components/user_details.rs b/app/src/components/user_details.rs index 2c50aa0..50017db 100644 --- a/app/src/components/user_details.rs +++ b/app/src/components/user_details.rs @@ -118,17 +118,32 @@ impl UserDetails { }; html! {
- {"Group memberships"} - - - - { if self.props.is_admin { html!{ }} else { html!{} }} - - {u.groups.iter().map(make_group_row).collect::>()} - - {self.view_add_group_button(u)} - -
{"Group"}
+

{"Group memberships"}

+
+ + + + + { if self.props.is_admin { html!{ }} else { html!{} }} + + + + {if u.groups.is_empty() { + html! { + + + + } + } else { + html! {<>{u.groups.iter().map(make_group_row).collect::>()}} + }} +
+
+ {self.view_add_group_button(u)} + + +
{"Group"}
{"Not member of any group"}
+
} } @@ -193,7 +208,11 @@ impl Component for UserDetails { {self.view_messages(error)} {self.view_group_memberships(u)}
- {"Change password"} + + {"Change password"} +
} diff --git a/app/src/components/user_details_form.rs b/app/src/components/user_details_form.rs index b213b7e..2f3c8b1 100644 --- a/app/src/components/user_details_form.rs +++ b/app/src/components/user_details_form.rs @@ -1,5 +1,5 @@ use crate::{components::user_details::User, infra::api::HostService}; -use anyhow::{Error, Result}; +use anyhow::{bail, Error, Result}; use graphql_client::GraphQLQuery; use validator_derive::Validate; use yew::{ @@ -101,45 +101,104 @@ impl Component for UserDetailsForm { type Field = yew_form::Field; html! { <> - -
- {"User ID: "} - {&self.props.user.id} -
-
- - -
- {&self.form.field_message("email")} + +
+ +
+ {&self.props.user.id}
-
- - -
- {&self.form.field_message("display_name")} +
+ +
+ +
+ {&self.form.field_message("email")} +
-
- - -
- {&self.form.field_message("first_name")} +
+ +
+ +
+ {&self.form.field_message("display_name")} +
-
- - -
- {&self.form.field_message("last_name")} +
+ +
+ +
+ {&self.form.field_message("first_name")} +
-
- {"Creation date: "} - {&self.props.user.creation_date.with_timezone(&chrono::Local)} +
+ +
+ +
+ {&self.form.field_message("last_name")} +
+
-
- +
+ +
+ {&self.props.user.creation_date.with_timezone(&chrono::Local)} +
+
+
+