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: projects with 0 envs

Andras Bacsai87b7337d9ef4
diff --git a/resources/views/livewire/dashboard.blade.php b/resources/views/livewire/dashboard.blade.php
index 2df3b1cdb8..c1dd375ff5 100644
--- a/resources/views/livewire/dashboard.blade.php
+++ b/resources/views/livewire/dashboard.blade.php
@@ -23,7 +23,7 @@
<div class="grid grid-cols-1 gap-2 xl:grid-cols-2">
@foreach ($projects as $project)
<div class="gap-2 border border-transparent cursor-pointer box group"
- onclick="window.location.href = '{{ route('project.resource.index', ['project_uuid' => data_get($project, 'uuid'), 'environment_name' => $project->default_environment()->name]) }}'">
+ onclick="gotoProject('{{ $project->uuid }}','{{ $project->default_environment()?->name }}')">
<div class="flex flex-1 mx-6">
<div class="flex flex-col justify-center flex-1">
<div class="box-title">{{ $project->name }}</div>
@@ -160,7 +160,10 @@
@endif
<script>
- function gotoProject(uuid, environment = 'production') {
+ function gotoProject(uuid, environment) {
+ if (!environment) {
+ window.location.href = '/project/' + uuid;
+ }
window.location.href = '/project/' + uuid + '/' + environment;
}
</script>
diff --git a/resources/views/livewire/project/index.blade.php b/resources/views/livewire/project/index.blade.php
index 0a5cb26bb5..76bae7a912 100644
--- a/resources/views/livewire/project/index.blade.php
+++ b/resources/views/livewire/project/index.blade.php
@@ -12,12 +12,12 @@
<div class="grid gap-2 lg:grid-cols-2">
@forelse ($projects as $project)
<div class="box group" x-data x-on:click="goto('{{ $project->uuid }}')">
- <a class="flex flex-col justify-center flex-1 mx-6"
- href="{{ route('project.resource.index', ['project_uuid' => data_get($project, 'uuid'), 'environment_name' => $project->default_environment()->name]) }}">
+ <div class="flex flex-col justify-center flex-1 mx-6"
+ onclick="gotoProject('{{ $project->uuid }}','{{ $project->default_environment()?->name }}')">
<div class="box-title">{{ $project->name }}</div>
<div class="box-description ">
{{ $project->description }}</div>
- </a>
+ </div>
<div class="flex items-center justify-center gap-2 pt-4 pb-2 mr-4 text-xs lg:py-0 lg:justify-normal">
<a class="mx-4 font-bold hover:underline"
href="{{ route('project.edit', ['project_uuid' => data_get($project, 'uuid')]) }}">
@@ -36,5 +36,12 @@
function goto(uuid) {
window.location.href = '/project/' + uuid;
}
+
+ function gotoProject(uuid, environment) {
+ if (!environment) {
+ window.location.href = '/project/' + uuid;
+ }
+ window.location.href = '/project/' + uuid + '/' + environment;
+ }
</script>
</div>