mirror of
https://github.com/tiennm99/coolify.git
synced 2026-04-17 17:21:04 +00:00
Fix PostgreSQL version selection in global search redirect
Allow users to select PostgreSQL version instead of automatically creating postgres:16-alpine when using global search. The fix includes: - Remove hardcoded database_image parameter from GlobalSearch - Update Create.php to fall through to Select component when database_image is not provided - Add type and destination to Select component query string with proper URL mapping - Jump directly to PostgreSQL version selection step when navigating from global search 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1314,11 +1314,6 @@ class GlobalSearch extends Component
|
||||
'server_id' => $this->selectedServerId,
|
||||
];
|
||||
|
||||
// PostgreSQL requires a database_image parameter
|
||||
if ($this->selectedResourceType === 'postgresql') {
|
||||
$queryParams['database_image'] = 'postgres:16-alpine';
|
||||
}
|
||||
|
||||
$this->redirect(route('project.resource.create', [
|
||||
'project_uuid' => $this->selectedProjectUuid,
|
||||
'environment_uuid' => $this->selectedEnvironmentUuid,
|
||||
|
||||
@@ -53,6 +53,8 @@ class Select extends Component
|
||||
|
||||
protected $queryString = [
|
||||
'server_id',
|
||||
'type' => ['except' => ''],
|
||||
'destination_uuid' => ['except' => '', 'as' => 'destination'],
|
||||
];
|
||||
|
||||
public function mount()
|
||||
@@ -66,6 +68,20 @@ class Select extends Component
|
||||
$project = Project::whereUuid($projectUuid)->firstOrFail();
|
||||
$this->environments = $project->environments;
|
||||
$this->selectedEnvironment = $this->environments->where('uuid', data_get($this->parameters, 'environment_uuid'))->firstOrFail()->name;
|
||||
|
||||
// Check if we have all required params for PostgreSQL type selection
|
||||
// This handles navigation from global search
|
||||
$queryType = request()->query('type');
|
||||
$queryServerId = request()->query('server_id');
|
||||
$queryDestination = request()->query('destination');
|
||||
|
||||
if ($queryType === 'postgresql' && $queryServerId !== null && $queryDestination) {
|
||||
$this->type = $queryType;
|
||||
$this->server_id = $queryServerId;
|
||||
$this->destination_uuid = $queryDestination;
|
||||
$this->server = Server::find($queryServerId);
|
||||
$this->current_step = 'select-postgresql-type';
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
return handleError($e, $this);
|
||||
}
|
||||
|
||||
@@ -35,6 +35,13 @@ class Create extends Component
|
||||
|
||||
if (in_array($type, DATABASE_TYPES)) {
|
||||
if ($type->value() === 'postgresql') {
|
||||
// PostgreSQL requires database_image to be explicitly set
|
||||
// If not provided, fall through to Select component for version selection
|
||||
if (! $database_image) {
|
||||
$this->type = $type->value();
|
||||
|
||||
return;
|
||||
}
|
||||
$database = create_standalone_postgresql(
|
||||
environmentId: $environment->id,
|
||||
destinationUuid: $destination_uuid,
|
||||
|
||||
Reference in New Issue
Block a user