I've already implemented the config, but it doesn't really help me because I found an interesting problem.

I took an example from luci-app-example, it’s like this:
'use strict';
'require view';
'require form';
// Project code format is tabs, not spaces
return view.extend({
render: function() {
var m, s, o;
/*
The first argument to form.Map() maps to the configuration file available
via uci at /etc/config/. In this case, 'example' maps to /etc/config/example.
If the file is completely empty, the form sections will indicate that the
section contains no values yet. As such, your package installation (LuCI app
or software that the app configures) should lay down a basic configuration
file with all the needed sections.
The relevant ACL path for reading a configuration with UCI this way is
read > uci > ["example"]
The relevant ACL path for writing back the configuration is
write > uci > ["example"]
*/
m = new form.Map('example', _('Example Form'),
_('Example Form Configuration.'));
s = m.section(form.TypedSection, 'first', _('first section'));
s.anonymous = true;
s.option(form.Value, 'first_option', _('First Option'),
_('Input for the first option'));
s = m.section(form.TypedSection, 'second', _('second section'));
s.anonymous = true;
o = s.option(form.Flag, 'flag', _('Flag Option'),
_('A boolean option'));
o.default = '1';
o.rmempty = false;
o = s.option(form.ListValue, 'select', _('Select Option'),
_('A select option'));
o.placeholder = 'placeholder';
o.value('key1', 'value1');
o.value('key2', 'value2');
o.rmempty = false;
o.editable = true;
s = m.section(form.TypedSection, 'third', _('third section'));
s.anonymous = true;
o = s.option(form.Value, 'password_option', _('Password Option'),
_('Input for a password (storage on disk is not encrypted)'));
o.password = true;
o = s.option(form.DynamicList, 'list_option', _('Dynamic list option'));
return m.render();
},
});
And everything comes out fine, then I decided to remake it for myself and got the following code:
'use strict';
'require view';
'require form';
// Project code format is tabs, not spaces
return view.extend({
render: function() {
var m, s, o;
/*
The first argument to form.Map() maps to the configuration file available
via uci at /etc/config/. In this case, 'example' maps to /etc/config/example.
If the file is completely empty, the form sections will indicate that the
section contains no values yet. As such, your package installation (LuCI app
or software that the app configures) should lay down a basic configuration
file with all the needed sections.
The relevant ACL path for reading a configuration with UCI this way is
read > uci > ["example"]
The relevant ACL path for writing back the configuration is
write > uci > ["example"]
*/
m = new form.Map('tiod', _('Конфигурация'));
s = m.section(form.TypedSection, "controlport", _("Контрольный порт"));
s.anonymous = true;
o = s.option(form.Value, "device", _("Устройство"),
_("Имя устройства для подключения.<br/>Должно быть в виде /dev/."));
o.rmempty = false;
o.default = "/dev/ttyS4";
s = m.section(form.TypedSection, "default", _("Настройки по умолчанию"));
s.anonymous = true;
o = s.option(form.ListValue, "speed", _("Скорость передачи в бодах"), _("Скорость, на которой должен работать порт устройства."));
o.rmempty = false;
o.value(300);
o.value(1200);
o.value(2400);
o.value(4800);
o.value(9600);
o.value(19200);
o.value(38400);
o.value(57600);
o.value(115200);
o.default = 9600;
o = s.option(form.ListValue, "databits", _("Биты данных"));
o.rmempty = false;
o.value(8);
o.value(7);
o.value(6);
o.value(5);
o.default = 8;
o = s.option(form.ListValue, "parity", _("Чётность"));
o.rmempty = false;
o.value("none", _("Отсутствует"));
o.value("even", _("Чётный"));
o.value("odd", _("Нечётный"));
o.default = "none";
o = s.option(form.ListValue, "stopbits", _("Стоповые биты"));
o.rmempty = false;
o.value(1);
o.value(2);
o.default = 1;
s.option(form.Flag, "rtscts", _("Использовать линии RTS и CTS"));
return m.render();
}
});
But the output is this:
I restarted the processes, the entire router (even during the firmware it creates all the files from scratch), but LuCi is trying to derive objects from the example, not my code.
I get the feeling that my objects are not registering in the form, why?
This confuses me, it’s as if I’m missing something, some kind of declaration file.