|
1 |
| -<x-pulse::card |
2 |
| - class="col-span-3" |
3 |
| - wire:poll="" |
4 |
| -> |
| 1 | +<x-pulse::card class="col-span-3"> |
5 | 2 | <x-slot:title>
|
6 | 3 | <x-pulse::card-title class="flex items-center">
|
7 | 4 | <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6 mr-2 stroke-gray-400">
|
8 | 5 | <path stroke-linecap="round" stroke-linejoin="round" d="M12 12.75c1.148 0 2.278.08 3.383.237 1.037.146 1.866.966 1.866 2.013 0 3.728-2.35 6.75-5.25 6.75S6.75 18.728 6.75 15c0-1.046.83-1.867 1.866-2.013A24.204 24.204 0 0112 12.75zm0 0c2.883 0 5.647.508 8.207 1.44a23.91 23.91 0 01-1.152 6.06M12 12.75c-2.883 0-5.647.508-8.208 1.44.125 2.104.52 4.136 1.153 6.06M12 12.75a2.25 2.25 0 002.248-2.354M12 12.75a2.25 2.25 0 01-2.248-2.354M12 8.25c.995 0 1.971-.08 2.922-.236.403-.066.74-.358.795-.762a3.778 3.778 0 00-.399-2.25M12 8.25c-.995 0-1.97-.08-2.922-.236-.402-.066-.74-.358-.795-.762a3.734 3.734 0 01.4-2.253M12 8.25a2.25 2.25 0 00-2.248 2.146M12 8.25a2.25 2.25 0 012.248 2.146M8.683 5a6.032 6.032 0 01-1.155-1.002c.07-.63.27-1.222.574-1.747m.581 2.749A3.75 3.75 0 0115.318 5m0 0c.427-.283.815-.62 1.155-.999a4.471 4.471 0 00-.575-1.752M4.921 6a24.048 24.048 0 00-.392 3.314c1.668.546 3.416.914 5.223 1.082M19.08 6c.205 1.08.337 2.187.392 3.314a23.882 23.882 0 01-5.223 1.082" />
|
9 | 6 | </svg>
|
10 | 7 | <span>
|
11 |
| - Exceptions |
12 |
| - <small class="ml-2 text-gray-400 text-xs font-medium">Past 7 days</small> |
| 8 | + <span title="Time: {{ $time }}; Run at: {{ $runAt }};">Exceptions</span> |
| 9 | + <small class="ml-2 text-gray-400 text-xs font-medium">past {{ match ($this->period) { |
| 10 | + '6_hours' => '6 hours', |
| 11 | + '24_hours' => '24 hours', |
| 12 | + '7_days' => '7 days', |
| 13 | + default => 'hour', |
| 14 | + } }}</small> |
13 | 15 | </span>
|
14 | 16 | </x-pulse::card-title>
|
15 |
| - <select wire:model="sortBy" class="rounded-md border-gray-200 text-gray-700 py-1 text-sm"> |
16 |
| - <option value="count">Trending</option> |
17 |
| - <option value="last_occurrence">Recent</option> |
18 |
| - </select> |
| 17 | + <div class="flex items-center gap-2"> |
| 18 | + <div class="text-sm text-gray-700">Sort by</div> |
| 19 | + <select |
| 20 | + wire:model="orderBy" |
| 21 | + wire:change="$emit('exceptionChanged', $event.target.value)" |
| 22 | + class="rounded-md border-gray-200 text-gray-700 py-1 text-sm" |
| 23 | + > |
| 24 | + <option value="count">count</option> |
| 25 | + <option value="last_occurrence">recent</option> |
| 26 | + </select> |
| 27 | + </div> |
19 | 28 | </x-slot:title>
|
20 | 29 |
|
21 |
| - <div class="max-h-56 h-full relative overflow-y-auto"> |
22 |
| - @if (count($exceptions) === 0) |
23 |
| - <x-pulse::no-results /> |
24 |
| - @else |
25 |
| - <x-pulse::table> |
26 |
| - <x-pulse::thead> |
27 |
| - <tr> |
28 |
| - <x-pulse::th class="w-full text-left">Type</x-pulse::th> |
29 |
| - <x-pulse::th class="text-center">Latest</x-pulse::th> |
30 |
| - <x-pulse::th class="text-right">Count</x-pulse::th> |
31 |
| - </tr> |
32 |
| - </x-pulse::thead> |
33 |
| - <tbody> |
34 |
| - @foreach ($exceptions as $exception) |
35 |
| - <tr> |
36 |
| - <x-pulse::td> |
37 |
| - <code class="block text-xs text-gray-900"> |
38 |
| - {{ $exception['class'] }} |
39 |
| - </code> |
40 |
| - <p class="text-xs text-gray-500"> |
41 |
| - {{ $exception['location'] }} |
42 |
| - </p> |
43 |
| - </x-pulse::td> |
44 |
| - <x-pulse::td class="text-center text-gray-700 text-sm font-bold whitespace-nowrap"> |
45 |
| - {{ $exception['last_occurrence'] !== null ? Carbon\Carbon::parse($exception['last_occurrence'])->fromNow() : 'Unknown' }} |
46 |
| - </x-pulse::td> |
47 |
| - <x-pulse::td class="text-right text-gray-700 text-sm font-bold"> |
48 |
| - {{ $exception['count'] }} |
49 |
| - </x-pulse::td> |
50 |
| - </tr> |
51 |
| - @endforeach |
52 |
| - </tbody> |
53 |
| - </x-pulse::table> |
54 |
| - @endif |
| 30 | + <div class="max-h-56 h-full relative overflow-y-auto" wire:poll.5s> |
| 31 | + <script> |
| 32 | + const initialExceptionDataLoaded = @js($initialDataLoaded) |
| 33 | + </script> |
| 34 | + <div x-data="{ |
| 35 | + initialDataLoaded: initialExceptionDataLoaded, |
| 36 | + loadingNewDataset: false, |
| 37 | + init() { |
| 38 | + ['periodChanged', 'exceptionChanged'].forEach(event => Livewire.on(event, () => (this.loadingNewDataset = true))) |
| 39 | +
|
| 40 | + window.addEventListener('exceptions:dataLoaded', () => { |
| 41 | + this.initialDataLoaded = true |
| 42 | + this.loadingNewDataset = false |
| 43 | + }) |
| 44 | +
|
| 45 | + if (! this.initialDataLoaded) { |
| 46 | + @this.loadData() |
| 47 | + } |
| 48 | + } |
| 49 | + }"> |
| 50 | + <x-pulse::loading-indicator x-cloak x-show="! initialDataLoaded" /> |
| 51 | + <div x-cloak x-show="initialDataLoaded"> |
| 52 | + <div :class="loadingNewDataset ? 'opacity-25 animate-pulse' : ''"> |
| 53 | + @if ($initialDataLoaded && count($exceptions) === 0) |
| 54 | + <x-pulse::no-results /> |
| 55 | + @elseif ($initialDataLoaded && count($exceptions) > 0) |
| 56 | + <x-pulse::table> |
| 57 | + <x-pulse::thead> |
| 58 | + <tr> |
| 59 | + <x-pulse::th class="w-full text-left">Type</x-pulse::th> |
| 60 | + <x-pulse::th class="text-center">Latest</x-pulse::th> |
| 61 | + <x-pulse::th class="text-right">Count</x-pulse::th> |
| 62 | + </tr> |
| 63 | + </x-pulse::thead> |
| 64 | + <tbody> |
| 65 | + @foreach ($exceptions as $exception) |
| 66 | + <tr> |
| 67 | + <x-pulse::td> |
| 68 | + <code class="block text-xs text-gray-900"> |
| 69 | + {{ $exception->class }} |
| 70 | + </code> |
| 71 | + <p class="text-xs text-gray-500"> |
| 72 | + {{ $exception->location }} |
| 73 | + </p> |
| 74 | + </x-pulse::td> |
| 75 | + <x-pulse::td class="text-center text-gray-700 text-sm font-bold whitespace-nowrap"> |
| 76 | + {{ $exception->last_occurrence !== null ? Carbon\Carbon::parse($exception->last_occurrence)->fromNow() : 'Unknown' }} |
| 77 | + </x-pulse::td> |
| 78 | + <x-pulse::td class="text-right text-gray-700 text-sm font-bold"> |
| 79 | + {{ $exception->count }} |
| 80 | + </x-pulse::td> |
| 81 | + </tr> |
| 82 | + @endforeach |
| 83 | + </tbody> |
| 84 | + </x-pulse::table> |
| 85 | + @endif |
| 86 | + </div> |
| 87 | + </div> |
| 88 | + </div> |
55 | 89 | </div>
|
56 | 90 | </x-pulse::card>
|
0 commit comments