mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-13 19:18:16 -06:00
Fix #2802
Check for an error in the output of each method. If there is an error, skip processing for that method
This commit is contained in:
parent
e17d79e10f
commit
3fb07777aa
@ -73,6 +73,7 @@ $(document).ready(function() {
|
||||
url: "{% url 'dcim-api:device-napalm' pk=device.pk %}?method=get_facts&method=get_environment",
|
||||
dataType: 'json',
|
||||
success: function(json) {
|
||||
if (!json['get_facts']['error']) {
|
||||
$('#hostname').html(json['get_facts']['hostname']);
|
||||
$('#fqdn').html(json['get_facts']['fqdn']);
|
||||
$('#vendor').html(json['get_facts']['vendor']);
|
||||
@ -86,6 +87,9 @@ $(document).ready(function() {
|
||||
var uptime_hours = Math.floor(uptime % 86400 / 3600);
|
||||
var uptime_minutes = Math.floor(uptime % 3600 / 60);
|
||||
$('#uptime').html(uptime_days + "d " + uptime_hours + "h " + uptime_minutes + "m");
|
||||
}
|
||||
|
||||
if (!json['get_environment']['error']) {
|
||||
$.each(json['get_environment']['cpu'], function(name, obj) {
|
||||
var row="<tr><td>" + name + "</td><td>" + obj['%usage'] + "%</td></tr>";
|
||||
$("#cpu").after(row)
|
||||
@ -120,6 +124,7 @@ $(document).ready(function() {
|
||||
}
|
||||
$("#power").after(row)
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function(xhr) {
|
||||
alert(xhr.responseText);
|
||||
|
Loading…
Reference in New Issue
Block a user