Files
coolify/resources/views/livewire/deployments-indicator.blade.php
T
Andras Bacsai 0a567cb8e7 feat(backups): refresh backup views live on team channel events
- Refresh application, database and volume backup lists on BackupCreated
- Refresh backup execution, edit and service resource views on
  ServiceStatusChanged as well as ServiceChecked
- Hide the deployments counter when only the current page's application
  is deploying, since its heading already shows "Deploying…"
- Show storage section shortcuts in the service configuration sidebar
- Drive server sidebar Sentinel/Security active state from activeMenu
  and activeSubMenu instead of route matching
- Start the app sidebar expanded for new users
- Drop a column from the backup executions table grid and adjust the
  responsive breakpoints
- Update the related feature tests
2026-10-15 14:10:14 +02:00

88 lines
5.8 KiB
PHP

{{-- Rendered twice: in the desktop top bar and in the mobile top bar. `.visible` pauses
polling for the copy hidden by the current breakpoint (a display:none element has no box). --}}
<div wire:poll.3000ms.visible x-data="{ expanded: false }" x-on:click.outside="expanded = false"
x-on:keydown.escape.window="expanded = false" @class(['relative' => $variant === 'topbar'])>
@if ($this->deploymentCount > 0 && ! $this->isOnlyCurrentApplicationDeploying)
@php
$deploymentLabel = $this->deploymentCount.' '.Str::plural('deployment', $this->deploymentCount);
@endphp
{{-- Deployment list: on desktop it opens below the button, aligned to its right edge.
On mobile the root is not positioned, so the list anchors to the sticky top bar
and spans its width. --}}
<div x-show="expanded" x-cloak x-transition.opacity.duration.150ms
@class([
'surface-popover absolute top-full z-60 mt-2 overflow-hidden rounded-xl',
'right-0 w-[22rem]' => $variant === 'topbar',
'inset-x-4' => $variant === 'mobile',
])>
<div class="max-h-96 space-y-1 overflow-y-auto p-2 scrollbar">
@foreach ($this->deployments as $deployment)
@php
$deploymentStatus = $deployment->status === 'in_progress' ? 'In progress' : 'Queued';
$deploymentStatusType = $deployment->status === 'in_progress' ? 'warning' : 'neutral';
$projectName = $deployment->application?->environment?->project?->name;
$environmentName = $deployment->application?->environment?->name;
$environmentPath = collect([$projectName, $environmentName])->filter()->join(' / ');
@endphp
<a wire:key="indicator-deployment-{{ $deployment->id }}"
href="{{ $deployment->deployment_url }}" {{ wireNavigate() }}
class="flex items-start gap-3 rounded-lg border border-transparent p-3 transition-colors hover:border-neutral-200 hover:bg-neutral-50 hover:no-underline dark:border-coolgray-300 dark:hover:border-coolgray-400 dark:hover:bg-raised">
<div
class="mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-lg border border-neutral-200 bg-neutral-50 text-coollabs dark:border-coolgray-300 dark:bg-raised dark:text-warning">
@if ($deployment->status === 'in_progress')
<svg class="size-3.5 animate-spin" xmlns="http://www.w3.org/2000/svg" fill="none"
viewBox="0 0 24 24" aria-hidden="true">
<circle class="opacity-25" cx="12" cy="12" r="10"
stroke="currentColor" stroke-width="4"></circle>
<path class="opacity-75" fill="currentColor"
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z">
</path>
</svg>
@else
<x-reicon name="time-back" class="size-3.5 text-neutral-500 dark:text-fg-dim" />
@endif
</div>
<div class="min-w-0 flex-1">
<div class="flex items-start justify-between gap-2">
<p class="truncate text-[13px] font-semibold text-black dark:text-fg">
{{ $deployment->application_name }}
</p>
<x-status-badge :status="$deploymentStatus" :type="$deploymentStatusType"
class="shrink-0" />
</div>
@if ($environmentPath !== '')
<p class="mt-0.5 truncate text-[11px] text-neutral-500 dark:text-fg-faint">
{{ $environmentPath }}
</p>
@endif
<p class="mt-0.5 truncate text-[11px] text-neutral-500 dark:text-fg-faint">
{{ $deployment->server_name ?: '-' }}
@if ($deployment->pull_request_id)
<span class="px-1 text-neutral-300 dark:text-fg-faint">·</span>
PR #{{ $deployment->pull_request_id }}
@endif
</p>
</div>
</a>
@endforeach
</div>
</div>
<button type="button" x-on:click="expanded = !expanded" title="{{ $deploymentLabel }}"
aria-label="Active deployments" :aria-expanded="expanded.toString()"
:class="expanded && 'bg-neutral-100 dark:bg-white/[0.06]'"
class="flex h-9 items-center gap-1.5 rounded-md px-2 text-[13px] font-medium text-coollabs transition-colors hover:bg-neutral-100 dark:text-warning dark:hover:bg-white/[0.06]">
<svg class="size-3.5 shrink-0 animate-spin" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
aria-hidden="true">
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
<path class="opacity-75" fill="currentColor"
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z">
</path>
</svg>
<span>{{ $this->deploymentCount }}</span>
</button>
@endif
</div>