Some checks failed
Main Confidence / confidence (push) Failing after 53s
## Summary - keep stale active operation runs visible in the tenant progress overlay and polling state - align tenant and canonical operation surfaces around the shared stale-active presentation contract - add Spec 233 artifacts and clean the promoted-candidate backlog entries ## Validation - browser smoke: `/admin/t/18000000-0000-4000-8000-000000000180` -> stale dashboard CTA -> `/admin/operations?tenant_id=7&activeTab=active_stale_attention&problemClass=active_stale_attention` -> `/admin/operations/15` - verified healthy vs likely-stale tenant cards, canonical stale list row, and canonical run detail consistency ## Notes - local smoke fixture seeded with one fresh and one stale running `baseline_compare` operation for browser validation - Pest suite was not re-run in this session before opening this PR Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #269
41 lines
961 B
PHP
41 lines
961 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Support\OpsUx;
|
|
|
|
use App\Models\OperationRun;
|
|
use App\Models\Tenant;
|
|
|
|
final class ActiveRuns
|
|
{
|
|
public static function existForTenant(Tenant $tenant): bool
|
|
{
|
|
return self::existForTenantId((int) $tenant->getKey());
|
|
}
|
|
|
|
public static function existForTenantId(?int $tenantId): bool
|
|
{
|
|
if (! is_int($tenantId) || $tenantId <= 0) {
|
|
return false;
|
|
}
|
|
|
|
return OperationRun::query()
|
|
->where('tenant_id', $tenantId)
|
|
->active()
|
|
->exists();
|
|
}
|
|
|
|
public static function pollingIntervalForTenant(?Tenant $tenant): ?string
|
|
{
|
|
return $tenant instanceof Tenant
|
|
? self::pollingIntervalForTenantId((int) $tenant->getKey())
|
|
: null;
|
|
}
|
|
|
|
public static function pollingIntervalForTenantId(?int $tenantId): ?string
|
|
{
|
|
return self::existForTenantId($tenantId) ? '10s' : null;
|
|
}
|
|
}
|