Add some quick daemon information when viewing nodes
This commit is contained in:
parent
d93f88f471
commit
edaae40df9
2 changed files with 50 additions and 17 deletions
|
@ -70,24 +70,27 @@
|
|||
<script>
|
||||
$(document).ready(function () {
|
||||
$('#sidebar_links').find("a[href='/admin/nodes']").addClass('active');
|
||||
pingNodes();
|
||||
setInterval(pingNodes, 10000);
|
||||
});
|
||||
function pingNodes() {
|
||||
$('td[data-action="ping"]').each(function(i, element) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: $(element).data('location'),
|
||||
headers: {
|
||||
'X-Access-Token': '{{ $node->daemonSecret }}'
|
||||
},
|
||||
timeout: 5000
|
||||
}).done(function (data) {
|
||||
$(element).removeClass('text-muted').find('i').removeClass().addClass('fa fa-fw fa-heartbeat faa-pulse animated').css('color', '#50af51');
|
||||
}).fail(function () {
|
||||
$(element).removeClass('text-muted').find('i').removeClass().addClass('fa fa-fw fa-heart-o').css('color', '#d9534f');
|
||||
(function pingNodes() {
|
||||
$('td[data-action="ping"]').each(function(i, element) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: $(element).data('location'),
|
||||
headers: {
|
||||
'X-Access-Token': '{{ $node->daemonSecret }}'
|
||||
},
|
||||
timeout: 5000
|
||||
}).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');
|
||||
}).fail(function () {
|
||||
$(element).removeClass('text-muted').find('i').removeClass().addClass('fa fa-fw fa-heart-o').css('color', '#d9534f');
|
||||
}).always(function () {
|
||||
setTimeout(pingNodes, 10000);
|
||||
});
|
||||
});
|
||||
});
|
||||
})();
|
||||
}
|
||||
</script>
|
||||
@endsection
|
||||
|
|
|
@ -69,6 +69,18 @@
|
|||
<div class="panel-body">
|
||||
<table class="table table-striped" style="margin-bottom:0;">
|
||||
<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>
|
||||
<td>Total Servers</td>
|
||||
<td>{{ count($servers) }}</td>
|
||||
|
@ -777,6 +789,24 @@ $(document).ready(function () {
|
|||
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>
|
||||
@endsection
|
||||
|
|
Loading…
Reference in a new issue