## Summary - move the Laravel application into `apps/platform` and keep the repository root for orchestration, docs, and tooling - update the local command model, Sail/Docker wiring, runtime paths, and ignore rules around the new platform location - add relocation quickstart/contracts plus focused smoke coverage for bootstrap, command model, routes, and runtime behavior ## Validation - `cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/PlatformRelocation` - integrated browser smoke validated `/up`, `/`, `/admin`, `/admin/choose-workspace`, and tenant route semantics for `200`, `403`, and `404` ## Remaining Rollout Checks - validate Dokploy build context and working-directory assumptions against the new `apps/platform` layout - confirm web, queue, and scheduler processes all start from the expected working directory in staging/production - verify no legacy volume mounts or asset-publish paths still point at the old root-level `public/` or `storage/` locations Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #213
66 lines
2.1 KiB
PHP
66 lines
2.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Filament\System\Widgets;
|
|
|
|
use App\Models\OperationRun;
|
|
use App\Support\OperationRunOutcome;
|
|
use App\Support\OperationRunStatus;
|
|
use App\Support\System\SystemOperationRunLinks;
|
|
use App\Support\SystemConsole\StuckRunClassifier;
|
|
use App\Support\SystemConsole\SystemConsoleWindow;
|
|
use Filament\Widgets\StatsOverviewWidget;
|
|
use Filament\Widgets\StatsOverviewWidget\Stat;
|
|
|
|
class ControlTowerKpis extends StatsOverviewWidget
|
|
{
|
|
protected static bool $isLazy = false;
|
|
|
|
protected int|string|array $columnSpan = 'full';
|
|
|
|
/**
|
|
* @return array<Stat>
|
|
*/
|
|
protected function getStats(): array
|
|
{
|
|
$window = SystemConsoleWindow::fromNullable((string) request()->query('window'));
|
|
$start = $window->startAt();
|
|
|
|
$baseQuery = OperationRun::query()->where('created_at', '>=', $start);
|
|
|
|
$totalRuns = (clone $baseQuery)->count();
|
|
|
|
$activeRuns = (clone $baseQuery)
|
|
->whereIn('status', [
|
|
OperationRunStatus::Queued->value,
|
|
OperationRunStatus::Running->value,
|
|
])
|
|
->count();
|
|
|
|
$failedRuns = (clone $baseQuery)
|
|
->where('status', OperationRunStatus::Completed->value)
|
|
->where('outcome', OperationRunOutcome::Failed->value)
|
|
->count();
|
|
|
|
$stuckRuns = app(StuckRunClassifier::class)
|
|
->apply((clone $baseQuery))
|
|
->count();
|
|
|
|
return [
|
|
Stat::make('Runs in window', $totalRuns)
|
|
->description($window::options()[$window->value] ?? 'Last 24 hours')
|
|
->url(SystemOperationRunLinks::index()),
|
|
Stat::make('Active', $activeRuns)
|
|
->color($activeRuns > 0 ? 'warning' : 'gray')
|
|
->url(SystemOperationRunLinks::index()),
|
|
Stat::make('Failed', $failedRuns)
|
|
->color($failedRuns > 0 ? 'danger' : 'gray')
|
|
->url(SystemOperationRunLinks::index()),
|
|
Stat::make('Stuck', $stuckRuns)
|
|
->color($stuckRuns > 0 ? 'danger' : 'gray')
|
|
->url(SystemOperationRunLinks::index()),
|
|
];
|
|
}
|
|
}
|