luci2: early wireless configuration
[project/luci2/ui.git] / luci2 / htdocs / luci2 / view / network.wireless.js
1 L.ui.view.extend({
2         execute: function() {
3                 var self = this;
4
5                 var m = new L.cbi.Map('wireless', {
6                         caption:        L.tr('Wireless configuration')
7                 });
8
9                 var s = m.section(L.cbi.TypedSection, 'wifi-device', {
10                         caption:        L.tr('WiFi devices'),
11                         collabsible:    true
12                 });
13
14                 (s.option(L.cbi.DummyValue, '__name', {
15                         caption:        L.tr('Device')
16                 })).ucivalue = function(sid)
17                 {
18                         return sid;
19                 };
20
21                 s.option(L.cbi.CheckboxValue, 'disabled', {
22                         caption:        L.tr('Disabled')
23                 });
24
25                 s.option(L.cbi.InputValue, 'channel', {
26                         caption:        L.tr('Channel')
27                 });
28
29                 var s_1 = s.subsection(L.cbi.TypedSection, 'wifi-iface', {
30                         caption:        L.tr('Device interfaces'),
31                         addremove:      true,
32                         add_caption:    L.tr('Add interface …')
33                 });
34
35                 s_1.filter = function(section, parent_sid) {
36                         return section.device == parent_sid;
37                 };
38
39                 s_1.add = function(name, sid) {
40                         var iface = this.ownerMap.add('wireless', 'wifi-iface');
41                         this.ownerMap.set('wireless', iface, 'device', sid);
42                 };
43
44                 s_1.tab({
45                         id:             'general',
46                         caption:        L.tr('General Settings')
47                 });
48
49                 s_1.taboption('general', L.cbi.CheckboxValue, 'disabled', {
50                         caption:        L.tr('Disabled')
51                 });
52
53                 s_1.taboption('general', L.cbi.ListValue, 'mode', {
54                         caption:        L.tr('Mode'),
55                         initial:        'ap'
56                 })
57                 .value('ap', L.tr('Access Point'))
58                 .value('sta', L.tr('Client'))
59                 .value('adhoc', L.tr('Ad-Hoc'))
60                 .value('wds', L.tr('WDS (Wireless Distribution System)'))
61                 .value('monitor', L.tr('Monitor'))
62                 .value('mesh', L.tr('Mesh'));
63
64                 s_1.taboption('general', L.cbi.InputValue, 'ssid', {
65                         caption:        'SSID'
66                 });
67
68                 s_1.tab({
69                         id:             'security',
70                         caption:        L.tr('Security')
71                 });
72
73                 s_1.taboption('security', L.cbi.ListValue, 'encryption', {
74                         caption:        L.tr('Encryption'),
75                         initial:        'none'
76                 })
77                 .value('none', L.tr('No encryption'))
78                 .value('psk', L.tr('WPA Personal (PSK)'))
79                 .value('psk2', L.tr('WPA2 Personal (PSK)'))
80                 .value('mixed-psk', L.tr('WPA/WPA2 Personal (PSK) mixed'));
81
82                 s_1.taboption('security', L.cbi.PasswordValue, 'key', {
83                         caption:        L.tr('Passphrase'),
84                         optional:       true
85                 });
86
87                 return m.insertInto('#map');
88         }
89 });