mirror of
https://github.com/tiennm99/coolify.git
synced 2026-04-17 23:20:43 +00:00
refactor: use Laravel route() helper for shared variable URLs
- Replace hardcoded URL paths in getScopeUrl() with Laravel's route() helper - Add scopeUrls property to EnvVarInput component with named routes - Pass projectUuid and environmentUuid to enable context-specific environment links - Environment scope link now navigates to the specific project/environment shared variables page 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -14,6 +14,8 @@ class EnvVarInput extends Component
|
||||
|
||||
public ?string $htmlId = null;
|
||||
|
||||
public array $scopeUrls = [];
|
||||
|
||||
public function __construct(
|
||||
public ?string $id = null,
|
||||
public ?string $name = null,
|
||||
@@ -33,6 +35,8 @@ class EnvVarInput extends Component
|
||||
public mixed $canResource = null,
|
||||
public bool $autoDisable = true,
|
||||
public array $availableVars = [],
|
||||
public ?string $projectUuid = null,
|
||||
public ?string $environmentUuid = null,
|
||||
) {
|
||||
// Handle authorization-based disabling
|
||||
if ($this->canGate && $this->canResource && $this->autoDisable) {
|
||||
@@ -68,6 +72,18 @@ class EnvVarInput extends Component
|
||||
$this->name = $this->modelBinding !== 'null' ? $this->modelBinding : (string) $this->id;
|
||||
}
|
||||
|
||||
$this->scopeUrls = [
|
||||
'team' => route('shared-variables.team.index'),
|
||||
'project' => route('shared-variables.project.index'),
|
||||
'environment' => $this->projectUuid && $this->environmentUuid
|
||||
? route('shared-variables.environment.show', [
|
||||
'project_uuid' => $this->projectUuid,
|
||||
'environment_uuid' => $this->environmentUuid,
|
||||
])
|
||||
: route('shared-variables.environment.index'),
|
||||
'default' => route('shared-variables.index'),
|
||||
];
|
||||
|
||||
return view('components.forms.env-var-input');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user