@@ -151,13 +153,13 @@ impl DeleteUser {
+ disabled={self.common.is_task_running()}
+ route={AppRoute::Login}>
{"Back"}
>
@@ -186,14 +187,14 @@ impl Component for ResetPasswordStep2Form {
+ oninput={link.callback(|_| Msg::FormUpdate)} />
{&self.form.field_message("password")}
@@ -206,14 +207,14 @@ impl Component for ResetPasswordStep2Form {
+ oninput={link.callback(|_| Msg::FormUpdate)} />
{&self.form.field_message("confirm_password")}
@@ -223,8 +224,8 @@ impl Component for ResetPasswordStep2Form {
diff --git a/app/src/components/select.rs b/app/src/components/select.rs
index b330608..b057638 100644
--- a/app/src/components/select.rs
+++ b/app/src/components/select.rs
@@ -68,9 +68,9 @@ impl Component for Select {
fn view(&self) -> Html {
html! {
}
@@ -105,7 +105,7 @@ impl Component for SelectOption {
fn view(&self) -> Html {
html! {
-
}
diff --git a/app/src/components/user_details.rs b/app/src/components/user_details.rs
index ae5e20e..3b0cd29 100644
--- a/app/src/components/user_details.rs
+++ b/app/src/components/user_details.rs
@@ -100,23 +100,24 @@ impl UserDetails {
}
fn view_group_memberships(&self, u: &User) -> Html {
+ let link = &self.common;
let make_group_row = |group: &Group| {
let display_name = group.display_name.clone();
html! {
-
+
{if self.common.is_admin { html! {
<>
-
+
{&group.display_name}
|
+ username={u.id.clone()}
+ group_id={group.id}
+ on_user_removed_from_group={link.callback(Msg::OnUserRemovedFromGroup)}
+ on_error={link.callback(Msg::OnError)}/>
|
>
} } else { html! {
@@ -154,13 +155,14 @@ impl UserDetails {
}
fn view_add_group_button(&self, u: &User) -> Html {
+ let link = &self.common;
if self.common.is_admin {
html! {
+ username={u.id.clone()}
+ groups={u.groups.clone()}
+ on_error={link.callback(Msg::OnError)}
+ on_user_added_to_group={link.callback(Msg::OnUserAddedToGroup)}/>
}
} else {
html! {}
@@ -199,7 +201,7 @@ impl Component for UserDetails {
{u.id.to_string()}
{"Modify password"}
@@ -208,8 +210,7 @@ impl Component for UserDetails {
{"User details"}
-
+
{self.view_group_memberships(u)}
{self.view_add_group_button(u)}
{self.view_messages(error)}
diff --git a/app/src/components/user_details_form.rs b/app/src/components/user_details_form.rs
index ca5c1af..0058caf 100644
--- a/app/src/components/user_details_form.rs
+++ b/app/src/components/user_details_form.rs
@@ -173,6 +173,7 @@ impl Component for UserDetailsForm {
fn view(&self) -> Html {
type Field = yew_form::Field;
+ let link = &self.common;
let avatar_base64 = maybe_to_base64(&self.avatar).unwrap_or_default();
let avatar_string = avatar_base64
@@ -221,10 +222,10 @@ impl Component for UserDetailsForm {
class="form-control"
class_invalid="is-invalid has-error"
class_valid="has-success"
- form=&self.form
+ form={&self.form}
field_name="email"
autocomplete="email"
- oninput=self.common.callback(|_| Msg::Update) />
+ oninput={link.callback(|_| Msg::Update)} />
{&self.form.field_message("email")}
@@ -240,10 +241,10 @@ impl Component for UserDetailsForm {
class="form-control"
class_invalid="is-invalid has-error"
class_valid="has-success"
- form=&self.form
+ form={&self.form}
field_name="display_name"
autocomplete="name"
- oninput=self.common.callback(|_| Msg::Update) />
+ oninput={link.callback(|_| Msg::Update)} />
{&self.form.field_message("display_name")}
@@ -257,10 +258,10 @@ impl Component for UserDetailsForm {
+ oninput={link.callback(|_| Msg::Update)} />
{&self.form.field_message("first_name")}
@@ -274,10 +275,10 @@ impl Component for UserDetailsForm {
+ oninput={link.callback(|_| Msg::Update)} />
{&self.form.field_message("last_name")}
@@ -296,7 +297,7 @@ impl Component for UserDetailsForm {
id="avatarInput"
type="file"
accept="image/jpeg"
- oninput=self.common.callback(|_| Msg::Update) />
+ oninput={link.callback(|_| Msg::Update)} />
+ disabled={self.common.is_task_running()}
+ onclick={link.callback(|e: MouseEvent| {e.prevent_default(); Msg::SubmitClicked})}>
{"Save changes"}
@@ -328,7 +329,7 @@ impl Component for UserDetailsForm {
}
} else { html! {} }
}
-
+
{"User successfully updated!"}
diff --git a/app/src/components/user_table.rs b/app/src/components/user_table.rs
index aaacba6..7ed78c5 100644
--- a/app/src/components/user_table.rs
+++ b/app/src/components/user_table.rs
@@ -126,9 +126,10 @@ impl UserTable {
}
fn view_user(&self, user: &User) -> Html {
+ let link = &self.common;
html! {
-
- {&user.id} |
+
+ {&user.id} |
{&user.email} |
{&user.display_name} |
{&user.first_name} |
@@ -136,9 +137,9 @@ impl UserTable {
{&user.creation_date.naive_local().date()} |
+ username={user.id.clone()}
+ on_user_deleted={link.callback(Msg::OnUserDeleted)}
+ on_error={link.callback(Msg::OnError)}/>
|
}