This commit is contained in:
Andras Bacsai 2023-04-19 15:38:59 +02:00
parent ffa8f40864
commit 97f0f34209
6 changed files with 15 additions and 17 deletions

View File

@ -13,6 +13,9 @@ public function environments()
return redirect()->route('home');
}
$project->load(['environments']);
if (count($project->environments) == 1) {
return redirect()->route('project.resources', ['project_uuid' => $project->uuid, 'environment_name' => $project->environments->first()->name]);
}
return view('project.environments', ['project' => $project]);
}

View File

@ -4,7 +4,7 @@
use Livewire\Component;
class Secrets extends Component
class EnvironmentVariables extends Component
{
public array $secrets = [];
public array $envs = [];
}

View File

@ -20,10 +20,5 @@ public function run(): void
'name' => 'production',
'project_id' => $project_1->id,
]);
Environment::create([
'id' => 2,
'name' => 'staging',
'project_id' => $project_1->id,
]);
}
}

View File

@ -0,0 +1,7 @@
<div>
@forelse ($envs as $env)
{{ dump($env) }}
@empty
<p>There are no environment variables for this application.</p>
@endforelse
</div>

View File

@ -1,7 +0,0 @@
<div>
@forelse ($secrets as $secret)
{{ dump($secret) }}
@empty
<p>There are no secrets for this application.</p>
@endforelse
</div>

View File

@ -2,7 +2,7 @@
<div x-data="{ tab: window.location.hash ? window.location.hash.substring(1) : 'general' }">
<div class="flex gap-4">
<a @click.prevent="tab = 'general'; window.location.hash = 'general'" href="#">General</a>
<a @click.prevent="tab = 'secrets'; window.location.hash = 'secrets'" href="#">Secrets</a>
<a @click.prevent="tab = 'envs'; window.location.hash = 'envs'" href="#">Environment Variables</a>
<a @click.prevent="tab = 'source'; window.location.hash = 'source'" href="#">Source</a>
<a @click.prevent="tab = 'destination'; window.location.hash = 'destination'" href="#">Destination
</a>
@ -12,8 +12,8 @@
<div x-cloak x-show="tab === 'general'">
<livewire:application.general :applicationId="$application->id" />
</div>
<div x-cloak x-show="tab === 'secrets'">
<livewire:application.secrets />
<div x-cloak x-show="tab === 'envs'">
<livewire:application.environment-variables />
</div>
<div x-cloak x-show="tab === 'source'">
<livewire:application.source :applicationId="$application->id" />