Skip to content

Commit

Permalink
✨ Health checks for links #79
Browse files Browse the repository at this point in the history
  • Loading branch information
MarceauKa committed Sep 8, 2020
1 parent 2ec3168 commit 5f696de
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 346 deletions.
55 changes: 0 additions & 55 deletions app/Http/Controllers/Manage/LinksController.php

This file was deleted.

38 changes: 38 additions & 0 deletions app/Http/Controllers/Manage/LinksHealthController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

namespace App\Http\Controllers\Manage;

use App\Http\Controllers\Controller;
use App\Link;
use App\Services\Shaark\Shaark;
use Illuminate\Support\Facades\Cache;

class LinksHealth extends Controller
{
public function __construct()
{
$this->middleware('auth');

$this->middleware('demo')->except('view');
}

public function view(Shaark $shaark)
{
$stats = Cache::remember('health-checks', now()->addHour(), function () {
return [
'total' => Link::isWatched()->count(),
'live' => Link::isWatched()->healthStatusIs(Link::HEALTH_STATUS_LIVE)->count(),
'dead' => Link::isWatched()->healthStatusIs(Link::HEALTH_STATUS_DEAD)->count(),
'error' => Link::isWatched()->healthStatusIs(Link::HEALTH_STATUS_ERROR)->count(),
'redirect' => Link::isWatched()->healthStatusIs(Link::HEALTH_STATUS_REDIRECT)->count(),
'disabled' => Link::isNotWatched()->count(),
];
});

return view('manage.links')->with([
'page_title' => __('Links'),
'enabled' => $shaark->getLinkHealthChecksEnabled(),
'stats' => $stats,
]);
}
}
79 changes: 0 additions & 79 deletions app/Services/HealthCheckStats.php

This file was deleted.

75 changes: 0 additions & 75 deletions resources/views/manage/links_dashboard.blade.php

This file was deleted.

47 changes: 0 additions & 47 deletions resources/views/manage/links_dead.blade.php

This file was deleted.

43 changes: 0 additions & 43 deletions resources/views/manage/links_disabled.blade.php

This file was deleted.

47 changes: 0 additions & 47 deletions resources/views/manage/links_other.blade.php

This file was deleted.

0 comments on commit 5f696de

Please sign in to comment.