feat: Improve sorting of environment variables in the All component
This commit is contained in:
parent
94810d5066
commit
fec98f45ce
@ -38,18 +38,20 @@ class All extends Component
|
|||||||
|
|
||||||
public function sortMe()
|
public function sortMe()
|
||||||
{
|
{
|
||||||
if ($this->resourceClass === 'App\Models\Application' && $this->resource->settings->is_env_sorting_enabled) {
|
if ($this->resourceClass === 'App\Models\Application' && data_get($this->resource, 'build_pack') !== 'dockercompose') {
|
||||||
$this->resource->environment_variables = $this->resource->environment_variables->sortBy('key');
|
if ($this->resource->settings->is_env_sorting_enabled) {
|
||||||
$this->resource->environment_variables_preview = $this->resource->environment_variables_preview->sortBy('key');
|
$this->resource->environment_variables = $this->resource->environment_variables->sortBy('key');
|
||||||
} else {
|
$this->resource->environment_variables_preview = $this->resource->environment_variables_preview->sortBy('key');
|
||||||
$this->resource->environment_variables = $this->resource->environment_variables->sortBy('id');
|
} else {
|
||||||
$this->resource->environment_variables_preview = $this->resource->environment_variables_preview->sortBy('id');
|
$this->resource->environment_variables = $this->resource->environment_variables->sortBy('id');
|
||||||
|
$this->resource->environment_variables_preview = $this->resource->environment_variables_preview->sortBy('id');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$this->getDevView();
|
$this->getDevView();
|
||||||
}
|
}
|
||||||
public function instantSave()
|
public function instantSave()
|
||||||
{
|
{
|
||||||
if ($this->resourceClass === 'App\Models\Application') {
|
if ($this->resourceClass === 'App\Models\Application' && data_get($this->resource, 'build_pack') !== 'dockercompose') {
|
||||||
$this->resource->settings->save();
|
$this->resource->settings->save();
|
||||||
$this->dispatch('success', 'Environment variable settings updated.');
|
$this->dispatch('success', 'Environment variable settings updated.');
|
||||||
$this->sortMe();
|
$this->sortMe();
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
wire:click='switch'>{{ $view === 'normal' ? 'Developer view' : 'Normal view' }}</x-forms.button>
|
wire:click='switch'>{{ $view === 'normal' ? 'Developer view' : 'Normal view' }}</x-forms.button>
|
||||||
</div>
|
</div>
|
||||||
<div>Environment variables (secrets) for this resource.</div>
|
<div>Environment variables (secrets) for this resource.</div>
|
||||||
@if ($this->resourceClass === 'App\Models\Application')
|
@if ($this->resourceClass === 'App\Models\Application' && data_get($this->resource, 'build_pack') !== 'dockercompose')
|
||||||
<div class="w-64 pt-2">
|
<div class="w-64 pt-2">
|
||||||
<x-forms.checkbox id="resource.settings.is_env_sorting_enabled" label="Sort alphabetically"
|
<x-forms.checkbox id="resource.settings.is_env_sorting_enabled" label="Sort alphabetically"
|
||||||
helper="Turn this off if one environment is dependent on an other. It will be sorted by creation order." instantSave></x-forms.checkbox>
|
helper="Turn this off if one environment is dependent on an other. It will be sorted by creation order." instantSave></x-forms.checkbox>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user