portsTab: sort telemetry, sensors, peripherals select lists (#3219)
* sort telemetry, sensors, peripherals select elements. disabledText on top * Update ports.js Ekstra comment10.9-maintenance
parent
78652bf37f
commit
00075939ac
|
@ -243,13 +243,15 @@ ports.initialize = function (callback) {
|
||||||
const selectElementSelector = `select[name=${selectElementName}]`;
|
const selectElementSelector = `select[name=${selectElementName}]`;
|
||||||
selectElement = functionsElement.find(selectElementSelector);
|
selectElement = functionsElement.find(selectElementSelector);
|
||||||
|
|
||||||
|
const disabledText = i18n.getMessage('portsTelemetryDisabled');
|
||||||
if (selectElement.length === 0) {
|
if (selectElement.length === 0) {
|
||||||
functionsElement.prepend(`<span class="function"><select name="${selectElementName}" /></span>`);
|
functionsElement.prepend(`<span class="function"><select name="${selectElementName}" /></span>`);
|
||||||
selectElement = functionsElement.find(selectElementSelector);
|
selectElement = functionsElement.find(selectElementSelector);
|
||||||
const disabledText = i18n.getMessage('portsTelemetryDisabled');
|
|
||||||
selectElement.append(`<option value="">${disabledText}</option>`);
|
selectElement.append(`<option value="">${disabledText}</option>`);
|
||||||
}
|
}
|
||||||
selectElement.append(`<option value="${functionName}">${functionRule.displayName}</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) {
|
if (serialPort.functions.indexOf(functionName) >= 0) {
|
||||||
selectElement.val(functionName);
|
selectElement.val(functionName);
|
||||||
|
|
Loading…
Reference in New Issue