portsTab: sort telemetry, sensors, peripherals select lists (#3219)

* sort telemetry, sensors, peripherals select elements. disabledText on top

* Update ports.js

Ekstra comment
10.9-maintenance
HThuren 2023-01-07 13:55:10 +01:00 committed by GitHub
parent 78652bf37f
commit 00075939ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -243,13 +243,15 @@ ports.initialize = function (callback) {
const selectElementSelector = `select[name=${selectElementName}]`;
selectElement = functionsElement.find(selectElementSelector);
const disabledText = i18n.getMessage('portsTelemetryDisabled');
if (selectElement.length === 0) {
functionsElement.prepend(`<span class="function"><select name="${selectElementName}" /></span>`);
selectElement = functionsElement.find(selectElementSelector);
const disabledText = i18n.getMessage('portsTelemetryDisabled');
selectElement.append(`<option value="">${disabledText}</option>`);
}
selectElement.append(`<option value="${functionName}">${functionRule.displayName}</option>`);
// sort telemetry, sensors, peripherals select elements. disabledText on top
selectElement.sortSelect(disabledText);
if (serialPort.functions.indexOf(functionName) >= 0) {
selectElement.val(functionName);