mirror of
https://github.com/nitnelave/lldap.git
synced 2023-04-12 14:25:13 +00:00
App: Display users in a table
This commit is contained in:
parent
ac492f987d
commit
e3ff3b7b0a
@ -61,14 +61,39 @@ impl Component for UserTable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn view(&self) -> Html {
|
fn view(&self) -> Html {
|
||||||
html! {
|
match &self.users {
|
||||||
<p>{
|
None => html! {{"Loading..."}},
|
||||||
match &self.users {
|
Some(Err(e)) => html! {<div>{"Error: "}{e.to_string()}</div>},
|
||||||
None => "Loading...".to_string(),
|
Some(Ok(users)) => {
|
||||||
Some(Ok(users)) => format!("Users: {:?}", &users),
|
let table_content: Vec<_> = users
|
||||||
Some(Err(e)) => e.to_string(),
|
.iter()
|
||||||
|
.map(|u| {
|
||||||
|
html! {
|
||||||
|
<tr>
|
||||||
|
<td>{&u.user_id}</td>
|
||||||
|
<td>{&u.email}</td>
|
||||||
|
<td>{&u.display_name.as_ref().unwrap_or(&String::new())}</td>
|
||||||
|
<td>{&u.first_name.as_ref().unwrap_or(&String::new())}</td>
|
||||||
|
<td>{&u.last_name.as_ref().unwrap_or(&String::new())}</td>
|
||||||
|
<td>{&u.creation_date}</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
html! {
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th>{"User ID"}</th>
|
||||||
|
<th>{"Email"}</th>
|
||||||
|
<th>{"Display name"}</th>
|
||||||
|
<th>{"First name"}</th>
|
||||||
|
<th>{"Last name"}</th>
|
||||||
|
<th>{"Creation date"}</th>
|
||||||
|
</tr>
|
||||||
|
{table_content}
|
||||||
|
</table>
|
||||||
}
|
}
|
||||||
}</p>
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user