From 5c584536b5ba1d6c2c422f24024cd0bdb30ae17a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Izaguirre?= Date: Thu, 21 Jul 2022 12:10:37 +0200 Subject: [PATCH] frontend: Add UUID and creation date This exposes the new info in the GraphQL API, and adds it to the frontend. --- app/queries/get_group_details.graphql | 2 ++ app/queries/get_group_list.graphql | 1 + app/queries/get_user_details.graphql | 1 + app/src/components/group_details.rs | 41 ++++++++++++++++++++++++- app/src/components/group_table.rs | 6 +++- app/src/components/user_details_form.rs | 10 ++++++ schema.graphql | 3 ++ server/src/infra/graphql/query.rs | 27 +++++++++++++++- 8 files changed, 88 insertions(+), 3 deletions(-) diff --git a/app/queries/get_group_details.graphql b/app/queries/get_group_details.graphql index b338527..00400d7 100644 --- a/app/queries/get_group_details.graphql +++ b/app/queries/get_group_details.graphql @@ -2,6 +2,8 @@ query GetGroupDetails($id: Int!) { group(groupId: $id) { id displayName + creationDate + uuid users { id displayName diff --git a/app/queries/get_group_list.graphql b/app/queries/get_group_list.graphql index 28f56e4..54714c2 100644 --- a/app/queries/get_group_list.graphql +++ b/app/queries/get_group_list.graphql @@ -2,5 +2,6 @@ query GetGroupList { groups { id displayName + creationDate } } diff --git a/app/queries/get_user_details.graphql b/app/queries/get_user_details.graphql index 8497ac0..f476f2d 100644 --- a/app/queries/get_user_details.graphql +++ b/app/queries/get_user_details.graphql @@ -6,6 +6,7 @@ query GetUserDetails($id: String!) { firstName lastName creationDate + uuid groups { id displayName diff --git a/app/src/components/group_details.rs b/app/src/components/group_details.rs index 442fec5..33bbd6f 100644 --- a/app/src/components/group_details.rs +++ b/app/src/components/group_details.rs @@ -68,6 +68,45 @@ impl GroupDetails { } } + fn view_details(&self, g: &Group) -> Html { + html! { + <> +

{g.display_name.to_string()}

+
+
+
+ +
+ {g.display_name.to_string()} +
+
+
+ +
+ {g.creation_date.date().naive_local()} +
+
+
+ +
+ {g.uuid.to_string()} +
+
+
+
+ + } + } + 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! { <> -

{g.display_name.to_string()}

{"Members"}
@@ -201,6 +239,7 @@ impl Component for GroupDetails { (Some(u), error) => { html! {
+ {self.view_details(u)} {self.view_user_list(u)} {self.view_add_user_button(u)} {self.view_messages(error)} diff --git a/app/src/components/group_table.rs b/app/src/components/group_table.rs index e6c7a0e..206c084 100644 --- a/app/src/components/group_table.rs +++ b/app/src/components/group_table.rs @@ -97,7 +97,8 @@ impl GroupTable {
- + + @@ -122,6 +123,9 @@ impl GroupTable { {&group.display_name} +
{"Groups"}{"Group name"}{"Creation date"} {"Delete"}
+ {&group.creation_date.date().naive_local()} + {&self.common.user.creation_date.date().naive_local()} +
+ +
+ {&self.common.user.uuid} +
+