Просмотр исходного кода

Fixes #3474: Fix device status page loading when NAPALM call fails

Jeremy Stretch 6 лет назад
Родитель
Сommit
c770b13903
2 измененных файлов с 6 добавлено и 2 удалено
  1. 1 0
      CHANGELOG.md
  2. 5 2
      netbox/templates/dcim/device_status.html

+ 1 - 0
CHANGELOG.md

@@ -3,6 +3,7 @@ v2.6.6 (FUTURE)
 ## Bug Fixes
 
 * [#3463](https://github.com/netbox-community/netbox/issues/3463) - Correct CSV headers for exported power feeds
+* [#3474](https://github.com/netbox-community/netbox/issues/3474) - Fix device status page loading when NAPALM call fails
 * [#3571](https://github.com/netbox-community/netbox/issues/3571) - Prevent erroneous redirects when editing tags
 * [#3573](https://github.com/netbox-community/netbox/issues/3573) - Ensure consistent display of changelog retention period
 * [#3574](https://github.com/netbox-community/netbox/issues/3574) - Change `device` to `parent` in interface editing VLAN filtering logic

+ 5 - 2
netbox/templates/dcim/device_status.html

@@ -94,8 +94,11 @@ $(document).ready(function() {
                     var row="<tr><td>" + name + "</td><td>" + obj['%usage'] + "%</td></tr>";
                     $("#cpu").after(row)
                 });
-                $('#memory').after("<tr><td>Used</td><td>" + json['get_environment']['memory']['used_ram'] + "</td></tr>");
-                $('#memory').after("<tr><td>Available</td><td>" + json['get_environment']['memory']['available_ram'] + "</td></tr>");
+                if (json['get_environment']['memory']) {
+                    var memory = $('#memory');
+                    memory.after("<tr><td>Used</td><td>" + json['get_environment']['memory']['used_ram'] + "</td></tr>");
+                    memory.after("<tr><td>Available</td><td>" + json['get_environment']['memory']['available_ram'] + "</td></tr>");
+                }
                 $.each(json['get_environment']['temperature'], function(name, obj) {
                     var style = "success";
                     if (obj['is_alert']) {