use dropdown for channel selection

This commit is contained in:
Martin/Geno 2018-07-28 12:27:26 +02:00
parent 58d843ae7e
commit 7c5d117784
No known key found for this signature in database
GPG Key ID: 9D7D3C6BFF600C6A
3 changed files with 82 additions and 100 deletions

View File

@ -16,71 +16,75 @@ var (
ChannelEU = true ChannelEU = true
ChannelList = map[uint32]*Channel{ ChannelList = map[uint32]*Channel{
1: &Channel{Frequenz: 2412, AllowedInEU: true, DFS: false, Indoor: false, SDR: false}, 1: &Channel{Frequenz: 2412, AllowedInEU: true, DFS: false, Indoor: false, SDR: false},
2: &Channel{Frequenz: 2417, AllowedInEU: true, DFS: false, Indoor: false, SDR: false}, //2: &Channel{Frequenz: 2417, AllowedInEU: true, DFS: false, Indoor: false, SDR: false},
3: &Channel{Frequenz: 2422, AllowedInEU: true, DFS: false, Indoor: false, SDR: false}, //3: &Channel{Frequenz: 2422, AllowedInEU: true, DFS: false, Indoor: false, SDR: false},
4: &Channel{Frequenz: 2427, AllowedInEU: true, DFS: false, Indoor: false, SDR: false}, //4: &Channel{Frequenz: 2427, AllowedInEU: true, DFS: false, Indoor: false, SDR: false},
5: &Channel{Frequenz: 2432, AllowedInEU: true, DFS: false, Indoor: false, SDR: false}, 5: &Channel{Frequenz: 2432, AllowedInEU: true, DFS: false, Indoor: false, SDR: false},
6: &Channel{Frequenz: 2437, AllowedInEU: true, DFS: false, Indoor: false, SDR: false}, //6: &Channel{Frequenz: 2437, AllowedInEU: true, DFS: false, Indoor: false, SDR: false},
7: &Channel{Frequenz: 2442, AllowedInEU: true, DFS: false, Indoor: false, SDR: false}, //7: &Channel{Frequenz: 2442, AllowedInEU: true, DFS: false, Indoor: false, SDR: false},
8: &Channel{Frequenz: 2447, AllowedInEU: true, DFS: false, Indoor: false, SDR: false}, //8: &Channel{Frequenz: 2447, AllowedInEU: true, DFS: false, Indoor: false, SDR: false},
9: &Channel{Frequenz: 2452, AllowedInEU: true, DFS: false, Indoor: false, SDR: false}, 9: &Channel{Frequenz: 2452, AllowedInEU: true, DFS: false, Indoor: false, SDR: false},
10: &Channel{Frequenz: 2457, AllowedInEU: true, DFS: false, Indoor: false, SDR: false}, //10: &Channel{Frequenz: 2457, AllowedInEU: true, DFS: false, Indoor: false, SDR: false},
11: &Channel{Frequenz: 2462, AllowedInEU: true, DFS: false, Indoor: false, SDR: false}, //11: &Channel{Frequenz: 2462, AllowedInEU: true, DFS: false, Indoor: false, SDR: false},
12: &Channel{Frequenz: 2467, AllowedInEU: true, DFS: false, Indoor: false, SDR: false}, //12: &Channel{Frequenz: 2467, AllowedInEU: true, DFS: false, Indoor: false, SDR: false},
13: &Channel{Frequenz: 2472, AllowedInEU: true, DFS: false, Indoor: false, SDR: false}, 13: &Channel{Frequenz: 2472, AllowedInEU: true, DFS: false, Indoor: false, SDR: false},
14: &Channel{Frequenz: 2484, AllowedInEU: false, DFS: false, Indoor: false, SDR: false}, //14: &Channel{Frequenz: 2484, AllowedInEU: false, DFS: false, Indoor: false, SDR: false},
32: &Channel{Frequenz: 5160, AllowedInEU: true, DFS: false, Indoor: false, SDR: false}, //32: &Channel{Frequenz: 5160, AllowedInEU: true, DFS: false, Indoor: false, SDR: false},
34: &Channel{Frequenz: 5170, AllowedInEU: false, DFS: false, Indoor: true, SDR: false}, 34: &Channel{Frequenz: 5170, AllowedInEU: false, DFS: false, Indoor: true, SDR: false},
36: &Channel{Frequenz: 5180, AllowedInEU: true, DFS: false, Indoor: true, SDR: false}, 36: &Channel{Frequenz: 5180, AllowedInEU: true, DFS: false, Indoor: true, SDR: false},
38: &Channel{Frequenz: 5190, AllowedInEU: false, DFS: false, Indoor: true, SDR: false}, 38: &Channel{Frequenz: 5190, AllowedInEU: false, DFS: false, Indoor: true, SDR: false},
40: &Channel{Frequenz: 5200, AllowedInEU: true, DFS: false, Indoor: true, SDR: false}, //40 MHz - 40: &Channel{Frequenz: 5200, AllowedInEU: true, DFS: false, Indoor: true, SDR: false},
42: &Channel{Frequenz: 5210, AllowedInEU: false, DFS: false, Indoor: true, SDR: false}, 42: &Channel{Frequenz: 5210, AllowedInEU: false, DFS: false, Indoor: true, SDR: false},
44: &Channel{Frequenz: 5220, AllowedInEU: true, DFS: false, Indoor: true, SDR: false}, 44: &Channel{Frequenz: 5220, AllowedInEU: true, DFS: false, Indoor: true, SDR: false},
46: &Channel{Frequenz: 5230, AllowedInEU: false, DFS: false, Indoor: true, SDR: false}, 46: &Channel{Frequenz: 5230, AllowedInEU: false, DFS: false, Indoor: true, SDR: false},
48: &Channel{Frequenz: 5240, AllowedInEU: true, DFS: false, Indoor: true, SDR: false}, //40 MHz - 48: &Channel{Frequenz: 5240, AllowedInEU: true, DFS: false, Indoor: true, SDR: false},
50: &Channel{Frequenz: 5250, AllowedInEU: true, DFS: true, Indoor: false, SDR: false}, //50: &Channel{Frequenz: 5250, AllowedInEU: true, DFS: true, Indoor: false, SDR: false},
52: &Channel{Frequenz: 5260, AllowedInEU: true, DFS: true, Indoor: true, SDR: false}, 52: &Channel{Frequenz: 5260, AllowedInEU: true, DFS: true, Indoor: true, SDR: false},
54: &Channel{Frequenz: 5270, AllowedInEU: false, DFS: true, Indoor: true, SDR: false}, 54: &Channel{Frequenz: 5270, AllowedInEU: false, DFS: true, Indoor: true, SDR: false},
56: &Channel{Frequenz: 5280, AllowedInEU: true, DFS: true, Indoor: true, SDR: false}, //40 MHz - 56: &Channel{Frequenz: 5280, AllowedInEU: true, DFS: true, Indoor: true, SDR: false},
58: &Channel{Frequenz: 5290, AllowedInEU: false, DFS: true, Indoor: true, SDR: false}, 58: &Channel{Frequenz: 5290, AllowedInEU: false, DFS: true, Indoor: true, SDR: false},
60: &Channel{Frequenz: 5300, AllowedInEU: true, DFS: true, Indoor: true, SDR: false}, 60: &Channel{Frequenz: 5300, AllowedInEU: true, DFS: true, Indoor: true, SDR: false},
62: &Channel{Frequenz: 5310, AllowedInEU: false, DFS: true, Indoor: true, SDR: false}, 62: &Channel{Frequenz: 5310, AllowedInEU: false, DFS: true, Indoor: true, SDR: false},
64: &Channel{Frequenz: 5320, AllowedInEU: true, DFS: true, Indoor: true, SDR: false}, //40 MHz -64: &Channel{Frequenz: 5320, AllowedInEU: true, DFS: true, Indoor: true, SDR: false},
68: &Channel{Frequenz: 5340, AllowedInEU: true, DFS: true, Indoor: true, SDR: false}, 68: &Channel{Frequenz: 5340, AllowedInEU: true, DFS: true, Indoor: true, SDR: false},
96: &Channel{Frequenz: 5480, AllowedInEU: true, DFS: true, Indoor: false, SDR: false}, 96: &Channel{Frequenz: 5480, AllowedInEU: true, DFS: true, Indoor: false, SDR: false},
100: &Channel{Frequenz: 5500, AllowedInEU: true, DFS: true, Indoor: false, SDR: false}, 100: &Channel{Frequenz: 5500, AllowedInEU: true, DFS: true, Indoor: false, SDR: false},
102: &Channel{Frequenz: 5510, AllowedInEU: false, DFS: true, Indoor: false, SDR: false}, 102: &Channel{Frequenz: 5510, AllowedInEU: false, DFS: true, Indoor: false, SDR: false},
104: &Channel{Frequenz: 5520, AllowedInEU: true, DFS: true, Indoor: false, SDR: false}, //40 MHz -104: &Channel{Frequenz: 5520, AllowedInEU: true, DFS: true, Indoor: false, SDR: false},
106: &Channel{Frequenz: 5530, AllowedInEU: false, DFS: true, Indoor: false, SDR: false}, 106: &Channel{Frequenz: 5530, AllowedInEU: false, DFS: true, Indoor: false, SDR: false},
108: &Channel{Frequenz: 5540, AllowedInEU: true, DFS: true, Indoor: false, SDR: false}, 108: &Channel{Frequenz: 5540, AllowedInEU: true, DFS: true, Indoor: false, SDR: false},
110: &Channel{Frequenz: 5550, AllowedInEU: false, DFS: true, Indoor: false, SDR: false}, 110: &Channel{Frequenz: 5550, AllowedInEU: false, DFS: true, Indoor: false, SDR: false},
112: &Channel{Frequenz: 5560, AllowedInEU: true, DFS: true, Indoor: false, SDR: false}, //40 MHz -112: &Channel{Frequenz: 5560, AllowedInEU: true, DFS: true, Indoor: false, SDR: false},
114: &Channel{Frequenz: 5570, AllowedInEU: true, DFS: true, Indoor: false, SDR: false}, 114: &Channel{Frequenz: 5570, AllowedInEU: true, DFS: true, Indoor: false, SDR: false},
116: &Channel{Frequenz: 5580, AllowedInEU: true, DFS: true, Indoor: false, SDR: false}, /*
118: &Channel{Frequenz: 5590, AllowedInEU: false, DFS: true, Indoor: false, SDR: false}, 116: &Channel{Frequenz: 5580, AllowedInEU: true, DFS: true, Indoor: false, SDR: false},
120: &Channel{Frequenz: 5600, AllowedInEU: true, DFS: true, Indoor: false, SDR: false}, 118: &Channel{Frequenz: 5590, AllowedInEU: false, DFS: true, Indoor: false, SDR: false},
122: &Channel{Frequenz: 5610, AllowedInEU: false, DFS: true, Indoor: false, SDR: false}, 120: &Channel{Frequenz: 5600, AllowedInEU: true, DFS: true, Indoor: false, SDR: false},
124: &Channel{Frequenz: 5620, AllowedInEU: true, DFS: true, Indoor: false, SDR: false}, 122: &Channel{Frequenz: 5610, AllowedInEU: false, DFS: true, Indoor: false, SDR: false},
126: &Channel{Frequenz: 5630, AllowedInEU: false, DFS: true, Indoor: false, SDR: false}, 124: &Channel{Frequenz: 5620, AllowedInEU: true, DFS: true, Indoor: false, SDR: false},
128: &Channel{Frequenz: 5640, AllowedInEU: true, DFS: true, Indoor: false, SDR: false}, 126: &Channel{Frequenz: 5630, AllowedInEU: false, DFS: true, Indoor: false, SDR: false},
132: &Channel{Frequenz: 5660, AllowedInEU: true, DFS: true, Indoor: false, SDR: false}, 128: &Channel{Frequenz: 5640, AllowedInEU: true, DFS: true, Indoor: false, SDR: false},
132: &Channel{Frequenz: 5660, AllowedInEU: true, DFS: true, Indoor: false, SDR: false},
*/
134: &Channel{Frequenz: 5670, AllowedInEU: false, DFS: true, Indoor: false, SDR: false}, 134: &Channel{Frequenz: 5670, AllowedInEU: false, DFS: true, Indoor: false, SDR: false},
136: &Channel{Frequenz: 5680, AllowedInEU: true, DFS: true, Indoor: false, SDR: false}, //40 MHz -136: &Channel{Frequenz: 5680, AllowedInEU: true, DFS: true, Indoor: false, SDR: false},
138: &Channel{Frequenz: 5690, AllowedInEU: false, DFS: true, Indoor: false, SDR: false}, 138: &Channel{Frequenz: 5690, AllowedInEU: false, DFS: true, Indoor: false, SDR: false},
140: &Channel{Frequenz: 5700, AllowedInEU: true, DFS: true, Indoor: false, SDR: false}, //40 MHz -140: &Channel{Frequenz: 5700, AllowedInEU: true, DFS: true, Indoor: false, SDR: false},
142: &Channel{Frequenz: 5710, AllowedInEU: false, DFS: true, Indoor: false, SDR: false}, /*
144: &Channel{Frequenz: 5720, AllowedInEU: true, DFS: true, Indoor: false, SDR: true}, 142: &Channel{Frequenz: 5710, AllowedInEU: false, DFS: true, Indoor: false, SDR: false},
149: &Channel{Frequenz: 5745, AllowedInEU: true, DFS: false, Indoor: false, SDR: true}, 144: &Channel{Frequenz: 5720, AllowedInEU: true, DFS: true, Indoor: false, SDR: true},
151: &Channel{Frequenz: 5755, AllowedInEU: true, DFS: false, Indoor: false, SDR: true}, 149: &Channel{Frequenz: 5745, AllowedInEU: true, DFS: false, Indoor: false, SDR: true},
153: &Channel{Frequenz: 5765, AllowedInEU: true, DFS: false, Indoor: false, SDR: true}, 151: &Channel{Frequenz: 5755, AllowedInEU: true, DFS: false, Indoor: false, SDR: true},
155: &Channel{Frequenz: 5775, AllowedInEU: true, DFS: false, Indoor: false, SDR: true}, 153: &Channel{Frequenz: 5765, AllowedInEU: true, DFS: false, Indoor: false, SDR: true},
157: &Channel{Frequenz: 5785, AllowedInEU: true, DFS: false, Indoor: false, SDR: true}, 155: &Channel{Frequenz: 5775, AllowedInEU: true, DFS: false, Indoor: false, SDR: true},
159: &Channel{Frequenz: 5795, AllowedInEU: true, DFS: false, Indoor: false, SDR: true}, 157: &Channel{Frequenz: 5785, AllowedInEU: true, DFS: false, Indoor: false, SDR: true},
161: &Channel{Frequenz: 5805, AllowedInEU: true, DFS: false, Indoor: false, SDR: true}, 159: &Channel{Frequenz: 5795, AllowedInEU: true, DFS: false, Indoor: false, SDR: true},
165: &Channel{Frequenz: 5825, AllowedInEU: true, DFS: false, Indoor: false, SDR: true}, 161: &Channel{Frequenz: 5805, AllowedInEU: true, DFS: false, Indoor: false, SDR: true},
169: &Channel{Frequenz: 5845, AllowedInEU: true, DFS: false, Indoor: false, SDR: true}, 165: &Channel{Frequenz: 5825, AllowedInEU: true, DFS: false, Indoor: false, SDR: true},
173: &Channel{Frequenz: 5865, AllowedInEU: true, DFS: false, Indoor: false, SDR: true}, 169: &Channel{Frequenz: 5845, AllowedInEU: true, DFS: false, Indoor: false, SDR: true},
173: &Channel{Frequenz: 5865, AllowedInEU: true, DFS: false, Indoor: false, SDR: true},
*/
} }
) )

View File

@ -105,6 +105,7 @@ a {
input[readonly] { input[readonly] {
border: none; border: none;
border-bottom: 1px solid;
background: none; background: none;
padding: 0px; padding: 0px;
font-size: 15px; font-size: 15px;

View File

@ -194,8 +194,8 @@ export class ListView extends View {
freq = domlib.newAt(tr, 'td'), freq = domlib.newAt(tr, 'td'),
curchannel = domlib.newAt(tr, 'td'), curchannel = domlib.newAt(tr, 'td'),
channel = domlib.newAt(tr, 'td'), channel = domlib.newAt(tr, 'td'),
channel24Input = domlib.newAt(domlib.newAt(channel, 'span'), 'input'), channel24Input = domlib.newAt(domlib.newAt(channel, 'span'), 'select'),
channel5Input = domlib.newAt(domlib.newAt(channel, 'span'), 'input'), channel5Input = domlib.newAt(domlib.newAt(channel, 'span'), 'select'),
curpower = domlib.newAt(tr, 'td'), curpower = domlib.newAt(tr, 'td'),
power = domlib.newAt(tr, 'td'), power = domlib.newAt(tr, 'td'),
power24Input = domlib.newAt(domlib.newAt(power, 'span'), 'input'), power24Input = domlib.newAt(domlib.newAt(power, 'span'), 'input'),
@ -249,25 +249,21 @@ export class ListView extends View {
domlib.newAt(curchannel, 'span').textContent = node._wireless.channel24 || '-'; domlib.newAt(curchannel, 'span').textContent = node._wireless.channel24 || '-';
domlib.newAt(curchannel, 'span').textContent = node._wireless.channel5 || '-'; domlib.newAt(curchannel, 'span').textContent = node._wireless.channel5 || '-';
} }
/* eslint-enable no-underscore-dangle */ let i = 0;
for (i = 0; i < store.channelsWifi24.length; i++) {
const opt = domlib.newAt(channel24Input,'option',{
'value': store.channelsWifi24[i],
},store.channelsWifi24[i]);
if(store.channelsWifi24[i] === node.wireless.channel24) {
channel24Input.value = node.wireless.channel24 || ''; opt.selected = true;
channel24Input.type = 'number'; }
channel24Input.min = 1; }
channel24Input.max = 14; channel24Input.addEventListener('focusin', () => {
channel24Input.readOnly = true;
channel24Input.setAttribute('placeholder', '-');
channel24Input.addEventListener('dblclick', () => {
this.editing = true; this.editing = true;
channel24Input.readOnly = false;
}); });
channel24Input.addEventListener('focusout', () => { channel24Input.addEventListener('focusout', () => {
if (channel24Input.readOnly) {
return;
}
this.editing = false; this.editing = false;
channel24Input.readOnly = true;
const old = node.wireless.channel24; const old = node.wireless.channel24;
node.wireless.channel24 = parseInt(channel24Input.value, 10); node.wireless.channel24 = parseInt(channel24Input.value, 10);
socket.sendnode(node, (msg)=>{ socket.sendnode(node, (msg)=>{
@ -278,21 +274,20 @@ export class ListView extends View {
}); });
}); });
channel5Input.value = node.wireless.channel5 || ''; for (i = 0; i < store.channelsWifi5.length; i++) {
channel5Input.type = 'number'; const opt = domlib.newAt(channel5Input,'option',{
channel5Input.min = 36; 'value': store.channelsWifi5[i],
channel5Input.readOnly = true; },store.channelsWifi5[i]);
channel5Input.setAttribute('placeholder', '-');
channel5Input.addEventListener('dblclick', () => { if(store.channelsWifi5[i] === node.wireless.channel5) {
opt.selected = true;
}
}
channel5Input.addEventListener('focusin', () => {
this.editing = true; this.editing = true;
channel5Input.readOnly = false;
}); });
channel5Input.addEventListener('focusout', () => { channel5Input.addEventListener('focusout', () => {
if (channel5Input.readOnly) {
return;
}
this.editing = false; this.editing = false;
channel5Input.readOnly = true;
const old = node.wireless.channel5; const old = node.wireless.channel5;
node.wireless.channel5 = parseInt(channel5Input.value, 10); node.wireless.channel5 = parseInt(channel5Input.value, 10);
socket.sendnode(node, (msg)=>{ socket.sendnode(node, (msg)=>{
@ -314,18 +309,9 @@ export class ListView extends View {
power24Input.type = 'number'; power24Input.type = 'number';
power24Input.min = 1; power24Input.min = 1;
power24Input.max = 23; power24Input.max = 23;
power24Input.readOnly = true;
power24Input.setAttribute('placeholder', '-'); power24Input.setAttribute('placeholder', '-');
power24Input.addEventListener('dblclick', () => {
this.editing = true;
power24Input.readOnly = false;
});
power24Input.addEventListener('focusout', () => { power24Input.addEventListener('focusout', () => {
if (power24Input.readOnly) {
return;
}
this.editing = false; this.editing = false;
power24Input.readOnly = true;
const old = node.wireless.txpower24; const old = node.wireless.txpower24;
node.wireless.txpower24 = parseInt(power24Input.value, 10); node.wireless.txpower24 = parseInt(power24Input.value, 10);
socket.sendnode(node, (msg)=>{ socket.sendnode(node, (msg)=>{
@ -340,18 +326,9 @@ export class ListView extends View {
power5Input.type = 'number'; power5Input.type = 'number';
power5Input.min = 1; power5Input.min = 1;
power5Input.max = 23; power5Input.max = 23;
power5Input.readOnly = true;
power5Input.setAttribute('placeholder', '-'); power5Input.setAttribute('placeholder', '-');
power5Input.addEventListener('dblclick', () => {
this.editing = true;
power5Input.readOnly = false;
});
power5Input.addEventListener('focusout', () => { power5Input.addEventListener('focusout', () => {
if (power5Input.readOnly) {
return;
}
this.editing = false; this.editing = false;
power5Input.readOnly = true;
const old = node.wireless.txpower5; const old = node.wireless.txpower5;
node.wireless.txpower5 = parseInt(power5Input.value, 10); node.wireless.txpower5 = parseInt(power5Input.value, 10);
socket.sendnode(node, (msg)=>{ socket.sendnode(node, (msg)=>{