Két commit közötti fájlok összegyűjtését előkészítő felület első fázisa: célkörnyezet választás (e2e/d2d), commitlista, diff-előnézet figyelmeztetésekkel. Ez a fázis még semmit nem ír a fájlrendszerre, a csomagolás a phase2-ben érkezik. - DeploymentGuard: .env kapcsoló + hardkódolt stage whitelist + developer szerep + feature flag; a flag szándékosan nem biztonsági réteg, csak láthatóság-vezérlés - GitRepository: csak olvasó wrapper, argumentum-tömbös Symfony Process (nincs shell), hash- és referencia-validáció, core.quotePath=false az ékezetes útvonalakhoz - ChangeSetAnalyzer: kizárási lista, törlendő/másolandó szétválasztás (átnevezésnél mindkettő), figyelmeztetések migrációra, composer.lock-ra és a nem verziókövetett fordított assetekre Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
226 lines
13 KiB
PHP
226 lines
13 KiB
PHP
@php
|
||
// A fázis 1 felülete csak olvas: a git történetet listázza és a kijelölt tartomány
|
||
// diffjét mutatja. A számított property-ket egy helyen kérjük le, hogy a hibabanner
|
||
// (gitError) már a renderelés elején beállított állapotot lássa.
|
||
$commits = $this->commits;
|
||
$changeSet = $this->changeSet;
|
||
$highlighted = $this->highlightedHashes;
|
||
$target = $this->target();
|
||
|
||
$statusStyles = [
|
||
'A' => ['label' => 'új', 'class' => 'bg-emerald-100 text-emerald-800 dark:bg-emerald-900 dark:text-emerald-200'],
|
||
'M' => ['label' => 'módosult', 'class' => 'bg-amber-100 text-amber-800 dark:bg-amber-900 dark:text-amber-200'],
|
||
'D' => ['label' => 'törölt', 'class' => 'bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200'],
|
||
'R' => ['label' => 'átnevezett', 'class' => 'bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200'],
|
||
'C' => ['label' => 'másolt', 'class' => 'bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200'],
|
||
];
|
||
|
||
$warningStyles = [
|
||
'danger' => 'border-red-300 bg-red-50 text-red-900 dark:border-red-800 dark:bg-red-950 dark:text-red-200',
|
||
'warning' => 'border-amber-300 bg-amber-50 text-amber-900 dark:border-amber-800 dark:bg-amber-950 dark:text-amber-200',
|
||
'info' => 'border-gray-300 bg-gray-50 text-gray-800 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-300',
|
||
];
|
||
|
||
$cardClass = 'p-6 bg-white border border-gray-200 rounded-lg shadow dark:bg-gray-800 dark:border-gray-700';
|
||
$buttonClass = 'px-2 py-1 text-xs font-semibold rounded border transition';
|
||
@endphp
|
||
|
||
<x-filament-panels::page>
|
||
<div class="space-y-6">
|
||
|
||
<div class="{{ $cardClass }}">
|
||
<h5 class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">Deployment csomagoló</h5>
|
||
<p class="font-normal text-gray-700 dark:text-gray-400">
|
||
Válaszd ki a célkörnyezetet, majd két commitot: a köztük változott fájlok kerülnek majd a csomagba
|
||
(a kezdő commit kizárva, a záró beleértve).
|
||
</p>
|
||
<p class="mt-2 text-sm text-gray-500 dark:text-gray-400">
|
||
Ez a felület jelenleg <strong>csak olvas</strong> — a csomag előállítása a következő fázisban készül el.
|
||
</p>
|
||
</div>
|
||
|
||
@if ($this->gitError)
|
||
<div class="p-4 border rounded-lg {{ $warningStyles['danger'] }}">
|
||
<p class="font-semibold">Git hiba</p>
|
||
<p class="mt-1 text-sm">{{ $this->gitError }}</p>
|
||
</div>
|
||
@elseif (! $this->isRepositoryAvailable())
|
||
<div class="p-4 border rounded-lg {{ $warningStyles['danger'] }}">
|
||
<p class="font-semibold">Nem érhető el git repó</p>
|
||
<p class="mt-1 text-sm">
|
||
A(z) <code>{{ config('deployment.repo_path') }}</code> útvonalon nincs git working copy,
|
||
vagy a git parancs nem található.
|
||
</p>
|
||
</div>
|
||
@endif
|
||
|
||
<div class="{{ $cardClass }}">
|
||
{{ $this->form }}
|
||
</div>
|
||
|
||
<div class="{{ $cardClass }}">
|
||
<div class="flex flex-wrap items-center justify-between gap-4">
|
||
<div class="flex flex-wrap items-center gap-3 text-sm">
|
||
<span class="text-gray-500 dark:text-gray-400">Tartomány:</span>
|
||
|
||
@if ($this->fromCommit)
|
||
<code class="px-2 py-1 rounded bg-gray-100 dark:bg-gray-900">{{ substr($this->fromCommit, 0, 7) }}</code>
|
||
@else
|
||
<span class="text-gray-400">nincs kezdő commit</span>
|
||
@endif
|
||
|
||
<span class="text-gray-400">→</span>
|
||
|
||
@if ($this->toCommit)
|
||
<code class="px-2 py-1 rounded bg-gray-100 dark:bg-gray-900">{{ substr($this->toCommit, 0, 7) }}</code>
|
||
@else
|
||
<span class="text-gray-400">nincs záró commit</span>
|
||
@endif
|
||
|
||
@if ($changeSet)
|
||
<span class="text-gray-500 dark:text-gray-400">
|
||
· {{ $changeSet['counts']['copied'] }} másolandó
|
||
@if ($changeSet['counts']['deleted'] > 0)
|
||
, {{ $changeSet['counts']['deleted'] }} törlendő
|
||
@endif
|
||
</span>
|
||
@endif
|
||
</div>
|
||
|
||
<div class="flex items-center gap-2">
|
||
<button type="button" wire:click="swapRange"
|
||
class="{{ $buttonClass }} border-gray-300 text-gray-700 hover:bg-gray-100 dark:border-gray-600 dark:text-gray-200 dark:hover:bg-gray-700">
|
||
Csere
|
||
</button>
|
||
<button type="button" wire:click="clearRange"
|
||
class="{{ $buttonClass }} border-gray-300 text-gray-700 hover:bg-gray-100 dark:border-gray-600 dark:text-gray-200 dark:hover:bg-gray-700">
|
||
Törlés
|
||
</button>
|
||
</div>
|
||
</div>
|
||
|
||
@if ($target)
|
||
<p class="mt-3 text-sm text-gray-500 dark:text-gray-400">
|
||
Cél: <strong>{{ $target['label'] }}</strong> — a fájlok ide kerülnek majd feltöltésre:
|
||
<code>{{ $target['remote_path'] }}</code>
|
||
</p>
|
||
@endif
|
||
</div>
|
||
|
||
<div class="{{ $cardClass }}">
|
||
<h6 class="mb-4 text-lg font-semibold text-gray-900 dark:text-white">
|
||
Commitok
|
||
<span class="ml-1 text-sm font-normal text-gray-500 dark:text-gray-400">({{ count($commits) }} db)</span>
|
||
</h6>
|
||
|
||
@if ($commits === [])
|
||
<p class="text-sm text-gray-500 dark:text-gray-400">Nincs megjeleníthető commit.</p>
|
||
@else
|
||
<div class="overflow-x-auto">
|
||
<table class="w-full text-sm text-left">
|
||
<thead class="text-xs uppercase text-gray-600 border-b border-gray-200 dark:text-gray-300 dark:border-gray-700">
|
||
<tr>
|
||
<th class="py-2 pr-4">Kijelölés</th>
|
||
<th class="py-2 pr-4">Hash</th>
|
||
<th class="py-2 pr-4">Dátum</th>
|
||
<th class="py-2 pr-4">Szerző</th>
|
||
<th class="py-2 pr-4">Üzenet</th>
|
||
<th class="py-2 text-right">Fájl</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
@foreach ($commits as $commit)
|
||
@php
|
||
$isFrom = $this->fromCommit === $commit['hash'];
|
||
$isTo = $this->toCommit === $commit['hash'];
|
||
$inRange = in_array($commit['hash'], $highlighted, true);
|
||
@endphp
|
||
<tr wire:key="commit-{{ $commit['hash'] }}"
|
||
class="border-b border-gray-100 dark:border-gray-700 {{ $inRange ? 'bg-primary-50 dark:bg-gray-900' : '' }}">
|
||
<td class="py-2 pr-4 whitespace-nowrap">
|
||
<button type="button" wire:click="selectFrom('{{ $commit['hash'] }}')"
|
||
class="{{ $buttonClass }} {{ $isFrom ? 'border-primary-600 bg-primary-600 text-white' : 'border-gray-300 text-gray-700 hover:bg-gray-100 dark:border-gray-600 dark:text-gray-200 dark:hover:bg-gray-700' }}">
|
||
Kezdő
|
||
</button>
|
||
<button type="button" wire:click="selectTo('{{ $commit['hash'] }}')"
|
||
class="{{ $buttonClass }} ml-1 {{ $isTo ? 'border-primary-600 bg-primary-600 text-white' : 'border-gray-300 text-gray-700 hover:bg-gray-100 dark:border-gray-600 dark:text-gray-200 dark:hover:bg-gray-700' }}">
|
||
Záró
|
||
</button>
|
||
</td>
|
||
<td class="py-2 pr-4 font-mono text-xs whitespace-nowrap">{{ $commit['short'] }}</td>
|
||
<td class="py-2 pr-4 whitespace-nowrap text-gray-600 dark:text-gray-300">
|
||
{{ \Illuminate\Support\Carbon::parse($commit['date'])->format('Y.m.d H:i') }}
|
||
</td>
|
||
<td class="py-2 pr-4 whitespace-nowrap text-gray-600 dark:text-gray-300">{{ $commit['author'] }}</td>
|
||
<td class="py-2 pr-4 text-gray-800 dark:text-gray-100">{{ $commit['subject'] }}</td>
|
||
<td class="py-2 text-right text-gray-500 dark:text-gray-400">{{ $commit['file_count'] ?? '–' }}</td>
|
||
</tr>
|
||
@endforeach
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
@endif
|
||
</div>
|
||
|
||
@if ($changeSet)
|
||
<div class="{{ $cardClass }}">
|
||
<h6 class="mb-4 text-lg font-semibold text-gray-900 dark:text-white">
|
||
Változott fájlok
|
||
<span class="ml-1 text-sm font-normal text-gray-500 dark:text-gray-400">
|
||
({{ $changeSet['counts']['total'] }} db)
|
||
</span>
|
||
</h6>
|
||
|
||
@foreach ($changeSet['warnings'] as $warning)
|
||
<div class="p-4 mb-3 border rounded-lg {{ $warningStyles[$warning['level']] ?? $warningStyles['info'] }}">
|
||
<p class="font-semibold">{{ $warning['title'] }}</p>
|
||
<p class="mt-1 text-sm">{{ $warning['body'] }}</p>
|
||
</div>
|
||
@endforeach
|
||
|
||
@if ($changeSet['files'] !== [])
|
||
<div class="overflow-x-auto">
|
||
<table class="w-full text-sm text-left">
|
||
<thead class="text-xs uppercase text-gray-600 border-b border-gray-200 dark:text-gray-300 dark:border-gray-700">
|
||
<tr>
|
||
<th class="py-2 pr-4">Állapot</th>
|
||
<th class="py-2 pr-4">Útvonal</th>
|
||
<th class="py-2">Művelet</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
@foreach ($changeSet['files'] as $file)
|
||
@php
|
||
$style = $statusStyles[$file['status']] ?? ['label' => $file['status'], 'class' => 'bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-200'];
|
||
@endphp
|
||
<tr wire:key="file-{{ $loop->index }}" class="border-b border-gray-100 dark:border-gray-700 {{ $file['excluded'] ? 'opacity-50' : '' }}">
|
||
<td class="py-2 pr-4 whitespace-nowrap">
|
||
<span class="px-2 py-0.5 text-xs font-semibold rounded {{ $style['class'] }}">
|
||
{{ $file['status'] }} · {{ $style['label'] }}
|
||
</span>
|
||
</td>
|
||
<td class="py-2 pr-4 font-mono text-xs break-all text-gray-800 dark:text-gray-100">
|
||
{{ $file['path'] }}
|
||
@if ($file['old_path'])
|
||
<span class="block text-gray-400">← {{ $file['old_path'] }}</span>
|
||
@endif
|
||
</td>
|
||
<td class="py-2 whitespace-nowrap text-gray-600 dark:text-gray-300">
|
||
@switch($file['action'])
|
||
@case('copy') másolandó @break
|
||
@case('delete') törlendő a célgépen @break
|
||
@default kihagyva (kizárási lista)
|
||
@endswitch
|
||
</td>
|
||
</tr>
|
||
@endforeach
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
@endif
|
||
</div>
|
||
@endif
|
||
|
||
</div>
|
||
</x-filament-panels::page>
|