luci-mod-status: index.js: skip includes which failed loading
authorJo-Philipp Wich <jo@mein.io>
Sat, 18 Apr 2020 17:57:00 +0000 (19:57 +0200)
committerJo-Philipp Wich <jo@mein.io>
Sat, 18 Apr 2020 21:25:22 +0000 (23:25 +0200)
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-mod-status/htdocs/luci-static/resources/view/status/index.js

index 15dcbe6385ce41c21c4ec5e3d5f5d954910ce108..da08ec12c27029cbb0595eee906aff106a842b9b 100644 (file)
@@ -10,7 +10,10 @@ function invokeIncludesLoad(includes) {
 
        for (var i = 0; i < includes.length; i++) {
                if (typeof(includes[i].load) == 'function') {
-                       tasks.push(includes[i].load());
+                       tasks.push(includes[i].load().catch(L.bind(function() {
+                               this.failed = true;
+                       }, includes[i])));
+
                        has_load = true;
                }
                else {
@@ -29,6 +32,9 @@ function startPolling(includes, containers) {
                        for (var i = 0; i < includes.length; i++) {
                                var content = null;
 
+                               if (includes[i].failed)
+                                       continue;
+
                                if (typeof(includes[i].render) == 'function')
                                        content = includes[i].render(results ? results[i] : null);
                                else if (includes[i].content != null)