A self-hosted media server and file management system
Vue ffmpegfile-serverjellyfinlaravelmediamedia-playermedia-servermediabrowsermediaservermusicmusic-librarymusic-playermusicplayerself-hostedvuejs
add loading to table (history)
aminnausinb6efc557cb4d
diff --git a/resources/js/components/table/TableBase.vue b/resources/js/components/table/TableBase.vueindex 46926769..894e5d4d 100644--- a/resources/js/components/table/TableBase.vue+++ b/resources/js/components/table/TableBase.vue@@ -6,20 +6,21 @@ import TablePagination from '../table/TablePagination.vue';import { watch } from 'vue';-const props = defineProps(['useToolbar','data', 'row', 'clickAction']);+const props = defineProps(['useToolbar','data', 'row', 'clickAction','loading']);const tableData = useTable(props);watch(props.data, tableData.handlePageReset, {immediate: true})</script><template>- <table class="w-full flex flex-col gap-4 divide-y first:pt-0 [&>*:not(:first-child)]:pt-4">+ <div v-if="props.loading" class="text-center text-lg text-gray-500 dark:text-gray-400 uppercase tracking-wider w-full">Loading</div>+ <div v-else-if="tableData.filteredPage.length === 0 && !props.loading" class="text-center text-lg text-gray-500 dark:text-gray-400 uppercase tracking-wider w-full">No Results</div>+ <table v-else class="w-full flex flex-col gap-4 divide-y first:pt-0 [&>*:not(:first-child)]:pt-4"><section v-if="props.useToolbar" class="flex justify-center sm:justify-between p-2"><LabelledTextInput v-model="tableData.fields.searchQuery" :text="'Search'" :placeholder="'Enter search query'" :id="'table-search'" class="w-80"/></section><tbody class="flex w-full flex-wrap gap-2"><component :is="props.row" v-for="(row, index) in tableData.filteredPage" :key="row?.id ?? index" :data="row" @clickAction="props.clickAction"></component>- <div v-if="tableData.filteredPage.length === 0" class="text-center text-lg text-gray-500 dark:text-gray-400 uppercase tracking-wider w-full">No Results</div></tbody><TablePagination :listLength="props.data?.length ?? 0" :itemsPerPage="tableData.fields.itemsPerPage" :currentPage="tableData.fields.currentPage" @setPage="tableData.handlePageChange"/></table>diff --git a/resources/js/views/HistoryView.vue b/resources/js/views/HistoryView.vueindex 77437ff5..976b0353 100644--- a/resources/js/views/HistoryView.vue+++ b/resources/js/views/HistoryView.vue@@ -16,7 +16,7 @@const { pageTitle, selectedSideBar } = storeToRefs(appStore);const { records } = storeToRefs(ContentStore);const { getRecords, deleteRecord } = ContentStore;- // const loaded = ref(false);+ const loading = ref(true);const cachedID = ref(null);const confirmModal = useModal({title: 'Delete Record?', submitText: 'Confim'});@@ -37,7 +37,7 @@(async () => {if( records.value.length <= 10 ) await getRecords();// await getRecords();- // loaded.value = true;+ loading.value = false;})()})</script>@@ -46,7 +46,7 @@<LayoutBase><template v-slot:content><section id="content-history" class=" space-y-2 cursor-pointer min-h-[80vh] ">- <TableBase :data="records" :row="RecordCardDetails" :clickAction="handleDelete">+ <TableBase :data="records" :row="RecordCardDetails" :clickAction="handleDelete" :loading="loading"></TableBase></section>