mirror of
https://github.com/openwrt/luci.git
synced 2026-04-15 19:01:56 +00:00
luci-mod-status: reorganize poll function for index page
Reorganize poll function for index page. Drop the external function and use the poll_status pattern used in other page that use poll.add API. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
This commit is contained in:
committed by
Paul Donald
parent
bad9c56541
commit
b92c7f696e
@@ -24,8 +24,8 @@ function invokeIncludesLoad(includes) {
|
||||
return has_load ? Promise.all(tasks) : Promise.resolve(null);
|
||||
}
|
||||
|
||||
function startPolling(includes, containers) {
|
||||
var step = function() {
|
||||
return view.extend({
|
||||
poll_status: function(includes, containers) {
|
||||
return network.flushCache().then(function() {
|
||||
return invokeIncludesLoad(includes);
|
||||
}).then(function(results) {
|
||||
@@ -59,14 +59,8 @@ function startPolling(includes, containers) {
|
||||
ssi.classList.add('fade-in');
|
||||
}
|
||||
});
|
||||
};
|
||||
},
|
||||
|
||||
return step().then(function() {
|
||||
poll.add(step);
|
||||
});
|
||||
}
|
||||
|
||||
return view.extend({
|
||||
load: function() {
|
||||
return L.resolveDefault(fs.list('/www' + L.resource('view/status/include')), []).then(function(entries) {
|
||||
return Promise.all(entries.filter(function(e) {
|
||||
@@ -103,7 +97,9 @@ return view.extend({
|
||||
containers.push(container);
|
||||
}
|
||||
|
||||
return startPolling(includes, containers).then(function() {
|
||||
return this.poll_status(includes, containers).then(function() {
|
||||
return poll.add(L.bind(this.poll_status, this, includes, containers))
|
||||
}).then(function() {
|
||||
return rv;
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user