frontend: Add UUID and creation date

This exposes the new info in the GraphQL API, and adds it to the frontend.
This commit is contained in:
Iván Izaguirre
2022-07-21 12:10:37 +02:00
committed by GitHub
parent 4ba0db4e9e
commit 5c584536b5
8 changed files with 88 additions and 3 deletions

View File

@@ -68,6 +68,45 @@ impl GroupDetails {
}
}
fn view_details(&self, g: &Group) -> Html {
html! {
<>
<h3>{g.display_name.to_string()}</h3>
<div class="py-3">
<form class="form">
<div class="form-group row mb-3">
<label for="displayName"
class="form-label col-4 col-form-label">
{"Group: "}
</label>
<div class="col-8">
<span id="groupId" class="form-constrol-static">{g.display_name.to_string()}</span>
</div>
</div>
<div class="form-group row mb-3">
<label for="creationDate"
class="form-label col-4 col-form-label">
{"Creation date: "}
</label>
<div class="col-8">
<span id="creationDate" class="form-constrol-static">{g.creation_date.date().naive_local()}</span>
</div>
</div>
<div class="form-group row mb-3">
<label for="uuid"
class="form-label col-4 col-form-label">
{"UUID: "}
</label>
<div class="col-8">
<span id="uuid" class="form-constrol-static">{g.uuid.to_string()}</span>
</div>
</div>
</form>
</div>
</>
}
}
fn view_user_list(&self, g: &Group) -> Html {
let make_user_row = |user: &User| {
let user_id = user.id.clone();
@@ -92,7 +131,6 @@ impl GroupDetails {
};
html! {
<>
<h3>{g.display_name.to_string()}</h3>
<h5 class="fw-bold">{"Members"}</h5>
<div class="table-responsive">
<table class="table table-striped">
@@ -201,6 +239,7 @@ impl Component for GroupDetails {
(Some(u), error) => {
html! {
<div>
{self.view_details(u)}
{self.view_user_list(u)}
{self.view_add_user_button(u)}
{self.view_messages(error)}

View File

@@ -97,7 +97,8 @@ impl GroupTable {
<table class="table table-striped">
<thead>
<tr>
<th>{"Groups"}</th>
<th>{"Group name"}</th>
<th>{"Creation date"}</th>
<th>{"Delete"}</th>
</tr>
</thead>
@@ -122,6 +123,9 @@ impl GroupTable {
{&group.display_name}
</Link>
</td>
<td>
{&group.creation_date.date().naive_local()}
</td>
<td>
<DeleteGroup
group=group.clone()

View File

@@ -195,6 +195,15 @@ impl Component for UserDetailsForm {
<span id="creationDate" class="form-constrol-static">{&self.common.user.creation_date.date().naive_local()}</span>
</div>
</div>
<div class="form-group row mb-3">
<label for="uuid"
class="form-label col-4 col-form-label">
{"UUID: "}
</label>
<div class="col-8">
<span id="creationDate" class="form-constrol-static">{&self.common.user.uuid}</span>
</div>
</div>
<div class="form-group row justify-content-center">
<button
type="submit"
@@ -267,6 +276,7 @@ impl UserDetailsForm {
first_name: model.first_name,
last_name: model.last_name,
creation_date: self.common.user.creation_date,
uuid: self.common.user.uuid.clone(),
groups: self.common.user.groups.clone(),
};
self.just_updated = true;