Summary Consolidates the “Tenant Operate Hub” work (Spec 085) and the follow-up adjustments from the 086 session merge into a single branch ready to merge into dev. Primary focus: stabilize Ops/Operate Hub UX flows, tighten/align authorization semantics, and make the full Sail test suite green. Key Changes Ops UX / Verification Readonly members can view verification operation runs (reports) while starting verification remains restricted. Normalized failure reason-code handling and aligned UX expectations with the provider reason-code taxonomy. Onboarding wizard UX “Start verification” CTA is hidden while a verification run is active; “Refresh” is shown during in-progress runs. Treats provider_permission_denied as a blocking reason (while keeping legacy compatibility). Test + fixture hardening Standardized use of default provider connection fixtures in tests where sync/restore flows require it. Fixed multiple Filament URL/tenant-context test cases to avoid 404s and reduce tenancy routing brittleness. Policy sync / restore safety Enrollment configuration type collision classification tests now exercise the real sync path (with required provider connection present). Restore edge-case safety tests updated to reflect current provider-connection requirements. Testing vendor/bin/sail artisan test --compact (green) vendor/bin/sail bin pint --dirty (green) Notes Includes merged 086 session work already (no separate PR needed). Co-authored-by: Ahmed Darrazi <ahmeddarrazi@ebc83aaa-d947-4a08-b88e-bd72ac9645f7.fritz.box> Co-authored-by: Ahmed Darrazi <ahmeddarrazi@MacBookPro.fritz.box> Co-authored-by: Ahmed Darrazi <ahmeddarrazi@adsmac.fritz.box> Reviewed-on: #103
97 lines
4.3 KiB
PHP
97 lines
4.3 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\BackupScheduleResource\RelationManagers;
|
|
|
|
use App\Models\OperationRun;
|
|
use App\Models\Tenant;
|
|
use App\Support\Badges\BadgeDomain;
|
|
use App\Support\Badges\BadgeRenderer;
|
|
use App\Support\OperationCatalog;
|
|
use App\Support\OperationRunLinks;
|
|
use App\Support\Ui\ActionSurface\ActionSurfaceDeclaration;
|
|
use App\Support\Ui\ActionSurface\Enums\ActionSurfaceInspectAffordance;
|
|
use App\Support\Ui\ActionSurface\Enums\ActionSurfaceProfile;
|
|
use App\Support\Ui\ActionSurface\Enums\ActionSurfaceSlot;
|
|
use Filament\Actions;
|
|
use Filament\Resources\RelationManagers\RelationManager;
|
|
use Filament\Tables;
|
|
use Filament\Tables\Table;
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
|
|
class BackupScheduleOperationRunsRelationManager extends RelationManager
|
|
{
|
|
protected static string $relationship = 'operationRuns';
|
|
|
|
protected static ?string $title = 'Executions';
|
|
|
|
public static function actionSurfaceDeclaration(): ActionSurfaceDeclaration
|
|
{
|
|
return ActionSurfaceDeclaration::forRelationManager(ActionSurfaceProfile::RelationManager)
|
|
->exempt(ActionSurfaceSlot::ListHeader, 'Executions relation list has no header actions.')
|
|
->satisfy(ActionSurfaceSlot::InspectAffordance, ActionSurfaceInspectAffordance::ViewAction->value)
|
|
->exempt(ActionSurfaceSlot::ListRowMoreMenu, 'Single primary row action is exposed, so no row menu is needed.')
|
|
->exempt(ActionSurfaceSlot::ListBulkMoreGroup, 'Bulk actions are intentionally omitted for operation run safety.')
|
|
->exempt(ActionSurfaceSlot::ListEmptyState, 'No empty-state actions are exposed in this embedded relation manager.');
|
|
}
|
|
|
|
public function table(Table $table): Table
|
|
{
|
|
return $table
|
|
->modifyQueryUsing(fn (Builder $query) => $query->where('tenant_id', Tenant::currentOrFail()->getKey()))
|
|
->defaultSort('created_at', 'desc')
|
|
->columns([
|
|
Tables\Columns\TextColumn::make('created_at')
|
|
->label('Enqueued')
|
|
->dateTime(),
|
|
|
|
Tables\Columns\TextColumn::make('type')
|
|
->label('Type')
|
|
->formatStateUsing([OperationCatalog::class, 'label']),
|
|
|
|
Tables\Columns\TextColumn::make('status')
|
|
->badge()
|
|
->formatStateUsing(BadgeRenderer::label(BadgeDomain::OperationRunStatus))
|
|
->color(BadgeRenderer::color(BadgeDomain::OperationRunStatus))
|
|
->icon(BadgeRenderer::icon(BadgeDomain::OperationRunStatus))
|
|
->iconColor(BadgeRenderer::iconColor(BadgeDomain::OperationRunStatus)),
|
|
|
|
Tables\Columns\TextColumn::make('outcome')
|
|
->badge()
|
|
->formatStateUsing(BadgeRenderer::label(BadgeDomain::OperationRunOutcome))
|
|
->color(BadgeRenderer::color(BadgeDomain::OperationRunOutcome))
|
|
->icon(BadgeRenderer::icon(BadgeDomain::OperationRunOutcome))
|
|
->iconColor(BadgeRenderer::iconColor(BadgeDomain::OperationRunOutcome)),
|
|
|
|
Tables\Columns\TextColumn::make('counts')
|
|
->label('Counts')
|
|
->getStateUsing(function (OperationRun $record): string {
|
|
$counts = is_array($record->summary_counts) ? $record->summary_counts : [];
|
|
|
|
$total = (int) ($counts['total'] ?? 0);
|
|
$succeeded = (int) ($counts['succeeded'] ?? 0);
|
|
$failed = (int) ($counts['failed'] ?? 0);
|
|
|
|
if ($total === 0 && $succeeded === 0 && $failed === 0) {
|
|
return '—';
|
|
}
|
|
|
|
return sprintf('%d/%d (%d failed)', $succeeded, $total, $failed);
|
|
}),
|
|
])
|
|
->filters([])
|
|
->headerActions([])
|
|
->actions([
|
|
Actions\Action::make('view')
|
|
->label('View')
|
|
->icon('heroicon-o-eye')
|
|
->url(function (OperationRun $record): string {
|
|
$tenant = Tenant::currentOrFail();
|
|
|
|
return OperationRunLinks::view($record, $tenant);
|
|
})
|
|
->openUrlInNewTab(true),
|
|
])
|
|
->bulkActions([]);
|
|
}
|
|
}
|