Implements Spec 078 operations tenantless canonical migration.
Highlights:
- Canonical run detail at `/admin/operations/{run}` renders with standard Filament chrome + sidebar and reuses `OperationRunResource::infolist()` (schema-based, Filament v5).
- Legacy tenant-scoped resource pages removed; legacy URLs return 404 as required.
- Added full spec test pack under `tests/Feature/078/` and updated existing tests.
- Added safe refresh/header actions wiring and KPI header guard when tenant context is null.
Validation:
- `vendor/bin/sail artisan test --compact tests/Feature/078/` (pass)
- `vendor/bin/sail bin pint --dirty` (pass)
Notes:
- Livewire v4+ compliant (Filament v5).
- Panel providers remain registered in `bootstrap/providers.php` (Laravel 11+ standard).
Co-authored-by: Ahmed Darrazi <ahmeddarrazi@MacBookPro.fritz.box>
Reviewed-on: #95
69 lines
2.0 KiB
PHP
69 lines
2.0 KiB
PHP
<?php
|
|
|
|
use App\Models\OperationRun;
|
|
use App\Support\Workspaces\WorkspaceContext;
|
|
use Filament\Facades\Filament;
|
|
use Illuminate\Support\Facades\Bus;
|
|
|
|
it('renders Monitoring → Operations index DB-only (no outbound HTTP, no background work)', function () {
|
|
[$user, $tenant] = createUserWithTenant(role: 'owner');
|
|
|
|
OperationRun::factory()->create([
|
|
'tenant_id' => $tenant->getKey(),
|
|
'type' => 'policy.sync',
|
|
'status' => 'queued',
|
|
'outcome' => 'pending',
|
|
'initiator_name' => 'System',
|
|
]);
|
|
|
|
$this->actingAs($user);
|
|
|
|
Bus::fake();
|
|
|
|
Filament::setTenant(null, true);
|
|
|
|
assertNoOutboundHttp(function () use ($tenant) {
|
|
$this->withSession([WorkspaceContext::SESSION_KEY => (int) $tenant->workspace_id])
|
|
->get('/admin/operations')
|
|
->assertOk()
|
|
->assertDontSee('Total Runs (30 days)')
|
|
->assertDontSee('Active Runs')
|
|
->assertDontSee('Failed/Partial (7 days)')
|
|
->assertDontSee('Avg Duration (7 days)')
|
|
->assertSee('All')
|
|
->assertSee('Active')
|
|
->assertSee('Succeeded')
|
|
->assertSee('Partial')
|
|
->assertSee('Failed');
|
|
});
|
|
|
|
Bus::assertNothingDispatched();
|
|
});
|
|
|
|
it('renders Monitoring → Operations detail DB-only (no outbound HTTP, no background work)', function () {
|
|
[$user, $tenant] = createUserWithTenant(role: 'owner');
|
|
|
|
$run = OperationRun::factory()->create([
|
|
'tenant_id' => $tenant->getKey(),
|
|
'type' => 'policy.sync',
|
|
'status' => 'queued',
|
|
'outcome' => 'pending',
|
|
'initiator_name' => 'System',
|
|
]);
|
|
|
|
$this->actingAs($user);
|
|
|
|
Bus::fake();
|
|
|
|
Filament::setTenant(null, true);
|
|
|
|
assertNoOutboundHttp(function () use ($tenant, $run) {
|
|
$this->withSession([WorkspaceContext::SESSION_KEY => (int) $tenant->workspace_id])
|
|
->get(route('admin.operations.view', ['run' => (int) $run->getKey()]))
|
|
->assertOk()
|
|
->assertSee('Operation run');
|
|
});
|
|
|
|
Bus::assertNothingDispatched();
|
|
});
|