mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 01:25:55 +02:00
Renamed config env to TABLE_PARTS_DEFAULT_COLUMNS and updated documentation
This commit is contained in:
parent
1369091b90
commit
79262972aa
7 changed files with 14 additions and 9 deletions
|
@ -35,7 +35,7 @@
|
||||||
PassEnv DEMO_MODE NO_URL_REWRITE_AVAILABLE FIXER_API_KEY BANNER
|
PassEnv DEMO_MODE NO_URL_REWRITE_AVAILABLE FIXER_API_KEY BANNER
|
||||||
# In old version the SAML sp private key env, was wrongly named SAMLP_SP_PRIVATE_KEY, keep it for backward compatibility
|
# In old version the SAML sp private key env, was wrongly named SAMLP_SP_PRIVATE_KEY, keep it for backward compatibility
|
||||||
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 SAML_SP_PRIVATE_KEY SAMLP_SP_PRIVATE_KEY
|
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 SAML_SP_PRIVATE_KEY SAMLP_SP_PRIVATE_KEY
|
||||||
PassEnv TABLE_DEFAULT_PAGE_SIZE TABLE_PART_DEFAULT_COLUMNS
|
PassEnv TABLE_DEFAULT_PAGE_SIZE TABLE_PARTS_DEFAULT_COLUMNS
|
||||||
|
|
||||||
PassEnv PROVIDER_DIGIKEY_CLIENT_ID PROVIDER_DIGIKEY_SECRET PROVIDER_DIGIKEY_CURRENCY PROVIDER_DIGIKEY_LANGUAGE PROVIDER_DIGIKEY_COUNTRY
|
PassEnv PROVIDER_DIGIKEY_CLIENT_ID PROVIDER_DIGIKEY_SECRET PROVIDER_DIGIKEY_CURRENCY PROVIDER_DIGIKEY_LANGUAGE PROVIDER_DIGIKEY_COUNTRY
|
||||||
PassEnv PROVIDER_ELEMENT14_KEY PROVIDER_ELEMENT14_STORE_ID
|
PassEnv PROVIDER_ELEMENT14_KEY PROVIDER_ELEMENT14_STORE_ID
|
||||||
|
|
3
.env
3
.env
|
@ -93,6 +93,9 @@ ERROR_PAGE_SHOW_HELP=1
|
||||||
|
|
||||||
# The default page size for the part table (set to -1 to show all parts on one page)
|
# The default page size for the part table (set to -1 to show all parts on one page)
|
||||||
TABLE_DEFAULT_PAGE_SIZE=50
|
TABLE_DEFAULT_PAGE_SIZE=50
|
||||||
|
# Configure which columns will be visible by default in the parts table (and in which order).
|
||||||
|
# This is a comma separated list of column names. See documentation for available values.
|
||||||
|
TABLE_PARTS_DEFAULT_COLUMNS=name,description,category,footprint,manufacturer,storage_location,amount
|
||||||
|
|
||||||
##################################################################################
|
##################################################################################
|
||||||
# Info provider settings
|
# Info provider settings
|
||||||
|
|
|
@ -54,7 +54,7 @@ parameters:
|
||||||
# Table settings
|
# Table settings
|
||||||
######################################################################################################################
|
######################################################################################################################
|
||||||
partdb.table.default_page_size: '%env(int:TABLE_DEFAULT_PAGE_SIZE)%' # The default number of entries shown per page in tables
|
partdb.table.default_page_size: '%env(int:TABLE_DEFAULT_PAGE_SIZE)%' # The default number of entries shown per page in tables
|
||||||
partdb.table.default_part_columns: '%env(trim:string:TABLE_PART_DEFAULT_COLUMNS)%' # The default columns in part tables and their order
|
partdb.table.parts.default_columns: '%env(trim:string:TABLE_PARTS_DEFAULT_COLUMNS)%' # The default columns in part tables and their order
|
||||||
|
|
||||||
######################################################################################################################
|
######################################################################################################################
|
||||||
# Sidebar
|
# Sidebar
|
||||||
|
|
|
@ -216,7 +216,7 @@ services:
|
||||||
####################################################################################################################
|
####################################################################################################################
|
||||||
App\DataTables\PartsDataTable:
|
App\DataTables\PartsDataTable:
|
||||||
arguments:
|
arguments:
|
||||||
$visible_columns: '%partdb.table.default_part_columns%'
|
$visible_columns: '%partdb.table.parts.default_columns%'
|
||||||
|
|
||||||
App\DataTables\Helpers\ColumnSortHelper:
|
App\DataTables\Helpers\ColumnSortHelper:
|
||||||
shared: false # Service has a state so not share it between different tables
|
shared: false # Service has a state so not share it between different tables
|
||||||
|
|
|
@ -46,7 +46,8 @@ The following configuration options can only be changed by the server administra
|
||||||
|
|
||||||
### Table related settings
|
### 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.
|
* `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.
|
||||||
* `TABLE_PART_DEFAULT_COLUMNS`: The default columns in part tables loading table for first time. Also specify default order of the columns. Specify as comma separated string. Available columns are: `name`, `id`, `ipn`, `description`, `category`, `footprint`, `manufacturer`, `storelocation`, `amount`, `minamount`, `partUnit`, `addedDate`, `lastModified`, `needs_review`, `favorite`, `manufacturing_status`, `manufacturer_product_number`, `mass`, `tags`, `attachments`, `edit`.
|
* `TABLE_PARTS_DEFAULT_COLUMNS`: The columns in parts tables, which are visible by default (when loading table for first time).
|
||||||
|
Also specify the default order of the columns. This is a comma separated list of column names. Available columns are: `name`, `id`, `ipn`, `description`, `category`, `footprint`, `manufacturer`, `storage_location`, `amount`, `minamount`, `partUnit`, `addedDate`, `lastModified`, `needs_review`, `favorite`, `manufacturing_status`, `manufacturer_product_number`, `mass`, `tags`, `attachments`, `edit`.
|
||||||
|
|
||||||
### History/Eventlog related settings
|
### History/Eventlog related settings
|
||||||
The following options are used to configure, which (and how much) data is written to the system log:
|
The following options are used to configure, which (and how much) data is written to the system log:
|
||||||
|
|
|
@ -76,7 +76,8 @@ class ColumnSortHelper
|
||||||
* be visible by default. If a column is not listed here, it will be hidden by default.
|
* be visible by default. If a column is not listed here, it will be hidden by default.
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function applyVisibilityAndConfigureColumns(DataTable $dataTable, string|array $visible_columns): void
|
public function applyVisibilityAndConfigureColumns(DataTable $dataTable, string|array $visible_columns,
|
||||||
|
string $config_var_name): void
|
||||||
{
|
{
|
||||||
//If the config is given as a string, convert it to an array first
|
//If the config is given as a string, convert it to an array first
|
||||||
if (!is_array($visible_columns)) {
|
if (!is_array($visible_columns)) {
|
||||||
|
@ -96,12 +97,12 @@ class ColumnSortHelper
|
||||||
//Afterwards the columns, which should be visible by default
|
//Afterwards the columns, which should be visible by default
|
||||||
foreach ($visible_columns as $col_id) {
|
foreach ($visible_columns as $col_id) {
|
||||||
if (!isset($this->columns[$col_id]) || !$this->columns[$col_id]['visibility_configurable']) {
|
if (!isset($this->columns[$col_id]) || !$this->columns[$col_id]['visibility_configurable']) {
|
||||||
$this->logger->warning("Configuration option TABLE_PART_DEFAULT_COLUMNS specify invalid column '$col_id'. Column is skipped.");
|
$this->logger->warning("Configuration option $config_var_name specify invalid column '$col_id'. Column is skipped.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array($col_id, $processed_columns, true)) {
|
if (in_array($col_id, $processed_columns, true)) {
|
||||||
$this->logger->warning("Configuration option TABLE_PART_DEFAULT_COLUMNS specify column '$col_id' multiple time. Only first occurrence is used.");
|
$this->logger->warning("Configuration option $config_var_name specify column '$col_id' multiple time. Only first occurrence is used.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$this->addColumnEntry($dataTable, $this->columns[$col_id], true);
|
$this->addColumnEntry($dataTable, $this->columns[$col_id], true);
|
||||||
|
|
|
@ -167,7 +167,7 @@ final class PartsDataTable implements DataTableTypeInterface
|
||||||
|
|
||||||
return implode('<br>', $tmp);
|
return implode('<br>', $tmp);
|
||||||
},
|
},
|
||||||
]);
|
], alias: 'storage_location');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->csh->add('amount', TextColumn::class, [
|
$this->csh->add('amount', TextColumn::class, [
|
||||||
|
@ -280,7 +280,7 @@ final class PartsDataTable implements DataTableTypeInterface
|
||||||
]);
|
]);
|
||||||
|
|
||||||
//Apply the user configured order and visibility and add the columns to the table
|
//Apply the user configured order and visibility and add the columns to the table
|
||||||
$this->csh->applyVisibilityAndConfigureColumns($dataTable, $this->visible_columns);
|
$this->csh->applyVisibilityAndConfigureColumns($dataTable, $this->visible_columns, "TABLE_PARTS_DEFAULT_COLUMNS");
|
||||||
|
|
||||||
$dataTable->addOrderBy('name')
|
$dataTable->addOrderBy('name')
|
||||||
->createAdapter(TwoStepORMAdapater::class, [
|
->createAdapter(TwoStepORMAdapater::class, [
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue