TenantAtlas/apps/platform/app/Services/Evidence/Sources/OperationsSummarySource.php
ahmido be314c577f Spec 400: rebuild Tenantial homepage visuals (#387)
## Summary
- rebuild the public Tenantial homepage around an evidence-first Microsoft tenant governance narrative
- replace the old hero visual with a new static dashboard preview and add dedicated Trust Bar and Feature Pillars sections
- update the shared public shell, navigation, footer, dark design tokens, assets, and homepage content to match the new brand direction
- align website smoke coverage and Spec 400 artifacts with the rebuilt homepage

## Testing
- not run in this pass
- updated website smoke specs under apps/website/tests/smoke

## Note
- `website-dev` was pushed to `origin` so the requested PR base exists remotely
- the remote `website-dev` branch is an ancestor of `origin/dev`, so this PR may also show upstream `dev` history relative to that base

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #387
2026-05-18 14:38:11 +00:00

64 lines
2.5 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Services\Evidence\Sources;
use App\Models\OperationRun;
use App\Models\Tenant;
use App\Services\Evidence\Contracts\EvidenceSourceProvider;
use App\Support\Evidence\EvidenceCompletenessState;
use App\Support\OperationRunOutcome;
final class OperationsSummarySource implements EvidenceSourceProvider
{
public function key(): string
{
return 'operations_summary';
}
public function collect(Tenant $tenant): array
{
$runs = OperationRun::query()
->where('tenant_id', (int) $tenant->getKey())
->where('created_at', '>=', now()->subDays(30))
->latest('created_at')
->get();
$latest = $runs->max('created_at');
return [
'dimension_key' => $this->key(),
'state' => $runs->isEmpty() ? EvidenceCompletenessState::Missing->value : EvidenceCompletenessState::Complete->value,
'required' => true,
'source_kind' => 'operation_rollup',
'source_record_type' => OperationRun::class,
'source_record_id' => null,
'source_fingerprint' => hash('sha256', implode('|', $runs->pluck('run_identity_hash')->all())),
'measured_at' => $latest,
'freshness_at' => $latest,
'summary_payload' => [
'operation_count' => $runs->count(),
'failed_count' => $runs->where('outcome', OperationRunOutcome::Failed->value)->count(),
'partial_count' => $runs->where('outcome', OperationRunOutcome::PartiallySucceeded->value)->count(),
'entries' => $runs->map(static fn (OperationRun $run): array => [
'id' => (int) $run->getKey(),
'type' => (string) $run->type,
'operation_type' => $run->canonicalOperationType(),
'status' => (string) $run->status,
'outcome' => (string) $run->outcome,
'initiator_name' => $run->user?->name,
'started_at' => $run->started_at?->toIso8601String(),
'completed_at' => $run->completed_at?->toIso8601String(),
])->all(),
],
'fingerprint_payload' => [
'count' => $runs->count(),
'latest' => $latest?->format(DATE_ATOM),
'hashes' => $runs->pluck('run_identity_hash')->values()->all(),
],
'sort_order' => 50,
];
}
}