This commit is contained in:
Andras Bacsai
2023-05-05 09:28:00 +02:00
parent 23f58b8c13
commit 539f82eb08
9 changed files with 66 additions and 34 deletions

View File

@@ -1,36 +1,40 @@
@props([
'id' => null,
'type' => 'text',
'required' => false,
'required' => $attributes->has('required'),
'label' => null,
'instantSave' => false,
'disabled' => false,
'hidden' => false,
'noLabel' => false,
'noDirty' => false,
])
<span @class([
'flex justify-end' => $type === 'checkbox',
'flex flex-col' => $type !== 'checkbox',
])>
<label for={{ $id }}>
@if ($label)
{{ $label }}
@else
{{ $id }}
@endif
@if ($required)
*
@endif
</label>
@if (!$noLabel)
<label for={{ $id }}>
@if ($label)
{{ $label }}
@else
{{ $id }}
@endif
@if ($required)
*
@endif
</label>
@endif
@if ($type === 'textarea')
<textarea {{ $attributes }} type={{ $type }} id={{ $id }} wire:model.defer={{ $id }}></textarea>
<textarea @if (!$noDirty) wire:dirty.class="text-black bg-amber-300" @endif {{ $attributes }}
required={{ $required }} type={{ $type }} id={{ $id }} wire:model.defer={{ $id }}></textarea>
@else
<input wire:dirty.class="text-black bg-amber-300" {{ $attributes }} type={{ $type }}
id={{ $id }}
<input {{ $attributes }} required={{ $required }}
@if (!$noDirty) wire:dirty.class="text-black bg-amber-300" @endif
type={{ $type }} id={{ $id }}
@if ($instantSave) wire:click='instantSave' wire:model.defer={{ $id }} @else wire:model.defer={{ $value ?? $id }} @endif />
@endif
@error($id)
<div class="text-red-500">{{ $message }}</div>
@enderror

View File

@@ -1,10 +1,10 @@
<form wire:submit.prevent='submit' class="flex gap-2 p-4">
<input type="text" wire:model.defer="key" wire:dirty.class="text-black bg-amber-300" />
<input type="text" wire:model.defer="value" wire:dirty.class="text-black bg-amber-300" />
<form wire:submit.prevent='submit' class="flex gap-2 px-2">
<x-inputs.input noLabel noDirty id="key" required />
<x-inputs.input noLabel noDirty id="value" required />
<div class="flex flex-col">
<div class="flex items-center gap-2">
<input type="checkbox" wire:model.defer="is_build_time" />
<label>Used during build?</label>
<label>Build Variable?</label>
</div>
</div>
<x-inputs.button type="submit">

View File

@@ -0,0 +1,10 @@
<div class="flex flex-col gap-2">
<h3>Environment Variables</h3>
@forelse ($application->environment_variables as $env)
<livewire:project.application.environment-variable.show wire:key="item-{{ $env->id }}" :env="$env" />
@empty
<p>There are no environment variables for this application.</p>
@endforelse
<h4>Add new environment variable</h4>
<livewire:project.application.environment-variable.add />
</div>

View File

@@ -1,11 +1,11 @@
<div x-data="{ deleteEnvironment: false }">
<form wire:submit.prevent='submit' class="flex gap-2 p-4">
<form wire:submit.prevent='submit' class="flex gap-2 px-2">
<input type="text" wire:model.defer="env.key" wire:dirty.class="text-black bg-amber-300" />
<input type="text" wire:model.defer="env.value" wire:dirty.class="text-black bg-amber-300" />
<div class="flex flex-col">
<div class="flex items-center gap-2">
<input type="checkbox" wire:model.defer="env.is_build_time" />
<label>Used during build?</label>
<label wire:dirty.class="text-amber-300" wire:target="env.is_build_time">Build Variable?</label>
</div>
</div>
<x-inputs.button type="submit">

View File

@@ -23,15 +23,8 @@
<h3>General Configurations</h3>
<livewire:project.application.general :applicationId="$application->id" />
</div>
<div x-cloak x-show="activeTab === 'environment-variables'" class="flex flex-col gap-2">
<h3>Environment Variables</h3>
@forelse ($application->environment_variables as $env)
<livewire:project.application.environment-variable.show :env="$env" />
@empty
<p>There are no environment variables for this application.</p>
@endforelse
<h4>Add new environment variable</h4>
<livewire:project.application.environment-variable.add />
<div x-cloak x-show="activeTab === 'environment-variables'">
<livewire:project.application.environment-variable.all :application="$application" />
</div>
<div x-cloak x-show="activeTab === 'source'">
<h3>Source</h3>