Skip to content

A self-hosted media server and file management system

cool changes

aminnausin8a79d6c3f975
diff --git a/app/Http/Controllers/Api/V1/SubTaskController.php b/app/Http/Controllers/Api/V1/SubTaskController.php
new file mode 100644
index 00000000..e526bd0f
--- /dev/null
+++ b/app/Http/Controllers/Api/V1/SubTaskController.php
@@ -0,0 +1,69 @@
+<?php
+
+namespace App\Http\Controllers\Api\V1;
+
+use App\Http\Controllers\Controller;
+use App\Models\SubTask;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Auth;
+
+class SubTaskController extends Controller {
+ /**
+ * Display a listing of the resource.
+ */
+ public function index() {
+ //
+ }
+
+ /**
+ * Show the form for creating a new resource.
+ */
+ public function create() {
+ //
+ }
+
+ /**
+ * Store a newly created resource in storage.
+ */
+ public function store(Request $request) {
+ //
+ }
+
+ /**
+ * Display the specified resource.
+ */
+ public function show(string $id) {
+ //
+ }
+
+ /**
+ * Show the form for editing the specified resource.
+ */
+ public function edit(string $id) {
+ //
+ }
+
+ /**
+ * Update the specified resource in storage.
+ */
+ public function update(Request $request, string $id) {
+ //
+ }
+ /**
+ * Remove the specified resource from storage.
+ *
+ * @param int $id
+ * @return \Illuminate\Http\Response
+ */
+ public function destroy(SubTask $task) {
+ return $this->isNotAuthorised() ?? $task->delete() ? $this->success('', 'Success', 200) : $this->error('', 'Not found', 404);
+ }
+
+ private function isNotAuthorised() {
+ if (Auth::id() != 1) {
+ return $this->error('', 'Unauthorised request.', 403);
+ }
+
+ return null;
+ }
+}
diff --git a/app/Http/Controllers/Api/V1/TasksController.php b/app/Http/Controllers/Api/V1/TasksController.php
index 13349757..01be48ce 100644
--- a/app/Http/Controllers/Api/V1/TasksController.php
+++ b/app/Http/Controllers/Api/V1/TasksController.php
@@ -72,4 +72,32 @@ class TasksController extends Controller {
return $this->error(null, 'Unable to get stats. Error: ' . $th->getMessage(), 500);
}
}
+
+ /**
+ * Remove the specified resource from storage.
+ *
+ * @param int $id
+ * @return \Illuminate\Http\Response
+ */
+ public function destroy(Task $task) {
+ return $this->isNotAuthorised() ?? $task->delete() ? $this->success('', 'Success', 200) : $this->error('', 'Not found', 404);
+ }
+
+ /**
+ * Remove the specified resource from storage.
+ *
+ * @param int $id
+ * @return \Illuminate\Http\Response
+ */
+ public function destroySubTask(Task $task) {
+ return $this->isNotAuthorised() ?? $task->delete() ? $this->success('', 'Success', 200) : $this->error('', 'Not found', 404);
+ }
+
+ private function isNotAuthorised() {
+ if (Auth::id() != 1) {
+ return $this->error('', 'Unauthorised request.', 403);
+ }
+
+ return null;
+ }
}
diff --git a/resources/js/components/cards/CategoryCard.vue b/resources/js/components/cards/CategoryCard.vue
index 5aba6351..5e37b736 100644
--- a/resources/js/components/cards/CategoryCard.vue
+++ b/resources/js/components/cards/CategoryCard.vue
@@ -2,9 +2,10 @@
import { type CategoryResource, type FolderResource } from '@/types/resources';
import { formatFileSize, toFormattedDate } from '@/service/util';
+import { ref, useTemplateRef, watch } from 'vue';
+import { startScanFilesTask } from '@/service/siteAPI';
import { useQueryClient } from '@tanstack/vue-query';
import { updateCategory } from '@/service/mediaAPI.ts';
-import { ref, useTemplateRef, watch } from 'vue';
import { toast } from '@/service/toaster/toastService';
import Popover from '@/components/pinesUI/Popover.vue';
@@ -17,7 +18,8 @@ import ProiconsArrowSync from '~icons/proicons/arrow-sync';
import ProiconsDelete from '~icons/proicons/delete';
import ProiconsLock from '~icons/proicons/lock';
import CircumEdit from '~icons/circum/edit';
-import { startScanFilesTask } from '@/service/siteAPI';
+import CircumShare1 from '~icons/circum/share-1';
+import ButtonIcon from '../inputs/ButtonIcon.vue';
const props = defineProps<{ data?: CategoryResource }>();
const defaultFolder = ref<FolderResource>();
@@ -76,30 +78,34 @@ watch(
</script>
<template>
- <div class="flex flex-col rounded-xl shadow-lg dark:bg-primary-dark-800/70 bg-white ring-1 ring-gray-900/5 w-full">
- <img
- id="folder-thumbnail"
- class="w-full h-40 object-cover rounded-t-md shadow-md mb-auto relative group ring-1 ring-gray-900/5"
- :src="
- defaultFolder?.series?.thumbnail_url ??
- 'https://m.media-amazon.com/images/M/MV5BMjVjZGU5ZTktYTZiNC00N2Q1LThiZjMtMDVmZDljN2I3ZWIwXkEyXkFqcGdeQXVyMTUzMTg2ODkz._V1_.jpg'
- "
- alt="Folder Cover Art"
- loading="lazy"
- />
+ <div class="flex flex-col rounded-xl shadow-lg dark:bg-primary-dark-800/70 bg-white ring-1 ring-gray-900/5 w-full group">
+ <RouterLink :to="`/${data?.name}`" class="w-full h-40">
+ <img
+ class="w-full h-full object-cover rounded-t-md shadow-md mb-auto ring-1 ring-gray-900/5"
+ :src="
+ defaultFolder?.series?.thumbnail_url ??
+ 'https://m.media-amazon.com/images/M/MV5BMjVjZGU5ZTktYTZiNC00N2Q1LThiZjMtMDVmZDljN2I3ZWIwXkEyXkFqcGdeQXVyMTUzMTg2ODkz._V1_.jpg'
+ "
+ alt="Folder Cover Art"
+ loading="lazy"
+ />
+ </RouterLink>
<section class="flex flex-1 h-full flex-col p-4 gap-2">
- <h3 class="capitalize text-lg flex items-start justify-between flex-wrap">
- {{ data?.name }}
-
+ <div class="flex items-start justify-between flex-wrap">
+ <h3 class="capitalize text-lg group-hover:text-purple-600">
+ {{ data?.name }}
+ </h3>
<span class="flex flex-wrap gap-2 [&>*]:h-6 text-sm">
- <ButtonText class="dark:!bg-neutral-950 hidden 2xl:flex" :title="'Scan for Folder Changes'" @click="handleStartScan">
+ <!-- <ButtonText class="hidden 2xl:flex" :title="'Scan for Folder Changes'" @click="handleStartScan">
<template #text> Scan </template>
<template #icon> <ProiconsArrowSync class="h-4 w-4" /></template>
- </ButtonText>
- <Popover popoverClass="w-48 sm:w-64 rounded-lg" :buttonClass="'!p-1 ml-auto'" ref="popover">
+ </ButtonText> -->
+ <ButtonIcon :title="'Open Library In New Tab'" :to="`/${data?.name}`" :target="'_blank'">
+ <template #icon><CircumShare1 class="h-4 w-4" /></template>
+ </ButtonIcon>
+ <Popover popoverClass="!max-w-56 rounded-lg" :buttonClass="'!p-1 ml-auto'" ref="popover">
<template #buttonIcon>
- <ProiconsMoreVertical class="h-4 w-4 2xl:hidden" />
- <CircumEdit class="w-full h-full hidden 2xl:block" />
+ <ProiconsMoreVertical class="h-4 w-4" />
</template>
<template #content>
<div class="grid gap-4">
@@ -128,7 +134,7 @@ watch(
/>
</div>
<ButtonText
- class="h-8 dark:!bg-neutral-950 2xl:hidden"
+ class="h-8 dark:!bg-neutral-950"
:title="'Scan for Folder Changes'"
@click="handleStartScan"
>
@@ -157,7 +163,7 @@ watch(
</template>
</Popover>
</span>
- </h3>
+ </div>
<span class="w-full text-sm text-neutral-500 dark:text-neutral-400" v-if="data">
<span class="flex items-center justify-between mt-auto flex-wrap">
<p class="">Folders: {{ data?.folders_count }}</p>
@@ -183,3 +189,14 @@ watch(
</section>
</div>
</template>
+
+<style lang="css" scoped>
+img {
+ image-rendering: auto;
+ image-rendering: crisp-edges;
+ image-rendering: pixelated;
+
+ /* Safari seems to support, but seems deprecated and does the same thing as the others. */
+ image-rendering: -webkit-optimize-contrast;
+}
+</style>
diff --git a/resources/js/components/cards/SubTaskCard.vue b/resources/js/components/cards/SubTaskCard.vue
index d3aa3acc..71a3811b 100644
--- a/resources/js/components/cards/SubTaskCard.vue
+++ b/resources/js/components/cards/SubTaskCard.vue
@@ -24,61 +24,56 @@ const props = defineProps<{ data: SubTaskResource }>();
</script>
<template>
- <span
- class="flex text-left rounded-xl dark:bg-primary-dark-800/50 bg-primary-800 ring-1 ring-gray-900/5 dark:text-white shadow w-full divide-gray-300 dark:divide-neutral-400"
- >
- <div class="flex flex-col gap-2 ring-1 ring-inset ring-purple-700 rounded-xl shadow-sm w-full">
- <section
- class="bg-white dark:bg-primary-dark-800/70 dark:hover:bg-primary-dark-600 hover:bg-primary-800 p-3 rounded-xl ring-1 ring-gray-900/5 flex gap-4 w-full items-center flex-wrap"
- >
- <div class="relative group flex flex-col gap-2 sm:gap-1 flex-1">
- <div class="flex gap-x-4 gap-y-2 items-center">
- <h2 class="truncate capitalize group" :title="data.name">
- {{ data.name }}
- </h2>
- <p v-if="data.summary" class="truncate text-neutral-500 dark:text-neutral-400 max-w-64">
- {{ data.summary }}
- </p>
- <div
- v-if="(data.summary?.length ?? 0) > 0"
- class="flex z-30 left-20 bottom-10 absolute opacity-0 group-hover:opacity-100 transition-opacity ease-in-out duration-500 w-1/2 text-sm p-3 bg-white dark:odd:bg-primary-dark-600/70 dark:bg-neutral-800/70 backdrop-blur-lg border dark:border-none rounded-md shadow-md border-neutral-200/70 gap-2 items-center"
- >
- <ProiconsCommentExclamation class="h-4 w-4" />
- <p class="text-wrap">{{ data.summary }}</p>
- </div>
- </div>
- <div class="flex gap-x-8 gap-y-2 flex-wrap">
- <h4 class="text-xs text-neutral-500 dark:text-neutral-400 truncate line-clamp-1 capitalize" title="">
- {{
- data.ended_at !== null
- ? `Finished: ${toFormattedDate(new Date(data.ended_at + ' UTC'), true, within24Hrs(data.ended_at + ' UTC') ? { hour: '2-digit', minute: '2-digit' } : undefined)}`
- : data.started_at !== null
- ? `Started: ${toFormattedDate(new Date(data.started_at + ' UTC'), true, within24Hrs(data.started_at + ' UTC') ? { hour: '2-digit', minute: '2-digit' } : undefined)}`
- : `Created: ${toFormattedDate(new Date(data.created_at + ' UTC'), true, within24Hrs(data.created_at + ' UTC') ? { hour: '2-digit', minute: '2-digit' } : undefined)}`
- }}
- </h4>
- <span class="flex gap-x-4 flex-1 flex-wrap">
- <h4
- class="text-xs text-neutral-500 dark:text-neutral-400 truncate line-clamp-1 capitalize w-20"
- title="Duration"
- >
- Duration: {{ toFormattedDuration(data.duration) }}
- </h4>
- </span>
+ <span class="flex text-left rounded-xl ring-1 ring-gray-900/5 dark:text-white shadow w-full divide-gray-300 dark:divide-neutral-400">
+ <section
+ class="flex ring-1 ring-inset ring-purple-700 rounded-xl shadow-sm w-full bg-white dark:bg-primary-dark-800/70 dark:hover:bg-primary-dark-600 hover:bg-primary-800 p-3 gap-4 items-center flex-1"
+ >
+ <div class="relative group flex flex-col gap-1 flex-1">
+ <div class="flex gap-x-4 gap-y-2 items-center">
+ <h2 class="truncate capitalize group" :title="data.name">
+ {{ data.name }}
+ </h2>
+ <p v-if="data.summary" class="truncate text-neutral-500 dark:text-neutral-400 max-w-64 hidden md:block">
+ {{ data.summary }}
+ </p>
+ <div
+ v-if="(data.summary?.length ?? 0) > 0"
+ class="flex z-30 left-20 bottom-10 absolute opacity-0 group-hover:opacity-100 transition-opacity ease-in-out duration-500 w-1/2 text-sm p-3 bg-white dark:odd:bg-primary-dark-600/70 dark:bg-neutral-800/70 backdrop-blur-lg border dark:border-none rounded-md shadow-md border-neutral-200/70 gap-2 items-center"
+ >
+ <ProiconsCommentExclamation class="h-4 w-4" />
+ <p class="text-wrap">{{ data.summary }}</p>
</div>
</div>
+ <div class="flex gap-x-8 gap-y-2 overflow-clip">
+ <h4 class="text-xs text-neutral-500 dark:text-neutral-400 truncate line-clamp-1 capitalize" title="">
+ {{
+ data.ended_at !== null
+ ? `Finished: ${toFormattedDate(new Date(data.ended_at + ' UTC'), true, within24Hrs(data.ended_at + ' UTC') ? { hour: '2-digit', minute: '2-digit' } : undefined)}`
+ : data.started_at !== null
+ ? `Started: ${toFormattedDate(new Date(data.started_at + ' UTC'), true, within24Hrs(data.started_at + ' UTC') ? { hour: '2-digit', minute: '2-digit' } : undefined)}`
+ : `Created: ${toFormattedDate(new Date(data.created_at), true, within24Hrs(data.created_at) ? { hour: '2-digit', minute: '2-digit' } : undefined)}`
+ }}
+ </h4>
+ <h4
+ class="text-xs text-neutral-500 dark:text-neutral-400 truncate line-clamp-1 capitalize w-20 hidden sm:block"
+ title="Duration"
+ >
+ Duration: {{ toFormattedDuration(data.duration) }}
+ </h4>
+ </div>
+ </div>
- <div class="px-2 text-xs flex flex-col gap-1 h-fit min-w-32">
- <p class="w-full text-left pe-8">{{ data.progress }}% Processed</p>
- <div class="rounded-full h-1 w-full bg-primary-dark-900 flex overflow-clip">
- <span
- :class="`h-1 ${data.status === 'completed' ? 'bg-purple-600' : data.status === 'failed' ? 'bg-rose-600' : 'bg-amber-500'} rounded-full`"
- :style="`width: ${data.progress}%;`"
- ></span>
- </div>
+ <div class="px-2 text-xs hidden lg:flex flex-col gap-1 h-fit min-w-32">
+ <p class="w-full text-left pe-8">{{ data.progress }}% Processed</p>
+ <div class="rounded-full h-1 w-full bg-primary-dark-900 flex overflow-clip">
+ <span
+ :class="`h-1 ${data.status === 'completed' ? 'bg-purple-600' : data.status === 'failed' ? 'bg-rose-600' : 'bg-amber-500'} rounded-full`"
+ :style="`width: ${data.progress}%;`"
+ ></span>
</div>
+ </div>
- <!-- <td>
+ <!-- <td>
<PulseDoughnutChart
class="!h-8 !w-8"
:chart-options="{
@@ -106,34 +101,65 @@ const props = defineProps<{ data: SubTaskResource }>();
/>
</td> -->
- <div class="flex gap-1 items-center">
- <ChipTag
- :class="`h-6 shadow-sm`"
- :colour="` ${
- data.status === 'pending'
- ? 'bg-[#e4e4e4] dark:bg-white !text-neutral-900'
- : data.status === 'processing'
- ? 'bg-purple-600 dark:bg-purple-700 !text-white'
- : data.status === 'completed'
- ? 'bg-[#660099] !text-white'
- : data.status === 'incomplete' || data.status === 'cancelled'
- ? 'bg-amber-500 !text-neutral-900 '
- : 'bg-rose-600 dark:bg-rose-700 !text-white'
- }`"
- :label="data.status"
- />
- <ButtonCorner
- disabled
- positionClasses="w-7 h-7 !p-1 ml-auto"
- textClasses="hover:text-rose-600 dark:hover:text-rose-500"
- colourClasses="dark:hover:bg-neutral-900 hover:bg-gray-100 hover:shadow-md"
- label="Remove Sub Task Record From Server"
- >
- <template #text> Remove </template>
- <template #icon> <ProiconsDelete class="h-4 w-4" /></template>
- </ButtonCorner>
- <!-- <Popover
- popoverClass="w-40 rounded-lg "
+ <div class="flex gap-1 items-center">
+ <PulseDoughnutChart
+ class="!h-6 !w-6 lg:!hidden"
+ :chart-options="{
+ borderWidth: 0,
+ plugins: {
+ legend: {
+ display: false,
+ },
+ tooltip: {
+ enabled: false,
+ displayColors: false,
+ },
+ },
+ }"
+ :chart-data="{
+ labels: ['Pending', 'Completed', 'Failed'],
+ datasets: [
+ {
+ data: [
+ 100 - data.progress,
+ data.status === 'processing' || data.status === 'completed' ? data.progress : 0,
+ data.status === 'failed' ? data.progress : 0,
+ ],
+ backgroundColor: ['#f59e0b', '#9333ea', '#be123c'],
+ hoverBackgroundColor: ['#f59e0b', '#9333ea', '#e11d48'],
+ },
+ ],
+ }"
+ />
+ <p class="text-left lg:!hidden text-xs">{{ data.progress }}%</p>
+
+ <ChipTag
+ :class="`h-6 shadow-sm`"
+ :colour="` ${
+ data.status === 'pending'
+ ? 'bg-[#e4e4e4] dark:bg-white !text-neutral-900'
+ : data.status === 'processing'
+ ? 'bg-purple-600 dark:bg-purple-700 !text-white'
+ : data.status === 'completed'
+ ? 'bg-[#660099] !text-white'
+ : data.status === 'incomplete' || data.status === 'cancelled'
+ ? 'bg-amber-500 !text-neutral-900 '
+ : 'bg-rose-600 dark:bg-rose-700 !text-white'
+ }`"
+ :label="data.status"
+ />
+ <ButtonCorner
+ disabled
+ positionClasses="w-7 h-7 !p-1 ml-auto"
+ textClasses="hover:text-rose-600 dark:hover:text-rose-500"
+ colourClasses="dark:hover:bg-neutral-900 hover:bg-gray-100 hover:shadow-md"
+ label="Remove Sub Task Record From Server"
+ >
+ <template #text> Remove </template>
+ <template #icon> <ProiconsDelete class="h-4 w-4" /></template>
+ </ButtonCorner>
+ <!-- <Popover
+ popoverClass="!w-40 rounded-lg "
:buttonComponent="ButtonCorner"
:button-attributes="{
positionClasses: 'w-7 h-7 !p-1 ml-auto',
@@ -171,9 +197,8 @@ const props = defineProps<{ data: SubTaskResource }>();
</div>
</template>
</Popover> -->
- </div>
- </section>
- </div>
- <ProiconsArrowReply class="-scale-y-100 h-6 w-6 mx-2 my-auto" />
+ </div>
+ </section>
+ <ProiconsArrowReply class="-scale-y-100 h-6 w-6 mx-2 my-auto shrink-0" />
</span>
</template>
diff --git a/resources/js/components/cards/TaskCard.vue b/resources/js/components/cards/TaskCard.vue
index 49807853..7b820049 100644
--- a/resources/js/components/cards/TaskCard.vue
+++ b/resources/js/components/cards/TaskCard.vue
@@ -48,7 +48,7 @@ const expanded = ref(false);
{{ data.summary }}
</p>
</div>
- <div class="grid grid-cols-1 md:grid-cols-3 flex-1 w-fit gap-1">
+ <div class="flex justify-between md:grid grid-cols-3 flex-1 w-full md:w-fit gap-4 md:gap-1 flex-wrap">
<div class="flex gap-1 h-fit">
<img
class="aspect-square h-4 my-auto rounded-t-xl xs:rounded-full object-cover"
@@ -60,14 +60,14 @@ const expanded = ref(false);
</h4>
</div>
- <span class="flex gap-1">
+ <span class="flex gap-1 flex-1">
<h4 class="text-xs text-neutral-500 dark:text-neutral-400 truncate line-clamp-1 capitalize" title="Time">
{{
data.ended_at
? `Finished: ${toFormattedDate(new Date(data.ended_at + ' UTC'), true, within24Hrs(data.ended_at + ' UTC') ? { hour: '2-digit', minute: '2-digit' } : undefined)}`
: data.started_at
? `Started: ${toFormattedDate(new Date(data.started_at + ' UTC'), true, within24Hrs(data.started_at + ' UTC') ? { hour: '2-digit', minute: '2-digit' } : undefined)}`
- : `Created: ${toFormattedDate(new Date(data.created_at + ' UTC'), true, within24Hrs(data.created_at + ' UTC') ? { hour: '2-digit', minute: '2-digit' } : undefined)}`
+ : `Created: ${toFormattedDate(new Date(data.created_at), true, within24Hrs(data.created_at) ? { hour: '2-digit', minute: '2-digit' } : undefined)}`
}}
</h4>
@@ -76,7 +76,7 @@ const expanded = ref(false);
</h4>
</span>
- <span class="flex flex-col md:flex-row gap-x-4 flex-1">
+ <span class="flex gap-x-4">
<h4
class="text-xs text-neutral-500 dark:text-neutral-400 truncate line-clamp-1 capitalize w-20"
title="Pending Tasks"
@@ -130,9 +130,37 @@ const expanded = ref(false);
</td> -->
<div class="flex items-center gap-2 w-full md:w-fit">
- <div class="px-2 text-xs flex flex-col gap-1 h-fit min-w-32 flex-1">
+ <PulseDoughnutChart
+ class="!h-8 !w-8 md:!hidden"
+ :chart-options="{
+ borderWidth: 0,
+ plugins: {
+ legend: {
+ display: false,
+ },
+ tooltip: {
+ enabled: false,
+ displayColors: false,
+ },
+ },
+ }"
+ :chart-data="{
+ labels: ['Pending', 'Completed', 'Failed'],
+ datasets: [
+ {
+ data: [data.sub_tasks_pending, data.sub_tasks_complete, data.sub_tasks_failed],
+ backgroundColor: ['#f59e0b', '#9333ea', '#be123c'],
+ hoverBackgroundColor: ['#f59e0b', '#9333ea', '#e11d48'],
+ },
+ ],
+ }"
+ />
+ <p class="w-full text-left md:!hidden text-xs">
+ {{ Math.ceil((data.sub_tasks_complete / (data.sub_tasks_total ? data.sub_tasks_total : 1)) * 100) }}%
+ </p>
+ <div class="px-2 text-xs hidden md:flex flex-col gap-1 h-fit min-w-32 flex-1">
<p class="w-full text-left pe-8">
- {{ (data.sub_tasks_complete / (data.sub_tasks_total ? data.sub_tasks_total : 1)) * 100 }}% Processed
+ {{ Math.ceil((data.sub_tasks_complete / (data.sub_tasks_total ? data.sub_tasks_total : 1)) * 100) }}% Processed
</p>
<div class="rounded-full h-1 w-full bg-primary-dark-900 flex overflow-clip">
<div
@@ -166,7 +194,7 @@ const expanded = ref(false);
:label="data.status"
/>
<Popover
- popoverClass="w-40 rounded-lg "
+ popoverClass="!w-40 rounded-lg "
:buttonComponent="ButtonCorner"
:button-attributes="{
positionClasses: 'w-7 h-7 !p-1 ml-auto',
@@ -241,7 +269,7 @@ const expanded = ref(false);
</section>
<section
- :class="`flex flex-col transition-all duration-300 ease-in-out ${expanded ? `py-1` : 'overflow-hidden '}`"
+ :class="`flex flex-col gap-1 transition-all duration-300 ease-in-out ${expanded ? `py-1 h-fit` : 'overflow-hidden '}`"
:style="`height: ${expanded ? `${Math.max(52, (data?.sub_tasks?.length ?? 0) * (68 + 4))}px` : '0px'};`"
>
<SubTaskCard v-for="subTask in data.sub_tasks" :key="subTask.id" :data="subTask" />
diff --git a/resources/js/components/cards/UserCard.vue b/resources/js/components/cards/UserCard.vue
index c971b561..0a55d56a 100644
--- a/resources/js/components/cards/UserCard.vue
+++ b/resources/js/components/cards/UserCard.vue
@@ -31,7 +31,7 @@ const props = defineProps<{ data: UserResource }>();
<div class="flex justify-end gap-1 flex-1">
<Popover
- popoverClass="w-64 rounded-lg "
+ popoverClass="!w-64 rounded-lg "
:buttonComponent="ButtonCorner"
:button-attributes="{
positionClasses: 'w-7 h-7 !p-1 ml-auto sm:hidden',
diff --git a/resources/js/components/dashboard/DashboardTasks.vue b/resources/js/components/dashboard/DashboardTasks.vue
index bec99cc7..bbcc57b2 100644
--- a/resources/js/components/dashboard/DashboardTasks.vue
+++ b/resources/js/components/dashboard/DashboardTasks.vue
@@ -25,11 +25,6 @@ const confirmModal = useModal({ title: 'Remove User?', submitText: 'Confim' });
const searchQuery = ref('');
const sortingOptions = ref([
- {
- title: 'Name',
- value: 'name',
- disabled: false,
- },
{
title: 'Add Time',
value: 'created_at',
@@ -50,9 +45,19 @@ const sortingOptions = ref([
value: 'status_key',
disabled: false,
},
+ {
+ title: 'Name',
+ value: 'name',
+ disabled: false,
+ },
{
title: 'Task Length',
- value: 'sub_tasks',
+ value: 'sub_tasks_total',
+ disabled: false,
+ },
+ {
+ title: 'Task Duration',
+ value: 'duration',
disabled: false,
},
]);
@@ -146,7 +151,7 @@ onMounted(() => {
<section id="tasks" class="flex gap-8 flex-col">
<div class="flex items-start gap-2 justify-between flex-wrap">
<div class="flex flex-wrap items-center gap-2 [&>*]:h-fit [&>*]:xs:h-8">
- <Popover popoverClass="w-52 rounded-lg " :button-attributes="{ title: 'Start New Task' }" ref="taskPopover">
+ <Popover popoverClass="!w-52 rounded-lg " :button-attributes="{ title: 'Start New Task' }" ref="taskPopover">
<template #buttonText>New Task</template>
<template #buttonIcon>
<ProiconsAdd />
diff --git a/resources/js/components/inputs/ButtonIcon.vue b/resources/js/components/inputs/ButtonIcon.vue
index 1a8235b1..94a6535b 100755
--- a/resources/js/components/inputs/ButtonIcon.vue
+++ b/resources/js/components/inputs/ButtonIcon.vue
@@ -6,15 +6,43 @@ const props = withDefaults(
disabled?: boolean;
title?: string;
variant?: 'default' | 'ghost';
+ to?: string;
+ target?: string;
}>(),
{
variant: 'default',
+ target: '_blank',
},
);
</script>
<template>
+ <router-link
+ v-if="to"
+ :to="to"
+ :class="`flex items-center justify-center h-10 max-h-full
+ aspect-square rounded-md cursor-pointer focus:outline-none
+ text-gray-900 dark:text-neutral-100
+ ${
+ variant === 'default'
+ ? `p-2 shadow-sm
+ ring-1 ring-neutral-200 dark:ring-neutral-700 hocus:ring-[0.125rem]
+ focus:ring-indigo-400 dark:focus:ring-indigo-500 hover:ring-violet-400 hover:dark:ring-violet-700
+ bg-white dark:bg-primary-dark-800
+ aria-disabled:cursor-not-allowed aria-disabled:hover:ring-neutral-200 aria-disabled:hover:dark:ring-neutral-700 aria-disabled:ring-1 aria-disabled:opacity-60`
+ : ''
+ }
+ ${props.class}`"
+ :type="props.type"
+ :title="props.title ?? 'Button'"
+ :aria-disabled="disabled"
+ :target="target ?? '_blank'"
+ >
+ <slot name="text"> </slot>
+ <slot name="icon"> </slot>
+ </router-link>
<button
+ v-else
:class="`flex items-center justify-center h-10 max-h-full
aspect-square rounded-md cursor-pointer focus:outline-none
text-gray-900 dark:text-neutral-100
diff --git a/resources/js/components/inputs/ButtonText.vue b/resources/js/components/inputs/ButtonText.vue
index 594a770a..3a385916 100755
--- a/resources/js/components/inputs/ButtonText.vue
+++ b/resources/js/components/inputs/ButtonText.vue
@@ -1,5 +1,21 @@
<script setup lang="ts">
-const props = defineProps(['class', 'type', 'disabled', 'title', 'to']);
+const props = withDefaults(
+ defineProps<{
+ class?: string;
+ type?: 'reset' | 'submit' | 'button' | undefined;
+ disabled?: boolean;
+ title?: string;
+ variant?: 'default' | 'ghost';
+ to?: string;
+ target?: string;
+ }>(),
+ {
+ title: 'Button',
+ type: 'button',
+ variant: 'default',
+ target: '_blank',
+ },
+);
</script>
<template>
@@ -12,9 +28,10 @@ const props = defineProps(['class', 'type', 'disabled', 'title', 'to']);
focus:ring-indigo-400 dark:focus:ring-indigo-500 hover:ring-violet-400 hover:dark:ring-violet-700
text-gray-900 dark:text-neutral-100 bg-white dark:bg-primary-dark-800
${props.class} aria-disabled:cursor-not-allowed aria-disabled:hover:ring-neutral-200 aria-disabled:hover:dark:ring-neutral-700 aria-disabled:ring-1 aria-disabled:opacity-60`"
- :type="props.type"
- :title="props.title ?? 'Button'"
+ :type="type"
+ :title="title"
:aria-disabled="disabled"
+ :target="target ?? '_blank'"
>
<slot name="text"> </slot>
<slot name="icon"> </slot>
@@ -27,9 +44,9 @@ const props = defineProps(['class', 'type', 'disabled', 'title', 'to']);
focus:ring-indigo-400 dark:focus:ring-indigo-500 hover:ring-violet-400 hover:dark:ring-violet-700
text-gray-900 dark:text-neutral-100 bg-white dark:bg-primary-dark-800
${props.class} disabled:cursor-not-allowed disabled:hover:ring-neutral-200 disabled:hover:dark:ring-neutral-700 disabled:ring-1 disabled:opacity-60`"
- :type="props.type"
- :disabled="props.disabled"
- :title="props.title ?? 'Button'"
+ :type="type"
+ :disabled="disabled"
+ :title="title ?? 'Button'"
>
<slot name="text"> </slot>
<slot name="icon"> </slot>
diff --git a/resources/js/components/pinesUI/DropdownMenu.vue b/resources/js/components/pinesUI/DropdownMenu.vue
index c2fe509e..a54f167a 100755
--- a/resources/js/components/pinesUI/DropdownMenu.vue
+++ b/resources/js/components/pinesUI/DropdownMenu.vue
@@ -18,8 +18,17 @@ import LucideFolderSearch from '~icons/lucide/folder-search';
import LucideFolderCheck from '~icons/lucide/folder-check';
import LucideLayoutDashboard from '~icons/lucide/layout-dashboard';
+import ProiconsLibrary from '~icons/proicons/library';
+import ProiconsHistory from '~icons/proicons/history';
+import CircumDatabase from '~icons/circum/database';
+import ProiconsGraph from '~icons/proicons/graph';
+import LucideImages from '~icons/lucide/images';
+import CircumServer from '~icons/circum/server';
+import ProiconsServer from '~icons/proicons/server';
+import CircumHardDrive from '~icons/circum/hard-drive';
+
const authStore = useAuthStore();
-const { userData } = storeToRefs(authStore);
+const props = defineProps(['dropdownOpen']);
const defaults = { external: false, disabled: false };
@@ -39,7 +48,13 @@ const dropDownItemsAuth = [
[
{ ...defaults, name: 'friends', url: '/friends', text: 'Friends', icon: LucideUsers, disabled: true },
{ ...defaults, name: 'history', url: '/history', text: 'Full History', icon: LucideHistory },
- { ...defaults, name: 'dashboard', url: '/dashboard?tab=overview', text: 'Dashboard', icon: LucideLayoutDashboard },
+ { ...defaults, name: 'overview', url: '/dashboard', text: 'Dashboard', icon: LucideLayoutDashboard, disabled: true },
+ ],
+ [
+ { ...defaults, name: 'overview', url: '/dashboard/overview', text: 'Analytics', icon: ProiconsGraph },
+ { ...defaults, name: 'libraries', url: '/dashboard/libraries', text: 'Libraries', icon: ProiconsLibrary },
+ { ...defaults, name: 'users', url: '/dashboard/users', text: 'Users', icon: LucideUsers },
+ { ...defaults, name: 'tasks', url: '/dashboard/tasks', text: 'Tasks', icon: CircumHardDrive },
],
[
{ ...defaults, name: 'index', url: '/jobs/indexFiles', text: 'Index Files', external: true, icon: LucideFolderSearch },
@@ -49,7 +64,7 @@ const dropDownItemsAuth = [
[{ ...defaults, name: 'logout', url: '/logout', text: 'Log out', icon: LucideLogOut, shortcut: '⇧⌘Q' }],
];
-const props = defineProps(['dropdownOpen']);
+const { userData } = storeToRefs(authStore);
</script>
<template>
@@ -80,21 +95,17 @@ const props = defineProps(['dropdownOpen']);
v-for="(item, index) in dropDownItemsAuth[groupIndex]"
:key="index"
:linkData="item"
- :selected="$route.name === item.name"
+ :selected="$route.path === item.name || $route.path === item.url"
:external="item?.external"
:disabled="item?.disabled ?? false"
+ @click="$emit('toggleDropdown', false)"
>
<template #icon>
<component
:is="item.icon"
- width="24"
- height="24"
viewBox="0 0 24 24"
- fill="none"
stroke="currentColor"
- stroke-width="2"
- stroke-linecap="round"
- stroke-linejoin="round"
+ stroke-width="0.2"
class="w-4 h-4 mr-2"
/>
</template>
diff --git a/resources/js/components/pinesUI/Popover.vue b/resources/js/components/pinesUI/Popover.vue
index 63f69d6f..3aa99bb5 100644
--- a/resources/js/components/pinesUI/Popover.vue
+++ b/resources/js/components/pinesUI/Popover.vue
@@ -69,9 +69,12 @@ const adjustPopoverPosition = () => {
if (viewportWidth > popoverRect.width + margin * 2 && viewportWidth - popoverRect.right - margin < 0) {
adjustment = viewportWidth - popoverRect.right - margin;
- } else if (viewportWidth > popoverRect.width + margin * 2 && popoverRect.left < 0) {
- adjustment = margin;
+ } else if (viewportWidth > popoverRect.width + margin * 2 && popoverRect.left <= margin) {
+ adjustment = margin * 2;
+ console.log(adjustment);
} else {
+ console.log(viewportWidth, popoverRect.width + margin * 2, popoverRect.left);
+
return;
}
diff --git a/resources/js/components/table/TableBase.vue b/resources/js/components/table/TableBase.vue
index 75065244..f35f070d 100755
--- a/resources/js/components/table/TableBase.vue
+++ b/resources/js/components/table/TableBase.vue
@@ -1,5 +1,5 @@
<script setup lang="ts">
-import { ref, watch, type Component } from 'vue';
+import { onMounted, ref, watch, type Component } from 'vue';
import TextInputLabelled from '@/components/inputs/TextInputLabelled.vue';
import TablePagination from '@/components/table/TablePagination.vue';
@@ -56,6 +56,10 @@ const handleSortChange = (sortKey?: { title?: string; value?: string; disabled?:
};
watch(props.data, tableData.handlePageReset, { immediate: true });
+
+onMounted(() => {
+ props.sortAction(lastSortKey.value, props.startAscending ? 1 : -1);
+});
</script>
<template>
diff --git a/resources/js/components/video/VideoAmbientPlayer.vue b/resources/js/components/video/VideoAmbientPlayer.vue
index 7b30b611..3c63a6c7 100755
--- a/resources/js/components/video/VideoAmbientPlayer.vue
+++ b/resources/js/components/video/VideoAmbientPlayer.vue
@@ -83,6 +83,7 @@ watch(player, (newVal) => {
ref="canvasContainer"
> -->
<canvas
+ v-cloak
v-show="!lightMode && ambientMode"
width="10"
height="6"
diff --git a/resources/js/router/index.js b/resources/js/router/index.js
index 5f4cfaa6..724fa347 100755
--- a/resources/js/router/index.js
+++ b/resources/js/router/index.js
@@ -81,6 +81,10 @@ const router = createRouter({
},
{
path: '/dashboard',
+ redirect: '/dashboard/overview',
+ },
+ {
+ path: '/dashboard/:tab?',
name: 'dashboard',
meta: { protected: true },
component: DashboardView,
diff --git a/resources/js/types/resources.ts b/resources/js/types/resources.ts
index 7013405a..5dfd4e6e 100644
--- a/resources/js/types/resources.ts
+++ b/resources/js/types/resources.ts
@@ -150,10 +150,10 @@ export interface TaskResource {
sub_tasks_complete: number;
sub_tasks_failed: number;
duration: number;
- started_at?: Date;
- ended_at?: Date;
- created_at: Date;
- updated_at: Date;
+ started_at?: string;
+ ended_at?: string;
+ created_at: string;
+ updated_at: string;
}
export interface SubTaskResource {
@@ -165,8 +165,8 @@ export interface SubTaskResource {
summary?: string;
progress: number;
duration: number;
- started_at?: Date;
- ended_at?: Date;
- created_at: Date;
- updated_at: Date;
+ started_at?: string;
+ ended_at?: string;
+ created_at: string;
+ updated_at: string;
}
diff --git a/resources/js/views/DashboardView.vue b/resources/js/views/DashboardView.vue
index e8e01f02..9a24bef0 100644
--- a/resources/js/views/DashboardView.vue
+++ b/resources/js/views/DashboardView.vue
@@ -70,14 +70,21 @@ const { cycleSideBar } = AppStore;
const { pageTitle, selectedSideBar } = storeToRefs(AppStore);
onMounted(async () => {
- const URL_TAB = route.query.tab;
- let defaultTab = dashboardTabs.find((tab) => (tab.title ?? tab.name) == URL_TAB) ?? dashboardTabs[0];
-
- pageTitle.value = defaultTab.title ?? defaultTab.name;
- dashboardTab.value = defaultTab;
cycleSideBar('dashboard', 'left-card');
});
+watch(
+ () => route?.params?.tab,
+ (URL_TAB) => {
+ if (!URL_TAB) return;
+ let defaultTab = dashboardTabs.find((tab) => (tab.title ?? tab.name) == URL_TAB) ?? dashboardTabs[0];
+
+ pageTitle.value = defaultTab.title ?? defaultTab.name;
+ dashboardTab.value = defaultTab;
+ },
+ { immediate: true },
+);
+
watch(
() => dashboardTab.value,
() => {
@@ -108,7 +115,7 @@ watch(
<SidebarCard
v-for="(tab, index) in dashboardTabs"
:key="index"
- :link="`/dashboard?tab=${tab.name}`"
+ :link="`/dashboard/${tab.name}`"
:class="`
items-center justify-between !gap-2
capitalize overflow-hidden bg-white hover:bg-primary-800