olsrdhna.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. 'use strict';
  2. 'require view';
  3. 'require form';
  4. 'require uci';
  5. 'require ui';
  6. return view.extend({
  7. load: function () {
  8. return Promise.all([uci.load('olsrd')]);
  9. },
  10. render: function () {
  11. var ipv = uci.get_first('olsrd', 'olsrd', 'IpVersion') || '4';
  12. var mh = new form.Map('olsrd', _('OLSR - HNA-Announcements'), _('Hosts in an OLSR routed network can announce connectivity ' + 'to external networks using HNA messages.'));
  13. if (ipv === '6and4' || ipv === '4') {
  14. var hna4 = mh.section(form.TypedSection, 'Hna4', _('Hna4'), _('Both values must use the dotted decimal notation.'));
  15. hna4.addremove = true;
  16. hna4.anonymous = true;
  17. hna4.template = 'cbi/tblsection';
  18. var net4 = hna4.option(form.Value, 'netaddr', _('Network address'));
  19. net4.datatype = 'ip4addr';
  20. net4.placeholder = '10.11.12.13';
  21. net4.default = '10.11.12.13';
  22. var msk4 = hna4.option(form.Value, 'netmask', _('Netmask'));
  23. msk4.datatype = 'ip4addr';
  24. msk4.placeholder = '255.255.255.255';
  25. msk4.default = '255.255.255.255';
  26. }
  27. if (ipv === '6and4' || ipv === '6') {
  28. var hna6 = mh.section(form.TypedSection, 'Hna6', _('Hna6'), _('IPv6 network must be given in full notation, ' + 'prefix must be in CIDR notation.'));
  29. hna6.addremove = true;
  30. hna6.anonymous = true;
  31. hna6.template = 'cbi/tblsection';
  32. var net6 = hna6.option(form.Value, 'netaddr', _('Network address'));
  33. net6.datatype = 'ip6addr';
  34. net6.placeholder = 'fec0:2200:106:0:0:0:0:0';
  35. net6.default = 'fec0:2200:106:0:0:0:0:0';
  36. var msk6 = hna6.option(form.Value, 'prefix', _('Prefix'));
  37. msk6.datatype = 'range(0,128)';
  38. msk6.placeholder = '128';
  39. msk6.default = '128';
  40. }
  41. return mh.render();
  42. },
  43. });