diff --git a/app/Livewire/Project/New/Select.php b/app/Livewire/Project/New/Select.php index 07348f2d5e..ecc8ef0dd3 100644 --- a/app/Livewire/Project/New/Select.php +++ b/app/Livewire/Project/New/Select.php @@ -300,7 +300,8 @@ class Select extends Component /** * Derive a website link from the documentation URL. Shared hosts keep the - * path that identifies the project, so the link does not open the host root. + * path that identifies the project, so the link does not open the host root. The ref tells the site that the + * visitor came from Coolify. */ private function serviceWebsiteUrl(?string $documentation): ?string { @@ -318,7 +319,7 @@ class Select extends Component $projectPath = str($url['path'] ?? '')->explode('/')->filter()->take($projectPathSegments)->implode('/'); - return rtrim("{$url['scheme']}://{$url['host']}/{$projectPath}", '/'); + return rtrim("{$url['scheme']}://{$url['host']}/{$projectPath}", '/').'?ref=coolify.io'; } private function serviceTemplatesLastUpdated(): ?string diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php index 410277eef2..22a0f1d005 100644 --- a/bootstrap/helpers/shared.php +++ b/bootstrap/helpers/shared.php @@ -5977,7 +5977,7 @@ function convertContainerMemoryBytesToMegabytes(array $metrics): array } /** - * Resolve shared environment variable patterns like {{environment.VAR}}, {{project.VAR}}, {{team.VAR}}. + * Resolve shared environment variable patterns like {{environment.VAR}}, {{project.VAR}}, {{team.VAR}}, {{server.VAR}}. * * This is the canonical implementation used by both EnvironmentVariable::realValue and the compose parsers * to ensure shared variable references are replaced with their actual values. @@ -6005,6 +6005,8 @@ function resolveSharedEnvironmentVariables(?string $value, $resource): ?string $id = $resource->environment->project->id; } elseif ($type->value() === 'team') { $id = $resource->team()->id; + } elseif ($type->value() === 'server') { + $id = data_get($resource, 'destination.server_id'); } if (is_null($id)) { continue; @@ -6028,7 +6030,7 @@ function resolveSharedEnvironmentVariables(?string $value, $resource): ?string * The compose parsers write resolved values into `docker_compose`: environment variables, database * overrides, and shared variable references. Deployments need those values, so only the displayed * copy is redacted. Covered: the resource's locked variables (also variables that reference a locked - * shared variable) and locked team, project, and environment variables that the raw compose references. + * shared variable) and locked team, project, environment, and server variables that the raw compose references. * Values shorter than 4 characters are not replaced, because they would match unrelated text. * A parsed compose (array or collection) gets the same replacement in every string value. * @@ -6046,13 +6048,14 @@ function redactLockedValuesInGeneratedCompose(string|array|Collection|null $comp $values = EnvironmentVariable::logRedactionSecretsFor($resource, includePreview: true, resolveRemoteSecrets: false)['locked']; preg_match_all('/{{\s*(\w+)\.([^}\s]+)\s*}}/', (string) $resource->docker_compose_raw, $matches, PREG_SET_ORDER); - $references = collect($matches)->filter(fn (array $match): bool => in_array($match[1], ['team', 'project', 'environment'], true)); + $references = collect($matches)->filter(fn (array $match): bool => in_array($match[1], SHARED_VARIABLE_TYPES, true)); $teamId = $resource->team()?->id; if ($references->isNotEmpty() && $teamId !== null) { $scopeIds = [ 'team' => $teamId, 'project' => $resource->environment?->project_id, 'environment' => $resource->environment_id, + 'server' => data_get($resource, 'destination.server_id'), ]; $values = SharedEnvironmentVariable::query() ->where('team_id', $teamId) diff --git a/resources/views/livewire/project/new/select.blade.php b/resources/views/livewire/project/new/select.blade.php index 5288bf6eaf..769523b76a 100644 --- a/resources/views/livewire/project/new/select.blade.php +++ b/resources/views/livewire/project/new/select.blade.php @@ -20,6 +20,18 @@
+ {{-- Only the view that is not current shows, as an icon: the button switches to that view. --}} +
+ @foreach (['list' => ['List view', 'unordered-list'], 'grid' => ['Grid view', 'grid']] as $mode => [$viewLabel, $icon]) + + @endforeach +
+
-
- +
@@ -223,62 +244,65 @@

Databases

-
- +
@@ -297,22 +321,26 @@ -
+
+
The respective trademarks mentioned here are owned by the respective companies, and use of them does not imply any affiliation or endorsement. +
-
+