* Manual automations * Scheduled automations * Incoming webhook triggers * Domain-event trigger foundation * Ordered automation steps * Queued execution * Run status and execution history * Per-step execution logs * Continue-or-stop-on-failure control * Email actions * Outgoing webhook actions * Application log actions * Delay actions * Secure incoming webhook secrets * Automation trigger and action registries * Extensible action and trigger contracts * Scheduled automation Artisan command * Administration navigation * Automation permissions * Module registration and boot test
27 lines
4.6 KiB
PHP
27 lines
4.6 KiB
PHP
<x-layouts.app :title="__('Automation')">
|
|
<div class="flex h-full w-full flex-1 flex-col gap-6 rounded-xl">
|
|
<div><flux:heading size="xl">Automation Platform</flux:heading><flux:text>Create event-driven, scheduled and webhook automations.</flux:text></div>
|
|
@if(session('status'))<flux:callout variant="success" icon="check-circle">{{ session('status') }}</flux:callout>@endif
|
|
<div class="grid gap-4 md:grid-cols-4">
|
|
<flux:card><flux:text>Automations</flux:text><flux:heading size="xl">{{ $automations->total() }}</flux:heading></flux:card>
|
|
<flux:card><flux:text>Active</flux:text><flux:heading size="xl">{{ \Modules\Automation\Models\Automation::where('status','active')->count() }}</flux:heading></flux:card>
|
|
<flux:card><flux:text>Completed runs</flux:text><flux:heading size="xl">{{ \Modules\Automation\Models\AutomationRun::where('status','completed')->count() }}</flux:heading></flux:card>
|
|
<flux:card><flux:text>Failed runs</flux:text><flux:heading size="xl">{{ \Modules\Automation\Models\AutomationRun::where('status','failed')->count() }}</flux:heading></flux:card>
|
|
</div>
|
|
@can('automation.manage')
|
|
<flux:card><flux:heading>Create automation</flux:heading><form method="POST" action="{{ route('administration.automation.store') }}" class="mt-4 grid gap-4 md:grid-cols-2">@csrf
|
|
<flux:input name="name" label="Name" required/><flux:select name="trigger_type" label="Trigger">@foreach($triggers as $key=>$trigger)<option value="{{ $key }}">{{ $trigger['label'] }}</option>@endforeach</flux:select>
|
|
<flux:textarea name="description" label="Description"/><flux:textarea name="trigger_config" label="Trigger configuration (JSON)" placeholder='{"interval_minutes":60}'/>
|
|
<flux:select name="status" label="Status"><option value="draft">Draft</option><option value="active">Active</option><option value="paused">Paused</option></flux:select><flux:input type="datetime-local" name="next_run_at" label="Next scheduled run"/>
|
|
<flux:checkbox name="stop_on_failure" value="1" checked label="Stop when a step fails"/><div><flux:button type="submit" variant="primary">Create automation</flux:button></div>
|
|
</form></flux:card>
|
|
@endcan
|
|
<div class="grid gap-6 xl:grid-cols-3"><div class="xl:col-span-2 space-y-4">
|
|
@forelse($automations as $automation)<flux:card><div class="flex items-start justify-between gap-4"><div><flux:heading>{{ $automation->name }}</flux:heading><flux:text>{{ $automation->trigger_type }} · {{ $automation->steps_count }} steps · {{ $automation->runs_count }} runs</flux:text></div><flux:badge color="{{ $automation->status==='active'?'green':($automation->status==='paused'?'amber':'zinc') }}">{{ ucfirst($automation->status) }}</flux:badge></div>
|
|
@if($automation->description)<flux:text class="mt-3">{{ $automation->description }}</flux:text>@endif
|
|
<div class="mt-4 flex flex-wrap gap-2">@can('automation.execute')<form method="POST" action="{{ route('administration.automation.run',$automation) }}">@csrf<flux:button type="submit" size="sm" icon="play">Run</flux:button></form>@endcan @can('automation.manage')<form method="POST" action="{{ route('administration.automation.toggle',$automation) }}">@csrf @method('PATCH')<flux:button type="submit" size="sm">{{ $automation->status==='active'?'Pause':'Activate' }}</flux:button></form><form method="POST" action="{{ route('administration.automation.destroy',$automation) }}">@csrf @method('DELETE')<flux:button type="submit" size="sm" variant="danger">Delete</flux:button></form>@endcan</div>
|
|
@can('automation.manage')<form method="POST" action="{{ route('administration.automation.steps.store',$automation) }}" class="mt-4 grid gap-3 md:grid-cols-3">@csrf<flux:select name="action_type" label="Add action">@foreach($actions as $key=>$action)<option value="{{ $key }}">{{ $action['label'] }}</option>@endforeach</flux:select><flux:input name="name" label="Step name"/><flux:textarea name="configuration" label="Configuration (JSON)" placeholder='{"message":"Done"}'/><div><flux:button type="submit" size="sm">Add step</flux:button></div></form>@endcan
|
|
</flux:card>@empty<flux:card><flux:text>No automations have been created.</flux:text></flux:card>@endforelse
|
|
{{ $automations->links() }}</div><div><flux:card><flux:heading>Recent runs</flux:heading><div class="mt-4 space-y-3">@forelse($recentRuns as $run)<div class="border-b border-zinc-200 pb-3 dark:border-zinc-700"><div class="flex justify-between gap-2"><flux:text class="font-medium">{{ $run->automation?->name }}</flux:text><flux:badge size="sm">{{ $run->status }}</flux:badge></div><flux:text size="sm">{{ $run->execution_id }}</flux:text></div>@empty<flux:text>No runs yet.</flux:text>@endforelse</div></flux:card></div></div>
|
|
</div></x-layouts.app>
|