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,24 +70,27 @@
<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); $('td[data-action="ping"]').each(function(i, element) {
}); $.ajax({
function pingNodes() { type: 'GET',
$('td[data-action="ping"]').each(function(i, element) { url: $(element).data('location'),
$.ajax({ headers: {
type: 'GET', 'X-Access-Token': '{{ $node->daemonSecret }}'
url: $(element).data('location'), },
headers: { timeout: 5000
'X-Access-Token': '{{ $node->daemonSecret }}' }).done(function (data) {
}, $(element).find('i').tooltip({
timeout: 5000 title: 'v' + data.version,
}).done(function (data) { });
$(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