Skip to content

A self-hosted media server and file management system

feat: dashboard breadcrumbs

aminnausineac9d37a7456
diff --git a/resources/js/components/cards/CategoryCard.vue b/resources/js/components/cards/CategoryCard.vue
index 83998851..b9c86bee 100644
--- a/resources/js/components/cards/CategoryCard.vue
+++ b/resources/js/components/cards/CategoryCard.vue
@@ -68,7 +68,7 @@ const handleStartScan = async (verifyOnly: boolean = false) => {
try {
if (verifyOnly) await startVerifyFilesTask(props.data.id);
else await startScanFilesTask(props.data.id);
- toast.add('Success', { type: 'success', description: `Submitted ${verifyOnly ? 'verify' : 'scan'} Request!` });
+ toast.add('Success', { type: 'success', description: `Submitted ${verifyOnly ? 'verify' : 'scan'} request!` });
popover.value?.handleClose();
} catch (error) {
toast('Failure', { type: 'danger', description: `Unable to submit ${verifyOnly ? 'verify' : 'scan'} request.` });
@@ -112,12 +112,13 @@ watch(
<template>
<div class="flex flex-col rounded-xl shadow-lg dark:bg-primary-dark-800/70 bg-white dark:hover:bg-primary-dark-600 hover:bg-primary-800 ring-1 ring-gray-900/5 w-full group">
- <RouterLink :to="`/${data?.name}`" class="w-full h-40">
+ <RouterLink :to="`/${data?.name}`" class="w-full h-40 relative peer">
<img
- class="w-full h-full object-cover rounded-t-md shadow-sm mb-auto ring-1 ring-gray-900/5"
+ class="w-full h-full object-cover rounded-t-md shadow-sm mb-auto ring-1 ring-gray-900/5 hover:ring-4 hover:ring-red-500 ring-inset peer"
:src="handleStorageURL(defaultFolder?.series?.thumbnail_url) ?? '/storage/thumbnails/default.webp'"
alt="Folder Cover Art"
/>
+ <span class="w-full h-full hover:ring-[0.125rem] ring-inset ring-purple-600/90 absolute top-0 left-0 rounded-t-md"></span>
</RouterLink>
<section class="flex flex-1 h-full flex-col p-3 gap-2">
<div class="flex items-start justify-between flex-wrap">
@@ -125,10 +126,7 @@ watch(
{{ data?.name }}
</h3>
<span class="flex gap-2 [&>*]:h-6 text-sm">
- <ButtonIcon :title="'Open Library In New Tab'" :to="`/${data?.name}`" :class="`!aspect-[auto]`">
- <template #icon><CircumShare1 class="h-4 w-4" /></template>
- </ButtonIcon>
- <Popover popoverClass="!max-w-56 rounded-lg" :buttonClass="'!p-1 ml-auto'" ref="popover">
+ <Popover popoverClass="!max-w-56 rounded-lg mt-8" :buttonClass="'!p-1 ml-auto'" ref="popover">
<template #buttonIcon>
<ProiconsMoreVertical class="h-4 w-4" />
</template>
diff --git a/resources/js/components/cards/CategoryFolderCard.vue b/resources/js/components/cards/CategoryFolderCard.vue
index e228491e..cf0d04c2 100644
--- a/resources/js/components/cards/CategoryFolderCard.vue
+++ b/resources/js/components/cards/CategoryFolderCard.vue
@@ -20,12 +20,13 @@ const popover = useTemplateRef('popover');
<template>
<div class="flex flex-col rounded-xl shadow-lg dark:bg-primary-dark-800/70 bg-white dark:hover:bg-primary-dark-600 hover:bg-primary-800 ring-1 ring-gray-900/5 w-full group">
- <RouterLink :to="`/${data?.path}`" class="w-full h-40">
+ <RouterLink :to="`/${data?.path}`" class="w-full h-40 relative">
<img
class="w-full h-full object-cover rounded-t-md shadow-sm mb-auto ring-1 ring-gray-900/5"
:src="handleStorageURL(data?.series?.thumbnail_url) ?? '/storage/thumbnails/default.webp'"
alt="Folder Cover Art"
/>
+ <span class="w-full h-full hover:ring-[0.125rem] ring-inset ring-purple-600/90 absolute top-0 left-0 rounded-t-md"></span>
</RouterLink>
<section class="flex flex-1 h-full flex-col p-3 gap-2">
<div class="flex items-start justify-between gap-1 flex-wrap xs:flex-nowrap">
@@ -36,7 +37,7 @@ const popover = useTemplateRef('popover');
<ButtonIcon :title="'Open Folder In New Tab'" :to="`/${data?.path}`" :class="`!aspect-[auto]`">
<template #icon><CircumShare1 class="h-4 w-4" /></template>
</ButtonIcon>
- <Popover popoverClass="!max-w-56 rounded-lg" :buttonClass="'!p-1 ml-auto'" ref="popover">
+ <Popover popoverClass="!max-w-56 rounded-lg mt-8" :buttonClass="'!p-1 ml-auto'" ref="popover">
<template #buttonIcon>
<ProiconsMoreVertical class="h-4 w-4" />
</template>
diff --git a/resources/js/components/dashboard/DashboardActivity.vue b/resources/js/components/dashboard/DashboardActivity.vue
index 803987e6..33dd216c 100644
--- a/resources/js/components/dashboard/DashboardActivity.vue
+++ b/resources/js/components/dashboard/DashboardActivity.vue
@@ -64,7 +64,7 @@ const handleSearch = (query: string) => {
</script>
<template>
- <section id="tasks" class="flex gap-8 flex-col">
+ <section id="tasks" class="flex gap-4 flex-col">
<div class="flex items-center gap-2 justify-between flex-wrap">
<p class="uppercase">Running: {{ categories?.length }}</p>
<div class="flex flex-wrap items-center gap-2 [&>*]:h-8">
diff --git a/resources/js/components/dashboard/DashboardAnalytics.vue b/resources/js/components/dashboard/DashboardAnalytics.vue
index b4b05cad..def6d365 100644
--- a/resources/js/components/dashboard/DashboardAnalytics.vue
+++ b/resources/js/components/dashboard/DashboardAnalytics.vue
@@ -1,8 +1,8 @@
<script setup lang="ts">
-import type { PulseResponse } from '@/types/types';
+import type { BreadCrumbItem, PulseResponse } from '@/types/types';
import { useGetPulse, useGetSiteAnalytics } from '@/service/queries';
-import { ref, useTemplateRef, watch } from 'vue';
+import { computed, ref, useTemplateRef, watch } from 'vue';
import { handleStartTask } from '@/service/taskService';
import { periodForHumans } from '@/service/pulseUtil';
@@ -11,12 +11,14 @@ import PulseRequests from '@/components/pulseCards/PulseRequests.vue';
import DashboardCard from '@/components/cards/DashboardCard.vue';
import PulseServers from '@/components/pulseCards/PulseServers.vue';
import PulseQueues from '@/components/pulseCards/PulseQueues.vue';
+import BreadCrumbs from '@/components/pinesUI/BreadCrumbs.vue';
import PulseUsage from '@/components/pulseCards/PulseUsage.vue';
import ButtonText from '@/components/inputs/ButtonText.vue';
import Popover from '@/components/pinesUI/Popover.vue';
import LucideChartNoAxesCombined from '~icons/lucide/chart-no-axes-combined';
import ProiconsArrowSync from '~icons/proicons/arrow-sync';
+import ProiconsHome2 from '~icons/proicons/home-2';
import ProiconsBolt from '~icons/proicons/bolt';
import ProiconsAdd from '~icons/proicons/add';
@@ -35,6 +37,18 @@ const taskPopover = useTemplateRef('taskPopover');
const { data: stats } = useGetSiteAnalytics(period);
const { data: rawPulseData, isLoading: pulseLoading } = useGetPulse({ period });
+const breadCrumbs = computed(() => {
+ const items: BreadCrumbItem[] = [
+ {
+ name: 'Dashboard',
+ url: '/dashboard/analytics',
+ icon: ProiconsHome2,
+ },
+ ];
+
+ return items;
+});
+
watch(
() => rawPulseData.value,
() => {
@@ -46,17 +60,25 @@ watch(
</script>
<template>
<section class="flex flex-wrap gap-4 flex-col">
- <section class="flex justify-between flex-wrap gap-2">
- <div class="flex items-center gap-2 flex-wrap [&>*]:h-8 w-full md:w-auto">
- <ButtonText @click.stop.prevent="handleStartTask('scan')" :text="'Run Full Scan'" class="flex-1">
+ <div class="flex items-center gap-2 justify-between flex-wrap">
+ <BreadCrumbs :bread-crumbs="breadCrumbs" />
+
+ <div class="flex items-center flex-wrap gap-2 ml-auto text-sm font-medium">
+ <h5>Time Period</h5>
+ <button
+ v-for="(validPeriod, index) in validPeriods"
+ :key="index"
+ @click="period = validPeriod.value"
+ :class="`font-semibold ${period === validPeriod.value ? 'text-gray-700 dark:text-gray-300' : 'text-gray-300 dark:text-gray-600'} hover:text-gray-400 dark:hover:text-gray-500`"
+ >
+ {{ validPeriod.key }}
+ </button>
+ </div>
+ <div class="flex flex-wrap items-center gap-2 [&>*]:h-fit [&>*]:xs:h-8 w-full">
+ <ButtonText @click.stop.prevent="handleStartTask('scan')" :text="'Run Full Scan'" class="flex-1 xs:flex-initial">
<template #icon><ProiconsArrowSync /></template>
</ButtonText>
- <Popover
- popoverClass="!w-52 rounded-lg mt-10 "
- :button-attributes="{ title: 'Start New Task', text: 'New Task', class: 'w-full sm:w-auto' }"
- ref="taskPopover"
- class="w-full sm:w-auto"
- >
+ <Popover popoverClass="!w-52 rounded-lg mt-10 " :button-attributes="{ title: 'Start New Task', text: 'New Task', class: 'h-full' }" ref="taskPopover" class="">
<template #buttonIcon>
<ProiconsAdd />
</template>
@@ -64,22 +86,11 @@ watch(
<DashboardTaskMenu @handle-close="taskPopover?.handleClose" :show-scan-all="false" />
</template>
</Popover>
- <ButtonText :to="'/pulse'" text="Pulse" class="w-full sm:w-auto">
+ <ButtonText :to="'/pulse'" text="Pulse" class="flex-1 xs:flex-initial">
<template #icon><ProiconsBolt /></template>
</ButtonText>
</div>
- <div class="flex items-center flex-wrap gap-2 ml-auto text-sm font-medium">
- <h5>Time Period</h5>
- <button
- v-for="(validPeriod, index) in validPeriods"
- :key="index"
- @click="period = validPeriod.value"
- :class="`font-semibold ${period === validPeriod.value ? 'text-gray-700 dark:text-gray-300' : 'text-gray-300 dark:text-gray-600'} hover:text-gray-400 dark:hover:text-gray-500`"
- >
- {{ validPeriod.key }}
- </button>
- </div>
- </section>
+ </div>
<PulseServers :pulseData="pulseData" :isLoading="pulseLoading" />
<span class="mx-auto grid grid-cols-2 sm:grid-cols-4 lg:grid-cols-6 gap-6 w-full">
<DashboardCard cols="2" :rows="4" :title="'Data changes over time'" :name="'Data Changes'" :details="`past ${periodForHumans(period)}`">
diff --git a/resources/js/components/dashboard/DashboardLibraries.vue b/resources/js/components/dashboard/DashboardLibraries.vue
index 9abc5ab5..7c9f5b3a 100644
--- a/resources/js/components/dashboard/DashboardLibraries.vue
+++ b/resources/js/components/dashboard/DashboardLibraries.vue
@@ -1,22 +1,29 @@
<script setup lang="ts">
-import type { CategoryResource } from '@/types/resources';
+import type { CategoryResource, FolderResource, SeriesResource } from '@/types/resources';
+import type { BreadCrumbItem } from '@/types/types';
-import { computed, onMounted, ref } from 'vue';
-import { startIndexFilesTask } from '@/service/siteAPI';
+import { computed, onMounted, ref, watchEffect } from 'vue';
+import { startScanFilesTask } from '@/service/siteAPI';
import { useDashboardStore } from '@/stores/DashboardStore';
+import { useContentStore } from '@/stores/ContentStore';
+import { useQueryClient } from '@tanstack/vue-query';
import { useAppStore } from '@/stores/AppStore';
import { storeToRefs } from 'pinia';
import { sortObject } from '@/service/util';
import { toast } from '@/service/toaster/toastService';
-import DashboardLibraryFolders from '@/components/dashboard/DashboardLibraryFolders.vue';
+import CategoryFolderCard from '@/components/cards/CategoryFolderCard.vue';
import CategoryCard from '@/components/cards/CategoryCard.vue';
+import BreadCrumbs from '@/components/pinesUI/BreadCrumbs.vue';
import ButtonText from '@/components/inputs/ButtonText.vue';
+import EditFolder from '@/components/forms/EditFolder.vue';
import ModalBase from '@/components/pinesUI/ModalBase.vue';
import TableBase from '@/components/table/TableBase.vue';
import useModal from '@/composables/useModal';
+import ProiconsLibrary from '~icons/proicons/library';
import ProiconsSearch from '~icons/proicons/search';
+import ProiconsHome2 from '~icons/proicons/home-2';
import ProiconsAdd from '~icons/proicons/add';
const sortingOptions = ref([
@@ -47,18 +54,82 @@ const sortingOptions = ref([
},
]);
-const { stateLibraries, isLoadingLibraries, stateLibraryId } = storeToRefs(useDashboardStore());
+const folderSortingOptions = ref([
+ {
+ title: 'ID',
+ value: 'id',
+ },
+ {
+ title: 'Title',
+ value: 'name',
+ disabled: false,
+ },
+ {
+ title: 'Date',
+ value: 'created_at',
+ disabled: false,
+ },
+ {
+ title: 'Videos',
+ value: 'file_count',
+ disabled: false,
+ },
+ {
+ title: 'Total Size',
+ value: 'total_size',
+ },
+]);
+
+const { stateLibraries, isLoadingLibraries, stateLibraryId, stateLibraryFolders, isLoadingLibraryFolders } = storeToRefs(useDashboardStore());
+const { updateFolderData } = useContentStore();
const { pageTitle } = storeToRefs(useAppStore());
-const cachedID = ref<null | number>(null);
+const editFolderModal = useModal({ title: 'Edit Folder Details', submitText: 'Submit Details' });
+const confirmModal = useModal({ title: 'Delete Library?', submitText: 'Confim' });
+const cachedLibrary = ref<CategoryResource>();
+const cachedFolder = ref<FolderResource>();
const searchQuery = ref('');
-const confirmModal = useModal({ title: 'Delete Category?', submitText: 'Confim' });
+const cachedID = ref<null | number>(null);
+const queryClient = useQueryClient();
+
+const breadCrumbs = computed(() => {
+ const items: BreadCrumbItem[] = [
+ {
+ name: 'Dashboard',
+ url: '/dashboard/analytics',
+ icon: ProiconsHome2,
+ },
+ {
+ name: 'Libraries',
+ url: '/dashboard/libraries',
+ icon: ProiconsLibrary,
+ },
+ ];
+
+ if (cachedLibrary.value)
+ return [
+ ...items,
+ {
+ name: cachedLibrary.value.name,
+ url: `/dashboard/libraries/${cachedLibrary.value.id}`,
+ },
+ ];
+ return items;
+});
-const filteredCategories = computed(() => {
+const filteredLibraries = computed(() => {
let tempList = searchQuery.value
? stateLibraries.value.filter((category: CategoryResource) => {
try {
- let strRepresentation = [category.name, category.folders_count, category.folders[0]?.name ?? '', category.created_at].join(' ').toLowerCase();
+ let strRepresentation = [
+ category.name,
+ category.folders_count,
+ category.folders.find((folder) => folder.id === category.default_folder_id)?.name ?? '',
+ category.created_at,
+ ]
+ .join(' ')
+ .toLowerCase();
+
return strRepresentation.includes(searchQuery.value.toLowerCase());
} catch (error) {
console.log(error);
@@ -69,7 +140,23 @@ const filteredCategories = computed(() => {
return tempList;
});
+const filteredFolders = computed(() => {
+ let tempList = searchQuery.value
+ ? stateLibraryFolders.value.filter((folder: FolderResource) => {
+ try {
+ let strRepresentation = [folder.name, folder.series?.title, folder.series?.description, folder.series?.studio, folder.created_at].join(' ').toLowerCase();
+ return strRepresentation.includes(searchQuery.value.toLowerCase());
+ } catch (error) {
+ console.log(error);
+ return false;
+ }
+ })
+ : stateLibraryFolders.value;
+ return tempList;
+});
+
const handleDelete = (id: number) => {
+ //Unimplemented
cachedID.value = id;
confirmModal.toggleModal(true);
};
@@ -82,41 +169,93 @@ const handleSort = async (column: keyof CategoryResource = 'created_at', dir: -1
return tempList;
};
+const handleFolderSort = async (column: keyof FolderResource = 'created_at', dir: -1 | 1 = 1) => {
+ let tempList = [...stateLibraryFolders.value].sort(sortObject<FolderResource>(column, dir, ['created_at']));
+ stateLibraryFolders.value = tempList;
+ return tempList;
+};
+
const handleStartScan = async () => {
try {
- await startIndexFilesTask();
+ await startScanFilesTask(stateLibraryId.value > 0 ? stateLibraryId.value : undefined);
- toast.add('Success', { type: 'success', description: `Submitted scan Request!` });
+ toast.add('Success', { type: 'success', description: `Submitted scan request${cachedLibrary.value?.name ? ` for ${cachedLibrary.value.name}` : ''}!` });
} catch (error) {
toast('Failure', { type: 'danger', description: `Unable to submit scan request.` });
console.error(error);
}
};
-onMounted(() => {
- pageTitle.value = 'Libraries';
+const handleFolderAction = (_: any, id: number, action: 'edit' | 'share' = 'edit') => {
+ let folder = stateLibraryFolders.value?.find((folder: FolderResource) => folder.id === id);
+
+ if (folder) cachedFolder.value = folder;
+
+ if (action === 'edit') editFolderModal.toggleModal();
+};
+
+const handleSeriesUpdate = async (res: any) => {
+ if (res?.data?.id) updateFolderData(res.data as SeriesResource);
+ editFolderModal.toggleModal(false);
+
+ await queryClient.invalidateQueries({
+ queryKey: ['libraryFolders'],
+ });
+};
+
+watchEffect(() => {
+ cachedLibrary.value = stateLibraries.value.find((library: CategoryResource) => library.id == stateLibraryId.value);
+
+ const title = cachedLibrary.value ? `Content Libraries · ${cachedLibrary.value.name}` : 'Content Libraries';
+ pageTitle.value = title;
+ document.title = title;
});
+
+onMounted(() => {});
</script>
<template>
- <DashboardLibraryFolders v-if="stateLibraryId > 0" />
- <section v-else id="content-libraries" class="flex gap-8 flex-col">
+ <section id="content-libraries" class="flex gap-4 flex-col">
<div class="flex items-center gap-2 justify-between flex-wrap">
- <div class="flex flex-wrap items-center gap-2 [&>*]:h-fit [&>*]:xs:h-8">
- <ButtonText title="Add New Library" disabled>
+ <BreadCrumbs :bread-crumbs="breadCrumbs" />
+
+ <p class="capitalize font-medium" v-if="stateLibraryId < 0">Count: {{ stateLibraries?.length }}</p>
+ <span v-else class="flex overflow-clip gap-2">
+ <p class="capitalize font-medium">Count: {{ stateLibraryFolders?.length }}</p>
+ <p class="capitalize font-medium">Videos: {{ stateLibraryFolders?.reduce((total: number, folder: FolderResource) => total + Number(folder.file_count), 0) }}</p>
+ </span>
+ <div class="flex flex-wrap items-center gap-2 [&>*]:h-fit [&>*]:xs:h-8 w-full">
+ <ButtonText title="Add New Library" disabled class="hidden">
<template #text>New Library</template>
<template #icon><ProiconsAdd /></template>
</ButtonText>
<ButtonText @click="handleStartScan" :title="'Index Files'">
- <template #text>Look For Changes</template>
+ <template #text>Scan For Changes</template>
<template #icon><ProiconsSearch /></template>
</ButtonText>
</div>
- <p class="capitalize text-sm font-medium">Count: {{ stateLibraries?.length }}</p>
</div>
<TableBase
+ v-if="stateLibraryId > 0"
+ :use-grid="'grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 3xl:grid-cols-5 gap-3'"
+ :use-pagination="true"
+ :data="filteredFolders"
+ :row="CategoryFolderCard"
+ :loading="isLoadingLibraryFolders"
+ :sort-action="handleFolderSort"
+ :click-action="handleFolderAction"
+ :sorting-options="folderSortingOptions"
+ @search="
+ (query: string) => {
+ searchQuery = query;
+ }
+ "
+ />
+
+ <TableBase
+ v-else
:use-grid="'grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 3xl:grid-cols-5 gap-3'"
:use-pagination="true"
- :data="filteredCategories"
+ :data="filteredLibraries"
:row="CategoryCard"
:click-action="handleDelete"
:loading="isLoadingLibraries"
@@ -136,4 +275,11 @@ onMounted(() => {
</div>
</template>
</ModalBase>
+ <ModalBase :modalData="editFolderModal" :useControls="false">
+ <template #content>
+ <div class="pt-2">
+ <EditFolder v-if="cachedFolder" :folder="cachedFolder" @handleFinish="handleSeriesUpdate" />
+ </div>
+ </template>
+ </ModalBase>
</template>
diff --git a/resources/js/components/dashboard/DashboardLibraryFolders.vue b/resources/js/components/dashboard/DashboardLibraryFolders.vue
index 47ddd3d1..e32b5837 100644
--- a/resources/js/components/dashboard/DashboardLibraryFolders.vue
+++ b/resources/js/components/dashboard/DashboardLibraryFolders.vue
@@ -77,18 +77,7 @@ const handleSort = async (column: keyof FolderResource = 'created_at', dir: -1 |
return tempList;
};
-const handleStartScan = async () => {
- try {
- await startIndexFilesTask();
-
- toast.add('Success', { type: 'success', description: `Submitted scan Request!` });
- } catch (error) {
- toast('Failure', { type: 'danger', description: `Unable to submit scan request.` });
- console.error(error);
- }
-};
-
-const handleFolderAction = (id: number, action: 'edit' | 'share' = 'edit') => {
+const handleFolderAction = (_: any, id: number, action: 'edit' | 'share' = 'edit') => {
let folder = stateLibraryFolders.value?.find((folder: FolderResource) => folder.id === id);
if (folder) cachedFolder.value = folder;
@@ -111,42 +100,21 @@ onMounted(() => {
});
</script>
<template>
- <section id="content-libraries" class="flex gap-8 flex-col">
- <div class="flex items-center gap-2 justify-between flex-wrap">
- <div class="flex flex-wrap items-center gap-2 [&>*]:h-fit [&>*]:xs:h-8">
- <ButtonText title="Return to Libraries" to="/dashboard/libraries" target="">
- <template #text>Return to Libraries</template>
- </ButtonText>
- <ButtonText @click="handleStartScan">
- <template #text>Scan For Changes</template>
- <template #icon>
- <ProiconsArrowSync />
- </template>
- </ButtonText>
- </div>
- <span>
- <p class="capitalize text-sm font-medium">Folders: {{ stateLibraryFolders?.length }}</p>
- <p class="capitalize text-sm font-medium">
- Videos: {{ stateLibraryFolders?.reduce((total: number, folder: FolderResource) => total + Number(folder.file_count), 0) }}
- </p>
- </span>
- </div>
- <TableBase
- :use-grid="'grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 3xl:grid-cols-5 gap-3'"
- :use-pagination="true"
- :data="filteredFolders"
- :row="CategoryFolderCard"
- :loading="isLoadingLibraryFolders"
- :sort-action="handleSort"
- :click-action="handleFolderAction"
- :sorting-options="sortingOptions"
- @search="
- (query: string) => {
- searchQuery = query;
- }
- "
- />
- </section>
+ <TableBase
+ :use-grid="'grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 3xl:grid-cols-5 gap-3'"
+ :use-pagination="true"
+ :data="filteredFolders"
+ :row="CategoryFolderCard"
+ :loading="isLoadingLibraryFolders"
+ :sort-action="handleSort"
+ :click-action="handleFolderAction"
+ :sorting-options="sortingOptions"
+ @search="
+ (query: string) => {
+ searchQuery = query;
+ }
+ "
+ />
<ModalBase :modalData="editFolderModal" :useControls="false">
<template #content>
<div class="pt-2">
diff --git a/resources/js/components/dashboard/DashboardTasks.vue b/resources/js/components/dashboard/DashboardTasks.vue
index 86dc8951..1dd81da5 100644
--- a/resources/js/components/dashboard/DashboardTasks.vue
+++ b/resources/js/components/dashboard/DashboardTasks.vue
@@ -1,12 +1,11 @@
<script setup lang="ts">
-import type { TaskStatsResponse } from '@/types/types';
+import type { BreadCrumbItem, TaskStatsResponse } from '@/types/types';
import type { TaskResource } from '@/types/resources';
import { computed, onMounted, onUnmounted, ref, useTemplateRef, type Ref } from 'vue';
import { cancelTask, deleteSubTask, deleteTask } from '@/service/siteAPI';
import { subscribeToDaskboardTasks } from '@/service/wsService';
import { useDashboardStore } from '@/stores/DashboardStore';
-import { handleStartTask } from '@/service/taskService';
import { useQueryClient } from '@tanstack/vue-query';
import { useAppStore } from '@/stores/AppStore';
import { storeToRefs } from 'pinia';
@@ -14,6 +13,7 @@ import { sortObject } from '@/service/util';
import { toast } from '@/service/toaster/toastService';
import DashboardTaskMenu from '@/components/dashboard/DashboardTaskMenu.vue';
+import BreadCrumbs from '@/components/pinesUI/BreadCrumbs.vue';
import ButtonText from '@/components/inputs/ButtonText.vue';
import ModalBase from '@/components/pinesUI/ModalBase.vue';
import TableBase from '@/components/table/TableBase.vue';
@@ -22,6 +22,8 @@ import useModal from '@/composables/useModal';
import Popover from '@/components/pinesUI/Popover.vue';
import ProiconsArrowSync from '~icons/proicons/arrow-sync';
+import ProiconsHome2 from '~icons/proicons/home-2';
+import CircumServer from '~icons/circum/server';
import ProiconsAdd from '~icons/proicons/add';
const sortingOptions = [
@@ -62,6 +64,23 @@ const sortingOptions = [
},
];
+const breadCrumbs = computed(() => {
+ const items: BreadCrumbItem[] = [
+ {
+ name: 'Dashboard',
+ url: '/dashboard/analytics',
+ icon: ProiconsHome2,
+ },
+ {
+ name: 'Tasks',
+ url: '/dashboard/tasks',
+ icon: CircumServer,
+ },
+ ];
+
+ return items;
+});
+
const { stateTasks, stateTaskStats, isLoadingTasks } = storeToRefs(useDashboardStore()) as {
stateTasks: Ref<TaskResource[]>;
stateTaskStats: Ref<TaskStatsResponse>;
@@ -190,9 +209,15 @@ onUnmounted(async () => {
</script>
<template>
- <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">
+ <section id="tasks" class="flex gap-4 flex-col">
+ <div class="flex items-center gap-2 justify-between flex-wrap">
+ <BreadCrumbs :bread-crumbs="breadCrumbs" />
+
+ <span class="flex overflow-clip gap-2 capitalize font-medium">
+ <p class="">Running Tasks: {{ stateTaskStats?.count_running }}</p>
+ <p class="">Total Tasks: {{ stateTasks.length ?? stateTaskStats?.count_tasks }}</p>
+ </span>
+ <div class="flex flex-wrap items-center gap-2 [&>*]:h-fit [&>*]:xs:h-8 w-full">
<Popover popoverClass="!w-52 rounded-lg mt-10" :button-attributes="{ title: 'Start New Task' }" ref="taskPopover">
<template #buttonText>New Task</template>
<template #buttonIcon>
@@ -215,10 +240,6 @@ onUnmounted(async () => {
<template #icon><ProiconsArrowSync /></template>
</ButtonText>
</div>
- <div class="capitalize text-sm font-medium text-neutral-600 dark:text-neutral-300 flex flex-col gap-1 w-fit text-end">
- <p class="w-fit">Running Tasks: {{ stateTaskStats?.count_running }}</p>
- <p class="w-fit">Total Tasks: {{ stateTasks.length ?? stateTaskStats?.count_tasks }}</p>
- </div>
</div>
<TableBase
:use-pagination="true"
diff --git a/resources/js/components/dashboard/DashboardUsers.vue b/resources/js/components/dashboard/DashboardUsers.vue
index fefbc101..881896a9 100644
--- a/resources/js/components/dashboard/DashboardUsers.vue
+++ b/resources/js/components/dashboard/DashboardUsers.vue
@@ -1,4 +1,5 @@
<script setup lang="ts">
+import type { BreadCrumbItem } from '@/types/types';
import type { UserResource } from '@/types/resources';
import { computed, onMounted, ref } from 'vue';
@@ -9,6 +10,7 @@ import { deleteUser } from '@/service/siteAPI';
import { sortObject } from '@/service/util';
import { toast } from '@/service/toaster/toastService';
+import BreadCrumbs from '@/components/pinesUI/BreadCrumbs.vue';
import ButtonText from '@/components/inputs/ButtonText.vue';
import ModalBase from '@/components/pinesUI/ModalBase.vue';
import TableBase from '@/components/table/TableBase.vue';
@@ -16,7 +18,9 @@ import UserCard from '@/components/cards/UserCard.vue';
import useModal from '@/composables/useModal';
import ProiconsArrowSync from '~icons/proicons/arrow-sync';
+import ProiconsHome2 from '~icons/proicons/home-2';
import ProiconsAdd from '~icons/proicons/add';
+import LucideUsers from '~icons/lucide/users';
const confirmModal = useModal({ title: 'Remove User?', submitText: 'Confim' });
@@ -41,6 +45,23 @@ const sortingOptions = ref([
},
]);
+const breadCrumbs = computed(() => {
+ const items: BreadCrumbItem[] = [
+ {
+ name: 'Dashboard',
+ url: '/dashboard/analytics',
+ icon: ProiconsHome2,
+ },
+ {
+ name: 'Users',
+ url: '/dashboard/users',
+ icon: LucideUsers,
+ },
+ ];
+
+ return items;
+});
+
const { stateUsers, isLoadingUsers, stateActiveSessions } = storeToRefs(useDashboardStore());
const filteredUsers = computed(() => {
@@ -102,9 +123,15 @@ onMounted(() => {
</script>
<template>
- <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">
+ <section id="tasks" class="flex gap-4 flex-col">
+ <div class="flex items-center gap-2 justify-between flex-wrap">
+ <BreadCrumbs :bread-crumbs="breadCrumbs" />
+
+ <span class="flex overflow-clip gap-2">
+ <p class="capitalize font-medium">Users: {{ stateUsers.length }}</p>
+ <p class="capitalize font-medium">Active: {{ stateActiveSessions ?? 0 }}</p>
+ </span>
+ <div class="flex flex-wrap items-center gap-2 [&>*]:h-fit [&>*]:xs:h-8 w-full">
<ButtonText title="Create new user" @click="toast.add('Success', { type: 'success', description: 'User Created!', life: 3000 })" disabled>
<template #text>New User</template>
<template #icon><ProiconsAdd /></template>
@@ -122,10 +149,6 @@ onMounted(() => {
<template #icon><ProiconsArrowSync /></template>
</ButtonText>
</div>
- <div class="capitalize text-sm font-medium text-neutral-600 dark:text-neutral-300 flex flex-col gap-1 w-fit text-end">
- <p class="w-fit">Users: {{ stateUsers.length }}</p>
- <p class="w-fit">Active: {{ stateActiveSessions ?? 0 }}</p>
- </div>
</div>
<TableBase
:use-pagination="true"
diff --git a/resources/js/components/pinesUI/BreadCrumbs.vue b/resources/js/components/pinesUI/BreadCrumbs.vue
new file mode 100644
index 00000000..9ecbc4ff
--- /dev/null
+++ b/resources/js/components/pinesUI/BreadCrumbs.vue
@@ -0,0 +1,31 @@
+<script setup lang="ts">
+import type { BreadCrumbItem } from '@/types/types';
+
+withDefaults(defineProps<{ breadCrumbs: BreadCrumbItem[] }>(), { breadCrumbs: () => [] });
+</script>
+<template>
+ <nav class="flex justify-between flex-1">
+ <ol
+ class="inline-flex items-center space-x-1 text-neutral-500 dark:text-neutral-300 [&_.active-breadcrumb]:text-neutral-600 dark:[&_.active-breadcrumb]:text-white [&_.active-breadcrumb]:font-medium sm:mb-0"
+ >
+ <template v-for="(breadCrumb, index) in breadCrumbs" :key="index">
+ <li class="flex items-center h-full">
+ <RouterLink
+ :to="breadCrumb.url"
+ class="inline-flex items-center p-2 py-1.5 space-x-1.5 rounded-md hover:!text-neutral-900 hover:ring-[0.125rem] ring-inset hover:ring-violet-400 hover:dark:ring-violet-700 dark:hover:ring-0 dark:hover:bg-neutral-100"
+ :class="{ 'cursor-default active-breadcrumb ': index === breadCrumbs.length - 1 }"
+ :title="breadCrumb.name"
+ >
+ <component v-if="breadCrumb.icon" :is="breadCrumb.icon" class="w-3.5 h-3.5 shrink-0" />
+ <span class="capitalize max-w-32 line-clamp-1 break-all">{{ breadCrumb.name }}</span>
+ </RouterLink>
+ </li>
+ <svg class="w-5 h-5 text-gray-400 shrink-0" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" v-if="index < breadCrumbs.length - 1">
+ <g fill="none" stroke="none">
+ <path d="M10 8.013l4 4-4 4" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
+ </g>
+ </svg>
+ </template>
+ </ol>
+ </nav>
+</template>
diff --git a/resources/js/components/pulseCards/PulseServers.vue b/resources/js/components/pulseCards/PulseServers.vue
index 2c769337..22fad53e 100644
--- a/resources/js/components/pulseCards/PulseServers.vue
+++ b/resources/js/components/pulseCards/PulseServers.vue
@@ -417,7 +417,7 @@ watch(
</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' : ''}`"
+ :class="`flex items-center gap-4 ${(Object.keys(servers).length ?? 0) > 1 ? 'py-2' : ''} ${!servers[server].recently_reported ? 'opacity-25 animate-pulse' : ''}`"
>
<div
v-for="storage in servers[server].storage"
diff --git a/resources/js/layouts/LayoutBase.vue b/resources/js/layouts/LayoutBase.vue
index f4670bef..12f980f8 100755
--- a/resources/js/layouts/LayoutBase.vue
+++ b/resources/js/layouts/LayoutBase.vue
@@ -29,8 +29,7 @@ watch(
</script>
<template>
- <div
- class="h-screen"
+ <main
:style="bodyStyles"
@scroll.passive="
(e) => {
@@ -56,29 +55,26 @@ watch(
}
}
"
+ class="h-full md:h-auto grid grid-cols-1 lg:grid-cols-10 2xl:grid-cols-6 sm:p-6 gap-6 snap-y bg-primary-900 dark:bg-primary-dark-900 sm:bg-primary-950 sm:dark:bg-primary-dark-950 dark:text-white text-gray-900 antialiased overflow-x-clip"
>
- <main
- class="h-full md:h-auto grid grid-cols-1 lg:grid-cols-10 2xl:grid-cols-6 sm:p-6 gap-6 snap-y bg-primary-900 dark:bg-primary-dark-900 sm:bg-primary-950 sm:dark:bg-primary-dark-950 dark:text-white text-gray-900 antialiased overflow-x-clip"
+ <section
+ id="left-card"
+ :class="`col-span-1 lg:col-span-2 2xl:col-span-1 h-fit order-2 lg:order-1 bg-primary-900 dark:bg-primary-dark-900 sm:shadow-xl sm:rounded-2xl space-y-2 sm:scroll-mt-6 ring-gray-900/5 ${selectedSideBar && sideBarTarget === 'left-card' ? 'sm:ring-1' : 'hidden lg:block lg:invisible'}`"
>
- <section
- id="left-card"
- :class="`col-span-1 lg:col-span-2 2xl:col-span-1 h-fit order-2 lg:order-1 bg-primary-900 dark:bg-primary-dark-900 sm:shadow-xl sm:rounded-2xl space-y-2 sm:scroll-mt-6 ring-gray-900/5 ${selectedSideBar && sideBarTarget === 'left-card' ? 'sm:ring-1' : 'hidden lg:block lg:invisible'}`"
- >
- <slot name="leftSidebar"></slot>
- </section>
- <section
- id="content-card"
- class="col-span-full lg:col-span-6 2xl:col-span-4 flex-grow order-1 lg:order-2 bg-primary-900 dark:bg-primary-dark-900 sm:shadow-xl p-6 pt-3 sm:rounded-2xl w-full h-fit flex flex-col gap-3 sm:ring-1 ring-gray-900/5"
- >
- <NavBar />
- <slot name="content" class="relative z-0"></slot>
- </section>
- <section
- id="list-card"
- :class="`col-span-1 lg:col-span-2 2xl:col-span-1 h-fit order-3 bg-primary-900 dark:bg-primary-dark-900 sm:shadow-xl sm:rounded-2xl space-y-2 sm:scroll-mt-6 ring-gray-900/5 ${selectedSideBar && sideBarTarget === 'list-card' ? 'sm:ring-1' : 'hidden'}`"
- >
- <slot name="sidebar"></slot>
- </section>
- </main>
- </div>
+ <slot name="leftSidebar"></slot>
+ </section>
+ <section
+ id="content-card"
+ class="col-span-full lg:col-span-6 2xl:col-span-4 flex-grow order-1 lg:order-2 bg-primary-900 dark:bg-primary-dark-900 sm:shadow-xl p-6 pt-3 sm:rounded-2xl w-full h-fit flex flex-col gap-3 sm:ring-1 ring-gray-900/5"
+ >
+ <NavBar />
+ <slot name="content" class="relative z-0"></slot>
+ </section>
+ <section
+ id="list-card"
+ :class="`col-span-1 lg:col-span-2 2xl:col-span-1 h-fit order-3 bg-primary-900 dark:bg-primary-dark-900 sm:shadow-xl sm:rounded-2xl space-y-2 sm:scroll-mt-6 ring-gray-900/5 ${selectedSideBar && sideBarTarget === 'list-card' ? 'sm:ring-1' : 'hidden'}`"
+ >
+ <slot name="sidebar"></slot>
+ </section>
+ </main>
</template>
diff --git a/resources/js/stores/AppStore.ts b/resources/js/stores/AppStore.ts
index 6191a686..e65763ae 100644
--- a/resources/js/stores/AppStore.ts
+++ b/resources/js/stores/AppStore.ts
@@ -71,7 +71,7 @@ export const useAppStore = defineStore('App', () => {
localStorage.setItem('playbackHeatmap', booleanToString(playbackHeatmap.value));
}
- async function cycleSideBar(target = '', scrollTarget: '' | 'left-card' | 'list-card' | 'root' = '') {
+ async function cycleSideBar(target = '', scrollTarget: '' | 'left-card' | 'list-card' | 'root' = '', scrollToTarget = true) {
sideBarTarget.value = scrollTarget;
if (selectedSideBar.value === target) {
@@ -80,7 +80,7 @@ export const useAppStore = defineStore('App', () => {
return;
}
selectedSideBar.value = target;
- if (scrollTarget) {
+ if (scrollTarget && scrollToTarget) {
await nextTick();
document.getElementById(scrollTarget)?.scrollIntoView({ behavior: 'smooth', block: 'start' });
}
diff --git a/resources/js/types/types.ts b/resources/js/types/types.ts
index 1a4aab74..aa8c5a53 100644
--- a/resources/js/types/types.ts
+++ b/resources/js/types/types.ts
@@ -302,3 +302,9 @@ export interface AppManifest {
version: string;
commit: string | null;
}
+
+export interface BreadCrumbItem {
+ name: string;
+ url: string;
+ icon?: Component;
+}
diff --git a/resources/js/views/DashboardView.vue b/resources/js/views/DashboardView.vue
index 0d38b106..a7e4777d 100644
--- a/resources/js/views/DashboardView.vue
+++ b/resources/js/views/DashboardView.vue
@@ -82,7 +82,7 @@ const dashboardTabs = computed<
const route = useRoute();
onMounted(async () => {
- cycleSideBar('dashboard', 'left-card');
+ cycleSideBar('dashboard', 'left-card', false);
});
watch(
@@ -110,7 +110,7 @@ watch(
<template>
<LayoutBase>
<template v-slot:content>
- <section id="content-dashboard" class="min-h-[80vh]">
+ <section id="content-dashboard" class="min-h-[80vh] text-sm">
<DashboardAnalytics v-if="dashboardTab?.name == 'overview'" />
<DashboardLibraries v-if="dashboardTab?.name == 'libraries'" />
<DashboardActivity v-if="dashboardTab?.name == 'activity'" />
@@ -144,7 +144,7 @@ watch(
:aria-disabled="tab.disabled"
>
<template #header>
- <h3 class="w-full flex-1 text-gray-900 dark:text-white" :title="tab.title ?? tab.name">{{ tab.title ?? tab.name }}</h3>
+ <h3 class="w-full flex-1 text-gray-900 dark:text-white line-clamp-1" :title="tab.title ?? tab.name">{{ tab.title ?? tab.name }}</h3>
<component v-if="tab.icon" :is="tab.icon" class="ml-auto w-6 h-6" />
</template>
<template #body>
@@ -160,6 +160,7 @@ watch(
<SidebarCard
:to="`${appManifest?.commit ? `https://github.com/aminnausin/mediaServer/commit/${appManifest?.commit}` : ''}`"
+ target="_blank"
:class="`
items-center justify-between
capitalize overflow-hidden bg-white hover:bg-primary-800
diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php
index 4e94c556..4114283b 100755
--- a/resources/views/layouts/app.blade.php
+++ b/resources/views/layouts/app.blade.php
@@ -42,7 +42,7 @@
data-reverb-config='@json(["key" => config("reverb.apps.apps.0.key"), "host" => config("reverb.apps.apps.0.options.host"), "port" => config("reverb.apps.apps.0.options.port")])'>
</div>
@vite('resources/js/app.ts')
- <div id='app'></div>
+ <div id='app' class="h-screen"></div>
{{ $slot }}
</body>