From 669fbc1ae5e11bd4749836609e1f46627e6e550f Mon Sep 17 00:00:00 2001 From: Miguel Nogueira Date: Sun, 3 May 2020 00:45:29 +0100 Subject: [PATCH] Add Mojang's status to dashboard Also adds a Cache table to the database. Contains incomplete routes. --- app/Http/Controllers/DashboardController.php | 14 +++++++- app/Http/Controllers/UserController.php | 19 ++++++++++ config/adminlte.php | 25 ++----------- ...04_29_022402_create_applications_table.php | 1 + ...04_29_022442_create_appointments_table.php | 5 +-- .../2020_05_02_223355_create_cache_table.php | 32 +++++++++++++++++ .../appmanagement/peerreview.blade.php | 2 +- resources/views/dashboard/dashboard.blade.php | 36 +++++++++++++++++-- routes/web.php | 6 ++++ 9 files changed, 111 insertions(+), 29 deletions(-) create mode 100644 app/Http/Controllers/UserController.php create mode 100644 database/migrations/2020_05_02_223355_create_cache_table.php diff --git a/app/Http/Controllers/DashboardController.php b/app/Http/Controllers/DashboardController.php index 672dd6c..e1df50e 100644 --- a/app/Http/Controllers/DashboardController.php +++ b/app/Http/Controllers/DashboardController.php @@ -3,13 +3,25 @@ namespace App\Http\Controllers; use Illuminate\Http\Request; +use Illuminate\Support\Facades\Cache; +use Illuminate\Support\Facades\Http; class DashboardController extends Controller { public function index() { - return view('dashboard.dashboard'); + // TODO: Switch status checking to provider, share with all views + + // Mojang status for informational purposes + if (!Cache::has('mojang_status')) + { + $mcstatus = Http::get('https://status.mojang.com/check'); + Cache::put('mojang_status', base64_encode($mcstatus->body()), now()->addMinutes(60)); + } + + return view('dashboard.dashboard') + ->with('mcstatus', json_decode(base64_decode(Cache::get('mojang_status')), true)); } } diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php new file mode 100644 index 0000000..b5b9064 --- /dev/null +++ b/app/Http/Controllers/UserController.php @@ -0,0 +1,19 @@ + 'Staff Members', - 'url' => 'fas fa-fw fa-users', - 'submenu' => [ - [ - 'text' => 'Active Members', - 'url' => '/hr/staff', - 'icon' => 'fas fa-fw fa-business-time' - ], - [ - 'text' => 'Former Members', - 'url' => '/hr/staff/former', - 'icon' => 'fas fa-fw fa-user-clock' - ], - [ - 'text' => 'Member Notes', - 'url' => '/hr/staff/notes', - 'icon' => 'far fa-address-card' - ], - [ - 'text' => 'Terminated Members', - 'url' => '/hr/staff/terminated', - 'icon' => 'fas fa-fw fa-user-slash' - ] - ] + 'icon' => 'fas fa-fw fa-users', + 'url' => '/hr/staff-members' ], [ // players who haven't been promoted yet 'text' => 'Registered Players', diff --git a/database/migrations/2020_04_29_022402_create_applications_table.php b/database/migrations/2020_04_29_022402_create_applications_table.php index 90b0483..2bb439a 100644 --- a/database/migrations/2020_04_29_022402_create_applications_table.php +++ b/database/migrations/2020_04_29_022402_create_applications_table.php @@ -26,6 +26,7 @@ class CreateApplicationsTable extends Migration 'STAGE_SUBMITTED', 'STAGE_PEERAPPROVAL', 'STAGE_INTERVIEW', + 'STAGE_INTERVIEW_SCHEDULED', 'APPROVED', 'DENIED' ])->default('STAGE_SUBMITTED'); diff --git a/database/migrations/2020_04_29_022442_create_appointments_table.php b/database/migrations/2020_04_29_022442_create_appointments_table.php index e95df27..f59ec51 100644 --- a/database/migrations/2020_04_29_022442_create_appointments_table.php +++ b/database/migrations/2020_04_29_022442_create_appointments_table.php @@ -27,9 +27,10 @@ class CreateAppointmentsTable extends Migration ]); $table->enum('appointmentStatus', [ 'SCHEDULED', - 'CONCLUDED' + 'CONCLUDED' // TODO: Review whether this status is necessary ])->default('SCHEDULED'); - $table->text('meetingNotes')->nullable(); + $table->boolean('userAccepted')->default(false); + $table->longText('meetingNotes')->nullable(); $table->timestamps(); }); } diff --git a/database/migrations/2020_05_02_223355_create_cache_table.php b/database/migrations/2020_05_02_223355_create_cache_table.php new file mode 100644 index 0000000..7b73e5f --- /dev/null +++ b/database/migrations/2020_05_02_223355_create_cache_table.php @@ -0,0 +1,32 @@ +string('key')->unique(); + $table->mediumText('value'); + $table->integer('expiration'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('cache'); + } +} diff --git a/resources/views/dashboard/appmanagement/peerreview.blade.php b/resources/views/dashboard/appmanagement/peerreview.blade.php index de7834a..d4c21fb 100644 --- a/resources/views/dashboard/appmanagement/peerreview.blade.php +++ b/resources/views/dashboard/appmanagement/peerreview.blade.php @@ -65,7 +65,7 @@ Under Review - + diff --git a/resources/views/dashboard/dashboard.blade.php b/resources/views/dashboard/dashboard.blade.php index 0904eba..03d12aa 100644 --- a/resources/views/dashboard/dashboard.blade.php +++ b/resources/views/dashboard/dashboard.blade.php @@ -3,9 +3,41 @@ @section('title', 'Raspberry Network Team Management') @section('content_header') -

Backoffice

+

Team Management Panel | Backoffice

@stop @section('content') -

Welcome to this beautiful admin panel.

+ +
+ +
+ + @if (!is_null($mcstatus)) + + @if($mcstatus[4]['sessionserver.mojang.com'] == 'red') + +
+

Mojang's session servers are (apparently) down

+ +

If you see missing profile pictures in our dashboard or in the staff list (homepage), or are unable to login to Raspberry Network or Minecraft itself, be advised that Mojang's session server is currently experiencing technical difficulties.

+

We hope this issue is resolved soon! For more information please visit the Mojang Support Center.

+ +

Raspberry Network and Spacejewel Hosting are not affiliated with Mojang AB or Microsoft Corporation. Minecraft(™) is a trademark of Mojang AB.

+
+ + @else + +
+ +

All OK! Feel free to explore the team management dashboard, manage your applications, or join our server.

+ +
+ + @endif + + @endif + +
+
+ @stop diff --git a/routes/web.php b/routes/web.php index e1e7cfc..d2a08ca 100644 --- a/routes/web.php +++ b/routes/web.php @@ -53,6 +53,12 @@ Route::group(['middleware' => 'auth'], function(){ }); + Route::group(['prefix' => '/hr'], function (){ + + Route::get('staff-members'); + + }); + }); //Route::get('/dashboard/login', '');