Skip to content

Commit edaae40

Browse files
committed
Add some quick daemon information when viewing nodes
1 parent d93f88f commit edaae40

File tree

2 files changed

+50
-17
lines changed

2 files changed

+50
-17
lines changed

resources/views/admin/nodes/index.blade.php

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -70,24 +70,27 @@
7070
<script>
7171
$(document).ready(function () {
7272
$('#sidebar_links').find("a[href='/admin/nodes']").addClass('active');
73-
pingNodes();
74-
setInterval(pingNodes, 10000);
75-
});
76-
function pingNodes() {
77-
$('td[data-action="ping"]').each(function(i, element) {
78-
$.ajax({
79-
type: 'GET',
80-
url: $(element).data('location'),
81-
headers: {
82-
'X-Access-Token': '{{ $node->daemonSecret }}'
83-
},
84-
timeout: 5000
85-
}).done(function (data) {
86-
$(element).removeClass('text-muted').find('i').removeClass().addClass('fa fa-fw fa-heartbeat faa-pulse animated').css('color', '#50af51');
87-
}).fail(function () {
88-
$(element).removeClass('text-muted').find('i').removeClass().addClass('fa fa-fw fa-heart-o').css('color', '#d9534f');
73+
(function pingNodes() {
74+
$('td[data-action="ping"]').each(function(i, element) {
75+
$.ajax({
76+
type: 'GET',
77+
url: $(element).data('location'),
78+
headers: {
79+
'X-Access-Token': '{{ $node->daemonSecret }}'
80+
},
81+
timeout: 5000
82+
}).done(function (data) {
83+
$(element).find('i').tooltip({
84+
title: 'v' + data.version,
85+
});
86+
$(element).removeClass('text-muted').find('i').removeClass().addClass('fa fa-fw fa-heartbeat faa-pulse animated').css('color', '#50af51');
87+
}).fail(function () {
88+
$(element).removeClass('text-muted').find('i').removeClass().addClass('fa fa-fw fa-heart-o').css('color', '#d9534f');
89+
}).always(function () {
90+
setTimeout(pingNodes, 10000);
91+
});
8992
});
90-
});
93+
})();
9194
}
9295
</script>
9396
@endsection

resources/views/admin/nodes/view.blade.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,18 @@
6969
<div class="panel-body">
7070
<table class="table table-striped" style="margin-bottom:0;">
7171
<tbody>
72+
<tr>
73+
<td>Daemon Version</td>
74+
<td><code data-attr="info-version"><i class="fa fa-refresh fa-fw fa-spin"></i></code></td>
75+
</tr>
76+
<tr>
77+
<td>System Information</td>
78+
<td data-attr="info-system"><i class="fa fa-refresh fa-fw fa-spin"></i></td>
79+
</tr>
80+
<tr>
81+
<td>Total CPU Cores</td>
82+
<td data-attr="info-cpus"><i class="fa fa-refresh fa-fw fa-spin"></i></td>
83+
</tr>
7284
<tr>
7385
<td>Total Servers</td>
7486
<td>{{ count($servers) }}</td>
@@ -777,6 +789,24 @@ function clearHighlight(element) {
777789
element.parent().removeClass('has-error has-success');
778790
}
779791
792+
(function getInformation() {
793+
$.ajax({
794+
method: 'GET',
795+
url: '{{ $node->scheme }}://{{ $node->fqdn }}:{{ $node->daemonListen }}',
796+
timeout: 5000,
797+
headers: {
798+
'X-Access-Token': '{{ $node->daemonSecret }}'
799+
},
800+
}).done(function (data) {
801+
$('[data-attr="info-version"]').html(data.version);
802+
$('[data-attr="info-system"]').html(data.system.type + '(' + data.system.arch + ') <code>' + data.system.release + '</code>');
803+
$('[data-attr="info-cpus"]').html(data.system.cpus);
804+
}).fail(function (jqXHR) {
805+
806+
}).always(function() {
807+
setTimeout(getInformation, 10000);
808+
});
809+
})();
780810
});
781811
</script>
782812
@endsection

0 commit comments

Comments
 (0)