Make pagination configurable in configuration (#533)

* Make pagination configurable in configuration

* Set pagination defaults in store

* Add documentation of pagination
This commit is contained in:
Robert-Jan de Dreu
2025-02-25 09:00:34 +01:00
committed by GitHub
parent 08ee98ed8b
commit ff0c247992
6 changed files with 17 additions and 15 deletions

View File

@@ -23,6 +23,7 @@ return [
'guest_redirection' => '', // useful for external auth adapters 'guest_redirection' => '', // useful for external auth adapters
'search_simultaneous' => 5, 'search_simultaneous' => 5,
'filter_entries' => [], 'filter_entries' => [],
'pagination' => ['', 5, 10, 15],
], ],
'services' => [ 'services' => [

View File

@@ -31,6 +31,10 @@ Note: if you've made a mistake in configuration file (forgot to close a quote?)
// neither of above => it is a file and could be in every folder, example: '.htaccess' // neither of above => it is a file and could be in every folder, example: '.htaccess'
// both of above => full folder path has to match, example: '/homes/web/filegator/.npm/' // both of above => full folder path has to match, example: '/homes/web/filegator/.npm/'
'filter_entries' => ['Recycle.bin/', 'File System Information/', '.DS_Store', '@eaDir/', '#recycle/'], 'filter_entries' => ['Recycle.bin/', 'File System Information/', '.DS_Store', '@eaDir/', '#recycle/'],
// Use '' for the unlimited pagination and integers for the items per page. The first item is used as the
// default pagination and the choices are ordered by the order in the array.
'pagination' => ['', 5, 10, 15],
], ],
``` ```

View File

@@ -8,7 +8,9 @@ Vue.use(Vuex)
export default new Vuex.Store({ export default new Vuex.Store({
state: { state: {
initialized: false, initialized: false,
config: [], config: {
pagination: ['', 5, 10, 15],
},
user: { user: {
role: 'guest', role: 'guest',
permissions: [], permissions: [],
@@ -50,7 +52,7 @@ export default new Vuex.Store({
} }
}, },
setConfig(state, data) { setConfig(state, data) {
state.config = data state.config = {...state.config, ...data}
}, },
setUser(state, data) { setUser(state, data) {
state.user = data state.user = data

View File

@@ -191,7 +191,7 @@ export default {
data() { data() {
return { return {
dropZone: false, dropZone: false,
perPage: '', perPage: this.$store.state.config.pagination[0],
currentPage: 1, currentPage: 1,
checked: [], checked: [],
isLoading: false, isLoading: false,

View File

@@ -65,7 +65,7 @@ export default {
components: { Menu, Pagination }, components: { Menu, Pagination },
data() { data() {
return { return {
perPage: '', perPage: this.$store.state.config.pagination[0],
currentPage: 1, currentPage: 1,
isLoading: false, isLoading: false,
defaultSort: ['name', 'desc'], defaultSort: ['name', 'desc'],

View File

@@ -1,17 +1,12 @@
<template> <template>
<div> <div>
<b-select :value="perpage" size="is-small" @input="$emit('selected', $event)"> <b-select :value="perpage" size="is-small" @input="$emit('selected', $event)">
<option value=""> <option
{{ lang('No pagination') }} v-for="page in this.$store.state.config.pagination"
</option> :key="page"
<option value="5"> :value="page"
{{ lang('Per page', 5) }} >
</option> {{ page === '' ? lang('No pagination') : lang('Per page', page) }}
<option value="10">
{{ lang('Per page', 10) }}
</option>
<option value="15">
{{ lang('Per page', 15) }}
</option> </option>
</b-select> </b-select>
</div> </div>