fix: wrong executions order
This commit is contained in:
		@@ -22,7 +22,8 @@ class ScheduledDatabaseBackup extends BaseModel
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    public function executions(): HasMany
 | 
					    public function executions(): HasMany
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return $this->hasMany(ScheduledDatabaseBackupExecution::class);
 | 
					        // Last execution first
 | 
				
			||||||
 | 
					        return $this->hasMany(ScheduledDatabaseBackupExecution::class)->orderBy('created_at', 'desc');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public function s3()
 | 
					    public function s3()
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -28,6 +28,7 @@ class ScheduledTask extends BaseModel
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    public function executions(): HasMany
 | 
					    public function executions(): HasMany
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					        // Last execution first
 | 
				
			||||||
        return $this->hasMany(ScheduledTaskExecution::class)->orderBy('created_at', 'desc');
 | 
					        return $this->hasMany(ScheduledTaskExecution::class)->orderBy('created_at', 'desc');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,7 +4,7 @@
 | 
				
			|||||||
            <h3 class="py-4">Executions</h3>
 | 
					            <h3 class="py-4">Executions</h3>
 | 
				
			||||||
            <x-forms.button wire:click='cleanupFailed'>Cleanup Failed Backups</x-forms.button>
 | 
					            <x-forms.button wire:click='cleanupFailed'>Cleanup Failed Backups</x-forms.button>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
        <div class="flex flex-col-reverse gap-4">
 | 
					        <div class="flex flex-col gap-4">
 | 
				
			||||||
            @forelse($executions as $execution)
 | 
					            @forelse($executions as $execution)
 | 
				
			||||||
                <div wire:key="{{ data_get($execution, 'id') }}" @class([
 | 
					                <div wire:key="{{ data_get($execution, 'id') }}" @class([
 | 
				
			||||||
                    'flex flex-col border-l-2 transition-colors p-4 ',
 | 
					                    'flex flex-col border-l-2 transition-colors p-4 ',
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
<div class="flex flex-col-reverse gap-4">
 | 
					<div class="flex flex-col gap-4">
 | 
				
			||||||
    @forelse($executions as $execution)
 | 
					    @forelse($executions as $execution)
 | 
				
			||||||
    @if (data_get($execution, 'id') == $selectedKey)
 | 
					    @if (data_get($execution, 'id') == $selectedKey)
 | 
				
			||||||
    <div class="p-4 mb-2 bg-gray-100 dark:bg-coolgray-200 rounded">
 | 
					    <div class="p-4 mb-2 bg-gray-100 dark:bg-coolgray-200 rounded">
 | 
				
			||||||
@@ -33,4 +33,4 @@
 | 
				
			|||||||
    @empty
 | 
					    @empty
 | 
				
			||||||
    <div class="p-4 bg-gray-100 dark:bg-coolgray-200 rounded">No executions found.</div>
 | 
					    <div class="p-4 bg-gray-100 dark:bg-coolgray-200 rounded">No executions found.</div>
 | 
				
			||||||
    @endforelse
 | 
					    @endforelse
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -42,6 +42,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        <div class="pt-4">
 | 
					        <div class="pt-4">
 | 
				
			||||||
            <h3 class="py-4">Recent executions <span class="text-xs text-neutral-500">(click to check output)</span></h3>
 | 
					            <h3 class="py-4">Recent executions <span class="text-xs text-neutral-500">(click to check output)</span></h3>
 | 
				
			||||||
            <livewire:project.shared.scheduled-task.executions :task="$task" key="{{ $task->id }}" selectedKey="" :executions="$task->executions->take(-20)" />
 | 
					            <livewire:project.shared.scheduled-task.executions :task="$task" key="{{ $task->id }}" selectedKey="" :executions="$task->executions->take(20)" />
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user