Fix end session report, move address when system is a ZC, show #addresses on systems

This commit is contained in:
Deon George 2021-08-15 11:42:38 +10:00
parent b9abd17139
commit 414a10f84e
6 changed files with 20 additions and 4 deletions

View File

@ -275,7 +275,7 @@ abstract class Protocol
Log::info(sprintf('%s: Total: %s - %d:%02d:%02d online, (%d) %lu%s sent, (%d) %lu%s received - %s',
__METHOD__,
$this->node->address,
$this->node->address->ftn,
$this->node->session_time/3600,
$this->node->session_time%3600/60,
$this->node->session_time%60,

View File

@ -47,6 +47,14 @@ class System extends Model
return $this->hasOne(Setup::class);
}
/**
* This system is the ZC for the following zones
*/
public function zcs()
{
return $this->belongsToMany(Zone::class);
}
/**
* Zones a system has addresses for
*

View File

@ -206,6 +206,8 @@
paging: true,
pageLength: 25,
searching: true,
ordering: true,
order: [],
conditionalPaging: {
style: 'fade',
speed: 500 // optional

View File

@ -14,6 +14,10 @@ use App\Http\Controllers\DomainController as DC;
@if($o->setup)<sup class="success" style="float:right;top:-2em;">* This Host</sup>@endif
@endif
@if($o->zcs)
<p>This system is the ZC for the following zones: <strong class="highlight">{!! $o->zcs->map(function($item) { return sprintf('%d@%s',$item->zone_id,$item->domain->name); })->join('</strong>, <strong class="highlight">') !!} </strong></p>
@endif
<div class="accordion accordion-flush" id="accordion_homepage">
@if ($o->exists)
<!-- System -->

View File

@ -32,6 +32,7 @@
<th>Connect</th>
<th>Address</th>
<th>ZeroTier ID</th>
<th>Addresses</th>
</tr>
</thead>
@ -52,6 +53,7 @@
</td>
<td>{{ $oo->addresses->pluck('ftn')->join(', ') }}</td>
<td>{{ $oo->zt_id }}</td>
<td>{{ $oo->addresses->count() }}</td>
</tr>
@endforeach
</tbody>

View File

@ -50,10 +50,10 @@ Move Address
<label for="remove" class="form-label">Delete System after Move</label>
<div class="input-group">
<div class="btn-group" role="group">
<input type="radio" class="btn-check" name="remove" id="remove_yes" value="1" @if($o->system->setup || $o->system->addresses->count() > 1)disabled @endif @if(old('remove',FALSE))checked @endif>
<input type="radio" class="btn-check" name="remove" id="remove_yes" value="1" @if($o->system->setup || $o->system->addresses->count()+$o->system->zcs->count() > 1)disabled @endif @if(old('remove',FALSE))checked @endif>
<label class="btn btn-outline-danger" for="remove_yes">Yes</label>
<input type="radio" class="btn-check" name="remove" id="remove_no" value="0" @if($o->system->addresses->count() > 1)disabled @endif @if(! old('remove',FALSE))checked @endif>
<input type="radio" class="btn-check" name="remove" id="remove_no" value="0" @if($o->system->addresses->count()+$o->system->zcs->count() > 1)disabled @endif @if(! old('remove',FALSE))checked @endif>
<label class="btn btn-outline-success" for="remove_no">No</label>
</div>
</div>