2023-08-07 20:14:21 +00:00
|
|
|
<div class="flex flex-col gap-2">
|
|
|
|
<div>
|
|
|
|
<div class="flex items-center gap-2">
|
|
|
|
<h2>Environment Variables</h2>
|
|
|
|
<x-forms.button class="btn" onclick="newVariable.showModal()">+ Add</x-forms.button>
|
2023-08-11 18:19:42 +00:00
|
|
|
<livewire:project.shared.environment-variable.add />
|
2023-09-08 14:16:59 +00:00
|
|
|
<x-forms.button
|
|
|
|
wire:click='switch'>{{ $view === 'normal' ? 'Developer view' : 'Normal view' }}</x-forms.button>
|
2023-08-07 20:14:21 +00:00
|
|
|
</div>
|
2023-09-08 14:16:59 +00:00
|
|
|
<div>Environment variables (secrets) for this resource.</div>
|
2023-08-07 20:14:21 +00:00
|
|
|
</div>
|
2023-09-08 14:16:59 +00:00
|
|
|
@if ($view === 'normal')
|
|
|
|
@forelse ($resource->environment_variables as $env)
|
2023-08-07 20:14:21 +00:00
|
|
|
<livewire:project.shared.environment-variable.show wire:key="environment-{{ $env->id }}"
|
2023-09-22 09:23:49 +00:00
|
|
|
:env="$env" :type="$resource->type()" />
|
2023-09-08 14:16:59 +00:00
|
|
|
@empty
|
|
|
|
<div class="text-neutral-500">No environment variables found.</div>
|
|
|
|
@endforelse
|
|
|
|
@if ($resource->type() === 'application' && $resource->environment_variables_preview->count() > 0 && $showPreview)
|
|
|
|
<div>
|
|
|
|
<h3>Preview Deployments</h3>
|
|
|
|
<div>Environment (secrets) variables for Preview Deployments.</div>
|
|
|
|
</div>
|
|
|
|
@foreach ($resource->environment_variables_preview as $env)
|
|
|
|
<livewire:project.shared.environment-variable.show wire:key="environment-{{ $env->id }}"
|
2023-09-22 09:23:49 +00:00
|
|
|
:env="$env" :type="$resource->type()" />
|
2023-09-08 14:16:59 +00:00
|
|
|
@endforeach
|
|
|
|
@endif
|
|
|
|
@else
|
|
|
|
<form wire:submit.prevent='saveVariables(false)' class="flex flex-col gap-2">
|
2023-09-26 12:45:52 +00:00
|
|
|
<x-forms.textarea rows=25 class="whitespace-pre-wrap"
|
2023-09-08 14:16:59 +00:00
|
|
|
id="variables"></x-forms.textarea>
|
|
|
|
<x-forms.button type="submit" class="btn btn-primary">Save</x-forms.button>
|
|
|
|
</form>
|
|
|
|
@if ($showPreview)
|
|
|
|
<form wire:submit.prevent='saveVariables(true)' class="flex flex-col gap-2">
|
2023-09-26 12:45:52 +00:00
|
|
|
<x-forms.textarea rows=25 class="whitespace-pre-wrap" label="Preview Environment Variables"
|
2023-09-08 14:16:59 +00:00
|
|
|
id="variablesPreview"></x-forms.textarea>
|
|
|
|
<x-forms.button type="submit" class="btn btn-primary">Save</x-forms.button>
|
|
|
|
</form>
|
|
|
|
@endif
|
2023-08-07 20:14:21 +00:00
|
|
|
@endif
|
|
|
|
</div>
|