mirror of
https://github.com/tiennm99/coolify.git
synced 2026-09-10 16:18:21 +00:00
Extract application/database/service configuration sidebars and unified headings; improve clone-to-environment, embedded deployments, storage actions, OAuth icons, terminal, and shared form components.
68 lines
2.5 KiB
PHP
68 lines
2.5 KiB
PHP
@php
|
|
$wireClickValue = $attributes->whereStartsWith('wire:click')->first();
|
|
$wireTargetValue = $attributes->get('wire:target');
|
|
$hasExplicitWireTarget = $attributes->has('wire:target')
|
|
&& filled($wireTargetValue)
|
|
&& $wireTargetValue !== true
|
|
&& $wireTargetValue !== '1';
|
|
|
|
$loadingTarget = null;
|
|
if ($showLoadingIndicator) {
|
|
if (filled($wireClickValue)) {
|
|
$loadingTarget = trim(explode('(', (string) $wireClickValue, 2)[0]);
|
|
} elseif ($hasExplicitWireTarget) {
|
|
$loadingTarget = trim(explode('(', (string) $wireTargetValue, 2)[0]);
|
|
}
|
|
}
|
|
|
|
$loadingAttributes = [];
|
|
if (filled($loadingTarget)) {
|
|
$loadingAttributes['wire:loading.attr'] = 'disabled';
|
|
$loadingAttributes['wire:loading.class'] = 'is-loading';
|
|
if (! $hasExplicitWireTarget) {
|
|
$loadingAttributes['wire:target'] = $loadingTarget;
|
|
}
|
|
}
|
|
@endphp
|
|
@if ($authDisabled || filled($tooltip))
|
|
<span class="relative inline-flex"
|
|
x-data="{ visible: false, _t: null }"
|
|
@mouseenter="_t = setTimeout(() => {
|
|
visible = true;
|
|
$nextTick(() => requestAnimationFrame(() => {
|
|
const tip = $refs.tip;
|
|
if (!tip) return;
|
|
const r = $el.getBoundingClientRect();
|
|
const t = tip.getBoundingClientRect();
|
|
let top = r.top - t.height - 6;
|
|
let left = r.left;
|
|
if (top < 4) top = r.bottom + 6;
|
|
if (left + t.width > innerWidth - 8) left = innerWidth - 8 - t.width;
|
|
if (left < 4) left = 4;
|
|
tip.style.top = top + 'px';
|
|
tip.style.left = left + 'px';
|
|
}));
|
|
}, 300)"
|
|
@mouseleave="clearTimeout(_t); visible = false">
|
|
@endif
|
|
<button @disabled($disabled) @if ($isHighlighted) isHighlighted @endif
|
|
{{ $attributes->merge(['class' => $defaultClass, 'type' => 'button'])->merge($loadingAttributes) }}
|
|
@isset($confirm)
|
|
x-on:click="toggleConfirmModal('{{ $confirm }}', '{{ explode('(', $confirmAction)[0] }}')"
|
|
@endisset
|
|
@isset($confirmAction)
|
|
x-on:{{ explode('(', $confirmAction)[0] }}.window="$wire.{{ explode('(', $confirmAction)[0] }}"
|
|
@endisset>
|
|
|
|
@if (filled($loadingTarget))
|
|
<x-loading-on-button wire:target="{{ $loadingTarget }}" wire:loading />
|
|
@endif
|
|
{{ $slot }}
|
|
</button>
|
|
@if ($authDisabled || filled($tooltip))
|
|
<div x-ref="tip" x-show="visible" x-cloak class="auth-tooltip">
|
|
{{ $tooltip ?: 'You do not have permission to perform this action.' }}
|
|
</div>
|
|
</span>
|
|
@endif
|