| 
									
										
										
										
											2021-11-26 22:37:06 -09:00
										 |  |  | <template> | 
					
						
							|  |  |  |   <v-container> | 
					
						
							|  |  |  |     <BasePageTitle divider> | 
					
						
							|  |  |  |       <template #header> | 
					
						
							|  |  |  |         <v-img max-height="200" max-width="200" class="mb-2" :src="require('~/static/svgs/data-reports.svg')"></v-img> | 
					
						
							|  |  |  |       </template> | 
					
						
							| 
									
										
										
										
											2022-05-25 19:33:58 -08:00
										 |  |  |       <template #title> Report </template> | 
					
						
							| 
									
										
										
										
											2021-11-26 22:37:06 -09:00
										 |  |  |     </BasePageTitle> | 
					
						
							|  |  |  |     <v-container v-if="report"> | 
					
						
							|  |  |  |       <BaseCardSectionTitle :title="report.name"> </BaseCardSectionTitle> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       <v-card-text> Report Id: {{ id }} </v-card-text> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       <v-data-table :headers="itemHeaders" :items="report.entries" :items-per-page="50" show-expand> | 
					
						
							|  |  |  |         <template #item.success="{ item }"> | 
					
						
							|  |  |  |           <v-icon :color="item.success ? 'success' : 'error'"> | 
					
						
							|  |  |  |             {{ item.success ? $globals.icons.checkboxMarkedCircle : $globals.icons.close }} | 
					
						
							|  |  |  |           </v-icon> | 
					
						
							|  |  |  |         </template> | 
					
						
							|  |  |  |         <template #item.timestamp="{ item }"> | 
					
						
							|  |  |  |           {{ $d(Date.parse(item.timestamp), "short") }} | 
					
						
							|  |  |  |         </template> | 
					
						
							|  |  |  |         <template #expanded-item="{ headers, item }"> | 
					
						
							|  |  |  |           <td class="pa-6" :colspan="headers.length">{{ item.exception }}</td> | 
					
						
							|  |  |  |         </template> | 
					
						
							|  |  |  |       </v-data-table> | 
					
						
							|  |  |  |     </v-container> | 
					
						
							|  |  |  |   </v-container> | 
					
						
							|  |  |  | </template> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-09 07:15:23 +01:00
										 |  |  | <script lang="ts"> | 
					
						
							| 
									
										
										
										
											2022-05-25 19:33:58 -08:00
										 |  |  | import { defineComponent, useRoute, ref, onMounted } from "@nuxtjs/composition-api"; | 
					
						
							| 
									
										
										
										
											2021-11-26 22:37:06 -09:00
										 |  |  | import { useUserApi } from "~/composables/api"; | 
					
						
							| 
									
										
										
										
											2022-10-22 11:51:07 -08:00
										 |  |  | import { ReportOut } from "~/lib/api/types/reports"; | 
					
						
							| 
									
										
										
										
											2021-11-26 22:37:06 -09:00
										 |  |  | 
 | 
					
						
							|  |  |  | export default defineComponent({ | 
					
						
							|  |  |  |   setup() { | 
					
						
							|  |  |  |     const route = useRoute(); | 
					
						
							|  |  |  |     const id = route.value.params.id; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const api = useUserApi(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-25 19:33:58 -08:00
										 |  |  |     const report = ref<ReportOut | null>(null); | 
					
						
							| 
									
										
										
										
											2021-11-26 22:37:06 -09:00
										 |  |  | 
 | 
					
						
							|  |  |  |     async function getReport() { | 
					
						
							|  |  |  |       const { data } = await api.groupReports.getOne(id); | 
					
						
							| 
									
										
										
										
											2022-05-25 19:33:58 -08:00
										 |  |  |       report.value = data ?? null; | 
					
						
							| 
									
										
										
										
											2021-11-26 22:37:06 -09:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     onMounted(async () => { | 
					
						
							|  |  |  |       await getReport(); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const itemHeaders = [ | 
					
						
							|  |  |  |       { text: "Success", value: "success" }, | 
					
						
							|  |  |  |       { text: "Message", value: "message" }, | 
					
						
							|  |  |  |       { text: "Timestamp", value: "timestamp" }, | 
					
						
							|  |  |  |     ]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return { | 
					
						
							| 
									
										
										
										
											2022-05-25 19:33:58 -08:00
										 |  |  |       report, | 
					
						
							| 
									
										
										
										
											2021-11-26 22:37:06 -09:00
										 |  |  |       id, | 
					
						
							|  |  |  |       itemHeaders, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | </script> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-25 19:33:58 -08:00
										 |  |  | <style lang="scss" scoped></style> |