Dashboard and error handling

This commit is contained in:
2025-07-15 13:22:11 +02:00
parent 5ac4c987d3
commit 6a5149fd4c
27 changed files with 572 additions and 204 deletions

View File

@ -147,43 +147,45 @@
</template>
</tbody>
</table>
<div
class="sticky bottom-0 right-0 items-center w-full p-4 bg-white border-t border-gray-200 sm:flex sm:justify-between dark:bg-gray-800 dark:border-gray-700"
v-if="totalPages > 0"
>
<div class="flex items-center mb-4 sm:mb-0">
<span class="text-sm font-normal text-gray-500 dark:text-gray-400">
Showing
<span
class="font-semibold text-gray-900 dark:text-white"
v-if="totalEntries < lastResult"
>
{{ firstResult }}-{{ TotalEntries }}
<template v-if="shouldPaginate">
<div
class="sticky bottom-0 right-0 items-center w-full p-4 bg-white border-t border-gray-200 sm:flex sm:justify-between dark:bg-gray-800 dark:border-gray-700"
v-if="totalPages > 0"
>
<div class="flex items-center mb-4 sm:mb-0">
<span class="text-sm font-normal text-gray-500 dark:text-gray-400">
Showing
<span
class="font-semibold text-gray-900 dark:text-white"
v-if="totalEntries < lastResult"
>
{{ firstResult }}-{{ TotalEntries }}
</span>
<span class="font-semibold text-gray-900 dark:text-white" v-else>
{{ firstResult }}-{{ lastResult }}
</span>
of
<span class="font-semibold text-gray-900 dark:text-white">
{{ totalEntries }}
</span>
</span>
<span class="font-semibold text-gray-900 dark:text-white" v-else>
{{ firstResult }}-{{ lastResult }}
</span>
of
<span class="font-semibold text-gray-900 dark:text-white">
{{ totalEntries }}
</span>
</span>
</div>
<div class="flex items-center space-x-3">
<div class="flex space-x-1">
<PageNumbers
@next="nextPage"
@previous="prevPage"
@goto="goToPage"
:pageNum="pageNum"
:totalPages="totalPages"
/>
</div>
<div class="flex items-center space-x-3">
<div class="flex space-x-1">
<PageNumbers
@next="nextPage"
@previous="prevPage"
@goto="goToPage"
:pageNum="pageNum"
:totalPages="totalPages"
/>
</div>
</div>
</div>
</div>
</template>
</template>
<template v-else>
<AuditSkeleton />
<AuditSkeleton :amount="perPage" />
</template>
</template>
<script setup lang="ts">
@ -193,11 +195,18 @@ import { usePagination } from '@/composables/usePagination'
import { SshecretAdmin, GetAuditLogApiV1AuditGetData } from '@/client'
import type { AuditListResult } from '@/client'
import type { AuditFilter } from '@/api/types'
import { assertSdkResponseOk } from '@/api/AssertSdkResponseOk'
import PageNumbers from '@/components/common/PageNumbers.vue'
import AuditSkeleton from '@/components/audit/AuditSkeleton.vue'
const props = defineProps<{ auditFilter: AuditFilter }>()
interface Props {
auditFilter: AuditFilter
paginate?: boolean
}
const props = defineProps<Props>()
const shouldPaginate = toRef(() => props.paginate ?? true)
const auditFilter = toRef(() => props.auditFilter)
console.log(auditFilter.value)
const auditList = ref<AuditListResult>([])
@ -220,7 +229,8 @@ async function loadLogs() {
const response = await SshecretAdmin.getAuditLogApiV1AuditGet({
query: queryInput.value,
})
auditList.value = response.data
const responseData = assertSdkResponseOk(response)
auditList.value = responseData
}
const expanded = ref(new Set<string>())