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

Added configurable InputFields::ModernizedSelection::MaxNumberOfOptions. #576

Merged
merged 11 commits into from
Nov 1, 2024
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="InputFields::ModernizedSelection::MaxNumberOfOptions" Required="1" Valid="1">
<Description Translatable="1">Limits the number of options for modernized selection fields. If this limit will be exceeded, the selection field will for performance reasons be shown as non-modernized.</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 @@ -5608,6 +5608,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).',
'Limits the number of options for modernized selection fields. If this limit will be exceeded, the selection field will for performance reasons be shown as non-modernized.' =>
'Limitiert die Anzahl an Optionen für modernized Auswahlfelder. Wenn das Limit überschritten ist, wird das Auswahlfeld aus Performancegründen als nicht-modernized angezeigt.',
'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 modernized input fields on selections with many entries
my $MaxNumberOfOptions = $Kernel::OM->Get('Kernel::Config')->Get("InputFields::ModernizedSelection::MaxNumberOfOptions");
$Self->AddJSData(
Key => 'InputFields::ModernizedSelection::MaxNumberOfOptions',
Value => $MaxNumberOfOptions,
);

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) {
MaxNumberOfOptions = Core.Config.Get('InputFields::ModernizedSelection::MaxNumberOfOptions');
if ($(SelectObj).children('option').length > MaxNumberOfOptions) {
return;
}

Expand Down
Loading