Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
nckrtl committed Dec 8, 2023
2 parents c89e1b9 + f435af4 commit a99de81
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 19 deletions.
27 changes: 14 additions & 13 deletions src/Livewire/OhDearUptimePulseCardComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

use Carbon\Carbon;
use Carbon\CarbonInterval;
use Livewire\Attributes\Lazy;
use Laravel\Pulse\Livewire\Card;
use OhDear\PhpSdk\Resources\Site;
use OhDear\PhpSdk\Resources\Check;
use OhDear\OhDearPulse\OhDearPulse;
use Illuminate\Contracts\Support\Renderable;
use OhDear\OhDearPulse\Livewire\Concerns\UsesOhDearApi;
use Laravel\Pulse\Livewire\Card;
use Livewire\Attributes\Lazy;
use OhDear\OhDearPulse\Livewire\Concerns\RemembersApiCalls;
use OhDear\OhDearPulse\Livewire\Concerns\UsesOhDearApi;
use OhDear\OhDearPulse\OhDearPulse;
use OhDear\PhpSdk\Resources\Check;
use OhDear\PhpSdk\Resources\Site;

#[Lazy]
class OhDearUptimePulseCardComponent extends Card
Expand All @@ -33,7 +33,8 @@ public function mount(?int $siteId = null)
$this->siteId = $siteId ?? config('services.oh_dear.pulse.site_id');
}

public function getData() {
public function getData()
{
return collect([
[
now()->timestamp * 1000,
Expand Down Expand Up @@ -90,11 +91,11 @@ protected function getLabels(): array
{

return collect($this->getData())
->map(function (array $dataPoint) {
return Carbon::createFromTimestamp($dataPoint[0]/1000)
->format('Y-m-d H:i');
})
->toArray();
->map(function (array $dataPoint) {
return Carbon::createFromTimestamp($dataPoint[0] / 1000)
->format('Y-m-d H:i');
})
->toArray();
}

public function render(): Renderable
Expand Down Expand Up @@ -134,7 +135,7 @@ protected function getStatus(?Site $site): ?string
return null;
}

return match($check->summary) {
return match ($check->summary) {
'Up' => 'Online',
default => $check->summary,
};
Expand Down
10 changes: 4 additions & 6 deletions src/OhDearPulseServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@

namespace OhDear\OhDearPulse;

use Livewire\Livewire;
use OhDear\PhpSdk\OhDear;
use Livewire\LivewireManager;
use Illuminate\Support\Facades\Blade;
use Spatie\LaravelPackageTools\Package;
use Spatie\LaravelPackageTools\PackageServiceProvider;
use OhDear\OhDearPulse\Livewire\OhDearCronPulseCardComponent;
use OhDear\OhDearPulse\Livewire\OhDearBrokenLinksCardComponent;
use OhDear\OhDearPulse\Livewire\OhDearCronPulseCardComponent;
use OhDear\OhDearPulse\Livewire\OhDearUptimePulseCardComponent;
use OhDear\PhpSdk\OhDear;
use Spatie\LaravelPackageTools\Package;
use Spatie\LaravelPackageTools\PackageServiceProvider;

class OhDearPulseServiceProvider extends PackageServiceProvider
{
Expand Down

0 comments on commit a99de81

Please sign in to comment.