01a8e1835a5d03af351a4e4f03406ea1c64a9342
5 function invokeIncludesLoad(includes
) {
6 var tasks
= [], has_load
= false;
8 for (var i
= 0; i
< includes
.length
; i
++) {
9 if (typeof(includes
[i
].load
) == 'function') {
10 tasks
.push(includes
[i
].load());
18 return has_load
? Promise
.all(tasks
) : Promise
.resolve(null);
21 function startPolling(includes
, containers
) {
22 var step = function() {
23 return network
.flushCache().then(function() {
24 return invokeIncludesLoad(includes
);
25 }).then(function(results
) {
26 for (var i
= 0; i
< includes
.length
; i
++) {
29 if (typeof(includes
[i
].render
) == 'function')
30 content
= includes
[i
].render(results
? results
[i
] : null);
31 else if (includes
[i
].content
!= null)
32 content
= includes
[i
].content
;
34 if (content
!= null) {
35 containers
[i
].parentNode
.style
.display
= '';
36 containers
[i
].parentNode
.classList
.add('fade-in');
38 L
.dom
.content(containers
[i
], content
);
42 var ssi
= document
.querySelector('div.includes');
44 ssi
.style
.display
= '';
45 ssi
.classList
.add('fade-in');
50 return step().then(function() {
55 return L
.view
.extend({
57 return L
.resolveDefault(fs
.list('/www' + L
.resource('view/status/include')), []).then(function(entries
) {
58 return Promise
.all(entries
.filter(function(e
) {
59 return (e
.type
== 'file' && e
.name
.match(/\.js$/));
61 return 'view.status.include.' + e
.name
.replace(/\.js$/, '');
62 }).sort().map(function(n
) {
68 render: function(includes
) {
69 var rv
= E([]), containers
= [];
71 for (var i
= 0; i
< includes
.length
; i
++) {
74 if (includes
[i
].title
!= null)
75 title
= includes
[i
].title
;
77 title
= String(includes
[i
]).replace(/^\[ViewStatusInclude\d+_(.+)Class\]$/,
78 function(m
, n
) { return n
.replace(/(^|_)(.)/g,
79 function(m
, s
, c
) { return (s
? ' ' : '') + c
.toUpperCase() })
82 var container
= E('div');
84 rv
.appendChild(E('div', { 'class': 'cbi-section', 'style': 'display:none' }, [
85 title
!= '' ? E('h3', title
) : '',
89 containers
.push(container
);
92 return startPolling(includes
, containers
).then(function() {
97 handleSaveApply
: null,