summaryrefslogtreecommitdiffhomepage
path: root/protocols/luci-proto-nebula/htdocs/luci-static/resources/protocol/nebula.js
blob: 409416dd49240242a321330a4fdd801ae248ebb7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
'use strict';
'require ui';
'require uci';
'require rpc';
'require form';
'require network';

return network.registerProtocol('nebula', {
	getI18n: function () {
		return _('Nebula Network');
	},

	getIfname: function () {
		return this._ubus('l3_device') || this.sid;
	},

	getOpkgPackage: function () {
		return 'nebula';
	},

	isFloating: function () {
		return true;
	},

	isVirtual: function () {
		return true;
	},

	getDevices: function () {
		return null;
	},

	containsDevice: function (ifname) {
		return (network.getIfnameOf(ifname) == this.getIfname());
	},

	renderFormOptions: function (s) {
		var o;

		o = s.taboption('general', form.Value, 'config_file', _('Config File'), _('Required. Path to the .yml config file for this interface.'));
		o.rmempty = false;

	},

	deleteConfiguration: function () {
		uci.sections('network', 'nebula_%s'.format(this.sid), function (s) {
			uci.remove('network', s['.name']);
		});
	}
});