Merge pull request #3118 from peaklabs-dev/fix-project-selection

Fix: Preselect environment when coming form the project screen
This commit is contained in:
Andras Bacsai 2024-08-26 10:46:05 +02:00 committed by GitHub
commit bfc538b6ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 20 deletions

View File

@ -28,16 +28,16 @@
<div class="flex flex-col justify-center flex-1">
<div class="box-title">{{ $project->name }}</div>
<div class="box-description">
{{ $project->description }}</div>
{{ $project->description }}
</div>
</div>
<div class="flex items-center justify-center gap-2 text-xs font-bold ">
<div class="flex items-center justify-center gap-2 text-xs font-bold">
<a class="hover:underline"
href="{{ route('project.resource.create', ['project_uuid' => data_get($project, 'uuid'), 'environment_name' => data_get($project, 'environments.0.name', 'production')]) }}">
<span class="p-2 font-bold">+
Add Resource</span>
href="{{ route('project.resource.create', ['project_uuid' => $project->uuid, 'environment_name' => $project->default_environment()]) }}">
<span class="p-2 font-bold">+ Add Resource</span>
</a>
<a class="hover:underline"
href="{{ route('project.edit', ['project_uuid' => data_get($project, 'uuid')]) }}">
href="{{ route('project.edit', ['project_uuid' => $project->uuid]) }}">
Settings
</a>
</div>
@ -159,12 +159,14 @@
</div>
@endif
<script>
function gotoProject(uuid, environment) {
if (!environment) {
if (environment) {
window.location.href = '/project/' + uuid + '/' + environment;
} else {
window.location.href = '/project/' + uuid;
}
window.location.href = '/project/' + uuid + '/' + environment;
}
</script>
{{-- <x-forms.button wire:click='getIptables'>Get IPTABLES</x-forms.button> --}}

View File

@ -11,9 +11,8 @@
<div class="subtitle">All your projects are here.</div>
<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 }}')">
<div class="flex flex-col justify-center flex-1 mx-6"
onclick="gotoProject('{{ $project->uuid }}','{{ $project->default_environment() }}')">
<div class="box group" onclick="gotoProject('{{ $project->uuid }}', '{{ $project->default_environment() }}')">
<div class="flex flex-col justify-center flex-1 mx-6">
<div class="box-title">{{ $project->name }}</div>
<div class="box-description ">
{{ $project->description }}</div>
@ -33,15 +32,12 @@
</div>
<script>
function goto(uuid) {
function gotoProject(uuid, environment) {
if (environment) {
window.location.href = '/project/' + uuid + '/' + environment;
} else {
window.location.href = '/project/' + uuid;
}
function gotoProject(uuid, environment) {
if (!environment) {
window.location.href = '/project/' + uuid;
}
window.location.href = '/project/' + uuid + '/' + environment;
}
</script>
}
</script>
</div>