node status in list, closes #124

This commit is contained in:
Dane Everitt 2016-10-07 15:15:04 -04:00
parent 06422b2055
commit 0fe0f750c4
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
5 changed files with 45 additions and 7 deletions

View file

@ -23,6 +23,11 @@
Node List
@endsection
@section('scripts')
@parent
{!! Theme::css('css/vendor/fontawesome/animation.min.css') !!}
@endsection
@section('content')
<div class="col-md-12">
<ul class="breadcrumb">
@ -33,27 +38,27 @@
<table class="table table-bordered table-hover">
<thead>
<tr>
<th></th>
<th>Name</th>
<th class="visible-lg">Location</th>
<th>FQDN</th>
<th>Location</th>
<th class="hidden-xs">Memory</th>
<th class="hidden-xs">Disk</th>
<th class="text-center hidden-xs">Servers</th>
<th class="text-center">HTTPS</th>
<th class="text-center">Public</th>
<th class="text-center">SSL</th>
<th class="text-center hidden-xs">Public</th>
</tr>
</thead>
<tbody>
@foreach ($nodes as $node)
<tr>
<td class="text-center text-muted left-icon" data-action="ping" data-location="{{ $node->scheme }}://{{ $node->fqdn }}:{{ $node->daemonListen }}"><i class="fa fa-fw fa-refresh fa-spin"></i></td>
<td><a href="/admin/nodes/view/{{ $node->id }}">{{ $node->name }}</td>
<td class="visible-lg">{{ $node->a_locationName }}</td>
<td><code>{{ $node->fqdn }}</code></td>
<td>{{ $node->a_locationName }}</td>
<td class="hidden-xs">{{ $node->memory }} MB</td>
<td class="hidden-xs">{{ $node->disk }} MB</td>
<td class="text-center hidden-xs">{{ $node->a_serverCount }}</td>
<td class="text-center" style="color:{{ ($node->scheme === 'https') ? '#50af51' : '#d9534f' }}"><i class="fa fa-{{ ($node->scheme === 'https') ? 'lock' : 'unlock' }}"></i></td>
<td class="text-center"><i class="fa fa-{{ ($node->public === 1) ? 'check' : 'times' }}"></i></td>
<td class="text-center hidden-xs"><i class="fa fa-{{ ($node->public === 1) ? 'eye' : 'eye-slash' }}"></i></td>
</tr>
@endforeach
</tbody>
@ -65,6 +70,21 @@
<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) {
elem = $(this);
$.ajax({
type: 'GET',
url: elem.data('location'),
}).done(function (data) {
elem.removeClass('text-muted').find('i').removeClass().addClass('fa fa-fw fa-heartbeat faa-pulse animated').css('color', '#50af51');
}).fail(function () {
elem.removeClass('text-muted').find('i').removeClass().addClass('fa fa-fw fa-heart-o').css('color', '#d9534f');
});
});
}
</script>
@endsection