Skip to content

Commit

Permalink
Pin cfg: Sort Driver / pin function list alphabeticaly (#1361)
Browse files Browse the repository at this point in the history
* Pin cfg: Sort Driver / pin function list alphabeticaly

* Let pins alias have fixed size
  • Loading branch information
MaxineMuster authored Sep 29, 2024
1 parent 56233df commit 2c7cfd5
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/httpserver/http_fns.c
Original file line number Diff line number Diff line change
Expand Up @@ -2531,6 +2531,8 @@ int http_fn_cfg_pins(http_request_t* request) {
}
poststr(request, "];");

poststr(request, "var sr = r.map((e,i)=>{return e[0]+'#'+i}).sort(Intl.Collator().compare).map(e=>e.split('#'));");

poststr(request, "function hide_show() {"
"n=this.name;"
"er=getElement('r'+n);"
Expand All @@ -2544,20 +2546,18 @@ int http_fn_cfg_pins(http_request_t* request) {
"let f = document.getElementById(\"x\");"
"let d = document.createElement(\"div\");"
"d.className = \"hdiv\";"
"d.innerText = alias;"
"d.innerHTML = \"<span class='disp-inline' style='min-width: 15ch'>\"+alias+\"</span>\";"
"f.appendChild(d);"
"let s = document.createElement(\"select\");"
"s.className = \"hele\";"
"s.name = id;"
"d.appendChild(s);"
" for (var i = 0; i < r.length; i++) {"
" if(b && r[i][0].startsWith(\"PWM\")) continue; "
" for (var i = 0; i < sr.length; i++) {"
" if(b && sr[i][0].startsWith(\"PWM\")) continue; "
"var o = document.createElement(\"option\");"
" o.text = r[i][0];"
" o.value = i;"
" if (i == c) {"
" o.selected = true;"
" }"
" o.text = sr[i][0];"
" o.value = sr[i][1];"
" o.selected = (sr[i][1] == c);"
"s.add(o);s.onchange = hide_show;"
"}"
"var y = document.createElement(\"input\");"
Expand Down

0 comments on commit 2c7cfd5

Please sign in to comment.