kenzok8-package/luci-app-wrtbwmon/htdocs/luci-static/resources/view/wrtbwmon/config.js
github-actions[bot] 96e6f38956 update-12.04
2021-12-04 09:01:13 +08:00

39 lines
986 B
JavaScript

'use strict';
'require form';
'require rpc';
'require view';
var callChangeDatabasePath = rpc.declare({
object: 'luci.wrtbwmon',
method: 'change_db_path',
params: [ 'state' ]
});
return view.extend({
render: function() {
var m, s, o;
m = new form.Map('wrtbwmon', _('Usage - Configuration'));
s = m.section(form.NamedSection, 'general', 'wrtbwmon', _('General settings'));
s.addremove = false;
o = s.option(form.Flag, 'enabled', _('Keep running in the background'));
o.rmempty = true;
o = s.option(form.Value, 'path', _('Database path'), _('This box is used to select the Database path, which is /tmp/usage.db by default.'));
o.value('/tmp/usage.db');
o.value('/etc/usage.db');
o.default = '/tmp/usage.db';
o.rmempty = false;
return m.render();
},
handleSaveApply: function(ev, mode) {
return callChangeDatabasePath('before')
.then(this.super.bind(this, 'handleSaveApply', arguments))
.then(callChangeDatabasePath.bind(this, 'after'));
}
});