fix(ui): prefer Compose env values and polish error pages

When a managed variable shares a Compose-defined key, show the
hardcoded Compose value as read-only and exclude it from managed
rows. Render Contact support as a button, use the collapsible
component for 419 proxy help, and style its list/code markers.
This commit is contained in:
Andras Bacsai
2026-08-07 18:31:19 +02:00
parent 47da47d8e0
commit e50108a905
8 changed files with 78 additions and 24 deletions
@@ -512,6 +512,11 @@ class All extends Component
->where('resourceable_id', $this->resource->id)
->where('is_preview', $isPreview);
$hardcodedKeys = $this->hardcodedEnvironmentVariableKeys();
if ($hardcodedKeys !== []) {
$query->whereNotIn('key', $hardcodedKeys);
}
if ($this->serviceFilters !== []) {
$query->whereRaw('1 = 0');
}
@@ -716,18 +721,6 @@ class All extends Component
return ! str($key)->startsWith(['SERVICE_FQDN_', 'SERVICE_URL_', 'SERVICE_NAME_']);
});
// Filter out variables that exist in database (user has overridden/managed them)
// For preview, check against preview variables; for production, check against production variables
if ($isPreview) {
$managedKeys = $this->resource->environment_variables_preview()->pluck('key')->toArray();
} else {
$managedKeys = $this->resource->environment_variables()->where('is_preview', false)->pluck('key')->toArray();
}
$hardcodedVars = $hardcodedVars->filter(function ($var) use ($managedKeys) {
return ! in_array($var['key'], $managedKeys);
});
if ($this->searchTerm() !== '') {
$hardcodedVars = $hardcodedVars->filter(function ($var) {
return str($var['key'])->contains($this->searchTerm(), true);
@@ -749,6 +742,27 @@ class All extends Component
return $hardcodedVars;
}
/** @return list<string> */
private function hardcodedEnvironmentVariableKeys(): array
{
if (! $this->showsHardcodedEnvironmentVariables()) {
return [];
}
$dockerComposeRaw = $this->resource->docker_compose_raw ?? $this->resource->docker_compose;
if (blank($dockerComposeRaw)) {
return [];
}
return extractHardcodedEnvironmentVariables($dockerComposeRaw)
->pluck('key')
->reject(fn (string $key): bool => str($key)->startsWith(['SERVICE_FQDN_', 'SERVICE_URL_', 'SERVICE_NAME_']))
->unique()
->values()
->all();
}
public function getDevView()
{
$this->variables = $this->formatEnvironmentVariables($this->getEnvironmentVariables(false, false));