fix(admin): authorize datacenter modal mounts; stale threshold uses step maxDuration

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
feat/portal-design
nexxo 2026-07-25 18:23:44 +02:00
parent 2b73a895c9
commit fd7cba7403
3 changed files with 10 additions and 1 deletions

View File

@ -22,6 +22,7 @@ class ConfirmDeleteDatacenter extends ModalComponent
public function mount(string $uuid): void
{
$this->authorize('datacenters.manage'); // modals are reachable without the route middleware
$dc = Datacenter::query()->where('uuid', $uuid)->withCount('hosts')->firstOrFail();
$this->uuid = $uuid;
$this->name = $dc->name;

View File

@ -24,6 +24,7 @@ class EditDatacenter extends ModalComponent
public function mount(string $uuid): void
{
$this->authorize('datacenters.manage'); // modals are reachable without the route middleware
$dc = Datacenter::query()->where('uuid', $uuid)->firstOrFail();
$this->uuid = $uuid;
$this->code = $dc->code;

View File

@ -74,7 +74,14 @@ class Provisioning extends Component
return false; // waiting out a scheduled retry/poll — not stuck
}
return $run->updated_at !== null && $run->updated_at->lt(now()->subMinutes(2));
// Compare against the CURRENT step's own allowed duration — some steps
// (VM clone, Proxmox install) legitimately run for many minutes — plus a
// small grace. Only past its own deadline without advancing is it stuck.
$pipeline = config('provisioning.pipelines.'.$run->pipeline, []);
$class = $pipeline[$run->current_step] ?? null;
$maxSeconds = $class !== null ? app($class)->maxDuration() : 120;
return $run->updated_at !== null && $run->updated_at->lt(now()->subSeconds($maxSeconds + 30));
}
private function subjectLabel(ProvisioningRun $run): string