Split the automation detail screen into four route-based tabs behind a shared AutomationHeader: - Workflow: the existing editor canvas. - Invocations: a paginated, filterable run log with expandable per-node detail, a refresh control, and a loading state. - Metrics: KPI cards, a runs-over-time @unovis chart with locale-aware date labels, and a posts-by-platform breakdown over a date range. - Settings: rename, an activate/pause switch, and a danger-zone delete. Invocations and Metrics report only real executions via a new productionRuns scope, so manual test runs (dry or with real data) never leak into the log or the charts. The now-unused excludingDryRuns scope is removed. Generated copy now flows the most-restrictive platform context through the humanizer too, and the editor guide documents every available expression grouped by source node.
37 lines
1.1 KiB
PHP
37 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
/**
|
|
* A single execution row for the Invocations tab: enough to render the list
|
|
* (status, timing, step count, error summary) without loading every node run.
|
|
*/
|
|
class AutomationInvocationResource extends JsonResource
|
|
{
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function toArray(Request $request): array
|
|
{
|
|
$durationMs = $this->started_at !== null && $this->finished_at !== null
|
|
? $this->started_at->diffInMilliseconds($this->finished_at)
|
|
: null;
|
|
|
|
return [
|
|
'id' => $this->id,
|
|
'status' => $this->status->value,
|
|
'is_manual' => (bool) $this->is_manual,
|
|
'node_run_count' => (int) ($this->node_runs_count ?? 0),
|
|
'duration_ms' => $durationMs,
|
|
'error_message' => is_array($this->error) ? ($this->error['message'] ?? null) : $this->error,
|
|
'created_at' => $this->created_at,
|
|
'started_at' => $this->started_at,
|
|
'finished_at' => $this->finished_at,
|
|
];
|
|
}
|
|
}
|