Skip to content

A self-hosted media server and file management system

feat: improve server analytics page layout

aminnausinc7ad9cad3f0e
diff --git a/resources/js/components/cards/pulse/PulseUsage.vue b/resources/js/components/cards/pulse/PulseUsage.vue
index 9878a141..745b0edb 100644
--- a/resources/js/components/cards/pulse/PulseUsage.vue
+++ b/resources/js/components/cards/pulse/PulseUsage.vue
@@ -12,6 +12,7 @@ import PulseNoResults from '@/components/pulse/PulseNoResults.vue';
import PulseUserCard from '@/components/pulse/PulseUserCard.vue';
import DashboardCard from '@/components/cards/layout/DashboardCard.vue';
import PulseScroll from '@/components/pulse/PulseScroll.vue';
+
import IconClock from '@/components/icons/IconClock.vue';
import IconScale from '@/components/icons/IconScale.vue';
@@ -85,18 +86,18 @@ const sampleRate = () => {
<IconCursorArrowRays v-else />
</template>
<template #actions>
- <span class="flex items-center text-sm">
- <PulseSelectLabel control-id="Select-Usage"> Top 10 users </PulseSelectLabel>
+ <div class="flex w-full items-center text-sm">
+ <PulseSelectLabel class="truncate" control-id="Select-Usage"> <span class="truncate">Top 10 users</span> </PulseSelectLabel>
<InputSelect
:placeholder="'None'"
:options="requestOptions"
- class="w-full! flex-1 rounded-l-none whitespace-nowrap! capitalize ring-inset"
+ class="flex-1 rounded-l-none capitalize ring-inset"
title="Select usage type"
@selectItem="handleSetType"
:defaultItem="0"
id="Select-Usage"
/>
- </span>
+ </div>
</template>
<PulseScroll :expand="false" :loading="isLoading ?? false">
diff --git a/resources/js/components/cedar-ui/select/InputSelect.vue b/resources/js/components/cedar-ui/select/InputSelect.vue
index 695d2d90..84fa5823 100644
--- a/resources/js/components/cedar-ui/select/InputSelect.vue
+++ b/resources/js/components/cedar-ui/select/InputSelect.vue
@@ -130,7 +130,7 @@ watch(
);
</script>
<template>
- <section :class="[`group relative w-full text-sm`, rootClass]" @focusout="handleFocusOut" ref="selectableItemsRoot">
+ <section :class="cn('group relative w-full text-sm', rootClass)" @focusout="handleFocusOut" ref="selectableItemsRoot">
<button
@click="select.toggleSelect(!select.selectOpen)"
:id="props.name"
diff --git a/resources/js/components/dashboard/DashboardAnalytics.vue b/resources/js/components/dashboard/DashboardAnalytics.vue
index de893df6..e37dbea6 100644
--- a/resources/js/components/dashboard/DashboardAnalytics.vue
+++ b/resources/js/components/dashboard/DashboardAnalytics.vue
@@ -3,22 +3,20 @@ import type { BreadCrumbItem } from '@/types/types';
import type { PulseResponse } from '@/types/pulseTypes';
import { computed, onMounted, ref, useTemplateRef } from 'vue';
-import { useGetPulse, useGetSiteAnalytics } from '@/service/queries';
import { ButtonText, ButtonBase } from '@/components/cedar-ui/button';
import { handleStartTask } from '@/service/taskService';
-import { periodForHumans } from '@/service/pulseUtil';
import { BreadCrumbs } from '@/components/cedar-ui/breadcrumbs';
import { BasePopover } from '@/components/cedar-ui/popover';
import { queryClient } from '@/service/vue-query';
+import { useGetPulse } from '@/service/queries';
import { useAuth } from '@/composables/auth/useAuth';
import PulseSlowOutgoingRequests from '@/components/cards/pulse/PulseSlowOutgoingRequests.vue';
-import LucideChartNoAxesCombined from '~icons/lucide/chart-no-axes-combined';
import DashboardTaskMenu from '@/components/menus/DashboardTaskMenu.vue';
import PulseSlowRequests from '@/components/cards/pulse/PulseSlowRequests.vue';
import PulseSlowQueries from '@/components/cards/pulse/PulseSlowQueries.vue';
+import ServerActivityCard from '@/components/cards/server/ServerActivityCard.vue';
import PulseExceptions from '@/components/cards/pulse/PulseExceptions.vue';
-import DashboardCard from '@/components/cards/layout/DashboardCard.vue';
import PulseRequests from '@/components/cards/pulse/PulseRequests.vue';
import PulseSlowJobs from '@/components/cards/pulse/PulseSlowJobs.vue';
import PulseServers from '@/components/cards/pulse/PulseServers.vue';
@@ -43,7 +41,6 @@ const validPeriods: { key: string; value: string }[] = [
const taskPopover = useTemplateRef('taskPopover');
const period = ref<string>('1_hour');
-const { data: stats } = useGetSiteAnalytics(period);
const { data: rawPulseData, isLoading: pulseLoading } = useGetPulse({ period });
const { isAdmin } = useAuth();
@@ -112,25 +109,21 @@ onMounted(() => {
</ButtonText>
</div>
</div>
- <span class="mx-auto grid w-full grid-cols-2 gap-6 sm:grid-cols-4 lg:grid-cols-6">
+ <span class="mx-auto grid w-full grid-cols-2 gap-3 sm:grid-cols-4 lg:grid-cols-6">
<PulseServers :pulseData="pulseData" :isLoading="pulseLoading" cols="6" :rows="1" />
- <DashboardCard cols="2" :rows="4" :title="'Data changes over time'" :name="'Data Changes'" :details="`past ${periodForHumans(period)}`">
- <template #icon>
- <LucideChartNoAxesCombined class="h-6 w-6" />
- </template>
- <span v-for="(stat, index) in stats?.changes" :key="index" class="flex flex-wrap items-center gap-2 capitalize">
- <h3 class="text-foreground-2 w-full text-sm text-nowrap">{{ stat.title }}</h3>
- <span>
- <h3 class="text-lg">{{ stat.count ?? 0 }}</h3>
- </span>
- <h4 :class="`text-sm ${stat.change >= 0 ? 'text-green-700 dark:text-green-600' : 'text-rose-500'} ml-auto`">
- {{ `${stat.change === 0 ? '~' : `${stat.change >= 0 ? '+' : '-'}${stat.change}`}` }}
- </h4>
- </span>
- </DashboardCard>
- <PulseUsage :pulseData="pulseData" :isLoading="pulseLoading" :period="period" :rows="4" />
- <PulseQueues :pulseData="pulseData" :isLoading="pulseLoading" :period="period" :rows="2" />
- <PulseRequests v-if="pulseData" :pulseData="pulseData" :isLoading="pulseLoading" :period="period" :rows="2" />
+ <ServerActivityCard :period="period" />
+ <PulseUsage :pulseData="pulseData" :isLoading="pulseLoading" :period="period" :rows="4" class="lg:col-span-6 xl:col-span-2! xl:row-span-2" />
+
+ <PulseQueues :pulseData="pulseData" :isLoading="pulseLoading" :period="period" :rows="2" class="xl:col-span-4 xl:col-start-1 xl:row-span-1 xl:row-start-3" />
+ <PulseRequests
+ v-if="pulseData"
+ :pulseData="pulseData"
+ :isLoading="pulseLoading"
+ :period="period"
+ :rows="2"
+ class="xl:col-span-4 xl:col-start-1 xl:row-span-1 xl:row-start-4"
+ />
+
<PulseSlowRequests v-if="pulseData" :pulse-data="pulseData" :is-loading="pulseLoading" :period="period" :rows="2" cols="3" />
<PulseSlowJobs v-if="pulseData" :pulse-data="pulseData" :is-loading="pulseLoading" :period="period" :rows="2" :cols="3" />
<PulseSlowQueries v-if="pulseData" :pulse-data="pulseData" :is-loading="pulseLoading" :period="period" :rows="2" :cols="3" />
diff --git a/resources/js/components/pulse/PulseSelectLabel.vue b/resources/js/components/pulse/PulseSelectLabel.vue
index 76ad4306..e2b6b3be 100644
--- a/resources/js/components/pulse/PulseSelectLabel.vue
+++ b/resources/js/components/pulse/PulseSelectLabel.vue
@@ -1,9 +1,17 @@
<script setup lang="ts">
+import { cn } from '@aminnausin/cedar-ui';
+
defineProps<{ controlId: string }>();
+defineOptions({ inheritAttrs: false });
</script>
<template>
<label
- class="text-foreground-0 bg-primary-800 flex h-10 w-full items-center justify-between rounded-l-md p-3 py-2 text-left text-sm whitespace-nowrap capitalize shadow-xs ring-1 ring-neutral-200 ring-inset dark:bg-neutral-900 dark:ring-neutral-700"
+ :class="
+ cn(
+ 'text-foreground-0 bg-primary-800 flex h-10 w-full items-center justify-between rounded-l-md p-3 py-2 text-left text-sm whitespace-nowrap capitalize shadow-xs ring-1 ring-neutral-200 ring-inset dark:bg-neutral-900 dark:ring-neutral-700',
+ $attrs.class,
+ )
+ "
:for="controlId"
>
<slot></slot>