diff --git a/dashboard/components/CardTitled.vue b/dashboard/components/CardTitled.vue index 153817c..adacf37 100644 --- a/dashboard/components/CardTitled.vue +++ b/dashboard/components/CardTitled.vue @@ -6,7 +6,7 @@ const props = defineProps<{ title: string, sub?: string }>(); diff --git a/dashboard/components/dashboard/EventsChart.vue b/dashboard/components/dashboard/EventsChart.vue index 2169e20..d5e4e51 100644 --- a/dashboard/components/dashboard/EventsChart.vue +++ b/dashboard/components/dashboard/EventsChart.vue @@ -104,7 +104,7 @@ const headers = computed(() => { 'x-to': safeSnapshotDates.value.to, 'Authorization': authorizationHeaderComputed.value, 'x-schema': 'events', - 'x-limit': "10", + 'x-limit': "6", 'x-pid': activeProjectId.data.value || '' } }); diff --git a/dashboard/components/events/EventsStackedBarChart.vue b/dashboard/components/events/EventsStackedBarChart.vue index 768ed5e..8757158 100644 --- a/dashboard/components/events/EventsStackedBarChart.vue +++ b/dashboard/components/events/EventsStackedBarChart.vue @@ -32,26 +32,26 @@ function transformResponse(input: { _id: string, name: string, count: number }[] const parsedDatasets: any[] = []; const colors = [ - "#5655d0", - "#6bbbe3", - "#a6d5cb", - "#fae0b9", - "#f28e8e", - "#e3a7e4", - "#c4a8e1", - "#8cc1d8", - "#f9c2cd", - "#b4e3b2", - "#ffdfba", - "#e9c3b5", - "#d5b8d6", - "#add7f6", - "#ffd1dc", - "#ffe7a1", - "#a8e6cf", - "#d4a5a5", - "#f3d6e4", - "#c3aed6" + "#5655d0", + "#6bbbe3", + "#a6d5cb", + "#fae0b9", + "#f28e8e", + "#e3a7e4", + "#c4a8e1", + "#8cc1d8", + "#f9c2cd", + "#b4e3b2", + "#ffdfba", + "#e9c3b5", + "#d5b8d6", + "#add7f6", + "#ffd1dc", + "#ffe7a1", + "#a8e6cf", + "#d4a5a5", + "#f3d6e4", + "#c3aed6" ]; for (let i = 0; i < fixed.allKeys.length; i++) { @@ -74,8 +74,26 @@ function transformResponse(input: { _id: string, name: string, count: number }[] } } +const errorData = ref<{ errored: boolean, text: string }>({ + errored: false, + text: '' +}) + + +function onResponseError(e: any) { + console.log('ON RESPONSE ERROR') + errorData.value = { errored: true, text: e.response._data.message ?? 'Generic error' } +} + +function onResponse(e: any) { + console.log('ON RESPONSE') + if (e.response.status != 500) errorData.value = { errored: false, text: '' } +} + const eventsStackedData = useFetch(`/api/metrics/${activeProject.value?._id}/timeline/events_stacked`, { - method: 'POST', body, lazy: true, immediate: false, transform: transformResponse, ...signHeaders() + method: 'POST', body, lazy: true, immediate: false, transform: transformResponse, ...signHeaders(), + onResponseError, + onResponse }); @@ -86,13 +104,17 @@ onMounted(async () => { \ No newline at end of file diff --git a/dashboard/pages/events.vue b/dashboard/pages/events.vue index a33d05b..d1862c6 100644 --- a/dashboard/pages/events.vue +++ b/dashboard/pages/events.vue @@ -20,15 +20,15 @@ const refreshKey = computed(() => `${snapshot.value._id.toString() + activeProje