From 1ab41a60d2a1e9c624ef53470d530f47c0eddcf7 Mon Sep 17 00:00:00 2001 From: itweserems Date: Thu, 27 Jun 2024 13:09:04 +0200 Subject: [PATCH 1/5] Configurable MaxNumberOfOptions #575 --- Kernel/Config/Files/XML/Framework.xml | 7 +++++++ Kernel/Language/de.pm | 2 ++ Kernel/Output/HTML/Layout.pm | 8 ++++++++ var/httpd/htdocs/js/Core.UI.InputFields.js | 4 ++-- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Kernel/Config/Files/XML/Framework.xml b/Kernel/Config/Files/XML/Framework.xml index a04063da9bd..9394dcbc7ff 100644 --- a/Kernel/Config/Files/XML/Framework.xml +++ b/Kernel/Config/Files/XML/Framework.xml @@ -550,6 +550,13 @@ 6000 + + Sets the maximum number of dropdown field values before the select layout will be changed for performance reasons. + Frontend::Base + + 1000 + + Turns on drag and drop for the main navigation. Frontend::Base diff --git a/Kernel/Language/de.pm b/Kernel/Language/de.pm index 6571f66723f..a65e23cae21 100644 --- a/Kernel/Language/de.pm +++ b/Kernel/Language/de.pm @@ -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).', diff --git a/Kernel/Output/HTML/Layout.pm b/Kernel/Output/HTML/Layout.pm index 5bf587c527e..018314f861b 100644 --- a/Kernel/Output/HTML/Layout.pm +++ b/Kernel/Output/HTML/Layout.pm @@ -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; } diff --git a/var/httpd/htdocs/js/Core.UI.InputFields.js b/var/httpd/htdocs/js/Core.UI.InputFields.js index fa8fd7220d7..8ffc548acdc 100644 --- a/var/httpd/htdocs/js/Core.UI.InputFields.js +++ b/var/httpd/htdocs/js/Core.UI.InputFields.js @@ -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", @@ -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; } From f5a32387f02ac6f7a88e9c70e37e0957b861f02a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denny=20Korsuk=C3=A9witz?= Date: Wed, 30 Oct 2024 11:26:19 +0100 Subject: [PATCH 2/5] Update Kernel/Output/HTML/Layout.pm --- Kernel/Output/HTML/Layout.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Kernel/Output/HTML/Layout.pm b/Kernel/Output/HTML/Layout.pm index 7e8c0b2272d..5549b06ac48 100644 --- a/Kernel/Output/HTML/Layout.pm +++ b/Kernel/Output/HTML/Layout.pm @@ -509,11 +509,11 @@ sub Block { }; # For performance reasons: - # Do not initialize modern inputfields on selects with many entries - my $MaxDropdownOptions = $Kernel::OM->Get('Kernel::Config')->Get("MaxDropdownOptions"); + # 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 => 'MaxDropdownOptions', - Value => $MaxDropdownOptions, + Key => 'InputFields::ModernizedSelection::MaxNumberOfOptions', + Value => $MaxNumberOfOptions, ); return 1; From 928d91a15af945b99dba64d4bb67001078fa9928 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denny=20Korsuk=C3=A9witz?= Date: Wed, 30 Oct 2024 11:26:26 +0100 Subject: [PATCH 3/5] Update Kernel/Language/de.pm --- Kernel/Language/de.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Kernel/Language/de.pm b/Kernel/Language/de.pm index 3af0edfd67d..ddf2d55a269 100644 --- a/Kernel/Language/de.pm +++ b/Kernel/Language/de.pm @@ -5608,8 +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).', - '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.', + '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).', From 15f79e399d9d75c01cdde1af2b11e441ee36873c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denny=20Korsuk=C3=A9witz?= Date: Wed, 30 Oct 2024 11:26:33 +0100 Subject: [PATCH 4/5] Update Kernel/Config/Files/XML/Framework.xml --- Kernel/Config/Files/XML/Framework.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Kernel/Config/Files/XML/Framework.xml b/Kernel/Config/Files/XML/Framework.xml index 9cfdacc7fa5..6c26b0fdb07 100644 --- a/Kernel/Config/Files/XML/Framework.xml +++ b/Kernel/Config/Files/XML/Framework.xml @@ -550,11 +550,11 @@ 6000 - - Sets the maximum number of dropdown field values before the select layout will be changed for performance reasons. + + 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. Frontend::Base - 1000 + 1000 From 92db86b4c68598198d6b1028a14078e68b6bb88f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denny=20Korsuk=C3=A9witz?= Date: Wed, 30 Oct 2024 11:26:39 +0100 Subject: [PATCH 5/5] Update var/httpd/htdocs/js/Core.UI.InputFields.js --- var/httpd/htdocs/js/Core.UI.InputFields.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/var/httpd/htdocs/js/Core.UI.InputFields.js b/var/httpd/htdocs/js/Core.UI.InputFields.js index 8ffc548acdc..d85dd7462ea 100644 --- a/var/httpd/htdocs/js/Core.UI.InputFields.js +++ b/var/httpd/htdocs/js/Core.UI.InputFields.js @@ -1188,8 +1188,8 @@ Core.UI.InputFields = (function (TargetNS) { // For performance reasons: // Do not initialize modern inputfields on selects with many entries - MaxDropdownOptions = Core.Config.Get('MaxDropdownOptions'); - if ($(SelectObj).children('option').length > MaxDropdownOptions) { + MaxNumberOfOptions = Core.Config.Get('InputFields::ModernizedSelection::MaxNumberOfOptions'); + if ($(SelectObj).children('option').length > MaxNumberOfOptions) { return; }