nebula.js 941 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. 'use strict';
  2. 'require ui';
  3. 'require uci';
  4. 'require rpc';
  5. 'require form';
  6. 'require network';
  7. return network.registerProtocol('nebula', {
  8. getI18n: function () {
  9. return _('Nebula Network');
  10. },
  11. getIfname: function () {
  12. return this._ubus('l3_device') || this.sid;
  13. },
  14. getOpkgPackage: function () {
  15. return 'nebula';
  16. },
  17. isFloating: function () {
  18. return true;
  19. },
  20. isVirtual: function () {
  21. return true;
  22. },
  23. getDevices: function () {
  24. return null;
  25. },
  26. containsDevice: function (ifname) {
  27. return (network.getIfnameOf(ifname) == this.getIfname());
  28. },
  29. renderFormOptions: function (s) {
  30. var o;
  31. o = s.taboption('general', form.Value, 'config_file', _('Config File'), _('Required. Path to the .yml config file for this interface.'));
  32. o.rmempty = false;
  33. },
  34. deleteConfiguration: function () {
  35. uci.sections('network', 'nebula_%s'.format(this.sid), function (s) {
  36. uci.remove('network', s['.name']);
  37. });
  38. }
  39. });