luci-app-adblock: re-apply poll/view class changes
* re-apply poll/view class changes in master after 19.07-branch split off Signed-off-by: Dirk Brenken <dev@brenken.org>
This commit is contained in:
parent
a8366b01b7
commit
65958c4992
5 changed files with 17 additions and 10 deletions
|
@ -1,8 +1,9 @@
|
|||
'use strict';
|
||||
'require view';
|
||||
'require fs';
|
||||
'require ui';
|
||||
|
||||
return L.view.extend({
|
||||
return view.extend({
|
||||
load: function() {
|
||||
return L.resolveDefault(fs.read_direct('/etc/adblock/adblock.blacklist'), '');
|
||||
},
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
'use strict';
|
||||
'require view';
|
||||
'require fs';
|
||||
'require ui';
|
||||
|
||||
|
@ -186,7 +187,7 @@ function handleAction(ev) {
|
|||
}
|
||||
}
|
||||
|
||||
return L.view.extend({
|
||||
return view.extend({
|
||||
load: function() {
|
||||
return L.resolveDefault(fs.exec_direct('/etc/init.d/adblock', ['report', '+', '50', 'false', 'json']),'');
|
||||
},
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
'use strict';
|
||||
'require view';
|
||||
'require poll';
|
||||
'require fs';
|
||||
|
||||
return L.view.extend({
|
||||
return view.extend({
|
||||
load: function() {
|
||||
return Promise.all([
|
||||
L.resolveDefault(fs.stat('/sbin/logread'), null),
|
||||
|
@ -10,7 +12,7 @@ return L.view.extend({
|
|||
},
|
||||
render: function(stat) {
|
||||
var logger = stat[0] ? stat[0].path : stat[1] ? stat[1].path : null;
|
||||
L.Poll.add(function() {
|
||||
poll.add(function() {
|
||||
return L.resolveDefault(fs.exec_direct(logger, ['-e', 'adblock-'])).then(function(res) {
|
||||
var log = document.getElementById("logfile");
|
||||
if (res) {
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
'use strict';
|
||||
'require view';
|
||||
'require poll';
|
||||
'require fs';
|
||||
'require ui';
|
||||
'require uci';
|
||||
|
@ -98,7 +100,7 @@ async function handleAction(ev) {
|
|||
}
|
||||
}
|
||||
|
||||
L.Poll.start();
|
||||
poll.start();
|
||||
fs.exec_direct('/etc/init.d/adblock', [ev])
|
||||
var running = 1;
|
||||
while (running === 1) {
|
||||
|
@ -109,10 +111,10 @@ async function handleAction(ev) {
|
|||
}
|
||||
})
|
||||
}
|
||||
L.Poll.stop();
|
||||
poll.stop();
|
||||
}
|
||||
|
||||
return L.view.extend({
|
||||
return view.extend({
|
||||
load: function() {
|
||||
return Promise.all([
|
||||
L.resolveDefault(fs.exec_direct('/etc/init.d/adblock', ['list']), {}),
|
||||
|
@ -129,7 +131,7 @@ return L.view.extend({
|
|||
/*
|
||||
poll runtime information
|
||||
*/
|
||||
pollData: L.Poll.add(function() {
|
||||
pollData: poll.add(function() {
|
||||
return L.resolveDefault(fs.read_direct('/tmp/adb_runtime.json'), 'null').then(function(res) {
|
||||
var info = JSON.parse(res);
|
||||
var status = document.getElementById('status');
|
||||
|
@ -142,7 +144,7 @@ return L.view.extend({
|
|||
} else {
|
||||
if (status.classList.contains("spinning")) {
|
||||
status.classList.remove("spinning");
|
||||
L.Poll.stop();
|
||||
poll.stop();
|
||||
}
|
||||
}
|
||||
if (status.textContent.substr(0,6) === 'paused' && document.getElementById('btn_suspend')) {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
'use strict';
|
||||
'require view';
|
||||
'require fs';
|
||||
'require ui';
|
||||
|
||||
return L.view.extend({
|
||||
return view.extend({
|
||||
load: function() {
|
||||
return L.resolveDefault(fs.read_direct('/etc/adblock/adblock.whitelist'), '');
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue