mirror of
https://github.com/nitnelave/lldap.git
synced 2023-04-12 14:25:13 +00:00
app: wrap template arguments in braces
To prepare for the migration to yew 1.19
This commit is contained in:
parent
07523219d1
commit
f44e8b7659
@ -149,18 +149,19 @@ impl Component for AddGroupMemberComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn view(&self) -> Html {
|
fn view(&self) -> Html {
|
||||||
|
let link = &self.common;
|
||||||
if let Some(user_list) = &self.user_list {
|
if let Some(user_list) = &self.user_list {
|
||||||
let to_add_user_list = self.get_selectable_user_list(user_list);
|
let to_add_user_list = self.get_selectable_user_list(user_list);
|
||||||
#[allow(unused_braces)]
|
#[allow(unused_braces)]
|
||||||
let make_select_option = |user: User| {
|
let make_select_option = |user: User| {
|
||||||
html_nested! {
|
html_nested! {
|
||||||
<SelectOption value=user.id.clone() text=user.display_name.clone() key=user.id />
|
<SelectOption value={user.id.clone()} text={user.display_name.clone()} key={user.id} />
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
html! {
|
html! {
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-3">
|
<div class="col-sm-3">
|
||||||
<Select on_selection_change=self.common.callback(Msg::SelectionChanged)>
|
<Select on_selection_change={link.callback(Msg::SelectionChanged)}>
|
||||||
{
|
{
|
||||||
to_add_user_list
|
to_add_user_list
|
||||||
.into_iter()
|
.into_iter()
|
||||||
@ -172,8 +173,8 @@ impl Component for AddGroupMemberComponent {
|
|||||||
<div class="col-3">
|
<div class="col-3">
|
||||||
<button
|
<button
|
||||||
class="btn btn-secondary"
|
class="btn btn-secondary"
|
||||||
disabled=self.selected_user.is_none() || self.common.is_task_running()
|
disabled={self.selected_user.is_none() || self.common.is_task_running()}
|
||||||
onclick=self.common.callback(|_| Msg::SubmitAddMember)>
|
onclick={link.callback(|_| Msg::SubmitAddMember)}>
|
||||||
<i class="bi-person-plus me-2"></i>
|
<i class="bi-person-plus me-2"></i>
|
||||||
{"Add to group"}
|
{"Add to group"}
|
||||||
</button>
|
</button>
|
||||||
|
@ -162,18 +162,19 @@ impl Component for AddUserToGroupComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn view(&self) -> Html {
|
fn view(&self) -> Html {
|
||||||
|
let link = &self.common;
|
||||||
if let Some(group_list) = &self.group_list {
|
if let Some(group_list) = &self.group_list {
|
||||||
let to_add_group_list = self.get_selectable_group_list(group_list);
|
let to_add_group_list = self.get_selectable_group_list(group_list);
|
||||||
#[allow(unused_braces)]
|
#[allow(unused_braces)]
|
||||||
let make_select_option = |group: Group| {
|
let make_select_option = |group: Group| {
|
||||||
html_nested! {
|
html_nested! {
|
||||||
<SelectOption value=group.id.to_string() text=group.display_name key=group.id />
|
<SelectOption value={group.id.to_string()} text={group.display_name} key={group.id} />
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
html! {
|
html! {
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-3">
|
<div class="col-sm-3">
|
||||||
<Select on_selection_change=self.common.callback(Msg::SelectionChanged)>
|
<Select on_selection_change={link.callback(Msg::SelectionChanged)}>
|
||||||
{
|
{
|
||||||
to_add_group_list
|
to_add_group_list
|
||||||
.into_iter()
|
.into_iter()
|
||||||
@ -185,8 +186,8 @@ impl Component for AddUserToGroupComponent {
|
|||||||
<div class="col-sm-3">
|
<div class="col-sm-3">
|
||||||
<button
|
<button
|
||||||
class="btn btn-secondary"
|
class="btn btn-secondary"
|
||||||
disabled=self.selected_group.is_none() || self.common.is_task_running()
|
disabled={self.selected_group.is_none() || self.common.is_task_running()}
|
||||||
onclick=self.common.callback(|_| Msg::SubmitAddGroup)>
|
onclick={link.callback(|_| Msg::SubmitAddGroup)}>
|
||||||
<i class="bi-person-plus me-2"></i>
|
<i class="bi-person-plus me-2"></i>
|
||||||
{"Add to group"}
|
{"Add to group"}
|
||||||
</button>
|
</button>
|
||||||
|
@ -128,7 +128,7 @@ impl Component for App {
|
|||||||
<div class="row justify-content-center" style="padding-bottom: 80px;">
|
<div class="row justify-content-center" style="padding-bottom: 80px;">
|
||||||
<div class="py-3" style="max-width: 1000px">
|
<div class="py-3" style="max-width: 1000px">
|
||||||
<Router<AppRoute>
|
<Router<AppRoute>
|
||||||
render = Router::render(move |s| Self::dispatch_route(s, &link, is_admin, password_reset_enabled))
|
render={Router::render(move |s| Self::dispatch_route(s, &link, is_admin, password_reset_enabled))}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -198,7 +198,7 @@ impl App {
|
|||||||
) -> Html {
|
) -> Html {
|
||||||
match switch {
|
match switch {
|
||||||
AppRoute::Login => html! {
|
AppRoute::Login => html! {
|
||||||
<LoginForm on_logged_in=link.callback(Msg::Login) password_reset_enabled=password_reset_enabled.unwrap_or(false)/>
|
<LoginForm on_logged_in={link.callback(Msg::Login)} password_reset_enabled={password_reset_enabled.unwrap_or(false)}/>
|
||||||
},
|
},
|
||||||
AppRoute::CreateUser => html! {
|
AppRoute::CreateUser => html! {
|
||||||
<CreateUserForm/>
|
<CreateUserForm/>
|
||||||
@ -206,7 +206,7 @@ impl App {
|
|||||||
AppRoute::Index | AppRoute::ListUsers => html! {
|
AppRoute::Index | AppRoute::ListUsers => html! {
|
||||||
<div>
|
<div>
|
||||||
<UserTable />
|
<UserTable />
|
||||||
<NavButton classes="btn btn-primary" route=AppRoute::CreateUser>
|
<NavButton classes="btn btn-primary" route={AppRoute::CreateUser}>
|
||||||
<i class="bi-person-plus me-2"></i>
|
<i class="bi-person-plus me-2"></i>
|
||||||
{"Create a user"}
|
{"Create a user"}
|
||||||
</NavButton>
|
</NavButton>
|
||||||
@ -218,20 +218,20 @@ impl App {
|
|||||||
AppRoute::ListGroups => html! {
|
AppRoute::ListGroups => html! {
|
||||||
<div>
|
<div>
|
||||||
<GroupTable />
|
<GroupTable />
|
||||||
<NavButton classes="btn btn-primary" route=AppRoute::CreateGroup>
|
<NavButton classes="btn btn-primary" route={AppRoute::CreateGroup}>
|
||||||
<i class="bi-plus-circle me-2"></i>
|
<i class="bi-plus-circle me-2"></i>
|
||||||
{"Create a group"}
|
{"Create a group"}
|
||||||
</NavButton>
|
</NavButton>
|
||||||
</div>
|
</div>
|
||||||
},
|
},
|
||||||
AppRoute::GroupDetails(group_id) => html! {
|
AppRoute::GroupDetails(group_id) => html! {
|
||||||
<GroupDetails group_id=group_id />
|
<GroupDetails group_id={group_id} />
|
||||||
},
|
},
|
||||||
AppRoute::UserDetails(username) => html! {
|
AppRoute::UserDetails(username) => html! {
|
||||||
<UserDetails username=username is_admin=is_admin />
|
<UserDetails username={username} is_admin={is_admin} />
|
||||||
},
|
},
|
||||||
AppRoute::ChangePassword(username) => html! {
|
AppRoute::ChangePassword(username) => html! {
|
||||||
<ChangePasswordForm username=username is_admin=is_admin />
|
<ChangePasswordForm username={username} is_admin={is_admin} />
|
||||||
},
|
},
|
||||||
AppRoute::StartResetPassword => match password_reset_enabled {
|
AppRoute::StartResetPassword => match password_reset_enabled {
|
||||||
Some(true) => html! { <ResetPasswordStep1Form /> },
|
Some(true) => html! { <ResetPasswordStep1Form /> },
|
||||||
@ -242,7 +242,7 @@ impl App {
|
|||||||
None => html! {},
|
None => html! {},
|
||||||
},
|
},
|
||||||
AppRoute::FinishResetPassword(token) => match password_reset_enabled {
|
AppRoute::FinishResetPassword(token) => match password_reset_enabled {
|
||||||
Some(true) => html! { <ResetPasswordStep2Form token=token /> },
|
Some(true) => html! { <ResetPasswordStep2Form token={token} /> },
|
||||||
Some(false) => {
|
Some(false) => {
|
||||||
App::dispatch_route(AppRoute::Login, link, is_admin, password_reset_enabled)
|
App::dispatch_route(AppRoute::Login, link, is_admin, password_reset_enabled)
|
||||||
}
|
}
|
||||||
@ -252,6 +252,7 @@ impl App {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn view_banner(&self) -> Html {
|
fn view_banner(&self) -> Html {
|
||||||
|
let link = &self.link;
|
||||||
html! {
|
html! {
|
||||||
<header class="p-2 mb-3 border-bottom">
|
<header class="p-2 mb-3 border-bottom">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
@ -266,7 +267,7 @@ impl App {
|
|||||||
<li>
|
<li>
|
||||||
<Link
|
<Link
|
||||||
classes="nav-link px-2 link-dark h6"
|
classes="nav-link px-2 link-dark h6"
|
||||||
route=AppRoute::ListUsers>
|
route={AppRoute::ListUsers}>
|
||||||
<i class="bi-people me-2"></i>
|
<i class="bi-people me-2"></i>
|
||||||
{"Users"}
|
{"Users"}
|
||||||
</Link>
|
</Link>
|
||||||
@ -274,7 +275,7 @@ impl App {
|
|||||||
<li>
|
<li>
|
||||||
<Link
|
<Link
|
||||||
classes="nav-link px-2 link-dark h6"
|
classes="nav-link px-2 link-dark h6"
|
||||||
route=AppRoute::ListGroups>
|
route={AppRoute::ListGroups}>
|
||||||
<i class="bi-collection me-2"></i>
|
<i class="bi-collection me-2"></i>
|
||||||
{"Groups"}
|
{"Groups"}
|
||||||
</Link>
|
</Link>
|
||||||
@ -312,13 +313,13 @@ impl App {
|
|||||||
<li>
|
<li>
|
||||||
<Link
|
<Link
|
||||||
classes="dropdown-item"
|
classes="dropdown-item"
|
||||||
route=AppRoute::UserDetails(user_id.clone())>
|
route={AppRoute::UserDetails(user_id.clone())}>
|
||||||
{"View details"}
|
{"View details"}
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
<li><hr class="dropdown-divider" /></li>
|
<li><hr class="dropdown-divider" /></li>
|
||||||
<li>
|
<li>
|
||||||
<LogoutButton on_logged_out=self.link.callback(|_| Msg::Logout) />
|
<LogoutButton on_logged_out={link.callback(|_| Msg::Logout)} />
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -212,6 +212,7 @@ impl Component for ChangePasswordForm {
|
|||||||
|
|
||||||
fn view(&self) -> Html {
|
fn view(&self) -> Html {
|
||||||
let is_admin = self.common.is_admin;
|
let is_admin = self.common.is_admin;
|
||||||
|
let link = &self.common;
|
||||||
type Field = yew_form::Field<FormModel>;
|
type Field = yew_form::Field<FormModel>;
|
||||||
html! {
|
html! {
|
||||||
<>
|
<>
|
||||||
@ -239,14 +240,14 @@ impl Component for ChangePasswordForm {
|
|||||||
</label>
|
</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<Field
|
<Field
|
||||||
form=&self.form
|
form={&self.form}
|
||||||
field_name="old_password"
|
field_name="old_password"
|
||||||
input_type="password"
|
input_type="password"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
class_invalid="is-invalid has-error"
|
class_invalid="is-invalid has-error"
|
||||||
class_valid="has-success"
|
class_valid="has-success"
|
||||||
autocomplete="current-password"
|
autocomplete="current-password"
|
||||||
oninput=self.common.callback(|_| Msg::FormUpdate) />
|
oninput={link.callback(|_| Msg::FormUpdate)} />
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
{&self.form.field_message("old_password")}
|
{&self.form.field_message("old_password")}
|
||||||
</div>
|
</div>
|
||||||
@ -262,14 +263,14 @@ impl Component for ChangePasswordForm {
|
|||||||
</label>
|
</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<Field
|
<Field
|
||||||
form=&self.form
|
form={&self.form}
|
||||||
field_name="password"
|
field_name="password"
|
||||||
input_type="password"
|
input_type="password"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
class_invalid="is-invalid has-error"
|
class_invalid="is-invalid has-error"
|
||||||
class_valid="has-success"
|
class_valid="has-success"
|
||||||
autocomplete="new-password"
|
autocomplete="new-password"
|
||||||
oninput=self.common.callback(|_| Msg::FormUpdate) />
|
oninput={link.callback(|_| Msg::FormUpdate)} />
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
{&self.form.field_message("password")}
|
{&self.form.field_message("password")}
|
||||||
</div>
|
</div>
|
||||||
@ -284,14 +285,14 @@ impl Component for ChangePasswordForm {
|
|||||||
</label>
|
</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<Field
|
<Field
|
||||||
form=&self.form
|
form={&self.form}
|
||||||
field_name="confirm_password"
|
field_name="confirm_password"
|
||||||
input_type="password"
|
input_type="password"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
class_invalid="is-invalid has-error"
|
class_invalid="is-invalid has-error"
|
||||||
class_valid="has-success"
|
class_valid="has-success"
|
||||||
autocomplete="new-password"
|
autocomplete="new-password"
|
||||||
oninput=self.common.callback(|_| Msg::FormUpdate) />
|
oninput={link.callback(|_| Msg::FormUpdate)} />
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
{&self.form.field_message("confirm_password")}
|
{&self.form.field_message("confirm_password")}
|
||||||
</div>
|
</div>
|
||||||
@ -301,14 +302,14 @@ impl Component for ChangePasswordForm {
|
|||||||
<button
|
<button
|
||||||
class="btn btn-primary col-auto col-form-label"
|
class="btn btn-primary col-auto col-form-label"
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled=self.common.is_task_running()
|
disabled={self.common.is_task_running()}
|
||||||
onclick=self.common.callback(|e: MouseEvent| {e.prevent_default(); Msg::Submit})>
|
onclick={link.callback(|e: MouseEvent| {e.prevent_default(); Msg::Submit})}>
|
||||||
<i class="bi-save me-2"></i>
|
<i class="bi-save me-2"></i>
|
||||||
{"Save changes"}
|
{"Save changes"}
|
||||||
</button>
|
</button>
|
||||||
<NavButton
|
<NavButton
|
||||||
classes="btn btn-secondary ms-2 col-auto col-form-label"
|
classes="btn btn-secondary ms-2 col-auto col-form-label"
|
||||||
route=AppRoute::UserDetails(self.common.username.clone())>
|
route={AppRoute::UserDetails(self.common.username.clone())}>
|
||||||
<i class="bi-arrow-return-left me-2"></i>
|
<i class="bi-arrow-return-left me-2"></i>
|
||||||
{"Back"}
|
{"Back"}
|
||||||
</NavButton>
|
</NavButton>
|
||||||
|
@ -97,6 +97,7 @@ impl Component for CreateGroupForm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn view(&self) -> Html {
|
fn view(&self) -> Html {
|
||||||
|
let link = &self.common;
|
||||||
type Field = yew_form::Field<CreateGroupModel>;
|
type Field = yew_form::Field<CreateGroupModel>;
|
||||||
html! {
|
html! {
|
||||||
<div class="row justify-content-center">
|
<div class="row justify-content-center">
|
||||||
@ -113,13 +114,13 @@ impl Component for CreateGroupForm {
|
|||||||
</label>
|
</label>
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<Field
|
<Field
|
||||||
form=&self.form
|
form={&self.form}
|
||||||
field_name="groupname"
|
field_name="groupname"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
class_invalid="is-invalid has-error"
|
class_invalid="is-invalid has-error"
|
||||||
class_valid="has-success"
|
class_valid="has-success"
|
||||||
autocomplete="groupname"
|
autocomplete="groupname"
|
||||||
oninput=self.common.callback(|_| Msg::Update) />
|
oninput={link.callback(|_| Msg::Update)} />
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
{&self.form.field_message("groupname")}
|
{&self.form.field_message("groupname")}
|
||||||
</div>
|
</div>
|
||||||
@ -129,8 +130,8 @@ impl Component for CreateGroupForm {
|
|||||||
<button
|
<button
|
||||||
class="btn btn-primary col-auto col-form-label"
|
class="btn btn-primary col-auto col-form-label"
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled=self.common.is_task_running()
|
disabled={self.common.is_task_running()}
|
||||||
onclick=self.common.callback(|e: MouseEvent| {e.prevent_default(); Msg::SubmitForm})>
|
onclick={link.callback(|e: MouseEvent| {e.prevent_default(); Msg::SubmitForm})}>
|
||||||
<i class="bi-save me-2"></i>
|
<i class="bi-save me-2"></i>
|
||||||
{"Submit"}
|
{"Submit"}
|
||||||
</button>
|
</button>
|
||||||
|
@ -190,6 +190,7 @@ impl Component for CreateUserForm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn view(&self) -> Html {
|
fn view(&self) -> Html {
|
||||||
|
let link = &self.common;
|
||||||
type Field = yew_form::Field<CreateUserModel>;
|
type Field = yew_form::Field<CreateUserModel>;
|
||||||
html! {
|
html! {
|
||||||
<div class="row justify-content-center">
|
<div class="row justify-content-center">
|
||||||
@ -206,13 +207,13 @@ impl Component for CreateUserForm {
|
|||||||
</label>
|
</label>
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<Field
|
<Field
|
||||||
form=&self.form
|
form={&self.form}
|
||||||
field_name="username"
|
field_name="username"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
class_invalid="is-invalid has-error"
|
class_invalid="is-invalid has-error"
|
||||||
class_valid="has-success"
|
class_valid="has-success"
|
||||||
autocomplete="username"
|
autocomplete="username"
|
||||||
oninput=self.common.callback(|_| Msg::Update) />
|
oninput={link.callback(|_| Msg::Update)} />
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
{&self.form.field_message("username")}
|
{&self.form.field_message("username")}
|
||||||
</div>
|
</div>
|
||||||
@ -227,14 +228,14 @@ impl Component for CreateUserForm {
|
|||||||
</label>
|
</label>
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<Field
|
<Field
|
||||||
form=&self.form
|
form={&self.form}
|
||||||
input_type="email"
|
input_type="email"
|
||||||
field_name="email"
|
field_name="email"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
class_invalid="is-invalid has-error"
|
class_invalid="is-invalid has-error"
|
||||||
class_valid="has-success"
|
class_valid="has-success"
|
||||||
autocomplete="email"
|
autocomplete="email"
|
||||||
oninput=self.common.callback(|_| Msg::Update) />
|
oninput={link.callback(|_| Msg::Update)} />
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
{&self.form.field_message("email")}
|
{&self.form.field_message("email")}
|
||||||
</div>
|
</div>
|
||||||
@ -247,13 +248,13 @@ impl Component for CreateUserForm {
|
|||||||
</label>
|
</label>
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<Field
|
<Field
|
||||||
form=&self.form
|
form={&self.form}
|
||||||
autocomplete="name"
|
autocomplete="name"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
class_invalid="is-invalid has-error"
|
class_invalid="is-invalid has-error"
|
||||||
class_valid="has-success"
|
class_valid="has-success"
|
||||||
field_name="display_name"
|
field_name="display_name"
|
||||||
oninput=self.common.callback(|_| Msg::Update) />
|
oninput={link.callback(|_| Msg::Update)} />
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
{&self.form.field_message("display_name")}
|
{&self.form.field_message("display_name")}
|
||||||
</div>
|
</div>
|
||||||
@ -266,13 +267,13 @@ impl Component for CreateUserForm {
|
|||||||
</label>
|
</label>
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<Field
|
<Field
|
||||||
form=&self.form
|
form={&self.form}
|
||||||
autocomplete="given-name"
|
autocomplete="given-name"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
class_invalid="is-invalid has-error"
|
class_invalid="is-invalid has-error"
|
||||||
class_valid="has-success"
|
class_valid="has-success"
|
||||||
field_name="first_name"
|
field_name="first_name"
|
||||||
oninput=self.common.callback(|_| Msg::Update) />
|
oninput={link.callback(|_| Msg::Update)} />
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
{&self.form.field_message("first_name")}
|
{&self.form.field_message("first_name")}
|
||||||
</div>
|
</div>
|
||||||
@ -285,13 +286,13 @@ impl Component for CreateUserForm {
|
|||||||
</label>
|
</label>
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<Field
|
<Field
|
||||||
form=&self.form
|
form={&self.form}
|
||||||
autocomplete="family-name"
|
autocomplete="family-name"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
class_invalid="is-invalid has-error"
|
class_invalid="is-invalid has-error"
|
||||||
class_valid="has-success"
|
class_valid="has-success"
|
||||||
field_name="last_name"
|
field_name="last_name"
|
||||||
oninput=self.common.callback(|_| Msg::Update) />
|
oninput={link.callback(|_| Msg::Update)} />
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
{&self.form.field_message("last_name")}
|
{&self.form.field_message("last_name")}
|
||||||
</div>
|
</div>
|
||||||
@ -304,14 +305,14 @@ impl Component for CreateUserForm {
|
|||||||
</label>
|
</label>
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<Field
|
<Field
|
||||||
form=&self.form
|
form={&self.form}
|
||||||
input_type="password"
|
input_type="password"
|
||||||
field_name="password"
|
field_name="password"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
class_invalid="is-invalid has-error"
|
class_invalid="is-invalid has-error"
|
||||||
class_valid="has-success"
|
class_valid="has-success"
|
||||||
autocomplete="new-password"
|
autocomplete="new-password"
|
||||||
oninput=self.common.callback(|_| Msg::Update) />
|
oninput={link.callback(|_| Msg::Update)} />
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
{&self.form.field_message("password")}
|
{&self.form.field_message("password")}
|
||||||
</div>
|
</div>
|
||||||
@ -324,14 +325,14 @@ impl Component for CreateUserForm {
|
|||||||
</label>
|
</label>
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<Field
|
<Field
|
||||||
form=&self.form
|
form={&self.form}
|
||||||
input_type="password"
|
input_type="password"
|
||||||
field_name="confirm_password"
|
field_name="confirm_password"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
class_invalid="is-invalid has-error"
|
class_invalid="is-invalid has-error"
|
||||||
class_valid="has-success"
|
class_valid="has-success"
|
||||||
autocomplete="new-password"
|
autocomplete="new-password"
|
||||||
oninput=self.common.callback(|_| Msg::Update) />
|
oninput={link.callback(|_| Msg::Update)} />
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
{&self.form.field_message("confirm_password")}
|
{&self.form.field_message("confirm_password")}
|
||||||
</div>
|
</div>
|
||||||
@ -340,9 +341,9 @@ impl Component for CreateUserForm {
|
|||||||
<div class="form-group row justify-content-center">
|
<div class="form-group row justify-content-center">
|
||||||
<button
|
<button
|
||||||
class="btn btn-primary col-auto col-form-label mt-4"
|
class="btn btn-primary col-auto col-form-label mt-4"
|
||||||
disabled=self.common.is_task_running()
|
disabled={self.common.is_task_running()}
|
||||||
type="submit"
|
type="submit"
|
||||||
onclick=self.common.callback(|e: MouseEvent| {e.prevent_default(); Msg::SubmitForm})>
|
onclick={link.callback(|e: MouseEvent| {e.prevent_default(); Msg::SubmitForm})}>
|
||||||
<i class="bi-save me-2"></i>
|
<i class="bi-save me-2"></i>
|
||||||
{"Submit"}
|
{"Submit"}
|
||||||
</button>
|
</button>
|
||||||
|
@ -109,12 +109,13 @@ impl Component for DeleteGroup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn view(&self) -> Html {
|
fn view(&self) -> Html {
|
||||||
|
let link = &self.common;
|
||||||
html! {
|
html! {
|
||||||
<>
|
<>
|
||||||
<button
|
<button
|
||||||
class="btn btn-danger"
|
class="btn btn-danger"
|
||||||
disabled=self.common.is_task_running()
|
disabled={self.common.is_task_running()}
|
||||||
onclick=self.common.callback(|_| Msg::ClickedDeleteGroup)>
|
onclick={link.callback(|_| Msg::ClickedDeleteGroup)}>
|
||||||
<i class="bi-x-circle-fill" aria-label="Delete group" />
|
<i class="bi-x-circle-fill" aria-label="Delete group" />
|
||||||
</button>
|
</button>
|
||||||
{self.show_modal()}
|
{self.show_modal()}
|
||||||
@ -125,14 +126,15 @@ impl Component for DeleteGroup {
|
|||||||
|
|
||||||
impl DeleteGroup {
|
impl DeleteGroup {
|
||||||
fn show_modal(&self) -> Html {
|
fn show_modal(&self) -> Html {
|
||||||
|
let link = &self.common;
|
||||||
html! {
|
html! {
|
||||||
<div
|
<div
|
||||||
class="modal fade"
|
class="modal fade"
|
||||||
id="deleteGroupModal".to_string() + &self.common.group.id.to_string()
|
id={"deleteGroupModal".to_string() + &self.common.group.id.to_string()}
|
||||||
tabindex="-1"
|
tabindex="-1"
|
||||||
aria-labelledby="deleteGroupModalLabel"
|
aria-labelledby="deleteGroupModalLabel"
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
ref=self.node_ref.clone()>
|
ref={self.node_ref.clone()}>
|
||||||
<div class="modal-dialog">
|
<div class="modal-dialog">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
@ -141,7 +143,7 @@ impl DeleteGroup {
|
|||||||
type="button"
|
type="button"
|
||||||
class="btn-close"
|
class="btn-close"
|
||||||
aria-label="Close"
|
aria-label="Close"
|
||||||
onclick=self.common.callback(|_| Msg::DismissModal) />
|
onclick={link.callback(|_| Msg::DismissModal)} />
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<span>
|
<span>
|
||||||
@ -153,13 +155,13 @@ impl DeleteGroup {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="btn btn-secondary"
|
class="btn btn-secondary"
|
||||||
onclick=self.common.callback(|_| Msg::DismissModal)>
|
onclick={link.callback(|_| Msg::DismissModal)}>
|
||||||
<i class="bi-x-circle me-2"></i>
|
<i class="bi-x-circle me-2"></i>
|
||||||
{"Cancel"}
|
{"Cancel"}
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onclick=self.common.callback(|_| Msg::ConfirmDeleteGroup)
|
onclick={link.callback(|_| Msg::ConfirmDeleteGroup)}
|
||||||
class="btn btn-danger">
|
class="btn btn-danger">
|
||||||
<i class="bi-check-circle me-2"></i>
|
<i class="bi-check-circle me-2"></i>
|
||||||
{"Yes, I'm sure"}
|
{"Yes, I'm sure"}
|
||||||
|
@ -106,12 +106,13 @@ impl Component for DeleteUser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn view(&self) -> Html {
|
fn view(&self) -> Html {
|
||||||
|
let link = &self.common;
|
||||||
html! {
|
html! {
|
||||||
<>
|
<>
|
||||||
<button
|
<button
|
||||||
class="btn btn-danger"
|
class="btn btn-danger"
|
||||||
disabled=self.common.is_task_running()
|
disabled={self.common.is_task_running()}
|
||||||
onclick=self.common.callback(|_| Msg::ClickedDeleteUser)>
|
onclick={link.callback(|_| Msg::ClickedDeleteUser)}>
|
||||||
<i class="bi-x-circle-fill" aria-label="Delete user" />
|
<i class="bi-x-circle-fill" aria-label="Delete user" />
|
||||||
</button>
|
</button>
|
||||||
{self.show_modal()}
|
{self.show_modal()}
|
||||||
@ -122,15 +123,16 @@ impl Component for DeleteUser {
|
|||||||
|
|
||||||
impl DeleteUser {
|
impl DeleteUser {
|
||||||
fn show_modal(&self) -> Html {
|
fn show_modal(&self) -> Html {
|
||||||
|
let link = &self.common;
|
||||||
html! {
|
html! {
|
||||||
<div
|
<div
|
||||||
class="modal fade"
|
class="modal fade"
|
||||||
id="deleteUserModal".to_string() + &self.common.username
|
id={"deleteUserModal".to_string() + &self.common.username}
|
||||||
tabindex="-1"
|
tabindex="-1"
|
||||||
//role="dialog"
|
//role="dialog"
|
||||||
aria-labelledby="deleteUserModalLabel"
|
aria-labelledby="deleteUserModalLabel"
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
ref=self.node_ref.clone()>
|
ref={self.node_ref.clone()}>
|
||||||
<div class="modal-dialog" /*role="document"*/>
|
<div class="modal-dialog" /*role="document"*/>
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
@ -139,7 +141,7 @@ impl DeleteUser {
|
|||||||
type="button"
|
type="button"
|
||||||
class="btn-close"
|
class="btn-close"
|
||||||
aria-label="Close"
|
aria-label="Close"
|
||||||
onclick=self.common.callback(|_| Msg::DismissModal) />
|
onclick={link.callback(|_| Msg::DismissModal)} />
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<span>
|
<span>
|
||||||
@ -151,13 +153,13 @@ impl DeleteUser {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="btn btn-secondary"
|
class="btn btn-secondary"
|
||||||
onclick=self.common.callback(|_| Msg::DismissModal)>
|
onclick={link.callback(|_| Msg::DismissModal)}>
|
||||||
<i class="bi-x-circle me-2"></i>
|
<i class="bi-x-circle me-2"></i>
|
||||||
{"Cancel"}
|
{"Cancel"}
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onclick=self.common.callback(|_| Msg::ConfirmDeleteUser)
|
onclick={link.callback(|_| Msg::ConfirmDeleteUser)}
|
||||||
class="btn btn-danger">
|
class="btn btn-danger">
|
||||||
<i class="bi-check-circle me-2"></i>
|
<i class="bi-check-circle me-2"></i>
|
||||||
{"Yes, I'm sure"}
|
{"Yes, I'm sure"}
|
||||||
|
@ -114,17 +114,17 @@ impl GroupDetails {
|
|||||||
html! {
|
html! {
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<Link route=AppRoute::UserDetails(user_id.clone())>
|
<Link route={AppRoute::UserDetails(user_id.clone())}>
|
||||||
{user_id.clone()}
|
{user_id.clone()}
|
||||||
</Link>
|
</Link>
|
||||||
</td>
|
</td>
|
||||||
<td>{display_name}</td>
|
<td>{display_name}</td>
|
||||||
<td>
|
<td>
|
||||||
<RemoveUserFromGroupComponent
|
<RemoveUserFromGroupComponent
|
||||||
username=user_id
|
username={user_id}
|
||||||
group_id=g.id
|
group_id={g.id}
|
||||||
on_user_removed_from_group=self.common.callback(Msg::OnUserRemovedFromGroup)
|
on_user_removed_from_group={self.common.callback(Msg::OnUserRemovedFromGroup)}
|
||||||
on_error=self.common.callback(Msg::OnError)/>
|
on_error={self.common.callback(Msg::OnError)}/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
@ -170,10 +170,10 @@ impl GroupDetails {
|
|||||||
.collect();
|
.collect();
|
||||||
html! {
|
html! {
|
||||||
<AddGroupMemberComponent
|
<AddGroupMemberComponent
|
||||||
group_id=g.id
|
group_id={g.id}
|
||||||
users=users
|
users={users}
|
||||||
on_error=self.common.callback(Msg::OnError)
|
on_error={self.common.callback(Msg::OnError)}
|
||||||
on_user_added_to_group=self.common.callback(Msg::OnUserAddedToGroup)/>
|
on_user_added_to_group={self.common.callback(Msg::OnUserAddedToGroup)}/>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -117,9 +117,9 @@ impl GroupTable {
|
|||||||
|
|
||||||
fn view_group(&self, group: &Group) -> Html {
|
fn view_group(&self, group: &Group) -> Html {
|
||||||
html! {
|
html! {
|
||||||
<tr key=group.id>
|
<tr key={group.id}>
|
||||||
<td>
|
<td>
|
||||||
<Link route=AppRoute::GroupDetails(group.id)>
|
<Link route={AppRoute::GroupDetails(group.id)}>
|
||||||
{&group.display_name}
|
{&group.display_name}
|
||||||
</Link>
|
</Link>
|
||||||
</td>
|
</td>
|
||||||
@ -128,9 +128,9 @@ impl GroupTable {
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<DeleteGroup
|
<DeleteGroup
|
||||||
group=group.clone()
|
group={group.clone()}
|
||||||
on_group_deleted=self.common.callback(Msg::OnGroupDeleted)
|
on_group_deleted={self.common.callback(Msg::OnGroupDeleted)}
|
||||||
on_error=self.common.callback(Msg::OnError)/>
|
on_error={self.common.callback(Msg::OnError)}/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
|
@ -149,6 +149,7 @@ impl Component for LoginForm {
|
|||||||
fn view(&self) -> Html {
|
fn view(&self) -> Html {
|
||||||
type Field = yew_form::Field<FormModel>;
|
type Field = yew_form::Field<FormModel>;
|
||||||
let password_reset_enabled = self.common.password_reset_enabled;
|
let password_reset_enabled = self.common.password_reset_enabled;
|
||||||
|
let link = &self.common;
|
||||||
if self.refreshing {
|
if self.refreshing {
|
||||||
html! {
|
html! {
|
||||||
<div>
|
<div>
|
||||||
@ -169,11 +170,11 @@ impl Component for LoginForm {
|
|||||||
class="form-control"
|
class="form-control"
|
||||||
class_invalid="is-invalid has-error"
|
class_invalid="is-invalid has-error"
|
||||||
class_valid="has-success"
|
class_valid="has-success"
|
||||||
form=&self.form
|
form={&self.form}
|
||||||
field_name="username"
|
field_name="username"
|
||||||
placeholder="Username"
|
placeholder="Username"
|
||||||
autocomplete="username"
|
autocomplete="username"
|
||||||
oninput=self.common.callback(|_| Msg::Update) />
|
oninput={link.callback(|_| Msg::Update)} />
|
||||||
</div>
|
</div>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
@ -185,7 +186,7 @@ impl Component for LoginForm {
|
|||||||
class="form-control"
|
class="form-control"
|
||||||
class_invalid="is-invalid has-error"
|
class_invalid="is-invalid has-error"
|
||||||
class_valid="has-success"
|
class_valid="has-success"
|
||||||
form=&self.form
|
form={&self.form}
|
||||||
field_name="password"
|
field_name="password"
|
||||||
input_type="password"
|
input_type="password"
|
||||||
placeholder="Password"
|
placeholder="Password"
|
||||||
@ -195,8 +196,8 @@ impl Component for LoginForm {
|
|||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
class="btn btn-primary"
|
class="btn btn-primary"
|
||||||
disabled=self.common.is_task_running()
|
disabled={self.common.is_task_running()}
|
||||||
onclick=self.common.callback(|e: MouseEvent| {e.prevent_default(); Msg::Submit})>
|
onclick={link.callback(|e: MouseEvent| {e.prevent_default(); Msg::Submit})}>
|
||||||
<i class="bi-box-arrow-in-right me-2"/>
|
<i class="bi-box-arrow-in-right me-2"/>
|
||||||
{"Login"}
|
{"Login"}
|
||||||
</button>
|
</button>
|
||||||
@ -204,8 +205,8 @@ impl Component for LoginForm {
|
|||||||
html! {
|
html! {
|
||||||
<NavButton
|
<NavButton
|
||||||
classes="btn-link btn"
|
classes="btn-link btn"
|
||||||
disabled=self.common.is_task_running()
|
disabled={self.common.is_task_running()}
|
||||||
route=AppRoute::StartResetPassword>
|
route={AppRoute::StartResetPassword}>
|
||||||
{"Forgot your password?"}
|
{"Forgot your password?"}
|
||||||
</NavButton>
|
</NavButton>
|
||||||
}
|
}
|
||||||
|
@ -60,10 +60,11 @@ impl Component for LogoutButton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn view(&self) -> Html {
|
fn view(&self) -> Html {
|
||||||
|
let link = &self.common;
|
||||||
html! {
|
html! {
|
||||||
<button
|
<button
|
||||||
class="dropdown-item"
|
class="dropdown-item"
|
||||||
onclick=self.common.callback(|_| Msg::LogoutRequested)>
|
onclick={link.callback(|_| Msg::LogoutRequested)}>
|
||||||
{"Logout"}
|
{"Logout"}
|
||||||
</button>
|
</button>
|
||||||
}
|
}
|
||||||
|
@ -86,11 +86,12 @@ impl Component for RemoveUserFromGroupComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn view(&self) -> Html {
|
fn view(&self) -> Html {
|
||||||
|
let link = &self.common;
|
||||||
html! {
|
html! {
|
||||||
<button
|
<button
|
||||||
class="btn btn-danger"
|
class="btn btn-danger"
|
||||||
disabled=self.common.is_task_running()
|
disabled={self.common.is_task_running()}
|
||||||
onclick=self.common.callback(|_| Msg::SubmitRemoveGroup)>
|
onclick={link.callback(|_| Msg::SubmitRemoveGroup)}>
|
||||||
<i class="bi-x-circle-fill" aria-label="Remove user from group" />
|
<i class="bi-x-circle-fill" aria-label="Remove user from group" />
|
||||||
</button>
|
</button>
|
||||||
}
|
}
|
||||||
|
@ -82,6 +82,7 @@ impl Component for ResetPasswordStep1Form {
|
|||||||
|
|
||||||
fn view(&self) -> Html {
|
fn view(&self) -> Html {
|
||||||
type Field = yew_form::Field<FormModel>;
|
type Field = yew_form::Field<FormModel>;
|
||||||
|
let link = &self.common;
|
||||||
html! {
|
html! {
|
||||||
<form
|
<form
|
||||||
class="form center-block col-sm-4 col-offset-4">
|
class="form center-block col-sm-4 col-offset-4">
|
||||||
@ -95,11 +96,11 @@ impl Component for ResetPasswordStep1Form {
|
|||||||
class="form-control"
|
class="form-control"
|
||||||
class_invalid="is-invalid has-error"
|
class_invalid="is-invalid has-error"
|
||||||
class_valid="has-success"
|
class_valid="has-success"
|
||||||
form=&self.form
|
form={&self.form}
|
||||||
field_name="username"
|
field_name="username"
|
||||||
placeholder="Username or email"
|
placeholder="Username or email"
|
||||||
autocomplete="username"
|
autocomplete="username"
|
||||||
oninput=self.common.callback(|_| Msg::Update) />
|
oninput={link.callback(|_| Msg::Update)} />
|
||||||
</div>
|
</div>
|
||||||
{ if self.just_succeeded {
|
{ if self.just_succeeded {
|
||||||
html! {
|
html! {
|
||||||
@ -111,15 +112,15 @@ impl Component for ResetPasswordStep1Form {
|
|||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
class="btn btn-primary"
|
class="btn btn-primary"
|
||||||
disabled=self.common.is_task_running()
|
disabled={self.common.is_task_running()}
|
||||||
onclick=self.common.callback(|e: MouseEvent| {e.prevent_default(); Msg::Submit})>
|
onclick={self.common.callback(|e: MouseEvent| {e.prevent_default(); Msg::Submit})}>
|
||||||
<i class="bi-check-circle me-2"/>
|
<i class="bi-check-circle me-2"/>
|
||||||
{"Reset password"}
|
{"Reset password"}
|
||||||
</button>
|
</button>
|
||||||
<NavButton
|
<NavButton
|
||||||
classes="btn-link btn"
|
classes="btn-link btn"
|
||||||
disabled=self.common.is_task_running()
|
disabled={self.common.is_task_running()}
|
||||||
route=AppRoute::Login>
|
route={AppRoute::Login}>
|
||||||
{"Back"}
|
{"Back"}
|
||||||
</NavButton>
|
</NavButton>
|
||||||
</div>
|
</div>
|
||||||
|
@ -150,6 +150,7 @@ impl Component for ResetPasswordStep2Form {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn view(&self) -> Html {
|
fn view(&self) -> Html {
|
||||||
|
let link = &self.common;
|
||||||
match (&self.username, &self.common.error) {
|
match (&self.username, &self.common.error) {
|
||||||
(None, None) => {
|
(None, None) => {
|
||||||
return html! {
|
return html! {
|
||||||
@ -164,8 +165,8 @@ impl Component for ResetPasswordStep2Form {
|
|||||||
</div>
|
</div>
|
||||||
<NavButton
|
<NavButton
|
||||||
classes="btn-link btn"
|
classes="btn-link btn"
|
||||||
disabled=self.common.is_task_running()
|
disabled={self.common.is_task_running()}
|
||||||
route=AppRoute::Login>
|
route={AppRoute::Login}>
|
||||||
{"Back"}
|
{"Back"}
|
||||||
</NavButton>
|
</NavButton>
|
||||||
</>
|
</>
|
||||||
@ -186,14 +187,14 @@ impl Component for ResetPasswordStep2Form {
|
|||||||
</label>
|
</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<Field
|
<Field
|
||||||
form=&self.form
|
form={&self.form}
|
||||||
field_name="password"
|
field_name="password"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
class_invalid="is-invalid has-error"
|
class_invalid="is-invalid has-error"
|
||||||
class_valid="has-success"
|
class_valid="has-success"
|
||||||
autocomplete="new-password"
|
autocomplete="new-password"
|
||||||
input_type="password"
|
input_type="password"
|
||||||
oninput=self.common.callback(|_| Msg::FormUpdate) />
|
oninput={link.callback(|_| Msg::FormUpdate)} />
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
{&self.form.field_message("password")}
|
{&self.form.field_message("password")}
|
||||||
</div>
|
</div>
|
||||||
@ -206,14 +207,14 @@ impl Component for ResetPasswordStep2Form {
|
|||||||
</label>
|
</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<Field
|
<Field
|
||||||
form=&self.form
|
form={&self.form}
|
||||||
field_name="confirm_password"
|
field_name="confirm_password"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
class_invalid="is-invalid has-error"
|
class_invalid="is-invalid has-error"
|
||||||
class_valid="has-success"
|
class_valid="has-success"
|
||||||
autocomplete="new-password"
|
autocomplete="new-password"
|
||||||
input_type="password"
|
input_type="password"
|
||||||
oninput=self.common.callback(|_| Msg::FormUpdate) />
|
oninput={link.callback(|_| Msg::FormUpdate)} />
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
{&self.form.field_message("confirm_password")}
|
{&self.form.field_message("confirm_password")}
|
||||||
</div>
|
</div>
|
||||||
@ -223,8 +224,8 @@ impl Component for ResetPasswordStep2Form {
|
|||||||
<button
|
<button
|
||||||
class="btn btn-primary col-sm-1 col-form-label"
|
class="btn btn-primary col-sm-1 col-form-label"
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled=self.common.is_task_running()
|
disabled={self.common.is_task_running()}
|
||||||
onclick=self.common.callback(|e: MouseEvent| {e.prevent_default(); Msg::Submit})>
|
onclick={link.callback(|e: MouseEvent| {e.prevent_default(); Msg::Submit})}>
|
||||||
{"Submit"}
|
{"Submit"}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -68,9 +68,9 @@ impl Component for Select {
|
|||||||
fn view(&self) -> Html {
|
fn view(&self) -> Html {
|
||||||
html! {
|
html! {
|
||||||
<select class="form-select"
|
<select class="form-select"
|
||||||
ref=self.node_ref.clone()
|
ref={self.node_ref.clone()}
|
||||||
disabled=self.props.children.is_empty()
|
disabled={self.props.children.is_empty()}
|
||||||
onchange=self.link.callback(SelectMsg::OnSelectChange)>
|
onchange={self.link.callback(SelectMsg::OnSelectChange)}>
|
||||||
{ self.props.children.clone() }
|
{ self.props.children.clone() }
|
||||||
</select>
|
</select>
|
||||||
}
|
}
|
||||||
@ -105,7 +105,7 @@ impl Component for SelectOption {
|
|||||||
|
|
||||||
fn view(&self) -> Html {
|
fn view(&self) -> Html {
|
||||||
html! {
|
html! {
|
||||||
<option value=self.props.value.clone()>
|
<option value={self.props.value.clone()}>
|
||||||
{&self.props.text}
|
{&self.props.text}
|
||||||
</option>
|
</option>
|
||||||
}
|
}
|
||||||
|
@ -100,23 +100,24 @@ impl UserDetails {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn view_group_memberships(&self, u: &User) -> Html {
|
fn view_group_memberships(&self, u: &User) -> Html {
|
||||||
|
let link = &self.common;
|
||||||
let make_group_row = |group: &Group| {
|
let make_group_row = |group: &Group| {
|
||||||
let display_name = group.display_name.clone();
|
let display_name = group.display_name.clone();
|
||||||
html! {
|
html! {
|
||||||
<tr key="groupRow_".to_string() + &display_name>
|
<tr key={"groupRow_".to_string() + &display_name}>
|
||||||
{if self.common.is_admin { html! {
|
{if self.common.is_admin { html! {
|
||||||
<>
|
<>
|
||||||
<td>
|
<td>
|
||||||
<Link route=AppRoute::GroupDetails(group.id)>
|
<Link route={AppRoute::GroupDetails(group.id)}>
|
||||||
{&group.display_name}
|
{&group.display_name}
|
||||||
</Link>
|
</Link>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<RemoveUserFromGroupComponent
|
<RemoveUserFromGroupComponent
|
||||||
username=u.id.clone()
|
username={u.id.clone()}
|
||||||
group_id=group.id
|
group_id={group.id}
|
||||||
on_user_removed_from_group=self.common.callback(Msg::OnUserRemovedFromGroup)
|
on_user_removed_from_group={link.callback(Msg::OnUserRemovedFromGroup)}
|
||||||
on_error=self.common.callback(Msg::OnError)/>
|
on_error={link.callback(Msg::OnError)}/>
|
||||||
</td>
|
</td>
|
||||||
</>
|
</>
|
||||||
} } else { html! {
|
} } else { html! {
|
||||||
@ -154,13 +155,14 @@ impl UserDetails {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn view_add_group_button(&self, u: &User) -> Html {
|
fn view_add_group_button(&self, u: &User) -> Html {
|
||||||
|
let link = &self.common;
|
||||||
if self.common.is_admin {
|
if self.common.is_admin {
|
||||||
html! {
|
html! {
|
||||||
<AddUserToGroupComponent
|
<AddUserToGroupComponent
|
||||||
username=u.id.clone()
|
username={u.id.clone()}
|
||||||
groups=u.groups.clone()
|
groups={u.groups.clone()}
|
||||||
on_error=self.common.callback(Msg::OnError)
|
on_error={link.callback(Msg::OnError)}
|
||||||
on_user_added_to_group=self.common.callback(Msg::OnUserAddedToGroup)/>
|
on_user_added_to_group={link.callback(Msg::OnUserAddedToGroup)}/>
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
html! {}
|
html! {}
|
||||||
@ -199,7 +201,7 @@ impl Component for UserDetails {
|
|||||||
<h3>{u.id.to_string()}</h3>
|
<h3>{u.id.to_string()}</h3>
|
||||||
<div class="d-flex flex-row-reverse">
|
<div class="d-flex flex-row-reverse">
|
||||||
<NavButton
|
<NavButton
|
||||||
route=AppRoute::ChangePassword(u.id.clone())
|
route={AppRoute::ChangePassword(u.id.clone())}
|
||||||
classes="btn btn-secondary">
|
classes="btn btn-secondary">
|
||||||
<i class="bi-key me-2"></i>
|
<i class="bi-key me-2"></i>
|
||||||
{"Modify password"}
|
{"Modify password"}
|
||||||
@ -208,8 +210,7 @@ impl Component for UserDetails {
|
|||||||
<div>
|
<div>
|
||||||
<h5 class="row m-3 fw-bold">{"User details"}</h5>
|
<h5 class="row m-3 fw-bold">{"User details"}</h5>
|
||||||
</div>
|
</div>
|
||||||
<UserDetailsForm
|
<UserDetailsForm user={u.clone()} />
|
||||||
user=u.clone() />
|
|
||||||
{self.view_group_memberships(u)}
|
{self.view_group_memberships(u)}
|
||||||
{self.view_add_group_button(u)}
|
{self.view_add_group_button(u)}
|
||||||
{self.view_messages(error)}
|
{self.view_messages(error)}
|
||||||
|
@ -173,6 +173,7 @@ impl Component for UserDetailsForm {
|
|||||||
|
|
||||||
fn view(&self) -> Html {
|
fn view(&self) -> Html {
|
||||||
type Field = yew_form::Field<UserModel>;
|
type Field = yew_form::Field<UserModel>;
|
||||||
|
let link = &self.common;
|
||||||
|
|
||||||
let avatar_base64 = maybe_to_base64(&self.avatar).unwrap_or_default();
|
let avatar_base64 = maybe_to_base64(&self.avatar).unwrap_or_default();
|
||||||
let avatar_string = avatar_base64
|
let avatar_string = avatar_base64
|
||||||
@ -221,10 +222,10 @@ impl Component for UserDetailsForm {
|
|||||||
class="form-control"
|
class="form-control"
|
||||||
class_invalid="is-invalid has-error"
|
class_invalid="is-invalid has-error"
|
||||||
class_valid="has-success"
|
class_valid="has-success"
|
||||||
form=&self.form
|
form={&self.form}
|
||||||
field_name="email"
|
field_name="email"
|
||||||
autocomplete="email"
|
autocomplete="email"
|
||||||
oninput=self.common.callback(|_| Msg::Update) />
|
oninput={link.callback(|_| Msg::Update)} />
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
{&self.form.field_message("email")}
|
{&self.form.field_message("email")}
|
||||||
</div>
|
</div>
|
||||||
@ -240,10 +241,10 @@ impl Component for UserDetailsForm {
|
|||||||
class="form-control"
|
class="form-control"
|
||||||
class_invalid="is-invalid has-error"
|
class_invalid="is-invalid has-error"
|
||||||
class_valid="has-success"
|
class_valid="has-success"
|
||||||
form=&self.form
|
form={&self.form}
|
||||||
field_name="display_name"
|
field_name="display_name"
|
||||||
autocomplete="name"
|
autocomplete="name"
|
||||||
oninput=self.common.callback(|_| Msg::Update) />
|
oninput={link.callback(|_| Msg::Update)} />
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
{&self.form.field_message("display_name")}
|
{&self.form.field_message("display_name")}
|
||||||
</div>
|
</div>
|
||||||
@ -257,10 +258,10 @@ impl Component for UserDetailsForm {
|
|||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<Field
|
<Field
|
||||||
class="form-control"
|
class="form-control"
|
||||||
form=&self.form
|
form={&self.form}
|
||||||
field_name="first_name"
|
field_name="first_name"
|
||||||
autocomplete="given-name"
|
autocomplete="given-name"
|
||||||
oninput=self.common.callback(|_| Msg::Update) />
|
oninput={link.callback(|_| Msg::Update)} />
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
{&self.form.field_message("first_name")}
|
{&self.form.field_message("first_name")}
|
||||||
</div>
|
</div>
|
||||||
@ -274,10 +275,10 @@ impl Component for UserDetailsForm {
|
|||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<Field
|
<Field
|
||||||
class="form-control"
|
class="form-control"
|
||||||
form=&self.form
|
form={&self.form}
|
||||||
field_name="last_name"
|
field_name="last_name"
|
||||||
autocomplete="family-name"
|
autocomplete="family-name"
|
||||||
oninput=self.common.callback(|_| Msg::Update) />
|
oninput={link.callback(|_| Msg::Update)} />
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
{&self.form.field_message("last_name")}
|
{&self.form.field_message("last_name")}
|
||||||
</div>
|
</div>
|
||||||
@ -296,7 +297,7 @@ impl Component for UserDetailsForm {
|
|||||||
id="avatarInput"
|
id="avatarInput"
|
||||||
type="file"
|
type="file"
|
||||||
accept="image/jpeg"
|
accept="image/jpeg"
|
||||||
oninput=self.common.callback(|_| Msg::Update) />
|
oninput={link.callback(|_| Msg::Update)} />
|
||||||
</div>
|
</div>
|
||||||
<div class="col-4">
|
<div class="col-4">
|
||||||
<img
|
<img
|
||||||
@ -312,8 +313,8 @@ impl Component for UserDetailsForm {
|
|||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
class="btn btn-primary col-auto col-form-label"
|
class="btn btn-primary col-auto col-form-label"
|
||||||
disabled=self.common.is_task_running()
|
disabled={self.common.is_task_running()}
|
||||||
onclick=self.common.callback(|e: MouseEvent| {e.prevent_default(); Msg::SubmitClicked})>
|
onclick={link.callback(|e: MouseEvent| {e.prevent_default(); Msg::SubmitClicked})}>
|
||||||
<i class="bi-save me-2"></i>
|
<i class="bi-save me-2"></i>
|
||||||
{"Save changes"}
|
{"Save changes"}
|
||||||
</button>
|
</button>
|
||||||
@ -328,7 +329,7 @@ impl Component for UserDetailsForm {
|
|||||||
}
|
}
|
||||||
} else { html! {} }
|
} else { html! {} }
|
||||||
}
|
}
|
||||||
<div hidden=!self.just_updated>
|
<div hidden={!self.just_updated}>
|
||||||
<div class="alert alert-success mt-4">{"User successfully updated!"}</div>
|
<div class="alert alert-success mt-4">{"User successfully updated!"}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -126,9 +126,10 @@ impl UserTable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn view_user(&self, user: &User) -> Html {
|
fn view_user(&self, user: &User) -> Html {
|
||||||
|
let link = &self.common;
|
||||||
html! {
|
html! {
|
||||||
<tr key=user.id.clone()>
|
<tr key={user.id.clone()}>
|
||||||
<td><Link route=AppRoute::UserDetails(user.id.clone())>{&user.id}</Link></td>
|
<td><Link route={AppRoute::UserDetails(user.id.clone())}>{&user.id}</Link></td>
|
||||||
<td>{&user.email}</td>
|
<td>{&user.email}</td>
|
||||||
<td>{&user.display_name}</td>
|
<td>{&user.display_name}</td>
|
||||||
<td>{&user.first_name}</td>
|
<td>{&user.first_name}</td>
|
||||||
@ -136,9 +137,9 @@ impl UserTable {
|
|||||||
<td>{&user.creation_date.naive_local().date()}</td>
|
<td>{&user.creation_date.naive_local().date()}</td>
|
||||||
<td>
|
<td>
|
||||||
<DeleteUser
|
<DeleteUser
|
||||||
username=user.id.clone()
|
username={user.id.clone()}
|
||||||
on_user_deleted=self.common.callback(Msg::OnUserDeleted)
|
on_user_deleted={link.callback(Msg::OnUserDeleted)}
|
||||||
on_error=self.common.callback(Msg::OnError)/>
|
on_error={link.callback(Msg::OnError)}/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user