Added YABs compare & implemented cache for YABs

Added YABs compare
Made YABs calls use relationship with disk and network table
Update YABs views to reflect access changes in data
Implemented cache for YABs
Added Server function serverYabsAmount() to count YABs for a server id
This commit is contained in:
cp6 2022-07-18 14:27:11 +10:00
parent 39ffe0712b
commit 50d4b8b3e2
8 changed files with 416 additions and 36 deletions

View File

@ -16,11 +16,7 @@ class YabsController extends Controller
{ {
public function index() public function index()
{ {
$yabs = DB::table('yabs as y') $yabs = Yabs::allYabs();
->join('servers as s', 'y.server_id', '=', 's.id')
->Join('disk_speed as ds', 'y.id', '=', 'ds.id')
->get(['y.*', 's.hostname', 'ds.*']);
return view('yabs.index', compact(['yabs'])); return view('yabs.index', compact(['yabs']));
} }
@ -38,7 +34,6 @@ class YabsController extends Controller
if (isset($yabs['error_id'])) { if (isset($yabs['error_id'])) {
return back()->withErrors(["yabs" => 'Problem inserting YABs. Error id ' . $yabs['error_id']])->withInput(); return back()->withErrors(["yabs" => 'Problem inserting YABs. Error id ' . $yabs['error_id']])->withInput();
//return redirect()->route('yabs.index')->with('error', 'Problem inserting YABs. Error id ' . $yabs['error_id']);
} }
//No errors, do insert //No errors, do insert
@ -111,6 +106,7 @@ class YabsController extends Controller
Cache::forget('all_active_servers');//all servers cache Cache::forget('all_active_servers');//all servers cache
Cache::forget('non_active_servers');//all servers cache Cache::forget('non_active_servers');//all servers cache
Cache::forget('all_yabs');//Forget the all YABs cache
return redirect()->route('yabs.index') return redirect()->route('yabs.index')
->with('success', 'Success inserting YABs'); ->with('success', 'Success inserting YABs');
@ -118,17 +114,8 @@ class YabsController extends Controller
public function show(Yabs $yab) public function show(Yabs $yab)
{ {
$yab = DB::table('yabs as y') $yab = Yabs::yabs($yab->id);
->join('servers as s', 'y.server_id', '=', 's.id') return view('yabs.show', compact(['yab']));
->join('disk_speed as ds', 'y.id', '=', 'ds.id')
->where('y.id', '=', $yab->id)
->get(['y.*', 's.hostname', 'ds.*']);
$network = DB::table('network_speed')
->where('id', '=', $yab[0]->id)
->get();
return view('yabs.show', compact(['yab', 'network']));
} }
public function destroy(Yabs $yab) public function destroy(Yabs $yab)
@ -136,11 +123,40 @@ class YabsController extends Controller
$yabs = Yabs::find($yab->id); $yabs = Yabs::find($yab->id);
$yabs->delete(); $yabs->delete();
$update_server = DB::table('servers') if (Server::serverYabsAmount($yab->server_id) === 0) {
DB::table('servers')
->where('id', $yab->server_id) ->where('id', $yab->server_id)
->update(['has_yabs' => 0]); ->update(['has_yabs' => 0]);
}
Cache::forget('all_yabs');
Cache::forget("yabs.{$yab->id}");
return redirect()->route('yabs.index') return redirect()->route('yabs.index')
->with('success', 'YABs was deleted Successfully.'); ->with('success', 'YABs was deleted Successfully.');
} }
public function chooseYabsCompare()
{
$all_yabs = Yabs::allYabs();
return view('yabs.choose-compare', compact('all_yabs'));
}
public function compareYabs($yabs1, $yabs2)
{
$yabs1_data = Yabs::yabs($yabs1);
if (count($yabs1_data) === 0) {
return response()->view('errors.404', array("status" => 404, "title" => "Page not found", "message" => "No YABs data was found for id '$yabs1'"), 404);
}
$yabs2_data = Yabs::yabs($yabs2);
if (count($yabs2_data) === 0) {
return response()->view('errors.404', array("status" => 404, "title" => "Page not found", "message" => "No YABs data was found for id '$server2'"), 404);
}
return view('yabs.compare', compact('yabs1_data', 'yabs2_data'));
}
} }

View File

@ -249,4 +249,11 @@ class Server extends Model
}); });
} }
public static function serverYabsAmount(string $server_id): int
{
return DB::table('yabs')
->where('server_id', '=', $server_id)
->get()->count();
}
} }

View File

@ -35,4 +35,35 @@ class Yabs extends Model
}); });
} }
public static function yabs(string $yabs_id)
{
return Cache::remember("yabs.$yabs_id", now()->addMonth(1), function () use ($yabs_id) {
return self::where('id', $yabs_id)->with(['server', 'disk_speed', 'network_speed'])
->get();
});
}
public static function allYabs()
{
return Cache::remember("all_yabs", now()->addMonth(1), function () {
return self::with(['server', 'disk_speed', 'network_speed'])
->get();
});
}
public function server()
{
return $this->hasOne(Server::class, 'id', 'server_id');
}
public function disk_speed()
{
return $this->hasOne(DiskSpeed::class, 'id', 'id');
}
public function network_speed()
{
return $this->hasMany(NetworkSpeed::class, 'id', 'id');
}
} }

View File

@ -0,0 +1,77 @@
@section('title')
{{'Choose YABs to compare'}}
@endsection
@section('scripts')
<script src="{{ asset('js/vue.min.js') }}"></script>
@endsection
<x-app-layout>
<x-slot name="header">
{{ __('Choose two YABs to compare') }}
</x-slot>
<div class="container" id="app">
<div class="card shadow mt-3">
<div class="card-body">
<a href="{{ route('yabs.index') }}" class="btn btn-primary mb-3">YABs home</a>
@if(count($all_yabs) >= 2)
<div class="row">
<div class="col-12 col-lg-6">
<div class="input-group">
<div class="input-group-prepend"><span class="input-group-text">YABs 1</span></div>
<select class="form-control" name="server1" @change="changeServer1($event)">
@foreach ($all_yabs as $yabs)
<option value="{{ $yabs['id'] }}">
{{ $yabs->server->hostname }} ({{$yabs['output_date']}})
</option>
@endforeach
</select>
</div>
</div>
<div class="col-12 col-lg-6">
<div class="input-group">
<div class="input-group-prepend"><span class="input-group-text">YABs 2</span></div>
<select class="form-control" name="server2" @change="changeServer2($event)">
@foreach ($all_yabs as $yabs)
<option value="{{ $yabs['id'] }}" {{($loop->index === 1)?'selected':''}}>
{{ $yabs->server->hostname }} ({{$yabs['output_date']}})
</option>
@endforeach
</select>
</div>
</div>
</div>
<a v-bind:href="full_url" class="btn btn-success mt-4">View comparison table</a>
@else
<p class="text-danger">You need to have added at least 2 YABs to use this feature</p>
@endif
</div>
</div>
@if(Session::has('timer_version_footer') && Session::get('timer_version_footer') === 1)
<p class="text-muted mt-4 text-end"><small>Built on Laravel
v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }})</small></p>
@endif
</div>
<script type="application/javascript">
let app = new Vue({
el: "#app",
data: {
"base_url": "yabs-compare/",
"full_url": "{{route('yabs.compare', ['yabs1' => $all_yabs[0]->id, 'yabs2' => $all_yabs[1]->id])}}",
"url_input": "",
"server1": "{{$all_yabs[0]->id ?? ''}}",
"server2": "{{$all_yabs[1]->id ?? ''}}",
},
methods: {
changeServer1: function changeServer1(event) {
this.server1 = event.target.value;
this.full_url = this.base_url + this.server1 + '/' + this.server2;
this.url_input = this.full_url;
},
changeServer2: function changeServer2(event) {
this.server2 = event.target.value;
this.full_url = this.base_url + this.server1 + '/' + this.server2;
this.url_input = this.full_url;
}
}
});
</script>
</x-app-layout>

View File

@ -0,0 +1,244 @@
@section('title') {{'Compare YABs'}} @endsection
@section('style')
<style>
.td-nowrap {
white-space: nowrap;
}
.plus-td {
background: #71ed7136 !important;
}
.neg-td {
background: #ed827136 !important;
}
.equal-td {
background: #6189ff26 !important;
}
.objects-table th:first-child, .objects-table td:first-child, .compare-table th:first-child, .compare-table td:first-child {
position: sticky;
left: 0;
background-color: #f6f6f6;
text-align: left;
}
.data-type {
color: #212529b3;
padding-left: .05rem;
font-size: 85%;
}
</style>
@endsection
<x-app-layout>
<div class="container" id="app">
<div class="card shadow mt-3">
<div class="card-body">
<a href="{{ route('yabs.compare-choose') }}" class="btn btn-primary mb-3">Choose others</a>
<div class="table-responsive">
<table class="table compare-table">
<thead>
<tr>
<th></th>
<th>{{ $yabs1_data[0]->id }}</th>
<th>DIF</th>
<th>{{ $yabs2_data[0]->id}}</th>
</tr>
</thead>
<tbody>
<tr>
<td class="td-nowrap">Date</td>
<td class="td-nowrap">{{ date_format(new DateTime($yabs1_data[0]->output_date), 'g:ia D jS F Y') }}</td>
<td class="td-nowrap equal-td">
{{\Carbon\Carbon::parse($yabs1_data[0]->output_date)->diffForHumans(\Carbon\Carbon::parse($yabs2_data[0]->output_date))}}
</td>
<td class="td-nowrap">{{ date_format(new DateTime($yabs2_data[0]->output_date), 'g:ia D jS F Y') }}</td>
</tr>
<tr>
<td class="td-nowrap">Server</td>
<td class="td-nowrap">{{$yabs1_data[0]->server->hostname}}</td>
<td class="td-nowrap equal-td"></td>
<td class="td-nowrap">{{$yabs2_data[0]->server->hostname}}</td>
</tr>
<tr>
<td class="td-nowrap">CPU count</td>
<td class="td-nowrap">{{$yabs1_data[0]->cpu_cores}}</td>
{!! \App\Models\Server::tableRowCompare($yabs1_data[0]->cpu_cores, $yabs2_data[0]->cpu_cores, ' cores') !!}
<td class="td-nowrap">{{$yabs2_data[0]->cpu_cores}}</td>
</tr>
<tr>
<td class="td-nowrap">CPU freq</td>
<td class="td-nowrap">{{$yabs1_data[0]->cpu_freq}}<span class="data-type">Mhz</span></td>
{!! \App\Models\Server::tableRowCompare($yabs1_data[0]->cpu_freq, $yabs2_data[0]->cpu_freq, 'Mhz') !!}
<td class="td-nowrap">{{$yabs2_data[0]->cpu_freq}}<span class="data-type">Mhz</span></td>
</tr>
<tr>
<td class="td-nowrap">Ram</td>
<td class="td-nowrap">{{$yabs1_data[0]->ram_mb}}<span class="data-type">MB</span></td>
{!! \App\Models\Server::tableRowCompare($yabs1_data[0]->ram_mb, $yabs2_data[0]->ram_mb, 'MB') !!}
<td class="td-nowrap">{{$yabs2_data[0]->ram_mb}}<span class="data-type">MB</span></td>
</tr>
<tr>
<td class="td-nowrap">Disk</td>
<td class="td-nowrap">{{$yabs1_data[0]->disk_gb}}<span class="data-type">GB</span></td>
{!! \App\Models\Server::tableRowCompare($yabs1_data[0]->disk_gb, $yabs2_data[0]->disk_gb, 'GB') !!}
<td class="td-nowrap">{{$yabs2_data[0]->disk_gb}}<span class="data-type">GB</span></td>
</tr>
<tr>
<td class="td-nowrap">GB5 single</td>
<td class="td-nowrap">{{$yabs1_data[0]->gb5_single}}</td>
{!! \App\Models\Server::tableRowCompare($yabs1_data[0]->gb5_single, $yabs2_data[0]->gb5_single, '') !!}
<td class="td-nowrap">{{$yabs2_data[0]->gb5_single}}</td>
</tr>
<tr>
<td class="td-nowrap">GB5 multi</td>
<td class="td-nowrap">{{$yabs1_data[0]->gb5_multi}}</td>
{!! \App\Models\Server::tableRowCompare($yabs1_data[0]->gb5_multi, $yabs2_data[0]->gb5_multi, '') !!}
<td class="td-nowrap">{{$yabs2_data[0]->gb5_multi}}</td>
</tr>
<tr>
<td class="td-nowrap">4k disk</td>
<td class="td-nowrap">{{$yabs1_data[0]->disk_speed->d_4k_as_mbps}}<span class="data-type">MB/s</span>
</td>
{!! \App\Models\Server::tableRowCompare($yabs1_data[0]->disk_speed->d_4k_as_mbps, $yabs2_data[0]->disk_speed->d_4k_as_mbps, 'MB/s') !!}
<td class="td-nowrap">{{$yabs2_data[0]->disk_speed->d_4k_as_mbps}}<span class="data-type">MB/s</span>
</td>
</tr>
<tr>
<td class="td-nowrap">64k disk</td>
<td class="td-nowrap">{{$yabs1_data[0]->disk_speed->d_64k_as_mbps}}<span class="data-type">MB/s</span>
</td>
{!! \App\Models\Server::tableRowCompare($yabs1_data[0]->disk_speed->d_64k_as_mbps, $yabs2_data[0]->disk_speed->d_64k_as_mbps, 'MB/s') !!}
<td class="td-nowrap">{{$yabs2_data[0]->disk_speed->d_64k_as_mbps}}<span class="data-type">MB/s</span>
</td>
</tr>
<tr>
<td class="td-nowrap">512k disk</td>
<td class="td-nowrap">{{$yabs1_data[0]->disk_speed->d_512k_as_mbps}}<span
class="data-type">MB/s</span></td>
{!! \App\Models\Server::tableRowCompare($yabs1_data[0]->disk_speed->d_512k_as_mbps, $yabs2_data[0]->disk_speed->d_512k_as_mbps, 'MB/s') !!}
<td class="td-nowrap">{{$yabs2_data[0]->disk_speed->d_512k_as_mbps}}<span
class="data-type">MB/s</span></td>
</tr>
<tr>
<td class="td-nowrap">1m disk</td>
<td class="td-nowrap">{{$yabs1_data[0]->disk_speed->d_1m_as_mbps}}<span class="data-type">MB/s</span>
</td>
{!! \App\Models\Server::tableRowCompare($yabs1_data[0]->disk_speed->d_1m_as_mbps, $yabs2_data[0]->disk_speed->d_1m_as_mbps, 'MB/s') !!}
<td class="td-nowrap">{{$yabs2_data[0]->disk_speed->d_1m_as_mbps}}<span class="data-type">MB/s</span>
</td>
</tr>
<tr>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[0]->location}} send</td>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[0]->send_as_mbps}}<span
class="data-type">MBps</span></td>
{!! \App\Models\Server::tableRowCompare($yabs1_data[0]->network_speed[0]->send_as_mbps, $yabs2_data[0]->network_speed[0]->send_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$yabs2_data[0]->network_speed[0]->send_as_mbps}}<span
class="data-type">MBps</span></td>
</tr>
<tr>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[0]->location}} receive</td>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[0]->receive_as_mbps}}<span
class="data-type">MBps</span></td>
{!! \App\Models\Server::tableRowCompare($yabs1_data[0]->network_speed[0]->receive_as_mbps, $yabs2_data[0]->network_speed[0]->receive_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$yabs2_data[0]->network_speed[0]->receive_as_mbps}}<span
class="data-type">MBps</span></td>
</tr>
@if($yabs1_data[0]->network_speed[1]->location === $yabs2_data[0]->network_speed[1]->location)
<tr>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[1]->location}} send</td>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[1]->send_as_mbps}}<span
class="data-type">MBps</span></td>
{!! \App\Models\Server::tableRowCompare($yabs1_data[0]->network_speed[1]->send_as_mbps, $yabs2_data[0]->network_speed[1]->send_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$yabs2_data[0]->network_speed[1]->send_as_mbps}}<span
class="data-type">MBps</span></td>
</tr>
<tr>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[1]->location}} receive</td>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[1]->receive_as_mbps}}<span class="data-type">MBps</span>
</td>
{!! \App\Models\Server::tableRowCompare($yabs1_data[0]->network_speed[1]->receive_as_mbps, $yabs2_data[0]->network_speed[1]->receive_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$yabs2_data[0]->network_speed[1]->receive_as_mbps}}<span class="data-type">MBps</span>
</td>
</tr>
@endif
@if($yabs1_data[0]->network_speed[2]->location === $yabs2_data[0]->network_speed[2]->location)
<tr>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[2]->location}} send</td>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[2]->send_as_mbps}}<span
class="data-type">MBps</span></td>
{!! \App\Models\Server::tableRowCompare($yabs1_data[0]->network_speed[2]->send_as_mbps, $yabs2_data[0]->network_speed[2]->send_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$yabs2_data[0]->network_speed[2]->send_as_mbps}}<span
class="data-type">MBps</span></td>
</tr>
<tr>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[2]->location}} receive</td>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[2]->receive_as_mbps}}<span class="data-type">MBps</span>
</td>
{!! \App\Models\Server::tableRowCompare($yabs1_data[0]->network_speed[2]->receive_as_mbps, $yabs2_data[0]->network_speed[2]->receive_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$yabs2_data[0]->network_speed[2]->receive_as_mbps}}<span class="data-type">MBps</span>
</td>
</tr>
@endif
@if($yabs1_data[0]->network_speed[3]->location === $yabs2_data[0]->network_speed[3]->location)
<tr>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[3]->location}} send</td>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[3]->send_as_mbps}}<span
class="data-type">MBps</span></td>
{!! \App\Models\Server::tableRowCompare($yabs1_data[0]->network_speed[3]->send_as_mbps, $yabs2_data[0]->network_speed[3]->send_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$yabs2_data[0]->network_speed[3]->send_as_mbps}}<span
class="data-type">MBps</span></td>
</tr>
<tr>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[3]->location}} receive</td>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[3]->receive_as_mbps}}<span class="data-type">MBps</span>
</td>
{!! \App\Models\Server::tableRowCompare($yabs1_data[0]->network_speed[3]->receive_as_mbps, $yabs2_data[0]->network_speed[3]->receive_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$yabs2_data[0]->network_speed[3]->receive_as_mbps}}<span class="data-type">MBps</span>
</td>
</tr>
@endif
@if($yabs1_data[0]->network_speed[4]->location === $yabs2_data[0]->network_speed[4]->location)
<tr>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[4]->location}} send</td>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[4]->send_as_mbps}}<span
class="data-type">MBps</span></td>
{!! \App\Models\Server::tableRowCompare($yabs1_data[0]->network_speed[4]->send_as_mbps, $yabs2_data[0]->network_speed[4]->send_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$yabs2_data[0]->network_speed[4]->send_as_mbps}}<span
class="data-type">MBps</span></td>
</tr>
<tr>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[4]->location}} receive</td>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[4]->receive_as_mbps}}<span class="data-type">MBps</span>
</td>
{!! \App\Models\Server::tableRowCompare($yabs1_data[0]->network_speed[4]->receive_as_mbps, $yabs2_data[0]->network_speed[4]->receive_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$yabs2_data[0]->network_speed[4]->receive_as_mbps}}<span class="data-type">MBps</span>
</td>
</tr>
@endif
@if($yabs1_data[0]->network_speed[4]->location === $yabs2_data[0]->network_speed[5]->location)
<tr>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[4]->location}} send</td>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[4]->send_as_mbps}}<span
class="data-type">MBps</span></td>
{!! \App\Models\Server::tableRowCompare($yabs1_data[0]->network_speed[4]->send_as_mbps, $yabs2_data[0]->network_speed[5]->send_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$yabs2_data[0]->network_speed[5]->send_as_mbps}}<span
class="data-type">MBps</span></td>
</tr>
<tr>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[4]->location}} receive</td>
<td class="td-nowrap">{{$yabs1_data[0]->network_speed[4]->receive_as_mbps}}<span class="data-type">MBps</span>
</td>
{!! \App\Models\Server::tableRowCompare($yabs1_data[0]->network_speed[4]->receive_as_mbps, $yabs2_data[0]->network_speed[5]->receive_as_mbps, 'MBps') !!}
<td class="td-nowrap">{{$yabs2_data[0]->network_speed[5]->receive_as_mbps}}<span class="data-type">MBps</span>
</td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
</div>
</div>
</x-app-layout>

View File

@ -14,6 +14,7 @@
<x-delete-confirm-modal></x-delete-confirm-modal> <x-delete-confirm-modal></x-delete-confirm-modal>
<x-card class="shadow mt-3"> <x-card class="shadow mt-3">
<a href="{{ route('yabs.create') }}" class="btn btn-primary mb-3">Add YABs</a> <a href="{{ route('yabs.create') }}" class="btn btn-primary mb-3">Add YABs</a>
<a href="{{ route('yabs.compare-choose') }}" class="btn btn-success mb-3">Compare YABs</a>
<x-errors-alert></x-errors-alert> <x-errors-alert></x-errors-alert>
<x-success-alert></x-success-alert> <x-success-alert></x-success-alert>
<div class="table-responsive"> <div class="table-responsive">
@ -40,7 +41,7 @@
@if(!empty($yabs)) @if(!empty($yabs))
@foreach($yabs as $yab) @foreach($yabs as $yab)
<tr> <tr>
<td><a href="servers/{{$yab->server_id}}" class="text-decoration-none">{{ $yab->hostname }}</a></td> <td><a href="servers/{{$yab->server_id}}" class="text-decoration-none">{{ $yab->server->hostname }}</a></td>
<td><span title="{{$yab->cpu_model}}">{{ $yab->cpu_cores }}</span></td> <td><span title="{{$yab->cpu_model}}">{{ $yab->cpu_cores }}</span></td>
<td><span title="{{$yab->cpu_model}}">{{ $yab->cpu_freq }}<small>Mhz</small></span></td> <td><span title="{{$yab->cpu_model}}">{{ $yab->cpu_freq }}<small>Mhz</small></span></td>
<td>{{ $yab->ram }}<small>{{ $yab->ram_type }}</small></td> <td>{{ $yab->ram }}<small>{{ $yab->ram_type }}</small></td>
@ -53,10 +54,10 @@
No No
@endif @endif
</td> </td>
<td>{{ $yab->d_4k }}<small>{{ $yab->d_4k_type }}</small></td> <td>{{ $yab->disk_speed->d_4k }}<small>{{ $yab->disk_speed->d_4k_type }}</small></td>
<td>{{ $yab->d_64k }}<small>{{ $yab->d_64k_type }}</small></td> <td>{{ $yab->disk_speed->d_64k }}<small>{{ $yab->disk_speed->d_64k_type }}</small></td>
<td>{{ $yab->d_512k }}<small>{{ $yab->d_512k_type }}</small></td> <td>{{ $yab->disk_speed->d_512k }}<small>{{ $yab->disk_speed->d_512k_type }}</small></td>
<td>{{ $yab->d_1m }}<small>{{ $yab->d_1m_type }}</small></td> <td>{{ $yab->disk_speed->d_1m }}<small>{{ $yab->disk_speed->d_1m_type }}</small></td>
<td>{{ date_format(new DateTime($yab->output_date), 'Y-m-d g:i a') }}</small></td> <td>{{ date_format(new DateTime($yab->output_date), 'Y-m-d g:i a') }}</small></td>
<td class="text-nowrap"> <td class="text-nowrap">
<form action="{{ route('yabs.destroy', $yab->id) }}" method="POST"> <form action="{{ route('yabs.destroy', $yab->id) }}" method="POST">
@ -66,7 +67,7 @@
</a> </a>
<i class="fas fa-trash text-danger ms-3" @click="modalForm" <i class="fas fa-trash text-danger ms-3" @click="modalForm"
id="btn-{{$yab->hostname}}" title="{{$yab->id}}"></i> id="btn-{{$yab->server->hostname}}" title="{{$yab->id}}"></i>
</form> </form>
</td> </td>
</tr> </tr>

View File

@ -16,7 +16,7 @@
<tbody> <tbody>
<tr> <tr>
<td class="px-4 py-2 font-bold">Server</td> <td class="px-4 py-2 font-bold">Server</td>
<td><a href="{{route('servers.show', ['server' => $yab[0]->server_id])}}" class="text-decoration-none">{{ $yab[0]->hostname }}</a></td> <td><a href="{{route('servers.show', ['server' => $yab[0]->server_id])}}" class="text-decoration-none">{{ $yab[0]->server->hostname }}</a></td>
</tr> </tr>
<tr> <tr>
<td class="px-4 py-2 font-bold">CPU</td> <td class="px-4 py-2 font-bold">CPU</td>
@ -75,10 +75,10 @@
class="text-decoration-none">{{ $yab[0]->gb5_multi }}</a></td> class="text-decoration-none">{{ $yab[0]->gb5_multi }}</a></td>
</tr> </tr>
<tr> <tr>
<td class="px-4 py-2 font-bold">Tested</td> <td class="px-4 py-2 font-bold">Test ran</td>
<td> <td>
@if(!is_null($yab[0]->output_date)) @if(!is_null($yab[0]->output_date))
{{date_format(new DateTime($yab[0]->output_date), 'jS F Y')}} {{date_format(new DateTime($yab[0]->output_date), 'g:ia D jS F Y')}}
@endif @endif
</td> </td>
</tr> </tr>
@ -93,25 +93,25 @@
<td class="py-2">Disk speeds:</td> <td class="py-2">Disk speeds:</td>
</tr> </tr>
<tr> <tr>
<td class="px-4 py-2"><b>4k</b> {{$yab[0]->d_4k}} <td class="px-4 py-2"><b>4k</b> {{$yab[0]->disk_speed->d_4k}}
<small>{{$yab[0]->d_4k_type}}</small></td> <small>{{$yab[0]->disk_speed->d_4k_type}}</small></td>
</tr> </tr>
<tr> <tr>
<td class="px-4 py-2"><b>64k</b> {{$yab[0]->d_64k}} <td class="px-4 py-2"><b>64k</b> {{$yab[0]->disk_speed->d_64k}}
<small>{{$yab[0]->d_64k_type}}</small></td> <small>{{$yab[0]->disk_speed->d_64k_type}}</small></td>
</tr> </tr>
<tr> <tr>
<td class="px-4 py-2"><b>512k</b> {{$yab[0]->d_512k}} <td class="px-4 py-2"><b>512k</b> {{$yab[0]->disk_speed->d_512k}}
<small>{{$yab[0]->d_512k_type}}</small></td> <small>{{$yab[0]->d_512k_type}}</small></td>
</tr> </tr>
<tr> <tr>
<td class="px-4 py-2"><b>1m</b> {{$yab[0]->d_1m}} <small>{{$yab[0]->d_1m_type}}</small> <td class="px-4 py-2"><b>1m</b> {{$yab[0]->disk_speed->d_1m}} <small>{{$yab[0]->disk_speed->d_1m_type}}</small>
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="py-2">Network speed (location|send|receive):</td> <td class="py-2">Network speed (location|send|receive):</td>
</tr> </tr>
@foreach($network as $speed_test) @foreach($yab[0]->network_speed as $speed_test)
<tr> <tr>
<td class="px-4 py-2 text-nowrap"> <td class="px-4 py-2 text-nowrap">
<b>{{$speed_test->location}}</b> {{$speed_test->send}} <b>{{$speed_test->location}}</b> {{$speed_test->send}}

View File

@ -70,6 +70,10 @@ Route::resource('shared', SharedController::class)->middleware(['auth']);
Route::resource('yabs', YabsController::class)->middleware(['auth']); Route::resource('yabs', YabsController::class)->middleware(['auth']);
Route::get('yabs-compare-choose', 'App\Http\Controllers\YabsController@chooseYabsCompare')->middleware(['auth'])->name('yabs.compare-choose');
Route::get('yabs-compare/{yabs1}/{yabs2}', 'App\Http\Controllers\YabsController@compareYabs')->middleware(['auth'])->name('yabs.compare');
Route::get('servers-compare-choose', 'App\Http\Controllers\ServerController@chooseCompare')->middleware(['auth'])->name('servers-compare-choose'); Route::get('servers-compare-choose', 'App\Http\Controllers\ServerController@chooseCompare')->middleware(['auth'])->name('servers-compare-choose');
Route::get('servers-compare/{server1}/{server2}', 'App\Http\Controllers\ServerController@compareServers')->middleware(['auth']); Route::get('servers-compare/{server1}/{server2}', 'App\Http\Controllers\ServerController@compareServers')->middleware(['auth']);