@php $servicePageItems = [ ['label' => 'Configuration', 'route' => 'project.service.configuration', 'active' => request()->routeIs('project.service.configuration')], ['label' => 'Logs', 'route' => 'project.service.logs', 'active' => request()->routeIs('project.service.logs')], ['label' => 'Terminal', 'route' => 'project.service.command', 'active' => request()->routeIs('project.service.command'), 'navigate' => false, 'visible' => auth()->user()?->can('canAccessTerminal')], ]; $serviceConfigurationItems = [ ['label' => 'General', 'route' => 'project.service.configuration', 'active' => request()->routeIs('project.service.configuration')], ['label' => 'Environment Variables', 'route' => 'project.service.environment-variables', 'active' => request()->routeIs('project.service.environment-variables')], ['label' => 'Persistent Storages', 'route' => 'project.service.storages', 'active' => request()->routeIs('project.service.storages')], ['label' => 'Scheduled Tasks', 'route' => 'project.service.scheduled-tasks.show', 'active' => request()->routeIs('project.service.scheduled-tasks.show', 'project.service.scheduled-tasks')], ['label' => 'Webhooks', 'route' => 'project.service.webhooks', 'active' => request()->routeIs('project.service.webhooks')], ['label' => 'Resource Operations', 'route' => 'project.service.resource-operations', 'active' => request()->routeIs('project.service.resource-operations')], ['label' => 'Tags', 'route' => 'project.service.tags', 'active' => request()->routeIs('project.service.tags')], ['label' => 'Danger Zone', 'route' => 'project.service.danger', 'active' => request()->routeIs('project.service.danger')], ]; $serviceResourceItems = []; if (filled(data_get($parameters, 'stack_service_uuid'))) { $serviceResourceItems = [ ['label' => 'Back', 'route' => 'project.service.configuration', 'active' => false, 'parameters' => [...$parameters, 'stack_service_uuid' => null]], ['label' => 'General', 'route' => 'project.service.index', 'active' => request()->routeIs('project.service.index')], ['label' => 'Advanced', 'route' => 'project.service.index.advanced', 'active' => request()->routeIs('project.service.index.advanced')], ['label' => 'Backups', 'route' => 'project.service.database.backups', 'active' => request()->routeIs('project.service.database.backups')], ['label' => 'Import Backup', 'route' => 'project.service.database.import', 'active' => request()->routeIs('project.service.database.import')], ]; } $servicePageItems = array_values(array_filter($servicePageItems, fn (array $item): bool => $item['visible'] ?? true)); $serviceResourceItems = array_values(array_filter($serviceResourceItems, fn (array $item): bool => $item['visible'] ?? true)); $activeServiceResourceItem = collect($serviceResourceItems)->firstWhere('active', true); $activeServiceConfigurationItem = collect($serviceConfigurationItems)->firstWhere('active', true); $activeServicePageItem = collect($servicePageItems)->firstWhere('active', true); $activeServiceMobileItem = $activeServiceResourceItem ?? $activeServiceConfigurationItem ?? $activeServicePageItem ?? $servicePageItems[0]; $activeServiceMobileGroup = $activeServiceResourceItem ? 'resource' : ($activeServiceConfigurationItem ? 'configuration' : 'service'); $activeServiceMobileNavigation = ($activeServiceMobileItem['navigate'] ?? true) ? 'navigate' : 'location'; $activeServiceMobileValue = $activeServiceMobileNavigation.'|'.$activeServiceMobileGroup.'|'.route($activeServiceMobileItem['route'], $activeServiceMobileItem['parameters'] ?? $parameters); $serviceLinks = collect([]); $service->applications()->get()->each(function ($application) use ($serviceLinks) { $type = $application->serviceType(); if ($type) { generateServiceSpecificFqdns($application) ->map(fn ($link) => getFqdnWithoutPort($link)) ->each(fn ($link) => $serviceLinks->push($link)); } else { if ($application->fqdn) { collect(str($application->fqdn)->explode(',')) ->each(fn ($fqdn) => $serviceLinks->push(getFqdnWithoutPort($fqdn))); } if ($application->ports) { collect(str($application->ports)->explode(',')) ->each(function ($port) use ($serviceLinks) { $hostPort = str($port)->contains(':') ? str($port)->before(':') : $port; $serviceLinks->push(base_url(withPort: false).":{$hostPort}"); }); } } }); $serviceMobileMenuChangeHandler = <<<'JS' const value = $event.target.value; if (!value) { return; } if (value.startsWith('navigate|')) { const url = value.split('|').slice(2).join('|'); window.Livewire?.navigate ? window.Livewire.navigate(url) : window.location.href = url; return; } if (value.startsWith('location|')) { const url = value.split('|').slice(2).join('|'); window.location.href = url; return; } resetToCurrent(); if (value.startsWith('external:')) { window.open(value.slice(9), '_blank', 'noopener'); return; } const action = value.slice(7); document.getElementById(`service-${action}-trigger`)?.click(); JS; @endphp Service Startup

{{ $title }}

@if ($service->isDeployable) @endif @script @endscript