Rewrite endpoints + bar cards

This commit is contained in:
Emily
2024-10-03 15:07:16 +02:00
parent 314660d8a3
commit e1953f2f9f
28 changed files with 667 additions and 434 deletions

View File

@@ -0,0 +1,35 @@
<script lang="ts" setup>
const router = useRouter();
function goToView() {
router.push('/dashboard/events');
}
const isShowMore = ref<boolean>(false);
const eventsData = useFetch('/api/data/events', {
headers: useComputedHeaders({
limit: computed(() => isShowMore.value ? '200' : '10'),
}), lazy: true
});
const { showDialog, dialogBarData, isDataLoading } = useBarCardDialog();
function showMore() {
isShowMore.value = true;
showDialog.value = true;
dialogBarData.value = eventsData.data.value || [];
}
</script>
<template>
<div class="flex flex-col gap-2 h-full">
<BarCardBase @showMore="showMore()" @showRawData="goToView()"
desc="Most frequent user events triggered in this project" @dataReload="eventsData.refresh()"
:data="eventsData.data.value || []" :loading="eventsData.pending.value" label="Top Events"
sub-label="Events" :rawButton="!isLiveDemo()"></BarCardBase>
</div>
</template>