'use strict';
'require fs';
+'require ui';
'require rpc';
'require uci';
'require view';
load: function() {
return Promise.all([
- fs.list("/var/run/sqm/available_qdiscs"),
- fs.list("/usr/lib/sqm").then(L.bind(function(scripts) {
+ L.resolveDefault(fs.list('/var/run/sqm/available_qdiscs'), []),
+ L.resolveDefault(fs.list('/usr/lib/sqm'), []).then(L.bind(function(scripts) {
var tasks = [], scriptHelpTbl = {};
for (var i = 0; i < scripts.length; i++)
var qdiscs = data[0],
scripts = data[1];
+ if (qdiscs.length === 0) {
+ ui.addNotification(null,
+ E('div', { 'class': 'left' }, [
+ E('p', _("The SQM service seems to be disabled. Please use the button below to activate this service.")),
+ E('button', {
+ 'class': 'btn cbi-button-active',
+ 'click': ui.createHandlerFn(this, function() {
+ fs.exec_direct('/etc/init.d/sqm', ['enable']);
+ fs.exec_direct('/etc/init.d/sqm', ['start']);
+ location.reload();
+ })
+ }, _('Enable SQM'))
+ ]));
+ }
+
var m, s, o;
m = new form.Map('sqm', _('Smart Queue Management'));
o.write = L.bind(function(section, value) {
if (value == "1") {
this.handleEnableSQM();
- L.ui.addNotification(null, E('p', _("The SQM GUI has just enabled the sqm initscript on your behalf. Remember to disable the sqm initscript manually under System Startup menu in case this change was not wished for.")));
+ ui.addNotification(null, E('p', _("The SQM GUI has just enabled the sqm initscript on your behalf. Remember to disable the sqm initscript manually under System Startup menu in case this change was not wished for.")));
}
return uci.set("sqm", section, "enabled", value);