Add some quick daemon information when viewing nodes

This commit is contained in:
Dane Everitt 2016-11-26 18:23:10 -05:00
parent d93f88f471
commit edaae40df9
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
2 changed files with 50 additions and 17 deletions

View file

@ -70,10 +70,7 @@
<script> <script>
$(document).ready(function () { $(document).ready(function () {
$('#sidebar_links').find("a[href='/admin/nodes']").addClass('active'); $('#sidebar_links').find("a[href='/admin/nodes']").addClass('active');
pingNodes(); (function pingNodes() {
setInterval(pingNodes, 10000);
});
function pingNodes() {
$('td[data-action="ping"]').each(function(i, element) { $('td[data-action="ping"]').each(function(i, element) {
$.ajax({ $.ajax({
type: 'GET', type: 'GET',
@ -83,11 +80,17 @@ function pingNodes() {
}, },
timeout: 5000 timeout: 5000
}).done(function (data) { }).done(function (data) {
$(element).find('i').tooltip({
title: 'v' + data.version,
});
$(element).removeClass('text-muted').find('i').removeClass().addClass('fa fa-fw fa-heartbeat faa-pulse animated').css('color', '#50af51'); $(element).removeClass('text-muted').find('i').removeClass().addClass('fa fa-fw fa-heartbeat faa-pulse animated').css('color', '#50af51');
}).fail(function () { }).fail(function () {
$(element).removeClass('text-muted').find('i').removeClass().addClass('fa fa-fw fa-heart-o').css('color', '#d9534f'); $(element).removeClass('text-muted').find('i').removeClass().addClass('fa fa-fw fa-heart-o').css('color', '#d9534f');
}).always(function () {
setTimeout(pingNodes, 10000);
}); });
}); });
})();
} }
</script> </script>
@endsection @endsection

View file

@ -69,6 +69,18 @@
<div class="panel-body"> <div class="panel-body">
<table class="table table-striped" style="margin-bottom:0;"> <table class="table table-striped" style="margin-bottom:0;">
<tbody> <tbody>
<tr>
<td>Daemon Version</td>
<td><code data-attr="info-version"><i class="fa fa-refresh fa-fw fa-spin"></i></code></td>
</tr>
<tr>
<td>System Information</td>
<td data-attr="info-system"><i class="fa fa-refresh fa-fw fa-spin"></i></td>
</tr>
<tr>
<td>Total CPU Cores</td>
<td data-attr="info-cpus"><i class="fa fa-refresh fa-fw fa-spin"></i></td>
</tr>
<tr> <tr>
<td>Total Servers</td> <td>Total Servers</td>
<td>{{ count($servers) }}</td> <td>{{ count($servers) }}</td>
@ -777,6 +789,24 @@ $(document).ready(function () {
element.parent().removeClass('has-error has-success'); element.parent().removeClass('has-error has-success');
} }
(function getInformation() {
$.ajax({
method: 'GET',
url: '{{ $node->scheme }}://{{ $node->fqdn }}:{{ $node->daemonListen }}',
timeout: 5000,
headers: {
'X-Access-Token': '{{ $node->daemonSecret }}'
},
}).done(function (data) {
$('[data-attr="info-version"]').html(data.version);
$('[data-attr="info-system"]').html(data.system.type + '(' + data.system.arch + ') <code>' + data.system.release + '</code>');
$('[data-attr="info-cpus"]').html(data.system.cpus);
}).fail(function (jqXHR) {
}).always(function() {
setTimeout(getInformation, 10000);
});
})();
}); });
</script> </script>
@endsection @endsection