Add Mojang's status to dashboard

Also adds a Cache table to the database. Contains incomplete routes.
This commit is contained in:
Miguel Nogueira 2020-05-03 00:45:29 +01:00
parent 5e87fb7683
commit 669fbc1ae5
9 changed files with 111 additions and 29 deletions

View File

@ -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));
}
}

View File

@ -0,0 +1,19 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class UserController extends Controller
{
public function showStaffMembers()
{
}
public function showPlayers()
{
}
}

View File

@ -256,29 +256,8 @@ return [
'Administration',
[
'text' => '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',

View File

@ -26,6 +26,7 @@ class CreateApplicationsTable extends Migration
'STAGE_SUBMITTED',
'STAGE_PEERAPPROVAL',
'STAGE_INTERVIEW',
'STAGE_INTERVIEW_SCHEDULED',
'APPROVED',
'DENIED'
])->default('STAGE_SUBMITTED');

View File

@ -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();
});
}

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCacheTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cache', function (Blueprint $table) {
$table->string('key')->unique();
$table->mediumText('value');
$table->integer('expiration');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cache');
}
}

View File

@ -65,7 +65,7 @@
<td><span class="badge badge-warning">Under Review</span></td>
<td>
<button type="button" class="btn btn-info btn-sm"><i class="far fa-clipboard"></i> Review</button>
<button type="button" class="btn btn-success btn-sm"><i class="fas fa-user-check"></i> Vote: Next Stage</button>
<button type="button" class="btn btn-success btn-sm"><i class="fas fa-user-check"></i> Vote: Approve</button>
<button type="button" class="btn btn-danger btn-sm"><i class="fas fa-user-times"></i> Vote: Deny</button>
</td>

View File

@ -3,9 +3,41 @@
@section('title', 'Raspberry Network Team Management')
@section('content_header')
<h1>Backoffice</h1>
<h1>Team Management Panel | Backoffice</h1>
@stop
@section('content')
<p>Welcome to this beautiful admin panel.</p>
<div class="row">
<div class="col">
@if (!is_null($mcstatus))
@if($mcstatus[4]['sessionserver.mojang.com'] == 'red')
<div class="alert alert-danger">
<h4>Mojang's session servers are (apparently) down</h4>
<p>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.</p>
<p>We hope this issue is resolved soon! For more information please visit the Mojang <a href="https://help.minecraft.net/hc/en-us">Support Center</a>.</p>
<p class="text-bold">Raspberry Network and Spacejewel Hosting are not affiliated with Mojang AB or Microsoft Corporation. Minecraft() is a trademark of Mojang AB.</p>
</div>
@else
<div class="alert alert-success">
<p>All OK! Feel free to explore the team management dashboard, manage your applications, or join our server.</p>
</div>
@endif
@endif
</div>
</div>
@stop

View File

@ -53,6 +53,12 @@ Route::group(['middleware' => 'auth'], function(){
});
Route::group(['prefix' => '/hr'], function (){
Route::get('staff-members');
});
});
//Route::get('/dashboard/login', '');