Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

7.0 KB
Raw Blame
<div x-on:open-backup-download.window="window.location.href = $event.detail.url">
    @if (count($pendingDownloads) > 0)
        <div wire:poll.3s="checkDownloads" class="hidden"></div>
    @endif
    @if ($executions->onFirstPage())
        <div wire:poll.5000ms class="hidden"></div>
    @endif
    @php
        $server = $service->server;
    @endphp
    @if ($selectedExecution)
        <x-modal-input title="Backup execution" wireOpen="executionModalOpen" :wireIgnore="false" isLarge>
            <x-slot:content><span></span></x-slot:content>
            <div class="flex flex-col gap-5">
                <div class="grid gap-4 sm:grid-cols-2 lg:grid-cols-4">
                    <div><p class="text-xs text-neutral-500 dark:text-fg-dim">Target</p><p class="mt-1 text-sm font-medium">{{ $selectedExecution['target'] }}</p></div>
                    <div><p class="text-xs text-neutral-500 dark:text-fg-dim">Status</p><p class="mt-1 text-sm font-medium">{{ str($selectedExecution['status'])->headline() }}</p></div>
                    <div><p class="text-xs text-neutral-500 dark:text-fg-dim">Started</p><p class="mt-1 text-sm font-medium" title="{{ $selectedExecution['started_at']->diffForHumans() }}">{{ formatDateInServerTimezone($selectedExecution['started_at'], $server) }}</p></div>
                    <div><p class="text-xs text-neutral-500 dark:text-fg-dim">Size</p><p class="mt-1 text-sm font-medium">{{ $selectedExecution['size'] ? formatBytes($selectedExecution['size']) : '-' }}</p></div>
                </div>
                @if ($selectedExecution['filename'])
                    <div><p class="text-xs text-neutral-500 dark:text-fg-dim">Backup path</p><code class="mt-1 block overflow-x-auto rounded-md bg-neutral-100 p-3 text-xs dark:bg-black/20">{{ $selectedExecution['filename'] }}</code></div>
                @endif
                @if ($selectedExecution['message'])
                    <div><p class="text-xs text-neutral-500 dark:text-fg-dim">Output</p><pre class="mt-1 max-h-80 overflow-auto rounded-md bg-neutral-100 p-3 font-mono text-xs whitespace-pre-wrap dark:bg-black/20">{{ $selectedExecution['message'] }}</pre></div>
                @endif
            </div>
        </x-modal-input>
    @endif

    <x-application.settings-section title="Executions"
        helper="Review backup runs across every database and storage target in this service." flush>
        @if ($executions->total() > 10)
            <x-slot:actions>
                <x-page-size-select model="perPage" livewire />
            </x-slot:actions>
        @endif
        @if ($executions->isEmpty())
            <x-empty size="sm" title="No backup executions"
                description="Execution history appears here after a backup schedule runs." icon-name="browser-terminal" />
        @else
            <div class="data-table relative w-full overflow-x-auto">
                <x-table.loading target="previousPage,nextPage,setPage,perPage" text="Loading executions..." />
                <div class="data-table-header grid min-w-[900px] grid-cols-[minmax(150px,1.4fr)_100px_100px_110px_190px_90px_48px]">
                    <span>Target</span><span>Type</span><span>Schedule</span><span>Status</span><span>Started</span><span>Size</span><span class="text-right">Actions</span>
                </div>
                @foreach ($executions as $execution)
                    @php
                        $statusType = match ($execution['status']) {
                            'success' => 'success',
                            'failed' => 'error',
                            'running' => 'warning',
                            default => 'neutral',
                        };
                    @endphp
                    <div wire:key="service-backup-execution-{{ $execution['id'] }}"
                        wire:click="openExecution('{{ $execution['uuid'] }}')"
                        wire:keydown.enter="openExecution('{{ $execution['uuid'] }}')" role="button" tabindex="0"
                        class="data-table-row grid min-w-[900px] cursor-pointer grid-cols-[minmax(150px,1.4fr)_100px_100px_110px_190px_90px_48px] text-left text-[13px] text-neutral-700 dark:text-fg-dim">
                        <span class="flex min-w-0 items-center gap-2 font-medium text-neutral-950 dark:text-fg">
                            <span class="truncate" title="{{ $execution['target'] }}">{{ $execution['target'] }}</span>
                            <span tabindex="0" data-tooltip="{{ $execution['s3_tooltip'] }}"
                                aria-label="{{ $execution['s3_tooltip'] }}" class="shrink-0 text-neutral-500 dark:text-fg-dim">
                                <x-reicon name="cloud" class="size-3.5" aria-hidden="true" />
                            </span>
                        </span>
                        <span>{{ $execution['type'] }}</span><span>{{ $execution['schedule'] }}</span>
                        <span><x-status-badge :status="str($execution['status'])->headline()" :type="$statusType" /></span>
                        <span>
                            <span class="block">{{ formatDateInServerTimezone($execution['started_at'], $server) }}</span>
                            <span class="text-[11px] text-neutral-500 dark:text-fg-faint">{{ $execution['started_at']->diffForHumans() }}</span>
                        </span>
                        <span>{{ $execution['size'] ? formatBytes($execution['size']) : '-' }}</span>
                        <span class="flex justify-end">
                            @if ($execution['download_url'] && $s3Downloads)
                                <button type="button" wire:click.stop="downloadExecution('{{ $execution['uuid'] }}')"
                                    class="icon-button shrink-0" title="Download backup" aria-label="Download backup">
                                    <x-reicon name="upload" class="size-3.5 rotate-180" />
                                </button>
                            @elseif ($execution['download_url'])
                                <a href="{{ $execution['download_url'] }}" target="_blank" rel="noopener"
                                    @click.stop class="icon-button shrink-0" title="Download backup"
                                    aria-label="Download backup">
                                    <x-reicon name="upload" class="size-3.5 rotate-180" />
                                </a>
                            @endif
                        </span>
                    </div>
                @endforeach
                @if ($executions->hasPages())
                    <x-table-pagination :from="$executions->firstItem()" :to="$executions->lastItem()"
                        :total="$executions->total()" :current-page="$executions->currentPage()" :last-page="$executions->lastPage()"
                        wire-target="previousPage,nextPage,setPage,perPage"
                        previous-action="previousPage('executionsPage')" next-action="nextPage('executionsPage')" />
                @endif
            </div>
        @endif
    </x-application.settings-section>
</div>