Add bot logs
All checks were successful
Deploy App / deploy (push) Successful in 11s

This commit is contained in:
2025-08-31 21:54:18 +02:00
parent 77ebc6bce1
commit 378355ad5b
16 changed files with 355 additions and 20 deletions

View File

@@ -0,0 +1,40 @@
<div>
<table class="p-2" wire:poll.5s>
<thead>
<tr>
<th class="px-4 py-2">Bot</th>
<th class="px-4 py-2">Status</th>
<th class="px-4 py-2">Started At</th>
<th class="px-4 py-2">Finished At</th>
</tr>
</thead>
<tbody class="text-center">
@foreach ($logs as $log)
<tr>
<td class="px-4 py-2">
{{ $log->bot->name }}
</td>
<td
@class([
'text-red-400' => $log->status === 'failed',
'text-green-400' => $log->status === 'success',
'text-yellow-400' => $log->status === 'pending',
]),
class="px-4 py-2"
>
{{ $log->status }}
</td>
<td class="px-4 py-2">
{{ $log->started_at ?? '' }}
</td>
<td class="px-4 py-2">
{{ $log->finished_at ?? '' }}
</td>
</tr>
@endforeach
</tbody>
</table>
<div class="mt-4">
{{ $logs->links() }}
</div>
</div>

View File

@@ -1,13 +1,27 @@
<div>
<table class="table w-full">
<div class="flex gap-2 my-auto mb-4">
<input
type="text"
wire:model="query"
wire:keydown.debounce.500ms="search"
class="border p-2 rounded"
placeholder="Search bots"
/>
</div>
<div wire:loading wire:target.delay.longer="search">
Searching
<i class="fas fa-spinner fa-spin"></i>
</div>
<table class="table w-full" wire:loading.remove>
<thead>
<tr>
<th class="border px-4 py-2">Name</th>
<th class="border px-4 py-2">Schema</th>
<th class="border px-4 py-2">Schedule</th>
<th class="border px-4 py-2">Next due</th>
<th class="border px-4 py-2">Enabled</th>
<th class="border px-4 py-2">Actions</th>
<th class="px-4 py-2">Name</th>
<th class="px-4 py-2">Schema</th>
<th class="px-4 py-2">Schedule</th>
<th class="px-4 py-2">Next due</th>
<th class="px-4 py-2">Enabled</th>
<th class="px-4 py-2">Actions</th>
</tr>
</thead>
<tbody class="text-center">
@@ -16,7 +30,7 @@
<td class="px-4 py-2">
<a
wire:navigate
href="{{ route('bots.edit', $bot) }}"
href="{{ route('bots.show', $bot) }}"
class="text-blue-500"
>
{{ $bot->name }}
@@ -37,7 +51,7 @@
wire:click="toggleBot({{ $bot->id }})"
/>
</td>
<td>
<td class="text-xs">
<button
wire:click="runBot({{ $bot->id }})"
class="ml-4 cursor-pointer"

View File

@@ -65,10 +65,19 @@
>
Prettify
</span>
@elseif ($meta['type'] === 'textarea')
<textarea
wire:model.live="config.{{ $field }}"
class="border rounded w-full"
name="config[{{ $field }}]"
rows="4"
>
{{ old("config.$field", $bot->config[$field] ?? '') }}
</textarea>
@else
<input
wire:model.live="config.{{ $field }}"
class="border p-2 rounded mb-2 w-full"
class="border p-2 rounded w-full"
type="text"
name="config[{{ $field }}]"
value="{{ old("config.$field", $bot->config[$field] ?? '') }}"

View File

@@ -0,0 +1,22 @@
<div>
<div class="flex justify-between mb-4">
<h1 class="text-2xl font-bold mb-4">
{{ $bot->name }}
</h1>
<div>
<button class="bg-green-600 p-2 text-white rounded-lg mr-2 cursor-pointer">
<i class="fas fa-play"></i>
<span wire:click="confirmRunBot({{ $bot->id }})" class="cursor-pointer">
{{ __('Run Bot') }}
</span>
<button
class="bg-gray-600 p-2 text-white rounded-lg cursor-pointer"
wire:navigate
href="{{ route('bots.edit', $bot) }}"
>
<i class="fas fa-edit"></i>
{{ __('Edit Bot') }}
</button>
</div>
</div>
</div>