diff --git a/web/app/Http/Controllers/OrganizationController.php b/web/app/Http/Controllers/OrganizationController.php index 77a8b12130ef7834f5bcb7f1b8b65b267f73c61a..d712506b01cc584899b3fe7e7df58659e0883a34 100644 --- a/web/app/Http/Controllers/OrganizationController.php +++ b/web/app/Http/Controllers/OrganizationController.php @@ -78,6 +78,11 @@ class OrganizationController extends Controller return view("organization.show", array("organization" => $organization)); } + public function dashboard(Organization $organization) + { + return view("organization.dashboard", array("organization" => $organization)); + } + /** * Show the form for editing the specified resource. * diff --git a/web/app/Http/Controllers/ServerController.php b/web/app/Http/Controllers/ServerController.php index 8fbfe6c5bdc6783f711d01c27c7df5ac80610570..0e8219b80b765ea766ead369b62730d4895653a5 100644 --- a/web/app/Http/Controllers/ServerController.php +++ b/web/app/Http/Controllers/ServerController.php @@ -24,7 +24,7 @@ class ServerController extends Controller protected function validator(array $data) { return Validator::make($data, [ - 'name' => 'required|string|regex:/^[a-zA-Z0-9\s-\.]+$/|max:255' + 'name' => 'required|string|regex:/^[a-zA-Z0-9\s\-\.]+$/|max:255' ]); } diff --git a/web/resources/views/organization/dashboard.blade.php b/web/resources/views/organization/dashboard.blade.php new file mode 100644 index 0000000000000000000000000000000000000000..59fe34979c22dadd860717f88ad35f35e079621b --- /dev/null +++ b/web/resources/views/organization/dashboard.blade.php @@ -0,0 +1,36 @@ +@extends('layouts.app') + +@section('content') +<div class="container-fluid"> + + <h1>{{ $organization->name }}</h1> + + <div class="row"> + @foreach($organization->servers()->orderBy("name")->get() as $server) + <div class="col-md-3"> + <div class="card"> + <div class="card-header"> + <h5 class="card-title"> + {{ $server->name }} + </h5> + </div> + + <div class="card-body"> + {!! $server->getBadge() !!} + <p> + {{ $server->lastRecordTime()->diffForHumans() }} + </p> + </div> + + <div class="card-footer"> + <a class="btn btn-primary btn-sm" + href="{{ action("ServerController@show", ["server" => $server]) }}"> + View + </a> + </div> + </div> + </div> + @endforeach + </div> +</div> +@endsection diff --git a/web/routes/web.php b/web/routes/web.php index 19580181b0022bd1a3d54eb499cb2ea8ab15d7df..37d41933bf9965178a18dd8c7920963cbe663eda 100644 --- a/web/routes/web.php +++ b/web/routes/web.php @@ -22,10 +22,11 @@ Route::get("home", function() { }); Route::get('app/dashboard', function() { - //return view("dashboard"); return redirect(action("OrganizationController@index")); })->name('dashboard'); +Route::get('app/organizations/{organization}/dashboard', 'OrganizationController@dashboard'); + Route::resource('app/organizations', 'OrganizationController'); Route::resource("app/organizations.user", "OrganizationUserController"); Route::resource('app/servers', 'ServerController'); \ No newline at end of file