Merge pull request #3118 from peaklabs-dev/fix-project-selection
Fix: Preselect environment when coming form the project screen
This commit is contained in:
		@@ -28,16 +28,16 @@
 | 
				
			|||||||
                        <div class="flex flex-col justify-center flex-1">
 | 
					                        <div class="flex flex-col justify-center flex-1">
 | 
				
			||||||
                            <div class="box-title">{{ $project->name }}</div>
 | 
					                            <div class="box-title">{{ $project->name }}</div>
 | 
				
			||||||
                            <div class="box-description">
 | 
					                            <div class="box-description">
 | 
				
			||||||
                                {{ $project->description }}</div>
 | 
					                                {{ $project->description }}
 | 
				
			||||||
 | 
					                            </div>
 | 
				
			||||||
                        </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"
 | 
					                            <a class="hover:underline"
 | 
				
			||||||
                                href="{{ route('project.resource.create', ['project_uuid' => data_get($project, 'uuid'), 'environment_name' => data_get($project, 'environments.0.name', 'production')]) }}">
 | 
					                                href="{{ route('project.resource.create', ['project_uuid' => $project->uuid, 'environment_name' => $project->default_environment()]) }}">
 | 
				
			||||||
                                <span class="p-2 font-bold">+
 | 
					                                <span class="p-2 font-bold">+ Add Resource</span>
 | 
				
			||||||
                                    Add Resource</span>
 | 
					 | 
				
			||||||
                            </a>
 | 
					                            </a>
 | 
				
			||||||
                            <a class="hover:underline"
 | 
					                            <a class="hover:underline"
 | 
				
			||||||
                                href="{{ route('project.edit', ['project_uuid' => data_get($project, 'uuid')]) }}">
 | 
					                                href="{{ route('project.edit', ['project_uuid' => $project->uuid]) }}">
 | 
				
			||||||
                                Settings
 | 
					                                Settings
 | 
				
			||||||
                            </a>
 | 
					                            </a>
 | 
				
			||||||
                        </div>
 | 
					                        </div>
 | 
				
			||||||
@@ -159,12 +159,14 @@
 | 
				
			|||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
    @endif
 | 
					    @endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <script>
 | 
					    <script>
 | 
				
			||||||
        function gotoProject(uuid, environment) {
 | 
					        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;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            window.location.href = '/project/' + uuid + '/' + environment;
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    </script>
 | 
					    </script>
 | 
				
			||||||
    {{-- <x-forms.button wire:click='getIptables'>Get IPTABLES</x-forms.button> --}}
 | 
					    {{-- <x-forms.button wire:click='getIptables'>Get IPTABLES</x-forms.button> --}}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,9 +11,8 @@
 | 
				
			|||||||
    <div class="subtitle">All your projects are here.</div>
 | 
					    <div class="subtitle">All your projects are here.</div>
 | 
				
			||||||
    <div class="grid gap-2 lg:grid-cols-2">
 | 
					    <div class="grid gap-2 lg:grid-cols-2">
 | 
				
			||||||
        @forelse ($projects as $project)
 | 
					        @forelse ($projects as $project)
 | 
				
			||||||
            <div class="box group" x-data x-on:click="goto('{{ $project->uuid }}')">
 | 
					            <div class="box group" onclick="gotoProject('{{ $project->uuid }}', '{{ $project->default_environment() }}')">
 | 
				
			||||||
                <div class="flex flex-col justify-center flex-1 mx-6"
 | 
					                <div class="flex flex-col justify-center flex-1 mx-6">
 | 
				
			||||||
                    onclick="gotoProject('{{ $project->uuid }}','{{ $project->default_environment() }}')">
 | 
					 | 
				
			||||||
                    <div class="box-title">{{ $project->name }}</div>
 | 
					                    <div class="box-title">{{ $project->name }}</div>
 | 
				
			||||||
                    <div class="box-description ">
 | 
					                    <div class="box-description ">
 | 
				
			||||||
                        {{ $project->description }}</div>
 | 
					                        {{ $project->description }}</div>
 | 
				
			||||||
@@ -33,15 +32,12 @@
 | 
				
			|||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <script>
 | 
					    <script>
 | 
				
			||||||
        function goto(uuid) {
 | 
					 | 
				
			||||||
            window.location.href = '/project/' + uuid;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    function gotoProject(uuid, environment) {
 | 
					    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;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
            window.location.href = '/project/' + uuid + '/' + environment;
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user