From 062017b0a6bf117d178b397dc8e19ae2adccbda1 Mon Sep 17 00:00:00 2001 From: Miguel Angel Mulero Martinez Date: Wed, 26 Aug 2020 16:08:17 +0200 Subject: [PATCH] Add search and order to the blackbox debug modes list --- src/js/tabs/onboard_logging.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/js/tabs/onboard_logging.js b/src/js/tabs/onboard_logging.js index 8355e8d3..18880237 100644 --- a/src/js/tabs/onboard_logging.js +++ b/src/js/tabs/onboard_logging.js @@ -353,6 +353,22 @@ TABS.onboard_logging.initialize = function (callback) { } debugModeSelect.val(FC.PID_ADVANCED_CONFIG.debugMode); + + // Convert to select2 and order alphabetic + debugModeSelect.select2({ + sorter(data) { + return data.sort(function(a, b) { + if (a.text === "NONE" || b.text === i18n.getMessage('onboardLoggingDebugModeUnknown')) { + return -1; + } else if (b.text ==="NONE" || a.text === i18n.getMessage('onboardLoggingDebugModeUnknown')) { + return 1; + } else { + return a.text.localeCompare(b.text); + } + }); + }, + }); + } else { $('.blackboxDebugMode').hide(); }