diff --git a/.docker/symfony.conf b/.docker/symfony.conf index d57b402f..0629d12c 100644 --- a/.docker/symfony.conf +++ b/.docker/symfony.conf @@ -34,7 +34,7 @@ PassEnv ERROR_PAGE_ADMIN_EMAIL ERROR_PAGE_SHOW_HELP PassEnv DEMO_MODE NO_URL_REWRITE_AVAILABLE FIXER_API_KEY BANNER PassEnv SAML_ENABLED SAML_ROLE_MAPPING SAML_UPDATE_GROUP_ON_LOGIN SAML_IDP_ENTITY_ID SAML_IDP_SINGLE_SIGN_ON_SERVICE SAML_IDP_SINGLE_LOGOUT_SERVICE SAML_IDP_X509_CERT SAML_SP_ENTITY_ID SAML_SP_X509_CERT SAMLP_SP_PRIVATE_KEY - + PassEnv TABLE_DEFAULT_PAGE_SIZE # For most configuration files from conf-available/, which are # enabled or disabled at a global level, it is possible to diff --git a/.env b/.env index e969be4a..ede0dd4b 100644 --- a/.env +++ b/.env @@ -84,6 +84,13 @@ ERROR_PAGE_ADMIN_EMAIL='' # If this is set to true, solutions to common problems are shown on error pages. Disable this, if you do not want your users to see them... ERROR_PAGE_SHOW_HELP=1 +################################################################################## +# Part table settings +################################################################################## + +# The default page size for the part table (set to -1 to show all parts on one page) +TABLE_DEFAULT_PAGE_SIZE=50 + ################################################################################### # SAML Single sign on-settings ################################################################################### diff --git a/assets/controllers/elements/datatables/datatables_controller.js b/assets/controllers/elements/datatables/datatables_controller.js index 0c7f0b11..9587d7d1 100644 --- a/assets/controllers/elements/datatables/datatables_controller.js +++ b/assets/controllers/elements/datatables/datatables_controller.js @@ -68,11 +68,13 @@ export default class extends Controller { stateLoadCallback(settings) { const data = JSON.parse( localStorage.getItem(this.getStateSaveKey()) ); + debugger; + if (data) { //Do not save the start value (current page), as we want to always start at the first page on a page reload - data.start = 0; - //50 is the default length supplied by datatables, reset it to that value - data.length = 50; + delete data.start; + //Reset the data length to the default value by deleting the length property + delete data.length; } return data; diff --git a/config/packages/datatables.yaml b/config/packages/datatables.yaml index 0ccd6434..dc116f97 100644 --- a/config/packages/datatables.yaml +++ b/config/packages/datatables.yaml @@ -9,7 +9,7 @@ datatables: # Set options, as documented at https://datatables.net/reference/option/ options: lengthMenu : [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]] - pageLength: 50 + pageLength: '%partdb.table.default_page_size%' # Set to -1 to disable pagination (i.e. show all rows) by default #dom: "<'row' <'col-sm-12' tr>><'row' <'col-sm-6'l><'col-sm-6 text-right'pif>>" dom: " <'row'<'col mb-2 input-group' B l> <'col mb-2' <'pull-end' p>>> <'card' diff --git a/config/parameters.yaml b/config/parameters.yaml index 1cfa41a4..27d720b0 100644 --- a/config/parameters.yaml +++ b/config/parameters.yaml @@ -48,6 +48,11 @@ parameters: ###################################################################################################################### partdb.saml.enabled: '%env(bool:SAML_ENABLED)%' # If this is set to true, SAML authentication is enabled + ###################################################################################################################### + # Table settings + ###################################################################################################################### + partdb.table.default_page_size: '%env(int:TABLE_DEFAULT_PAGE_SIZE)%' # The default number of entries shown per page in tables + ###################################################################################################################### # Sidebar ###################################################################################################################### @@ -119,6 +124,8 @@ parameters: env(EMAIL_SENDER_NAME): 'Part-DB Mailer' env(ALLOW_EMAIL_PW_RESET): 0 + env(TABLE_DEFAULT_PAGE_SIZE): 50 + env(TRUSTED_PROXIES): '127.0.0.1' #By default trust only our own server env(TRUSTED_HOSTS): '' # Trust all host names by default diff --git a/docs/configuration.md b/docs/configuration.md index f7748195..e1e115ff 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -43,6 +43,9 @@ The following configuration options can only be changed by the server administra * `EMAIL_SENDER_NAME`: Similar to `EMAIL_SENDER_EMAIL` but this allows you to specify the name from which the mails are sent from. * `ALLOW_EMAIL_PW_RESET`: Set this value to true, if you wan to allow users to reset their password via an email notification. You have to configure the mailprovider first before via the MAILER_DSN setting. +### Table related settings +* `TABLE_DEFAULT_PAGE_SIZE`: The default page size for tables. This is the number of rows which are shown per page. Set to `-1` to disable pagination and show all rows at once. + ### History/Eventlog related settings The following options are used to configure, which (and how much) data is written to the system log: * `HISTORY_SAVE_CHANGED_FIELDS`: When this option is set to true, the name of the fields which are changed, are saved to the DB (so for example it is logged that a user has changed, that the user has changed the name and description of the field, but not the data/content of these changes)