A self-hosted media server and file management system
Vue ffmpegfile-serverjellyfinlaravelmediamedia-playermedia-servermediabrowsermediaservermusicmusic-librarymusic-playermusicplayerself-hostedvuejs
dashboard pulse server and icons
aminnausinaf4f4939ad88
diff --git a/app/Http/Controllers/Api/V1/SiteController.php b/app/Http/Controllers/Api/V1/SiteController.phpindex 6cfe823d..a7c110db 100644--- a/app/Http/Controllers/Api/V1/SiteController.php+++ b/app/Http/Controllers/Api/V1/SiteController.php@@ -5,6 +5,7 @@ namespace App\Http\Controllers\Api\V1;use App\Http\Controllers\Controller;use App\Models\Category;use App\Models\Folder;+use App\Models\Record;use App\Models\Tag;use App\Models\User;use App\Models\Video;@@ -24,7 +25,7 @@ class SiteController extends Controller {array('title' => 'videos', "count" => Video::count()),array('title' => 'users', "count" => User::count()),array('title' => 'tags', "count" => Tag::count()),- array('title' => 'views', "count" => Tag::count())+ array('title' => 'views', "count" => Record::count()));} catch (\Throwable $th) {return $this->error(null, 'Unable to get stats. Error: ' . $th->getMessage(), 500);diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.phpindex bb9677b4..cf6ec30b 100755--- a/app/Providers/AppServiceProvider.php+++ b/app/Providers/AppServiceProvider.php@@ -4,7 +4,9 @@ namespace App\Providers;use Illuminate\Support\ServiceProvider;use App\Models\User;+use Illuminate\Support\Facades\Auth;use Illuminate\Support\Facades\Gate;+use Laravel\Pulse\Facades\Pulse;class AppServiceProvider extends ServiceProvider {/**@@ -19,8 +21,13 @@ class AppServiceProvider extends ServiceProvider {*/public function boot(): void {//- Gate::define('viewPulse', function (User $user) {- return $user->isAdmin();+ Pulse::user(fn($user) => [+ 'name' => $user->name,+ 'extra' => $user->email,+ ]);++ Gate::define('viewPulse', function (?User $user) {+ return $user?->isAdmin();});}}diff --git a/config/pulse-api.php b/config/pulse-api.phpindex 9cf4d3e0..eaebb1fa 100644--- a/config/pulse-api.php+++ b/config/pulse-api.php@@ -36,7 +36,7 @@ return [|*/- 'include_config' => env('PULSE_API_INCLUDE_CONFIG', fake()),+ 'include_config' => env('PULSE_API_INCLUDE_CONFIG', false),/*|--------------------------------------------------------------------------@@ -51,6 +51,7 @@ return ['middleware' => ['api',+ 'auth:sanctum',Authorize::class,],@@ -67,6 +68,15 @@ return ['resources' => \Robertogallea\PulseApi\Services\PulseAPI::getDefaultResources()->merge([// Add your custom resources+ // PulseResourcesEnum::SERVERS->value => ServersResource::class,+ // PulseResourcesEnum::USAGE->value => UsageResource::class,+ // PulseResourcesEnum::QUEUES->value => QueueResource::class,+ // PulseResourcesEnum::CACHE->value => CacheResource::class,+ // PulseResourcesEnum::SLOW_QUERIES->value => SlowQueriesResource::class,+ // PulseResourcesEnum::EXCEPTIONS->value => ExceptionsResource::class,+ // PulseResourcesEnum::SLOW_REQUESTS->value => SlowRequestsResource::class,+ // PulseResourcesEnum::SLOW_JOBS->value => SlowJobsResource::class,+ // PulseResourcesEnum::SLOW_OUTGOING_REQUESTS->value => SlowOutgoingRequestsResource::class,]),];diff --git a/package-lock.json b/package-lock.jsonindex 08025c4d..7d54281e 100755--- a/package-lock.json+++ b/package-lock.json@@ -12,12 +12,14 @@"@vueuse/components": "^10.11.0","@vueuse/core": "^10.11.0","@vueuse/integrations": "^11.0.0",+ "chart.js": "^4.4.7","focus-trap": "^7.5.4","lodash.clonedeep": "^4.5.0","lodash.isequal": "^4.5.0","pinia": "^2.1.7","tailwind-scrollbar-hide": "^1.1.7","vue": "^3.4.29",+ "vue-chartjs": "^5.3.2","vue-loader": "^17.4.2","vue-router": "^4.4.0"},@@ -26,9 +28,11 @@"@eslint/js": "^9.7.0","@iconify-json/circum": "^1.1.11","@iconify-json/lucide": "^1.1.202",+ "@iconify-json/majesticons": "^1.2.1","@iconify-json/material-symbols-light": "^1.1.25","@iconify-json/mdi-light": "^1.2.1","@iconify-json/ph": "^1.1.13",+ "@iconify-json/proicons": "^1.2.9","@tsconfig/node22": "^22.0.0","@types/node": "^22.9.3","@typescript-eslint/eslint-plugin": "^8.13.0",@@ -881,6 +885,16 @@"@iconify/types": "*"}},+ "node_modules/@iconify-json/majesticons": {+ "version": "1.2.1",+ "resolved": "https://registry.npmjs.org/@iconify-json/majesticons/-/majesticons-1.2.1.tgz",+ "integrity": "sha512-BTHOY++kpylECduX7UNVGT7LSqP3oJau9MT345VzFgnjz5EfDuiGp2pCzzI9KEM2o+ftERJsHovhWCl6otPaHg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@iconify/types": "*"+ }+ },"node_modules/@iconify-json/material-symbols-light": {"version": "1.2.9","resolved": "https://registry.npmjs.org/@iconify-json/material-symbols-light/-/material-symbols-light-1.2.9.tgz",@@ -911,6 +925,16 @@"@iconify/types": "*"}},+ "node_modules/@iconify-json/proicons": {+ "version": "1.2.9",+ "resolved": "https://registry.npmjs.org/@iconify-json/proicons/-/proicons-1.2.9.tgz",+ "integrity": "sha512-iI3pAeyTx5OnnKyg2KkHJ4caKRsXvnaIofbLmx3r8xHn/AUTlqOOBt+e9CJmE/WYjhjmFVZOAW+K6YGTrtYCqA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@iconify/types": "*"+ }+ },"node_modules/@iconify/types": {"version": "2.0.0","resolved": "https://registry.npmjs.org/@iconify/types/-/types-2.0.0.tgz",@@ -1024,6 +1048,12 @@"@jridgewell/sourcemap-codec": "^1.4.14"}},+ "node_modules/@kurkle/color": {+ "version": "0.3.4",+ "resolved": "https://registry.npmjs.org/@kurkle/color/-/color-0.3.4.tgz",+ "integrity": "sha512-M5UknZPHRu3DEDWoipU6sE8PdkZ6Z/S+v4dD+Ke8IaNlpdSQah50lz1KtcFBa2vsdOnwbbnxJwVM4wty6udA5w==",+ "license": "MIT"+ },"node_modules/@nodelib/fs.scandir": {"version": "2.1.5","resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",@@ -2579,6 +2609,18 @@"node": ">=8"}},+ "node_modules/chart.js": {+ "version": "4.4.7",+ "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-4.4.7.tgz",+ "integrity": "sha512-pwkcKfdzTMAU/+jNosKhNL2bHtJc/sSmYgVbuGTEDhzkrhmyihmP7vUc/5ZK9WopidMDHNe3Wm7jOd/WhuHWuw==",+ "license": "MIT",+ "dependencies": {+ "@kurkle/color": "^0.3.0"+ },+ "engines": {+ "pnpm": ">=8"+ }+ },"node_modules/chokidar": {"version": "3.6.0","resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz",@@ -5567,6 +5609,16 @@}}},+ "node_modules/vue-chartjs": {+ "version": "5.3.2",+ "resolved": "https://registry.npmjs.org/vue-chartjs/-/vue-chartjs-5.3.2.tgz",+ "integrity": "sha512-NrkbRRoYshbXbWqJkTN6InoDVwVb90C0R7eAVgMWcB9dPikbruaOoTFjFYHE/+tNPdIe6qdLCDjfjPHQ0fw4jw==",+ "license": "MIT",+ "peerDependencies": {+ "chart.js": "^4.1.1",+ "vue": "^3.0.0-0 || ^2.7.0"+ }+ },"node_modules/vue-demi": {"version": "0.14.10","resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.10.tgz",diff --git a/package.json b/package.jsonindex 42986148..7d5fe579 100755--- a/package.json+++ b/package.json@@ -12,7 +12,7 @@"vite:dev2": "concurrently -k -p \"[{name}]\" -c \"blue.bold,green.bold,red.bold\" \"npm:php:serve\" \"npm:php:pail\" \"npm:dev\"","vite:cron": "concurrently -k -p \"[{name}]\" -c \"blue.bold,green.bold,red.bold,white.bold\" \"npm:php:queue\" \"npm:php:scheduler\" \"npm:dev\" \"npm:php:pulse\"","vite:php": "concurrently -k -p \"[{name}]\" -c \"blue.bold,green.bold\" \"npm:php:queue\" \"npm:php:scheduler\"",- "build": "concurrently -k -p \"[{name}]\" \"npm:type-check\" \"npm:build-only\"",+ "build": "npm run type-check && npm run build-only","build-only": "vite build","type-check": "vue-tsc --build","lint": "eslint . --fix",@@ -25,9 +25,11 @@"@eslint/js": "^9.7.0","@iconify-json/circum": "^1.1.11","@iconify-json/lucide": "^1.1.202",+ "@iconify-json/majesticons": "^1.2.1","@iconify-json/material-symbols-light": "^1.1.25","@iconify-json/mdi-light": "^1.2.1","@iconify-json/ph": "^1.1.13",+ "@iconify-json/proicons": "^1.2.9","@tsconfig/node22": "^22.0.0","@types/node": "^22.9.3","@typescript-eslint/eslint-plugin": "^8.13.0",@@ -38,6 +40,7 @@"@vue/tsconfig": "^0.7.0","autoprefixer": "^10.4.20","axios": "^1.7.4",+ "concurrently": "^9.1.0","eslint": "^9.14.0","eslint-config-prettier": "^9.1.0","eslint-plugin-vue": "^9.30.0",@@ -48,8 +51,7 @@"typescript": "~5.6.3","unplugin-icons": "^0.19.0","vite": "^5.0.0",- "vue-tsc": "^2.1.10",- "concurrently": "^9.1.0"+ "vue-tsc": "^2.1.10"},"dependencies": {"@eslint/compat": "^1.2.0",@@ -59,12 +61,14 @@"@vueuse/components": "^10.11.0","@vueuse/core": "^10.11.0","@vueuse/integrations": "^11.0.0",+ "chart.js": "^4.4.7","focus-trap": "^7.5.4","lodash.clonedeep": "^4.5.0","lodash.isequal": "^4.5.0","pinia": "^2.1.7","tailwind-scrollbar-hide": "^1.1.7","vue": "^3.4.29",+ "vue-chartjs": "^5.3.2","vue-loader": "^17.4.2","vue-router": "^4.4.0"}diff --git a/resources/js/components/cards/StatsCard.vue b/resources/js/components/cards/StatsCard.vueindex 865c8621..da7ae9d0 100644--- a/resources/js/components/cards/StatsCard.vue+++ b/resources/js/components/cards/StatsCard.vue@@ -3,7 +3,7 @@ const props = defineProps<{ title: string; data?: any[]; forceCount?: number; cl</script><template><div- :class="`flex flex-col gap-2 p-4 overflow-clip rounded-xl shadow-lg dark:bg-primary-dark-800/70 bg-primary-800 ring-1 ring-gray-900/5 flex-1 w-1/3 ${props.class}`"+ :class="`flex flex-col gap-2 p-4 overflow-clip rounded-xl shadow-lg dark:bg-primary-dark-800/70 bg-white ring-1 ring-gray-900/5 flex-1 w-1/3 ${props.class}`"><p class="text-sm dark:text-slate-400 text-slate-500 max-w-full text-nowrap">{{ props.title }}</p><h3 class="text-xl">{{ props.forceCount ?? data?.length ?? 0 }}</h3>diff --git a/resources/js/components/charts/PulseDoughnutChart.vue b/resources/js/components/charts/PulseDoughnutChart.vuenew file mode 100644index 00000000..3db16052--- /dev/null+++ b/resources/js/components/charts/PulseDoughnutChart.vue@@ -0,0 +1,43 @@+<script setup lang="ts">+import type { ChartData, ChartOptions } from 'chart.js';+import { Doughnut } from 'vue-chartjs';++const props = defineProps<{+ class: string;+ chartData?: any;+ chartOptions?: any;+}>();++const defaultChartData = {+ labels: ['Used', 'Free'],+ datasets: [+ {+ data: [20, 128],+ backgroundColor: ['#9333ea', '#c084fc30'],+ hoverBackgroundColor: ['#9333ea', '#c084fc30'],+ },+ ],+};+const defaultChartOptions = {+ borderWidth: 0,+ plugins: {+ legend: {+ display: false,+ },+ tooltip: {+ enabled: false,+ callbacks: {+ label: (context: any) => context.formattedValue + ' MB',+ },+ displayColors: false,+ },+ },+};+</script>+<template>+ <Doughnut+ :class="`${props.class}`"+ :data="props.chartData ?? defaultChartData"+ :options="props.chartOptions ?? defaultChartOptions"+ ></Doughnut>+</template>diff --git a/resources/js/components/charts/PulseLineChart.vue b/resources/js/components/charts/PulseLineChart.vuenew file mode 100644index 00000000..65619893--- /dev/null+++ b/resources/js/components/charts/PulseLineChart.vue@@ -0,0 +1,69 @@+<script setup lang="ts">+import { Chart, registerables } from 'chart.js';+import { Line } from 'vue-chartjs';++Chart.register(...registerables);++const props = defineProps<{+ class?: string;+ chartData?: any;+ chartOptions?: any;+}>();++const defaultChartData = {+ labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],+ datasets: [+ {+ label: 'Data One',+ backgroundColor: '#f87979',+ data: [40, 39, 10, 40, 39, 80, 40],+ },+ ],+};++const defaultChartOptions = {+ maintainAspectRatio: false,+ layout: {+ autoPadding: false,+ },+ scales: {+ x: {+ display: false,+ grid: {+ display: false,+ },+ },+ y: {+ display: false,+ min: 0,+ max: 100,+ grid: {+ display: false,+ },+ },+ },+ plugins: {+ legend: {+ display: false,+ },+ tooltip: {+ mode: 'index',+ position: 'nearest',+ intersect: false,+ callbacks: {+ title: () => '',+ label: (context: any) => `${context.label} - ${context.formattedValue}%`,+ },+ displayColors: false,+ },+ },+};+</script>++<template>+ <Line+ :class="`${props.class ?? 'w-full ring-1 ring-gray-900/5 bg-white dark:bg-gray-900 rounded-md shadow-sm'}`"+ :data="props.chartData ?? defaultChartData"+ :options="props.chartOptions ?? defaultChartOptions"+ ></Line>+</template>diff --git a/resources/js/components/icons/IconArrowTrendingUp.vue b/resources/js/components/icons/IconArrowTrendingUp.vuenew file mode 100644index 00000000..c59182fc--- /dev/null+++ b/resources/js/components/icons/IconArrowTrendingUp.vue@@ -0,0 +1,9 @@+<template>+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">+ <path+ stroke-linecap="round"+ stroke-linejoin="round"+ d="M2.25 18L9 11.25l4.306 4.307a11.95 11.95 0 015.814-5.519l2.74-1.22m0 0l-5.94-2.28m5.94 2.28l-2.28 5.941"+ />+ </svg>+</template>diff --git a/resources/js/components/icons/IconArrowsLeftRight.vue b/resources/js/components/icons/IconArrowsLeftRight.vuenew file mode 100644index 00000000..83ac6a74--- /dev/null+++ b/resources/js/components/icons/IconArrowsLeftRight.vue@@ -0,0 +1,9 @@+<template>+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">+ <path+ stroke-linecap="round"+ stroke-linejoin="round"+ d="M7.5 21L3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5"+ />+ </svg>+</template>diff --git a/resources/js/components/icons/IconBugAnt.vue b/resources/js/components/icons/IconBugAnt.vuenew file mode 100644index 00000000..e282f170--- /dev/null+++ b/resources/js/components/icons/IconBugAnt.vue@@ -0,0 +1,9 @@+<template>+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">+ <path+ stroke-linecap="round"+ stroke-linejoin="round"+ d="M12 12.75c1.148 0 2.278.08 3.383.237 1.037.146 1.866.966 1.866 2.013 0 3.728-2.35 6.75-5.25 6.75S6.75 18.728 6.75 15c0-1.046.83-1.867 1.866-2.013A24.204 24.204 0 0112 12.75zm0 0c2.883 0 5.647.508 8.207 1.44a23.91 23.91 0 01-1.152 6.06M12 12.75c-2.883 0-5.647.508-8.208 1.44.125 2.104.52 4.136 1.153 6.06M12 12.75a2.25 2.25 0 002.248-2.354M12 12.75a2.25 2.25 0 01-2.248-2.354M12 8.25c.995 0 1.971-.08 2.922-.236.403-.066.74-.358.795-.762a3.778 3.778 0 00-.399-2.25M12 8.25c-.995 0-1.97-.08-2.922-.236-.402-.066-.74-.358-.795-.762a3.734 3.734 0 01.4-2.253M12 8.25a2.25 2.25 0 00-2.248 2.146M12 8.25a2.25 2.25 0 012.248 2.146M8.683 5a6.032 6.032 0 01-1.155-1.002c.07-.63.27-1.222.574-1.747m.581 2.749A3.75 3.75 0 0115.318 5m0 0c.427-.283.815-.62 1.155-.999a4.471 4.471 0 00-.575-1.752M4.921 6a24.048 24.048 0 00-.392 3.314c1.668.546 3.416.914 5.223 1.082M19.08 6c.205 1.08.337 2.187.392 3.314a23.882 23.882 0 01-5.223 1.082"+ />+ </svg>+</template>diff --git a/resources/js/components/icons/IconCircleStack.vue b/resources/js/components/icons/IconCircleStack.vuenew file mode 100644index 00000000..038ec682--- /dev/null+++ b/resources/js/components/icons/IconCircleStack.vue@@ -0,0 +1,9 @@+<template>+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">+ <path+ stroke-linecap="round"+ stroke-linejoin="round"+ d="M20.25 6.375c0 2.278-3.694 4.125-8.25 4.125S3.75 8.653 3.75 6.375m16.5 0c0-2.278-3.694-4.125-8.25-4.125S3.75 4.097 3.75 6.375m16.5 0v11.25c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125V6.375m16.5 0v3.75m-16.5-3.75v3.75m16.5 0v3.75C20.25 16.153 16.556 18 12 18s-8.25-1.847-8.25-4.125v-3.75m16.5 0c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125"+ />+ </svg>+</template>diff --git a/resources/js/components/icons/IconClipboard.vue b/resources/js/components/icons/IconClipboard.vuenew file mode 100644index 00000000..a32c3404--- /dev/null+++ b/resources/js/components/icons/IconClipboard.vue@@ -0,0 +1,9 @@+<template>+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">+ <path+ stroke-linecap="round"+ stroke-linejoin="round"+ d="M15.666 3.888A2.25 2.25 0 0013.5 2.25h-3c-1.03 0-1.9.693-2.166 1.638m7.332 0c.055.194.084.4.084.612v0a.75.75 0 01-.75.75H9a.75.75 0 01-.75-.75v0c0-.212.03-.418.084-.612m7.332 0c.646.049 1.288.11 1.927.184 1.1.128 1.907 1.077 1.907 2.185V19.5a2.25 2.25 0 01-2.25 2.25H6.75A2.25 2.25 0 014.5 19.5V6.257c0-1.108.806-2.057 1.907-2.185a48.208 48.208 0 011.927-.184"+ />+ </svg>+</template>diff --git a/resources/js/components/icons/IconClock.vue b/resources/js/components/icons/IconClock.vuenew file mode 100644index 00000000..d8e0d670--- /dev/null+++ b/resources/js/components/icons/IconClock.vue@@ -0,0 +1,5 @@+<template>+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">+ <path stroke-linecap="round" stroke-linejoin="round" d="M12 6v6h4.5m4.5 0a9 9 0 11-18 0 9 9 0 0118 0z" />+ </svg>+</template>diff --git a/resources/js/components/icons/IconCloudArrowUp.vue b/resources/js/components/icons/IconCloudArrowUp.vuenew file mode 100644index 00000000..cdd3cea0--- /dev/null+++ b/resources/js/components/icons/IconCloudArrowUp.vue@@ -0,0 +1,9 @@+<template>+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">+ <path+ stroke-linecap="round"+ stroke-linejoin="round"+ d="M12 16.5V9.75m0 0l3 3m-3-3l-3 3M6.75 19.5a4.5 4.5 0 01-1.41-8.775 5.25 5.25 0 0110.233-2.33 3 3 0 013.758 3.848A3.752 3.752 0 0118 19.5H6.75z"+ />+ </svg>+</template>diff --git a/resources/js/components/icons/IconCommandLine.vue b/resources/js/components/icons/IconCommandLine.vuenew file mode 100644index 00000000..3cd67a50--- /dev/null+++ b/resources/js/components/icons/IconCommandLine.vue@@ -0,0 +1,9 @@+<template>+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">+ <path+ stroke-linecap="round"+ stroke-linejoin="round"+ d="M6.75 7.5l3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0021 18V6a2.25 2.25 0 00-2.25-2.25H5.25A2.25 2.25 0 003 6v12a2.25 2.25 0 002.25 2.25z"+ />+ </svg>+</template>diff --git a/resources/js/components/icons/IconComputerDesktop.vue b/resources/js/components/icons/IconComputerDesktop.vuenew file mode 100644index 00000000..2c8830cf--- /dev/null+++ b/resources/js/components/icons/IconComputerDesktop.vue@@ -0,0 +1,9 @@+<template>+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">+ <path+ stroke-linecap="round"+ stroke-linejoin="round"+ d="M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"+ />+ </svg>+</template>diff --git a/resources/js/components/icons/IconCursorArrowRays.vue b/resources/js/components/icons/IconCursorArrowRays.vuenew file mode 100644index 00000000..f5ac2a12--- /dev/null+++ b/resources/js/components/icons/IconCursorArrowRays.vue@@ -0,0 +1,9 @@+<template>+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">+ <path+ stroke-linecap="round"+ stroke-linejoin="round"+ d="M15.042 21.672L13.684 16.6m0 0l-2.51 2.225.569-9.47 5.227 7.917-3.286-.672zM12 2.25V4.5m5.834.166l-1.591 1.591M20.25 10.5H18M7.757 14.743l-1.59 1.59M6 10.5H3.75m4.007-4.243l-1.59-1.59"+ />+ </svg>+</template>diff --git a/resources/js/components/icons/IconEllipsisHorizontal.vue b/resources/js/components/icons/IconEllipsisHorizontal.vuenew file mode 100644index 00000000..04644af2--- /dev/null+++ b/resources/js/components/icons/IconEllipsisHorizontal.vue@@ -0,0 +1,9 @@+<template>+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">+ <path+ stroke-linecap="round"+ stroke-linejoin="round"+ d="M6.75 12a.75.75 0 11-1.5 0 .75.75 0 011.5 0zM12.75 12a.75.75 0 11-1.5 0 .75.75 0 011.5 0zM18.75 12a.75.75 0 11-1.5 0 .75.75 0 011.5 0z"+ />+ </svg>+</template>diff --git a/resources/js/components/icons/IconInformationCircle.vue b/resources/js/components/icons/IconInformationCircle.vuenew file mode 100644index 00000000..fbf03a50--- /dev/null+++ b/resources/js/components/icons/IconInformationCircle.vue@@ -0,0 +1,9 @@+<template>+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">+ <path+ stroke-linecap="round"+ stroke-linejoin="round"+ d="M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"+ />+ </svg>+</template>diff --git a/resources/js/components/icons/IconMoon.vue b/resources/js/components/icons/IconMoon.vuenew file mode 100644index 00000000..6d9d3664--- /dev/null+++ b/resources/js/components/icons/IconMoon.vue@@ -0,0 +1,9 @@+<template>+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">+ <path+ stroke-linecap="round"+ stroke-linejoin="round"+ d="M21.752 15.002A9.718 9.718 0 0118 15.75c-5.385 0-9.75-4.365-9.75-9.75 0-1.33.266-2.597.748-3.752A9.753 9.753 0 003 11.25C3 16.635 7.365 21 12.75 21a9.753 9.753 0 009.002-5.998z"+ />+ </svg>+</template>diff --git a/resources/js/components/icons/IconNoPulse.vue b/resources/js/components/icons/IconNoPulse.vuenew file mode 100644index 00000000..0219b473--- /dev/null+++ b/resources/js/components/icons/IconNoPulse.vue@@ -0,0 +1,5 @@+<template>+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" fill="none" stroke-width="1.5" stroke="currentColor">+ <path d="M2 15.6154H7.5L9.5 12L12 19L14.1094 15.6154H29.75" stroke-linecap="round" stroke-linejoin="round" />+ </svg>+</template>diff --git a/resources/js/components/icons/IconQueueList.vue b/resources/js/components/icons/IconQueueList.vuenew file mode 100644index 00000000..17fa8a70--- /dev/null+++ b/resources/js/components/icons/IconQueueList.vue@@ -0,0 +1,9 @@+<template>+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">+ <path+ stroke-linecap="round"+ stroke-linejoin="round"+ d="M3.75 12h16.5m-16.5 3.75h16.5M3.75 19.5h16.5M5.625 4.5h12.75a1.875 1.875 0 010 3.75H5.625a1.875 1.875 0 010-3.75z"+ />+ </svg>+</template>diff --git a/resources/js/components/icons/IconRocketLaunch.vue b/resources/js/components/icons/IconRocketLaunch.vuenew file mode 100644index 00000000..0acfa8f2--- /dev/null+++ b/resources/js/components/icons/IconRocketLaunch.vue@@ -0,0 +1,9 @@+<template>+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">+ <path+ stroke-linecap="round"+ stroke-linejoin="round"+ d="M15.59 14.37a6 6 0 01-5.84 7.38v-4.8m5.84-2.58a14.98 14.98 0 006.16-12.12A14.98 14.98 0 009.631 8.41m5.96 5.96a14.926 14.926 0 01-5.841 2.58m-.119-8.54a6 6 0 00-7.381 5.84h4.8m2.581-5.84a14.927 14.927 0 00-2.58 5.84m2.699 2.7c-.103.021-.207.041-.311.06a15.09 15.09 0 01-2.448-2.448 14.9 14.9 0 01.06-.312m-2.24 2.39a4.493 4.493 0 00-1.757 4.306 4.493 4.493 0 004.306-1.758M16.5 9a1.5 1.5 0 11-3 0 1.5 1.5 0 013 0z"+ />+ </svg>+</template>diff --git a/resources/js/components/icons/IconScale.vue b/resources/js/components/icons/IconScale.vuenew file mode 100644index 00000000..9d47c7e5--- /dev/null+++ b/resources/js/components/icons/IconScale.vue@@ -0,0 +1,9 @@+<template>+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">+ <path+ stroke-linecap="round"+ stroke-linejoin="round"+ d="M12 3v17.25m0 0c-1.472 0-2.882.265-4.185.75M12 20.25c1.472 0 2.882.265 4.185.75M18.75 4.97A48.416 48.416 0 0012 4.5c-2.291 0-4.545.16-6.75.47m13.5 0c1.01.143 2.01.317 3 .52m-3-.52l2.62 10.726c.122.499-.106 1.028-.589 1.202a5.988 5.988 0 01-2.031.352 5.988 5.988 0 01-2.031-.352c-.483-.174-.711-.703-.59-1.202L18.75 4.971zm-16.5.52c.99-.203 1.99-.377 3-.52m0 0l2.62 10.726c.122.499-.106 1.028-.589 1.202a5.989 5.989 0 01-2.031.352 5.989 5.989 0 01-2.031-.352c-.483-.174-.711-.703-.59-1.202L5.25 4.971z"+ />+ </svg>+</template>diff --git a/resources/js/components/icons/IconServer.vue b/resources/js/components/icons/IconServer.vuenew file mode 100644index 00000000..11684694--- /dev/null+++ b/resources/js/components/icons/IconServer.vue@@ -0,0 +1,9 @@+<template>+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">+ <path+ stroke-linecap="round"+ stroke-linejoin="round"+ d="M21.75 17.25v-.228a4.5 4.5 0 00-.12-1.03l-2.268-9.64a3.375 3.375 0 00-3.285-2.602H7.923a3.375 3.375 0 00-3.285 2.602l-2.268 9.64a4.5 4.5 0 00-.12 1.03v.228m19.5 0a3 3 0 01-3 3H5.25a3 3 0 01-3-3m19.5 0a3 3 0 00-3-3H5.25a3 3 0 00-3 3m16.5 0h.008v.008h-.008v-.008zm-3 0h.008v.008h-.008v-.008z"+ />+ </svg>+</template>diff --git a/resources/js/components/icons/IconSignalSlash.vue b/resources/js/components/icons/IconSignalSlash.vuenew file mode 100644index 00000000..7e7a0843--- /dev/null+++ b/resources/js/components/icons/IconSignalSlash.vue@@ -0,0 +1,9 @@+<template>+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">+ <path+ stroke-linecap="round"+ stroke-linejoin="round"+ d="M3 3l8.735 8.735m0 0a.374.374 0 11.53.53m-.53-.53l.53.53m0 0L21 21M14.652 9.348a3.75 3.75 0 010 5.304m2.121-7.425a6.75 6.75 0 010 9.546m2.121-11.667c3.808 3.807 3.808 9.98 0 13.788m-9.546-4.242a3.733 3.733 0 01-1.06-2.122m-1.061 4.243a6.75 6.75 0 01-1.625-6.929m-.496 9.05c-3.068-3.067-3.664-7.67-1.79-11.334M12 12h.008v.008H12V12z"+ />+ </svg>+</template>diff --git a/resources/js/components/icons/IconSparkles.vue b/resources/js/components/icons/IconSparkles.vuenew file mode 100644index 00000000..b686b936--- /dev/null+++ b/resources/js/components/icons/IconSparkles.vue@@ -0,0 +1,9 @@+<template>+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">+ <path+ stroke-linecap="round"+ stroke-linejoin="round"+ d="M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09zM18.259 8.715L18 9.75l-.259-1.035a3.375 3.375 0 00-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 002.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 002.456 2.456L21.75 6l-1.035.259a3.375 3.375 0 00-2.456 2.456zM16.894 20.567L16.5 21.75l-.394-1.183a2.25 2.25 0 00-1.423-1.423L13.5 18.75l1.183-.394a2.25 2.25 0 001.423-1.423l.394-1.183.394 1.183a2.25 2.25 0 001.423 1.423l1.183.394-1.183.394a2.25 2.25 0 00-1.423 1.423z"+ />+ </svg>+</template>diff --git a/resources/js/components/icons/IconSun.vue b/resources/js/components/icons/IconSun.vuenew file mode 100644index 00000000..c24741a0--- /dev/null+++ b/resources/js/components/icons/IconSun.vue@@ -0,0 +1,9 @@+<template>+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">+ <path+ stroke-linecap="round"+ stroke-linejoin="round"+ d="M12 3v2.25m6.364.386l-1.591 1.591M21 12h-2.25m-.386 6.364l-1.591-1.591M12 18.75V21m-4.773-4.227l-1.591 1.591M5.25 12H3m4.227-4.773L5.636 5.636M15.75 12a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0z"+ />+ </svg>+</template>diff --git a/resources/js/components/inputs/ButtonCorner.vue b/resources/js/components/inputs/ButtonCorner.vueindex efcde37e..f3d716e2 100755--- a/resources/js/components/inputs/ButtonCorner.vue+++ b/resources/js/components/inputs/ButtonCorner.vue@@ -1,5 +1,6 @@<script setup>-import IconDelete from '../icons/IconDelete.vue';+import IconDelete from '../icons/Icondelete.vue';+const props = defineProps(['positionClasses', 'colourClasses', 'textClasses', 'to', 'label']);</script>diff --git a/resources/js/components/inputs/NavLink.vue b/resources/js/components/inputs/NavLink.vueindex 3d78cc44..00c295b4 100755--- a/resources/js/components/inputs/NavLink.vue+++ b/resources/js/components/inputs/NavLink.vue@@ -8,7 +8,7 @@ const activeColour = `bg-neutral-300 dark:bg-violet-600/60`;<router-link:id="'btn-nav-' + props.label":to="props.URL"- :class="`${props.active ? activeColour : 'bg-neutral-100 dark:bg-primary-dark-800 hover:bg-neutral-200 hover:dark:bg-violet-600/60'} dark:text-neutral-200 flex justify-center items-center shrink-0 h-8 w-8 rounded-lg shadow-lg`"+ :class="`${props.active ? activeColour : `bg-white dark:bg-primary-dark-800`} hover:bg-neutral-100 hover:dark:bg-violet-600/60 dark:text-neutral-200 flex justify-center items-center shrink-0 h-8 w-8 rounded-lg shadow-lg`":aria-label="props.label"><slot name="icon"></slot>diff --git a/resources/js/components/panels/NavBar.vue b/resources/js/components/panels/NavBar.vueindex ba76c65b..f4372be0 100755--- a/resources/js/components/panels/NavBar.vue+++ b/resources/js/components/panels/NavBar.vue@@ -10,9 +10,11 @@ import NavButton from '@/components/inputs/NavButton.vue';import NavLink from '@/components/inputs/NavLink.vue';import MaterialSymbolsLightHistory from '~icons/material-symbols-light/history';+import MaterialSymbolsLightMenu from '~icons/material-symbols-light/menu?width=24px&height=24px';import CircumFolderOn from '~icons/circum/folder-on';import CircumInboxIn from '~icons/circum/inbox-in';import CircumMonitor from '~icons/circum/monitor';+import ProiconsMenu from '~icons/proicons/menu?width=24px&height=24px';const authStore = useAuthStore();const appStore = useAppStore();@@ -54,7 +56,7 @@ watch(userData, handleAuthEvent, { immediate: false });<template #trigger><buttonid="user-header"- class="flex gap-2 text-2xl text-slate-900 dark:text-white hover:text-violet-500 dark:hover:text-violet-600 items-center justify-center capitalize h-8"+ class="flex gap-2 text-2xl text-slate-900 dark:text-white hover:text-violet-600 items-center justify-center capitalize h-8"@click="toggleDropdown"><span id="user-name" class="hidden sm:block truncate" v-if="username">{{ username }}</span>@@ -62,7 +64,7 @@ watch(userData, handleAuthEvent, { immediate: false });<img:src="userData?.value?.avatar ?? '/storage/avatars/12345.jpg'"- class="h-7 w-7 rounded-full ring-2 ring-violet-600/60 object-cover aspect-square"+ class="h-7 w-7 rounded-full ring-2 ring-violet-600/80 object-cover aspect-square"alt="profile picture"/></button></template>@@ -106,7 +108,7 @@ watch(userData, handleAuthEvent, { immediate: false });:class="`ring-1 ring-gray-900/5`"><template #icon>- <MaterialSymbolsLightHistory height="24" width="24" />+ <MaterialSymbolsLightMenu height="26" width="26" /></template></NavButton><NavLink v-if="$route.name != 'home'" :label="'home'" :URL="'/'" :class="`ring-1 ring-gray-900/5`">diff --git a/resources/js/components/panels/VideoSidebar.vue b/resources/js/components/panels/VideoSidebar.vueindex f5a10f3a..29ba2eb7 100755--- a/resources/js/components/panels/VideoSidebar.vue+++ b/resources/js/components/panels/VideoSidebar.vue@@ -33,7 +33,7 @@ watch(selectedSideBar, () => {<template><div class="flex p-1 text-ri">- <h1 id="sidebar-title" class="text-2xl w-full capitalize dark:text-white">{{ selectedSideBar }}</h1>+ <h1 id="sidebar-title" class="text-xl h-8 w-full capitalize dark:text-white">{{ selectedSideBar }}</h1></div><hr class="mt-2 mb-3" />diff --git a/resources/js/components/pulseCards/PulseServers.vue b/resources/js/components/pulseCards/PulseServers.vuenew file mode 100644index 00000000..c7780fb8--- /dev/null+++ b/resources/js/components/pulseCards/PulseServers.vue@@ -0,0 +1,491 @@+<script setup lang="ts">+import type { PulseResponse, PulseServerResponse } from '@/types/types.ts';++import { useGetPulse } from '@/service/queries';+import { toTimeSpan } from '@/service/util';+import { ref, watch } from 'vue';++import IconSignalSlash from '../icons/IconSignalSlash.vue';+import IconServer from '../icons/IconServer.vue';+import PulseLineChart from '../charts/PulseLineChart.vue';+import PulseDoughnutChart from '../charts/PulseDoughnutChart.vue';++const { data, isLoading } = useGetPulse('servers');++const pulseData = ref<PulseResponse>();+const servers = ref<{ [key: string]: PulseServerResponse }>();++const props = withDefaults(+ defineProps<{+ cols?: number | string;+ rows?: number;+ class?: string;+ }>(),+ {+ cols: 'full',+ rows: 1,+ },+);++function friendlySize(mb: number, precision: number = 0) {+ if (!mb && mb !== 0) return '';+ if (mb >= 1024 * 1024) {+ return `${parseFloat((mb / 1024 / 1024)?.toFixed(precision))}TB`;+ }+ if (mb >= 1024) {+ return `${parseFloat((mb / 1024)?.toFixed(precision))}GB`;+ }+ return `${mb?.toFixed(precision)}MB`;+}++watch(+ () => data.value,+ () => {+ if (data.value.data) {+ pulseData.value = data.value.data;+ console.log(data.value.data);+ }+ if (data.value.data.servers) {+ servers.value = data.value.data.servers.servers;+ console.log(data.value.data.servers.servers);+ }+ },+);++// Alpine.data('cpuChart', (config) => ({+// init() {+// let chart = new Chart(this.$refs.canvas, {+// type: 'line',+// data: {+// labels: config.labels.map(formatDate),+// datasets: [+// {+// label: 'CPU Percent',+// borderColor: '#9333ea',+// borderWidth: 2,+// borderCapStyle: 'round',+// data: config.data,+// pointHitRadius: 10,+// pointStyle: false,+// tension: 0.2,+// spanGaps: false,+// },+// ],+// },+// options: {+// maintainAspectRatio: false,+// layout: {+// autoPadding: false,+// },+// scales: {+// x: {+// display: false,+// grid: {+// display: false,+// },+// },+// y: {+// display: false,+// min: 0,+// max: 100,+// grid: {+// display: false,+// },+// },+// },+// plugins: {+// legend: {+// display: false,+// },+// tooltip: {+// mode: 'index',+// position: 'nearest',+// intersect: false,+// callbacks: {+// title: () => '',+// label: (context) => `${context.label} - ${context.formattedValue}%`,+// },+// displayColors: false,+// },+// },+// },+// });++// Livewire.on('servers-chart-update', ({ servers }) => {+// if (chart === undefined) {+// return;+// }++// if (servers[config.slug] === undefined && chart) {+// chart.destroy();+// chart = undefined;+// return;+// }++// chart.data.labels = Object.keys(servers[config.slug].cpu).map(formatDate);+// chart.data.datasets[0].data = Object.values(servers[config.slug].cpu);+// chart.update();+// });+// },+// }));+// Alpine.data('memoryChart', (config) => ({+// init() {+// let chart = new Chart(this.$refs.canvas, {+// type: 'line',+// data: {+// labels: config.labels.map(formatDate),+// datasets: [+// {+// label: 'Memory Used',+// borderColor: '#9333ea',+// borderWidth: 2,+// borderCapStyle: 'round',+// data: config.data,+// pointHitRadius: 10,+// pointStyle: false,+// tension: 0.2,+// spanGaps: false,+// },+// ],+// },+// options: {+// maintainAspectRatio: false,+// layout: {+// autoPadding: false,+// },+// scales: {+// x: {+// display: false,+// grid: {+// display: false,+// },+// },+// y: {+// display: false,+// min: 0,+// max: config.total,+// grid: {+// display: false,+// },+// },+// },+// plugins: {+// legend: {+// display: false,+// },+// tooltip: {+// mode: 'index',+// position: 'nearest',+// intersect: false,+// callbacks: {+// title: () => '',+// label: (context) => `${context.label} - ${context.formattedValue} MB`,+// },+// displayColors: false,+// },+// },+// },+// });++// Livewire.on('servers-chart-update', ({ servers }) => {+// if (chart === undefined) {+// return;+// }++// if (servers[config.slug] === undefined && chart) {+// chart.destroy();+// chart = undefined;+// return;+// }++// chart.data.labels = Object.keys(servers[config.slug].memory).map(formatDate);+// chart.data.datasets[0].data = Object.values(servers[config.slug].memory);+// chart.update();+// });+// },+// }));++// Alpine.data('storageChart', (config) => ({+// init() {+// let chart = new Chart(this.$refs.canvas, {+// type: 'doughnut',+// data: {+// labels: ['Used', 'Free'],+// datasets: [+// {+// data: [config.used, config.total - config.used],+// backgroundColor: ['#9333ea', '#c084fc30'],+// hoverBackgroundColor: ['#9333ea', '#c084fc30'],+// },+// ],+// },+// options: {+// borderWidth: 0,+// plugins: {+// legend: {+// display: false,+// },+// tooltip: {+// enabled: false,+// callbacks: {+// label: (context) => context.formattedValue + ' MB',+// },+// displayColors: false,+// },+// },+// },+// });++// Livewire.on('servers-chart-update', ({ servers }) => {+// const storage = servers[config.slug]?.storage?.find((storage) => storage.directory === config.directory);++// if (chart === undefined) {+// return;+// }++// if (storage === undefined && chart) {+// chart.destroy();+// chart = undefined;+// return;+// }++// chart.data.datasets[0].data = [storage.used, storage.total - storage.used];+// chart.update();+// });+// },+// }));+</script>++<template>+ <section+ :class="`overflow-x-auto overflow-y-hidden max-w-full pb-px default:col-span-full default:lg:col-span-${props.cols} default:row-span-${props.rows} ${props.class} ${isLoading && 'opacity-25 animate-pulse'}`"+ >+ <div+ v-if="servers"+ class="max-w-full grid grid-cols-[max-content,minmax(max-content,1fr),max-content,minmax(min-content,2fr),max-content,minmax(min-content,2fr),minmax(max-content,1fr)]"+ >+ <div></div>+ <div></div>+ <div class="text-xs uppercase text-left text-gray-500 dark:text-gray-400 font-bold">CPU</div>+ <div></div>+ <div class="text-xs uppercase text-left text-gray-500 dark:text-gray-400 font-bold">Memory</div>+ <div></div>+ <div class="text-xs uppercase text-left text-gray-500 dark:text-gray-400 font-bold">Storage</div>+ <template v-for="server in Object.keys(servers)" :key="`${server}-indicator`" class="flex">+ <div+ :class="`flex items-center ${(Object.keys(servers).length ?? 0) > 1 ? 'py-2' : ''}`"+ :title="`${toTimeSpan(servers[server].updated_at)}`"+ >+ <div v-if="servers[server]?.recently_reported" class="w-5 flex justify-center mr-1">+ <div class="h-1 w-1 bg-green-500 rounded-full animate-pulse"></div>+ </div>+ <IconSignalSlash v-else class="w-5 h-5 stroke-red-500 mr-1" />+ </div>+ <div+ :id="`${server}-name`"+ :class="`flex items-center pr-8 xl:pr-12 ${(Object.keys(servers).length ?? 0) > 1 ? 'py-2' : ''} ${!servers[server].recently_reported ? 'opacity-25 animate-pulse' : ''}`"+ >+ <IconServer class="w-6 h-6 mr-2 stroke-gray-500 dark:stroke-gray-400" />+ <span+ class="text-base font-bold text-gray-600 dark:text-gray-300"+ :title="`Time: ${Intl.NumberFormat().format(pulseData?.servers?.time ?? 0)}ms; Run at: ${pulseData?.servers?.runAt ? new Date(pulseData?.servers?.runAt).toLocaleDateString() : ''};`"+ >+ {{ servers[server]?.name }}+ </span>+ </div>+ <div+ :id="`${server}-cpu`"+ :class="`flex items-center ${(Object.keys(servers).length ?? 0) > 1 ? 'py-2' : ''} ${!servers[server].recently_reported ? 'opacity-25 animate-pulse' : ''}`"+ >+ <div class="text-xl font-bold text-gray-700 dark:text-gray-200 w-14 whitespace-nowrap tabular-nums">+ {{ servers[server].cpu_current }}%+ </div>+ </div>+ <div+ :id="`${server}-cpu-graph`"+ :class="`flex items-center pr-8 xl:pr-12 ${(Object.keys(servers).length ?? 0) > 1 ? 'py-2' : ''} ${!servers[server].recently_reported ? 'opacity-25 animate-pulse' : ''}`"+ >+ <div class="w-full min-w-[5rem] max-w-xs h-9 relative">+ <PulseLineChart+ :chart-data="{+ labels: Object.keys(servers[server].cpu),+ datasets: [+ {+ label: 'CPU Percent',+ borderColor: '#9333ea',+ borderWidth: 2,+ borderCapStyle: 'round',+ data: Object.values(servers[server].cpu).map((value) => parseFloat(value)),+ pointHitRadius: 10,+ pointStyle: false,+ tension: 0.2,+ spanGaps: false,+ },+ ],+ }"+ :chart-options="{+ maintainAspectRatio: false,+ layout: {+ autoPadding: false,+ },+ scales: {+ x: {+ display: false,+ grid: {+ display: false,+ },+ },+ y: {+ display: false,+ min: 0,+ max: 100,+ grid: {+ display: false,+ },+ },+ },+ plugins: {+ legend: {+ display: false,+ },+ tooltip: {+ mode: 'index',+ position: 'nearest',+ intersect: false,+ callbacks: {+ title: () => '',+ label: (context: any) => `${context.label} - ${context.formattedValue}%`,+ },+ displayColors: false,+ },+ },+ }"+ />+ </div>+ </div>+ <div+ :id="`${server}-memory`"+ :class="`flex items-center ${(Object.keys(servers).length ?? 0) > 1 ? 'py-2' : ''} ${!servers[server].recently_reported ? 'opacity-25 animate-pulse' : ''}`"+ >+ <div class="w-36 flex-shrink-0 whitespace-nowrap tabular-nums">+ <span class="text-xl font-bold text-gray-700 dark:text-gray-200">+ {{ friendlySize(servers[server].memory_current, 1) }}+ </span>+ <span class="text-sm font-medium text-gray-500 dark:text-gray-400">+ / {{ friendlySize(servers[server].memory_total, 1) }}+ </span>+ </div>+ </div>+ <div+ :id="`${server}-memory-graph`"+ :class="`flex items-center pr-8 xl:pr-12 ${(Object.keys(servers).length ?? 0) > 1 ? 'py-2' : ''} ${!servers[server].recently_reported ? 'opacity-25 animate-pulse' : ''}`"+ >+ <div class="w-full min-w-[5rem] max-w-xs h-9 relative">+ <PulseLineChart+ :chart-data="{+ labels: Object.keys(servers[server].memory),+ datasets: [+ {+ label: 'Memory Used',+ borderColor: '#9333ea',+ borderWidth: 2,+ borderCapStyle: 'round',+ data: Object.values(servers[server].memory).map((value) => parseFloat(value)),+ pointHitRadius: 10,+ pointStyle: false,+ tension: 0.2,+ spanGaps: false,+ },+ ],+ }"+ :chart-options="{+ maintainAspectRatio: false,+ layout: {+ autoPadding: false,+ },+ scales: {+ x: {+ display: false,+ grid: {+ display: false,+ },+ },+ y: {+ display: false,+ min: 0,+ max: servers[server].memory.total,+ grid: {+ display: false,+ },+ },+ },+ plugins: {+ legend: {+ display: false,+ },+ tooltip: {+ mode: 'index',+ position: 'nearest',+ intersect: false,+ callbacks: {+ title: () => '',+ label: (context: any) => `${context.label} - ${context.formattedValue} MB`,+ },+ displayColors: false,+ },+ },+ }"+ />+ </div>+ </div>+ <div+ :id="`${server}-storage`"+ :class="`flex items-center gap-8 ${(Object.keys(servers).length ?? 0) > 1 ? 'py-2' : ''} ${!servers[server].recently_reported ? 'opacity-25 animate-pulse' : ''}`"+ >+ <div+ v-for="storage in servers[server].storage"+ :key="`${server}-storage-${storage.directory}`"+ class="flex items-center gap-4"+ :title="`Directory: ${storage.directory}`"+ >+ <div class="whitespace-nowrap tabular-nums">+ <span class="text-xl font-bold text-gray-700 dark:text-gray-200">{{ friendlySize(storage.used) }}</span>+ <span class="text-sm font-medium text-gray-500 dark:text-gray-400">/ {{ friendlySize(storage.total) }}</span>+ </div>++ <div>+ <PulseDoughnutChart+ class="h-8 w-8"+ :chart-data="{+ labels: ['Used', 'Free'],+ datasets: [+ {+ data: [storage.used, storage.total - storage.used],+ backgroundColor: ['#9333ea', '#c084fc30'],+ hoverBackgroundColor: ['#9333ea', '#c084fc30'],+ },+ ],+ }"+ :chart-options="{+ borderWidth: 0,+ plugins: {+ legend: {+ display: false,+ },+ tooltip: {+ enabled: false,+ callbacks: {+ label: (context: any) => context.formattedValue + ' MB',+ },+ displayColors: false,+ },+ },+ }"+ />+ </div>+ </div>+ </div>+ </template>+ </div>+ </section>+</template>diff --git a/resources/js/composables/useMetaData.js b/resources/js/composables/useMetaData.jsindex 51425487..5312c843 100755--- a/resources/js/composables/useMetaData.js+++ b/resources/js/composables/useMetaData.js@@ -27,7 +27,7 @@ export default function useMetaData(data) {});}-export function formatFileSize(size) {+export function formatFileSize(size, space = true) {if (isNaN(size) || size < 0) {return 'Invalid size';}@@ -42,5 +42,5 @@ export function formatFileSize(size) {// 2 decimal placesconst formattedSize = Math.round(size * 100) / 100;- return `${formattedSize} ${units[unitIndex]}`;+ return `${formattedSize}${space ? ' ' : ''}${units[unitIndex]}`;}diff --git a/resources/js/layouts/LayoutBase.vue b/resources/js/layouts/LayoutBase.vueindex 0e4ae47f..713ac4fc 100755--- a/resources/js/layouts/LayoutBase.vue+++ b/resources/js/layouts/LayoutBase.vue@@ -19,16 +19,17 @@ const scrollBody = ref(null);<template><div class="h-screen" :class="{ '': scrollLock }" ref="scrollBody"><!-- overflow-y-hidden -->+ <!-- class="flex p-6 gap-6 flex-wrap lg:flex-nowrap snap-y bg-primary-950 dark:bg-primary-dark-950 dark:text-[#e2e0e2] font-sans text-gray-900 antialiased" --><main- class="flex p-6 gap-6 flex-wrap lg:flex-nowrap snap-y bg-primary-950 dark:bg-primary-dark-950 dark:text-[#e2e0e2] font-sans text-gray-900 antialiased"+ class="grid grid-cols-1 lg:grid-cols-6 p-6 gap-6 snap-y bg-primary-950 dark:bg-primary-dark-950 dark:text-[#e2e0e2] font-sans text-gray-900 antialiased">- <section- id="left-card"- class="w-full h-fit p-3 pb-6 rounded-2xl lg:w-1/6 lg:max-w-72 sm:min-w-32 shrink-0 space-y-2 scroll-mt-6 hidden lg:block"- ></section>+ <section id="left-card" class="col-span-1 h-fit order-2 lg:order-1 p-3 pb-6 rounded-2xl space-y-2 scroll-mt-6 hidden lg:block">+ <slot name="leftSidebar"></slot>+ </section>+ <!-- class="bg-primary-900 dark:bg-primary-dark-900 dark:text-[#e2e0e2] shadow-xl p-6 pt-3 rounded-2xl w-full h-fit flex flex-col gap-3 z-20 ring-1 ring-gray-900/5" --><sectionid="content-card"- class="bg-primary-900 dark:bg-primary-dark-900 dark:text-[#e2e0e2] shadow-xl p-6 pt-3 rounded-2xl w-full h-fit flex flex-col gap-3 z-20 ring-1 ring-gray-900/5"+ class="col-span-4 flex-grow order-1 lg:order-2 bg-primary-900 dark:bg-primary-dark-900 dark:text-[#e2e0e2] shadow-xl p-6 pt-3 rounded-2xl w-full h-fit flex flex-col gap-3 z-20 ring-1 ring-gray-900/5"><NavBar class="z-20" /><slot name="content" class="relative z-0"></slot>@@ -36,8 +37,10 @@ const scrollBody = ref(null);<sectionid="list-card":class="{ invisible: !selectedSideBar }"- class="bg-primary-900 dark:bg-primary-dark-900 dark:text-[#e2e0e2] shadow-xl p-3 rounded-2xl w-full h-fit lg:w-1/6 lg:max-w-72 sm:min-w-32 shrink-0 space-y-2 scroll-mt-6 z-20 ring-1 ring-gray-900/5"+ class="col-span-1 h-fit order-3 bg-primary-900 dark:bg-primary-dark-900 dark:text-[#e2e0e2] shadow-xl p-3 rounded-2xl space-y-2 scroll-mt-6 z-20 ring-1 ring-gray-900/5">+ <!-- w-full h-fit lg:w-1/6 lg:max-w-72 sm:min-w-32 shrink-0 -->+ <!-- class="bg-primary-900 dark:bg-primary-dark-900 dark:text-[#e2e0e2] shadow-xl p-3 rounded-2xl w-full h-fit lg:w-1/6 lg:max-w-72 sm:min-w-32 shrink-0 space-y-2 scroll-mt-6 z-20 ring-1 ring-gray-900/5" --><slot name="sidebar"></slot></section></main>diff --git a/resources/js/service/mutations.ts b/resources/js/service/mutations.tsindex acadfce9..eb544cfe 100644--- a/resources/js/service/mutations.ts+++ b/resources/js/service/mutations.ts@@ -9,8 +9,8 @@ export const UseCreatePlayback = () => {return useMutation({mutationFn: mediaAPI.createPlayback,onError: () => {},- onSuccess: (data, variable) => {},- onSettled: async (data, error, variable) => {+ onSuccess: () => {},+ onSettled: async () => {// console.log(variable);await queryClient.invalidateQueries({queryKey: ['videoPlayback'],@@ -24,8 +24,8 @@ export const UseCreateTag = () => {return useMutation({mutationFn: CreateTag,onError: () => {},- onSuccess: (data, variable) => {},- onSettled: async (data, error, variable) => {+ onSuccess: () => {},+ onSettled: async () => {// console.log(variable);await queryClient.invalidateQueries({queryKey: ['videoTags'],diff --git a/resources/js/service/queries.ts b/resources/js/service/queries.tsindex 4c73e3c9..88ec83c1 100644--- a/resources/js/service/queries.ts+++ b/resources/js/service/queries.ts@@ -1,8 +1,10 @@+import type { PulseResponse } from '@/types/types.ts';import type { Ref } from 'vue';+import { getPulse } from '@/service/siteAPI.ts';import { useQuery } from '@tanstack/vue-query';-import mediaAPI from './mediaAPI.ts';+import mediaAPI from '@/service/mediaAPI.ts';export const useGetVideoTags = () => {return useQuery({@@ -24,6 +26,16 @@ export const useVideoPlayback = (idRef: Ref<number, number>) => {});};+export const useGetPulse = (type?: string) => {+ return useQuery<{ data: PulseResponse }>({+ queryKey: ['pulse'],+ queryFn: async () => {+ const { data: response } = await getPulse(type);+ return response;+ },+ });+};+// export const useGetChatRoomMessagesQuery = (chat_id: number | null) => {// return useInfiniteQuery({// queryKey: ['chatroom-messages', chat_id],diff --git a/resources/js/service/siteAPI.ts b/resources/js/service/siteAPI.tsindex 8273d588..8705b223 100644--- a/resources/js/service/siteAPI.ts+++ b/resources/js/service/siteAPI.ts@@ -7,8 +7,10 @@*/import { API } from './api';-export default {- getStats() {- return API.get(`/site/`);- },-};+export function getStats() {+ return API.get(`/site/`);+}++export function getPulse(type?: string) {+ return API.get(`/pulse/${type ?? ''}`);+}diff --git a/resources/js/service/util.js b/resources/js/service/util.tsold mode 100755new mode 100644similarity index 75%rename from resources/js/service/util.jsrename to resources/js/service/util.tsindex 7e397670..59ff770a--- a/resources/js/service/util.js+++ b/resources/js/service/util.ts@@ -1,10 +1,15 @@-export function toTitleCase(str) {+export function toTitleCase(str: string) {return str.toLowerCase().replace(/(?:^|\s)\w/g, function (match) {return match.toUpperCase();});}-export function toTimeSpan(rawDate) {+export function toTimeSpan(rawDate: Date | string) {+ if (!rawDate) return '';+ if (typeof rawDate === 'string') {+ rawDate = new Date(rawDate + ' EST');+ }+const rawAge = Date.now() - rawDate.getTime();const weeks = Math.round(rawAge / (1000 * 3600 * 24 * 7));@@ -27,15 +32,15 @@ export function toTimeSpan(rawDate) {return timeSpan;}-export function toFormattedDate(rawDate) {+export function toFormattedDate(rawDate: Date) {return rawDate.toLocaleString([], { year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit', hour12: true }).toLocaleUpperCase().replaceAll('.', '');}-export function toFormattedDuration(rawSeconds) {- if (isNaN(parseInt(rawSeconds))) return null;+export function toFormattedDuration(rawSeconds: number = 0) {+ if (isNaN(parseInt(rawSeconds.toString()))) return null;const hours = Math.floor(rawSeconds / 3600);const minutes = Math.floor((rawSeconds % 3600) / 60);const seconds = Math.floor(rawSeconds % 60);@@ -45,11 +50,11 @@ export function toFormattedDuration(rawSeconds) {return duration;}-export function formatInteger(integer, minimumDigits = 2) {+export function formatInteger(integer: number, minimumDigits = 2) {return integer.toLocaleString('en-CA', { minimumIntegerDigits: minimumDigits });}-export function toCalendarFormattedDate(date) {+export function toCalendarFormattedDate(date: string) {let rawDate = new Date(date + ' EST');return rawDate.toLocaleDateString('en-CA', { month: 'long', day: '2-digit', year: 'numeric' }).replaceAll('.', '');diff --git a/resources/js/types/types.ts b/resources/js/types/types.tsindex 63a832ab..20cedc94 100644--- a/resources/js/types/types.ts+++ b/resources/js/types/types.ts@@ -1,6 +1,42 @@-export interface httpResponse {+export interface HttpResponse {success?: 'true' | 'false';status?: string;message?: string | null;data: string | number | string[] | number[] | null;}++export interface PulseResponse {+ cache?: any;+ exceptions?: any;+ queues?: any;+ servers?: {+ servers: { [key: string]: PulseServerResponse };+ runAt: string;+ time: number;+ };+ slow_jobs?: any;+ slow_outgoing_requests?: any;+ slow_queries?: any;+ slow_requests?: any;+ usage?: any;+}++export interface PulseServerResponse {+ name: string;+ cpu_current: number;+ cpu: { [key: string]: string };+ memory_current: number;+ memory_total: number;+ memory: { [key: string]: string };+ storage: { directory: string; total: number; used: number }[];+ updated_at: string;+ recently_reported: boolean;+ runAt: string;+ time: number;+}++export interface ChartData {+ labels: string[];+}++export interface ChartOptions {}diff --git a/resources/js/views/DashboardView.vue b/resources/js/views/DashboardView.vueindex 7ad672a5..db0bcd93 100644--- a/resources/js/views/DashboardView.vue+++ b/resources/js/views/DashboardView.vue@@ -1,13 +1,14 @@<script setup lang="ts">+import { onMounted, ref } from 'vue';import { useAppStore } from '@/stores/AppStore';import { storeToRefs } from 'pinia';-import { onMounted, ref } from 'vue';+import { getStats } from '@/service/siteAPI';+import PulseServers from '@/components/pulseCards/PulseServers.vue';import LayoutBase from '@/layouts/LayoutBase.vue';import ModalBase from '@/components/pinesUI/ModalBase.vue';import StatsCard from '@/components/cards/StatsCard.vue';import useModal from '@/composables/useModal';-import siteAPI from '@/service/siteAPI';const cancelModal = useModal({ title: 'Cancel Job?', submitText: 'Confim' });const appStore = useAppStore();@@ -20,6 +21,17 @@ const handleCancel = () => {cancelModal.toggleModal(true);};+const setPeriod = (period: string) => {+ let query = new URLSearchParams(window.location.search);+ if (period === '1_hour') {+ query.delete('period');+ } else {+ query.set('period', period);+ }++ // window.location = `${location.pathname}?${query}`;+};+onMounted(async () => {pageTitle.value = 'Dashboard';selectedSideBar.value = '';@@ -27,7 +39,7 @@ onMounted(async () => {// await getRecords();// loading.value = false;// })();- const { data } = await siteAPI.getStats();+ const { data } = await getStats();stats.value = data;});</script>@@ -35,8 +47,9 @@ onMounted(async () => {<template><LayoutBase><template v-slot:content>- <section id="content-dashboard" class="space-y-2 min-h-[80vh]">- <span class="flex flex-wrap gap-4">+ <section id="content-dashboard" class="flex flex-wrap gap-4 flex-col min-h-[80vh]">+ <PulseServers />+ <span class="mx-auto grid grid-flow-row auto-rows-max gap-6 w-full"><StatsCard v-for="stat in stats" :title="`Total ${stat.title}`" :forceCount="stat.count" /></span></section>@@ -50,6 +63,45 @@ onMounted(async () => {</template><template v-slot:sidebar><!-- <HistorySidebar /> -->+ <div class="flex p-1 text-ri">+ <h1 id="sidebar-title" class="text-2xl h-8 w-full capitalize dark:text-white">{{ 'Management' }}</h1>+ </div>++ <hr class="mt-2 mb-3" />++ <section class="sm:text-lg flex flex-col gap-2">+ <div+ class="flex justify-between items-center bg-white rounded-lg p-2 shadow ring-inset ring-purple-600 hover:ring-[0.125rem]"+ >+ Pulse+ <div class="flex items-center">+ <button+ @click="setPeriod('1_hour')"+ class="p-1 font-semibold sm:text-lg text-gray-300 dark:text-gray-600 hover:text-gray-400 dark:hover:text-gray-500"+ >+ 1h+ </button>+ <button+ @click="setPeriod('6_hours')"+ class="p-1 font-semibold sm:text-lg text-gray-300 dark:text-gray-600 hover:text-gray-400 dark:hover:text-gray-500"+ >+ 6h+ </button>+ <button @click="setPeriod('24_hours')" class="p-1 font-semibold sm:text-lg text-gray-700 dark:text-gray-300">+ 24h+ </button>+ <button+ @click="setPeriod('7_days')"+ class="p-1 font-semibold sm:text-lg text-gray-300 dark:text-gray-600 hover:text-gray-400 dark:hover:text-gray-500"+ >+ 7d+ </button>+ </div>+ </div>+ <div class="flex justify-between items-center bg-white rounded-lg p-2 shadow">Activity</div>+ <div class="flex justify-between items-center bg-white rounded-lg p-2 shadow">Jobs</div>+ <div class="flex justify-between items-center bg-white rounded-lg p-2 shadow">Content</div>+ </section></template></LayoutBase></template>diff --git a/resources/js/views/VideoView.vue b/resources/js/views/VideoView.vueindex 976299ff..0d4af1c4 100755--- a/resources/js/views/VideoView.vue+++ b/resources/js/views/VideoView.vue@@ -101,6 +101,15 @@ onMounted(async () => {await getCategory(URL_CATEGORY, URL_FOLDER);loading.value = false;++ // pageTitle.value = 'Dashboard';+ selectedSideBar.value = '';+ // (async () => {+ // await getRecords();+ // loading.value = false;+ // })();+ // const { data } = await getStats();+ // stats.value = data;});watch(diff --git a/resources/views/vendor/pulse/dashboard.blade.php b/resources/views/vendor/pulse/dashboard.blade.phpindex 7406e377..3d492059 100644--- a/resources/views/vendor/pulse/dashboard.blade.php+++ b/resources/views/vendor/pulse/dashboard.blade.php@@ -17,7 +17,7 @@<livewire:pulse.slow-outgoing-requests cols="6" />- <livewire:pulse.schedule cols="8" />+ <livewire:pulse.schedule cols="6" rows="2" />- <livewire:requests-graph cols="4" />+ <livewire:requests-graph cols="6" rows="2" /></x-pulse>\ No newline at end of filediff --git a/routes/api.php b/routes/api.phpindex 25dbaa98..f11f1aa4 100755--- a/routes/api.php+++ b/routes/api.php@@ -15,6 +15,7 @@ use App\Http\Controllers\DirectoryController;use Illuminate\Http\Request;use Illuminate\Support\Facades\Route;+use Robertogallea\PulseApi\Http\Controllers\DashboardController;Route::get('/user', function (Request $request) {return $request->user();@@ -33,6 +34,20 @@ Route::group(['middleware' => ['auth:sanctum']], function () {Route::resource('/site', SiteController::class)->only(['index']);});+Route::prefix('pulse')->group(function () {+ Route::get('/', [DashboardController::class, 'index'])->name('dashboard');+ Route::get('/{type}', [DashboardController::class, 'show'])->name('resource');+})->middleware('auth');++// Route::prefix(config('pulse-api.route_prefix') . '/' . config('pulse-api.path'))+// ->middleware(config('pulse-api.middleware'))+// ->name('api.pulse.')+// ->group(['middleware' => ['auth:sanctum']], function () {+// Route::get('/', [DashboardController::class, 'index'])+// ->name('dashboard');+// Route::get('/{type}', [DashboardController::class, 'show'])+// ->name('resource');+// });// publicRoute::post('/login', [AuthController::class, 'login']); // Deprecatediff --git a/tsconfig.json b/tsconfig.jsonindex bedd2e43..fa554a9e 100644--- a/tsconfig.json+++ b/tsconfig.json@@ -1,10 +1,19 @@{"extends": "@vue/tsconfig/tsconfig.dom.json",- "include": ["resources/**/*.ts", "resources/**/*.js", "resources/**/*.d.ts", "resources/**/*.vue"],+ "include": [+ "resources/**/*.ts",+ "resources/**/*.js",+ "resources/**/*.d.ts",+ "resources/**/*.vue"+ ],"compilerOptions": {- "target": "ES2020",+ "target": "ES2021","module": "ESNext",- "lib": ["ES2020", "DOM", "DOM.Iterable"],+ "lib": [+ "ES2021",+ "DOM",+ "DOM.Iterable"+ ],/* Bundler mode */"moduleResolution": "node","allowImportingTsExtensions": true,@@ -20,8 +29,13 @@"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo","baseUrl": ".","paths": {- "@/*": ["resources/js/*"]+ "@/*": [+ "resources/js/*"+ ]},- "types": ["vite/client", "unplugin-icons/types/vue"]+ "types": [+ "vite/client",+ "unplugin-icons/types/vue",+ ]}-}+}\ No newline at end of file