## Summary - retrofit the tenant detail recent-operations and verification surfaces to keep one clear primary inspect path per state - keep onboarding workflow actions on the wizard step while moving previous-run and advanced monitoring links into diagnostics-only technical details - add focused spec 172 design artifacts, feature coverage, and a dedicated browser smoke test for the deferred operator surface retrofit ## Testing - `vendor/bin/sail artisan test --compact tests/Browser/Spec172DeferredOperatorSurfacesSmokeTest.php tests/Browser/OnboardingDraftRefreshTest.php tests/Browser/OnboardingDraftVerificationResumeTest.php` ## Notes - base branch: `dev` - branch head: `172-deferred-operator-surfaces-retrofit` - browser smoke pack passed locally after the final changes Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #203
75 lines
2.1 KiB
PHP
75 lines
2.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Filament\Widgets\Tenant;
|
|
|
|
use App\Models\OperationRun;
|
|
use App\Models\Tenant;
|
|
use App\Support\OperationRunLinks;
|
|
use Filament\Facades\Filament;
|
|
use Filament\Widgets\Widget;
|
|
use Illuminate\Database\Eloquent\Collection;
|
|
|
|
class RecentOperationsSummary extends Widget
|
|
{
|
|
protected static bool $isLazy = false;
|
|
|
|
protected string $view = 'filament.widgets.tenant.recent-operations-summary';
|
|
|
|
public ?Tenant $record = null;
|
|
|
|
private function resolveTenant(): ?Tenant
|
|
{
|
|
$tenant = Filament::getTenant();
|
|
|
|
if ($tenant instanceof Tenant) {
|
|
return $tenant;
|
|
}
|
|
|
|
return $this->record instanceof Tenant ? $this->record : null;
|
|
}
|
|
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
protected function getViewData(): array
|
|
{
|
|
$tenant = $this->resolveTenant();
|
|
|
|
if (! $tenant instanceof Tenant) {
|
|
return [
|
|
'tenant' => null,
|
|
'runs' => collect(),
|
|
'operationsIndexUrl' => route('admin.operations.index'),
|
|
'operationsIndexLabel' => OperationRunLinks::openCollectionLabel(),
|
|
'operationsIndexDescription' => OperationRunLinks::collectionScopeDescription(),
|
|
];
|
|
}
|
|
|
|
/** @var Collection<int, OperationRun> $runs */
|
|
$runs = OperationRun::query()
|
|
->where('tenant_id', (int) $tenant->getKey())
|
|
->orderByDesc('created_at')
|
|
->orderByDesc('id')
|
|
->limit(5)
|
|
->get([
|
|
'id',
|
|
'type',
|
|
'status',
|
|
'outcome',
|
|
'created_at',
|
|
'started_at',
|
|
'completed_at',
|
|
]);
|
|
|
|
return [
|
|
'tenant' => $tenant,
|
|
'runs' => $runs,
|
|
'operationsIndexUrl' => route('admin.operations.index'),
|
|
'operationsIndexLabel' => OperationRunLinks::openCollectionLabel(),
|
|
'operationsIndexDescription' => OperationRunLinks::collectionScopeDescription(),
|
|
];
|
|
}
|
|
}
|