Skip to content

Commit a5312bb

Browse files
Bufix: Environment dropdown navigation giving 404 when navigating from application page
1 parent e920c2b commit a5312bb

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

app/utils/routes/environment.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ func EnvironmentNew() string {
2626
return fmt.Sprintf("%s/new", EnvironmentBase)
2727
}
2828

29+
func EnvironmentNewCtx(ctx context.Context) string {
30+
return fmt.Sprintf("%s/%s", ProjectCtx(ctx), EnvironmentNew())
31+
}
32+
2933
func EnvironmentCtx(ctx context.Context) string {
3034
environment, _ := request.EnvironmentFrom(ctx)
3135
return fmt.Sprintf("%s/environment/%d", ProjectCtx(ctx), environment.UID)

app/web/views/components/venvironment/dropdown.templ

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ templ Dropdown(envs []*types.Environment, selectedEnv int64) {
2121
<div class="min-w-full table">
2222
for _, env := range envs {
2323
<div class="relative flex select-none items-center rounded-sm text-xs outline-none hover:bg-overlay-hover hover:text-strong data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 cursor-pointer w-full">
24-
<a class="w-full flex items-center justify-between mx-2 my-1.5" href={ routes.EnvironmentUID(env.UID) }>
24+
<a
25+
class="w-full flex items-center justify-between mx-2 my-1.5"
26+
href={ routes.EnvironmentCtxUID(ctx, env.UID) }
27+
>
2528
<span class="truncate max-w-60">{ env.Name }</span>
2629
if env.UID== selectedEnv {
2730
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6 9 17l-5-5"></path></svg>
@@ -45,7 +48,7 @@ templ Dropdown(envs []*types.Environment, selectedEnv int64) {
4548
>
4649
<a
4750
class="w-full flex items-center gap-2"
48-
href={ routes.ProjectEnvironment }
51+
href={ routes.ProjectCtx(ctx) + "/" + routes.ProjectEnvironment }
4952
>
5053
<p>Manage Environments</p>
5154
</a>
@@ -64,7 +67,7 @@ templ Dropdown(envs []*types.Environment, selectedEnv int64) {
6467
>
6568
<a
6669
class="w-full flex items-center gap-2"
67-
href={ routes.EnvironmentNew() }
70+
href={ routes.EnvironmentNewCtx(ctx) }
6871
>
6972
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-plus"><path d="M5 12h14"></path><path d="M12 5v14"></path></svg>
7073
<p>New Environment</p>

0 commit comments

Comments
 (0)