Merge pull request #5540 from jow-/wireguard-peer-gridsection
[project/luci.git] / protocols / luci-proto-wireguard / htdocs / luci-static / resources / protocol / wireguard.js
index 74327f3001d73229b584ad975f22a1cae69810f4..50080ca9b65da5d0f9757b312fe4e38fdefe3c14 100644 (file)
@@ -163,13 +163,15 @@ return network.registerProtocol('wireguard', {
                }
                catch(e) {}
 
-               o = s.taboption('peers', form.SectionValue, '_peers', form.TypedSection, 'wireguard_%s'.format(s.section));
+               o = s.taboption('peers', form.SectionValue, '_peers', form.GridSection, 'wireguard_%s'.format(s.section));
                o.depends('proto', 'wireguard');
 
                ss = o.subsection;
                ss.anonymous = true;
                ss.addremove = true;
                ss.addbtntitle = _('Add peer');
+               ss.nodescriptions = true;
+               ss.modaltitle = _('Edit peer');
 
                ss.renderSectionPlaceholder = function() {
                        return E([], [
@@ -180,6 +182,7 @@ return network.registerProtocol('wireguard', {
 
                o = ss.option(form.Flag, 'disabled', _('Peer disabled'), _('Enable / Disable peer. Restart wireguard interface to apply changes.'));
                o.optional = true;
+               o.editable = true;
 
                o = ss.option(form.Value, 'description', _('Description'), _('Optional. Description of peer.'));
                o.placeholder = 'My Peer';
@@ -187,6 +190,7 @@ return network.registerProtocol('wireguard', {
                o.optional = true;
 
                o = ss.option(form.Value, 'description', _('QR-Code'));
+               o.modalonly = true;
                o.render = L.bind(function (view, section_id) {
                        var sections = uci.sections('network');
                        var client = findSection(sections, section_id);
@@ -259,10 +263,12 @@ return network.registerProtocol('wireguard', {
                }, this);
 
                o = ss.option(form.Value, 'public_key', _('Public Key'), _('Required. Base64-encoded public key of peer.'));
+               o.modalonly = true;
                o.validate = validateBase64;
                o.rmempty = false;
 
                o = ss.option(form.Value, 'preshared_key', _('Preshared Key'), _('Optional. Base64-encoded preshared key. Adds in an additional layer of symmetric-key cryptography for post-quantum resistance.'));
+               o.modalonly = true;
                o.password = true;
                o.validate = validateBase64;
                o.optional = true;
@@ -272,6 +278,7 @@ return network.registerProtocol('wireguard', {
                o.optional = true;
 
                o = ss.option(form.Flag, 'route_allowed_ips', _('Route Allowed IPs'), _('Optional. Create routes for Allowed IPs for this peer.'));
+               o.modalonly = true;
 
                o = ss.option(form.Value, 'endpoint_host', _('Endpoint Host'), _('Optional. Host of peer. Names are resolved prior to bringing up the interface.'));
                o.placeholder = 'vpn.example.com';
@@ -282,6 +289,7 @@ return network.registerProtocol('wireguard', {
                o.datatype = 'port';
 
                o = ss.option(form.Value, 'persistent_keepalive', _('Persistent Keep Alive'), _('Optional. Seconds between keep alive messages. Default is 0 (disabled). Recommended value if this device is behind a NAT is 25.'));
+               o.modalonly = true;
                o.datatype = 'range(0,65535)';
                o.placeholder = '0';
        },