Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable MaxNumberOfOptions #575 #576

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Kernel/Config/Files/XML/Framework.xml
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,13 @@
<Item ValueType="String" ValueRegex="^[0-9]{1,5}$">6000</Item>
</Value>
</Setting>
<Setting Name="MaxDropdownOptions" Required="1" Valid="1">
<Description Translatable="1">Sets the maximum number of dropdown field values before the select layout will be changed for performance reasons.</Description>
<Navigation>Frontend::Base</Navigation>
<Value>
<Item ValueType="String" ValueRegex="^\d*$">1000</Item>
</Value>
</Setting>
<Setting Name="Frontend::MenuDragDropEnabled" Required="1" Valid="1">
<Description Translatable="1">Turns on drag and drop for the main navigation.</Description>
<Navigation>Frontend::Base</Navigation>
Expand Down
2 changes: 2 additions & 0 deletions Kernel/Language/de.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5636,6 +5636,8 @@ sub Data {
'Automatischer Zeilenumbruch in Textnachrichten nach x-Zeichen.',
'Sets the number of lines that are displayed in text messages (e.g. ticket lines in the QueueZoom).' =>
'Legt die Anzahl an Zeilen fest, die von Textnachrichten angezeigt werden sollen (z. B. von Tickets in der Queue-Ansicht).',
'Sets the maximum number of dropdown field values before the select layout will be changed for performance reasons.' =>
'Legt die maximale Anzahl an Werten fest, bevor das Auswahlfeld-Layout zu Performancezwecken geändert wird.',
'Turns on drag and drop for the main navigation.' => 'Aktiviert Drag und Drop für die Hauptnavigation.',
'Defines the date input format used in forms (option or input fields).' =>
'Definiert das benutzte Datumseingabeformat in Formularen (Option für Eingabefelder).',
Expand Down
8 changes: 8 additions & 0 deletions Kernel/Output/HTML/Layout.pm
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,14 @@ sub Block {
Data => $Param{Data},
};

# For performance reasons:
# Do not initialize modern inputfields on selects with many entries
my $MaxDropdownOptions = $Kernel::OM->Get('Kernel::Config')->Get("MaxDropdownOptions");
$Self->AddJSData(
Key => 'MaxDropdownOptions',
Value => $MaxDropdownOptions,
);

return 1;
}

Expand Down
4 changes: 2 additions & 2 deletions var/httpd/htdocs/js/Core.UI.InputFields.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ Core.UI.InputFields = (function (TargetNS) {
ResizeEvent: 'onorientationchange' in window ? 'orientationchange' : 'resize',
ResizeTimeout: 0,
SafeMargin: 30,
MaxNumberOfOptions: 1000,
MinQueryLength: 4,
Diacritics: {
"\u24B6":"A", "\uFF21":"A", "\u00C0":"A", "\u00C1":"A", "\u00C2":"A", "\u1EA6":"A",
Expand Down Expand Up @@ -1189,7 +1188,8 @@ Core.UI.InputFields = (function (TargetNS) {

// For performance reasons:
// Do not initialize modern inputfields on selects with many entries
if ($(SelectObj).children('option').length > Config.MaxNumberOfOptions) {
MaxDropdownOptions = Core.Config.Get('MaxDropdownOptions');
if ($(SelectObj).children('option').length > MaxDropdownOptions) {
return;
}

Expand Down
Loading