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.

16.0 KB
Raw Blame
<nav wire:poll.10000ms="checkStatus" class="w-full max-w-none" x-data
    x-init="@js($loadComposeOnOpen) && $wire.loadComposeFile(true)">
    <div>
        @if ($application->build_pack === 'nixpacks')
            <x-callout type="warning" title="Nixpacks is deprecated" class="mb-4">
                {{ config('deprecations.nixpacks') }}
                <a class="underline" href="{{ route('project.application.configuration', $parameters) }}" {{ wireNavigate() }}>
                    Switch to Railpack in General settings.
                </a>
            </x-callout>
        @endif

        {{-- Below xl: the title and the resource actions share one row. --}}
        <div class="mb-3 flex w-full min-w-0 items-start gap-3 xl:hidden">
            <div class="min-w-0 flex-1">
                <div class="flex min-w-0 flex-col items-start gap-2">
                    <h1 class="min-w-0 max-w-full truncate text-[24px]! leading-7! font-semibold! tracking-tight! text-black dark:text-fg">
                        {{ $application->name }}
                    </h1>
                    <div class="relative flex w-full min-w-0 items-center gap-2">
                        <x-status-summary :status="$application->status"
                            :healthcheck-url="route('project.application.healthcheck', $parameters)" />
                        <x-applications.links :application="$application" compact />
                        @if ($this->runningDeploymentUrl)
                            <x-deploying-indicator :href="$this->runningDeploymentUrl" />
                        @endif
                    </div>
                    <div class="flex w-full flex-wrap gap-1">
                        <x-application.restart-limit-warning :application="$application" />
                    </div>
                </div>
            </div>

            <div class="shrink-0">
                @if ($this->needsComposeFile())
                    <div class="flex items-center gap-1">
                        @can('update', $application)
                            <x-forms.button wire:click="loadComposeFile">Load compose</x-forms.button>
                        @endcan
                        @can('deploy', $application)
                            <x-forms.button id="application-mobile-actions" disabled default-class="split-action-main rounded-md!"
                                tooltip="Load the Compose file before you deploy.">
                                <x-reicon name="play-circle" class="size-3.5" />
                                Deploy
                            </x-forms.button>
                        @endcan
                    </div>
                @else
                    @can('deploy', $application)
                        <x-split-action id="application-mobile-actions">
                            @if (str($application->status)->startsWith('exited'))
                                <x-slot:main wire:click="deploy">
                                    <x-reicon name="play-circle" class="size-3.5" />
                                    {{ $application->stoppedAfterRestartLimit() ? 'Retry deployment' : 'Deploy' }}
                                </x-slot:main>
                                @if (!$application->destination->server->isSwarm())
                                    <button type="button" class="listbox-option justify-start! gap-2.5!" wire:click="deploy(true)"
                                        @click="open = false" role="menuitem">
                                        <x-reicon name="refresh" class="size-3.5 opacity-70" />
                                        {{ $application->stoppedAfterRestartLimit() ? 'Retry deployment (without cache)' : 'Deploy (without cache)' }}
                                    </button>
                                @endif
                                @if ($application->container_present !== false)
                                    <button type="button" class="listbox-option justify-start! gap-2.5!"
                                        @click="open = false; document.getElementById('application-mobile-stop-trigger')?.click()" role="menuitem">
                                        <x-reicon name="stop-circle" class="size-3.5 text-error" />
                                        Remove container
                                    </button>
                                @endif
                            @else
                                @if ($application->destination->server->isSwarm())
                                    @if ($application->build_pack !== 'dockercompose')
                                        <x-slot:main wire:click="deploy">
                                            <x-reicon name="refresh" class="size-3.5" />
                                            Update Service
                                        </x-slot:main>
                                    @else
                                        <x-slot:main @click="document.getElementById('application-mobile-stop-trigger')?.click()">
                                            <x-reicon name="stop-circle" class="size-3.5" />
                                            Stop
                                        </x-slot:main>
                                    @endif
                                @else
                                    <x-slot:main wire:click="deploy">
                                        <x-reicon name="refresh" class="size-3.5" />
                                        Redeploy
                                    </x-slot:main>
                                    <button type="button" class="listbox-option justify-start! gap-2.5!"
                                        wire:click="{{ str($application->status)->startsWith('running') ? 'force_deploy_without_cache' : 'deploy(true)' }}"
                                        @click="open = false" role="menuitem">
                                        <x-reicon name="refresh" class="size-3.5 opacity-70" />
                                        Redeploy (without cache)
                                    </button>
                                    @if ($application->build_pack !== 'dockercompose')
                                        <button type="button" class="listbox-option justify-start! gap-2.5!"
                                            @click="open = false; document.getElementById('application-mobile-restart-trigger')?.click()"
                                            role="menuitem">
                                            <x-reicon name="restart" class="size-3.5 opacity-70" />
                                            Restart
                                        </button>
                                    @endif
                                @endif
                                @unless ($application->destination->server->isSwarm() && $application->build_pack === 'dockercompose')
                                    <button type="button" class="listbox-option justify-start! gap-2.5!"
                                        @click="open = false; document.getElementById('application-mobile-stop-trigger')?.click()"
                                        role="menuitem">
                                        <x-reicon name="stop-circle" class="size-3.5 text-error" />
                                        Stop
                                    </button>
                                @endunless
                            @endif
                        </x-split-action>
                    @endcan
                @endif
                <div class="hidden" aria-hidden="true">
                    <x-modal-confirmation
                        canGate="deploy" :canResource="$application"
                        title="{{ str($application->status)->startsWith('exited') ? 'Confirm Container Removal?' : 'Confirm Application Stopping?' }}"
                        buttonTitle="{{ str($application->status)->startsWith('exited') ? 'Remove container' : 'Stop' }}"
                        submitAction="stop" :checkboxes="$checkboxes" :actions="[
                            str($application->status)->startsWith('exited') ? 'The exited application container will be removed.' : 'This application will be stopped.',
                            str($application->status)->startsWith('exited') ? 'Anonymous volumes may become eligible for Docker cleanup.' : 'All non-persistent data of this application will be deleted.',
                        ]" :confirmWithText="false" :confirmWithPassword="false"
                        step1ButtonText="Continue" step2ButtonText="Confirm">
                        <x-slot:trigger>
                            <button id="application-mobile-stop-trigger" type="button">Stop</button>
                        </x-slot:trigger>
                    </x-modal-confirmation>
                    <x-modal-confirmation title="Confirm Application Restart?" buttonTitle="Restart"
                        submitAction="restart" :actions="[
                            'This application will be restarted without rebuilding.',
                        ]" :confirmWithText="false" :confirmWithPassword="false"
                        step2ButtonText="Confirm">
                        <x-slot:trigger>
                            <button id="application-mobile-restart-trigger" type="button">Restart</button>
                        </x-slot:trigger>
                    </x-modal-confirmation>
                </div>
            </div>
        </div>

        {{-- Desktop actions live in the fixed top bar so they cannot overlap page content. --}}
        @teleport('#resource-action-hud-slot')
        <div class="hidden w-full items-center xl:flex xl:w-auto">
            <div
                class="resource-heading-navbar application-heading-actions flex w-full min-w-0 items-center justify-start gap-1 overflow-visible xl:w-auto xl:justify-end">
                <div class="resource-heading-actions flex shrink-0 items-center gap-0.5">
                    @if ($this->runningDeploymentUrl)
                        <x-deploying-indicator :href="$this->runningDeploymentUrl" class="mr-1" />
                    @endif
                    @if ($this->needsComposeFile())
                        @can('update', $application)
                            <x-forms.button wire:click="loadComposeFile">Load compose</x-forms.button>
                        @endcan
                        @can('deploy', $application)
                            <x-forms.button id="application-desktop-actions" disabled default-class="split-action-main rounded-md!"
                                tooltip="Load the Compose file before you deploy.">
                                <x-reicon name="play-circle" class="size-3.5" />
                                Deploy
                            </x-forms.button>
                        @endcan
                    @else
                        <div class="resource-heading-menus shrink-0">
                            <x-applications.links :application="$application" />
                        </div>
                        @can('deploy', $application)
                            <x-split-action id="application-desktop-actions">
                                @if (str($application->status)->startsWith('exited'))
                                    <x-slot:main wire:click="deploy">
                                        <x-reicon name="play-circle" class="size-3.5" />
                                        {{ $application->stoppedAfterRestartLimit() ? 'Retry deployment' : 'Deploy' }}
                                    </x-slot:main>
                                    @if (!$application->destination->server->isSwarm())
                                        <button type="button" class="listbox-option justify-start! gap-2.5!" wire:click="deploy(true)"
                                            @click="open = false" role="menuitem">
                                            <x-reicon name="refresh" class="size-3.5 opacity-70" />
                                            {{ $application->stoppedAfterRestartLimit() ? 'Retry deployment (without cache)' : 'Deploy (without cache)' }}
                                        </button>
                                    @endif
                                    @if ($application->container_present !== false)
                                        <button type="button" class="listbox-option justify-start! gap-2.5!"
                                            @click="open = false; document.getElementById('application-mobile-stop-trigger')?.click()" role="menuitem">
                                            <x-reicon name="stop-circle" class="size-3.5 text-error" />
                                            Remove container
                                        </button>
                                    @endif
                                @else
                                    @if ($application->destination->server->isSwarm())
                                        @if ($application->build_pack !== 'dockercompose')
                                            <x-slot:main wire:click="deploy">
                                                <x-reicon name="refresh" class="size-3.5" />
                                                Update Service
                                            </x-slot:main>
                                        @else
                                            <x-slot:main @click="document.getElementById('application-mobile-stop-trigger')?.click()">
                                                <x-reicon name="stop-circle" class="size-3.5" />
                                                Stop
                                            </x-slot:main>
                                        @endif
                                    @else
                                        <x-slot:main wire:click="deploy">
                                            <x-reicon name="refresh" class="size-3.5" />
                                            Redeploy
                                        </x-slot:main>
                                        <button type="button" class="listbox-option justify-start! gap-2.5!"
                                            wire:click="{{ str($application->status)->startsWith('running') ? 'force_deploy_without_cache' : 'deploy(true)' }}"
                                            @click="open = false" role="menuitem">
                                            <x-reicon name="refresh" class="size-3.5 opacity-70" />
                                            Redeploy (without cache)
                                        </button>
                                        @if ($application->build_pack !== 'dockercompose')
                                            <button type="button" class="listbox-option justify-start! gap-2.5!"
                                                @click="open = false; document.getElementById('application-mobile-restart-trigger')?.click()"
                                                role="menuitem">
                                                <x-reicon name="restart" class="size-3.5 opacity-70" />
                                                Restart
                                            </button>
                                        @endif
                                    @endif
                                    @unless ($application->destination->server->isSwarm() && $application->build_pack === 'dockercompose')
                                        <button type="button" class="listbox-option justify-start! gap-2.5!"
                                            @click="open = false; document.getElementById('application-mobile-stop-trigger')?.click()"
                                            role="menuitem">
                                            <x-reicon name="stop-circle" class="size-3.5 text-error" />
                                            Stop
                                        </button>
                                    @endunless
                                @endif
                            </x-split-action>
                        @endcan
                    @endif
                </div>
            </div>
        </div>
        @endteleport
    </div>
</nav>