34 lines
875 B
Rust
34 lines
875 B
Rust
use super::*;
|
|
|
|
use crate::api::Observer;
|
|
|
|
impl Main {
|
|
fn observer_list_row(&self, observer: &Observer) -> Html<Self> {
|
|
html!{ <tr>
|
|
<th scope="row">{ observer.id }</th>
|
|
<td class="text-right">{ crate::uitools::ago(observer.last_seen) }</td>
|
|
<td>{ observer.longitude }</td>
|
|
<td>{ observer.latitude }</td>
|
|
</tr> }
|
|
}
|
|
|
|
pub fn view_observer_list(&self) -> Html<Self> {
|
|
let observers = self.props.base.observers();
|
|
html!{
|
|
<table class="table table-striped table-sm text-monospace d-inline technical">
|
|
<thead><tr>
|
|
<th scope="col">{ "ID" }</th>
|
|
<th scope="col">{ "Last seen" }</th>
|
|
<th scope="col">{ "Longitude" }</th>
|
|
<th scope="col">{ "Latitude" }</th>
|
|
</tr></thead>
|
|
<tbody class="text-nowrap">
|
|
{ for observers.iter().map(|observer| {
|
|
self.observer_list_row(observer)
|
|
}) }
|
|
</tbody>
|
|
</table>
|
|
}
|
|
}
|
|
}
|