diff options
author | Devaev Maxim <[email protected]> | 2020-06-02 20:59:43 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2020-06-02 20:59:43 +0300 |
commit | cb9597679d8c9189e671e166de45c707c650bb2f (patch) | |
tree | e0f3e00bafe4c1674f8497e6832f292233d94821 /web/share/js/index/main.js | |
parent | fe7c275d1a827f95d40d774e38b928aee493a41b (diff) |
improved info handler
Diffstat (limited to 'web/share/js/index/main.js')
-rw-r--r-- | web/share/js/index/main.js | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/web/share/js/index/main.js b/web/share/js/index/main.js index ba33b0aa..497a4d73 100644 --- a/web/share/js/index/main.js +++ b/web/share/js/index/main.js @@ -56,15 +56,20 @@ function __loadKvmdInfo() { if (http.status === 200) { let info = JSON.parse(http.responseText).result; - let apps = Object.values(info.extras).sort(function(a, b) { - if (a.place < b.place) { - return -1; - } else if (a.place > b.place) { - return 1; - } else { - return 0; - } - }); + let apps = []; + if (info.extras === null) { + wm.error("Not all applications in the menu can be displayed<br>due an error. See KVMD logs for details."); + } else { + apps = Object.values(info.extras).sort(function(a, b) { + if (a.place < b.place) { + return -1; + } else if (a.place > b.place) { + return 1; + } else { + return 0; + } + }); + } $("apps-box").innerHTML = "<ul id=\"apps\"></ul>"; @@ -79,7 +84,7 @@ function __loadKvmdInfo() { $("apps").innerHTML += __makeApp("logout-button", "#", "share/svg/logout.svg", "Logout"); tools.setOnClick($("logout-button"), __logout); - if (info.meta && info.meta.server && info.meta.server.host) { + if (info.meta !== null && info.meta.server && info.meta.server.host) { $("kvmd-meta-server-host").innerHTML = info.meta.server.host; document.title = `Pi-KVM Index: ${info.meta.server.host}`; } else { |