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.

fix: slash in env names ui: placement of env switcher

Andras Bacsai76ba3653253a
diff --git a/app/Console/Commands/Init.php b/app/Console/Commands/Init.php
index 50c9fe29bd..7949b24570 100644
--- a/app/Console/Commands/Init.php
+++ b/app/Console/Commands/Init.php
@@ -5,6 +5,7 @@ namespace App\Console\Commands;
use App\Enums\ApplicationDeploymentStatus;
use App\Jobs\CleanupHelperContainersJob;
use App\Models\ApplicationDeploymentQueue;
+use App\Models\Environment;
use App\Models\InstanceSettings;
use App\Models\ScheduledDatabaseBackup;
use App\Models\Server;
@@ -24,6 +25,8 @@ class Init extends Command
get_public_ips();
$full_cleanup = $this->option('full-cleanup');
$cleanup_deployments = $this->option('cleanup-deployments');
+
+ $this->replace_slash_in_environment_name();
if ($cleanup_deployments) {
echo "Running cleanup deployments.\n";
$this->cleanup_in_progress_application_deployments();
@@ -150,4 +153,15 @@ class Init extends Command
echo "Error: {$e->getMessage()}\n";
}
}
+
+ private function replace_slash_in_environment_name()
+ {
+ $environments = Environment::all();
+ foreach ($environments as $environment) {
+ if (str_contains($environment->name, '/')) {
+ $environment->name = str_replace('/', '-', $environment->name);
+ $environment->save();
+ }
+ }
+ }
}
diff --git a/app/Models/Environment.php b/app/Models/Environment.php
index e84b6989b1..b2bb51092a 100644
--- a/app/Models/Environment.php
+++ b/app/Models/Environment.php
@@ -109,7 +109,7 @@ class Environment extends Model
protected function name(): Attribute
{
return Attribute::make(
- set: fn (string $value) => strtolower($value),
+ set: fn (string $value) => str($value)->lower()->trim()->replace('/', '-')->toString(),
);
}
}
diff --git a/resources/views/livewire/project/environment-edit.blade.php b/resources/views/livewire/project/environment-edit.blade.php
index b4c37a37ba..2035259595 100644
--- a/resources/views/livewire/project/environment-edit.blade.php
+++ b/resources/views/livewire/project/environment-edit.blade.php
@@ -27,12 +27,6 @@
<div class="flex items-center">
<a class="text-xs truncate lg:text-sm"
href="{{ route('project.resource.index', ['environment_name' => data_get($parameters, 'environment_name'), 'project_uuid' => data_get($parameters, 'project_uuid')]) }}">{{ data_get($parameters, 'environment_name') }}</a>
- <svg aria-hidden="true" class="w-4 h-4 mx-1 font-bold dark:text-warning" fill="currentColor"
- viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
- <path fill-rule="evenodd"
- d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z"
- clip-rule="evenodd"></path>
- </svg>
</div>
</li>
<li>
diff --git a/resources/views/livewire/project/resource/environment-select.blade.php b/resources/views/livewire/project/resource/environment-select.blade.php
index cd9219efc5..ab160dcdaa 100644
--- a/resources/views/livewire/project/resource/environment-select.blade.php
+++ b/resources/views/livewire/project/resource/environment-select.blade.php
@@ -1,8 +1,8 @@
-<x-forms.select label="Switch Environment" wire:model.live="selectedEnvironment">
- <option value="edit">Create/Edit Environments</option>
- <option disabled>-----</option>
- @foreach ($environments as $environment)
- <option value="{{ $environment->name }}">{{ $environment->name }}
- </option>
- @endforeach
-</x-forms.select>
+ <x-forms.select wire:model.live="selectedEnvironment">
+ <option value="edit">Create/Edit Environments</option>
+ <option disabled>-----</option>
+ @foreach ($environments as $environment)
+ <option value="{{ $environment->name }}">{{ $environment->name }}
+ </option>
+ @endforeach
+ </x-forms.select>
diff --git a/resources/views/livewire/project/resource/index.blade.php b/resources/views/livewire/project/resource/index.blade.php
index f623b41b52..cbe9f8a468 100644
--- a/resources/views/livewire/project/resource/index.blade.php
+++ b/resources/views/livewire/project/resource/index.blade.php
@@ -21,7 +21,7 @@
@endif
<livewire:project.delete-environment :disabled="!$environment->isEmpty()" :environment_id="$environment->id" />
</div>
- <nav class="flex pt-2 pb-10">
+ <nav class="flex pt-2 pb-6">
<ol class="flex items-center">
<li class="inline-flex items-center">
<a class="text-xs truncate lg:text-sm"
@@ -37,16 +37,15 @@
clip-rule="evenodd"></path>
</svg>
- <a class="text-xs truncate lg:text-sm"
- href="{{ route('project.resource.index', ['environment_name' => request()->route('environment_name'), 'project_uuid' => request()->route('project_uuid')]) }}">{{ request()->route('environment_name') }}</a>
+ <livewire:project.resource.environment-select :environments="$project->environments" />
</div>
</li>
+ <li>
+
+ </li>
</ol>
</nav>
</div>
- <div class="pb-4">
- <livewire:project.resource.environment-select :environments="$project->environments" />
- </div>
@if ($environment->isEmpty())
<a href="{{ route('project.resource.create', ['project_uuid' => request()->route('project_uuid'), 'environment_name' => request()->route('environment_name')]) }} "
class="items-center justify-center box">+ Add New Resource</a>