fix(ui): replace history entry on redirect so browser back navigation works (#27478)

This commit is contained in:
G30 authored and GitHub committed 2026-07-26 18:44:23 -04:00
1 parent 79695a1d14
commit 11d72c1ce2
13 files changed
+24 -24

No files matched your search

+2 -2
View File
@@ -14,12 +14,12 @@
onMount(async () => { onMount(async () => {
if ($user?.role !== 'admin') { if ($user?.role !== 'admin') {
await goto('/'); await goto('/', { replaceState: true });
} else if ( } else if (
!$config?.features?.enable_plugins && !$config?.features?.enable_plugins &&
$page.url.pathname.includes('/admin/functions') $page.url.pathname.includes('/admin/functions')
) { ) {
await goto('/admin'); await goto('/admin', { replaceState: true });
} }
loaded = true; loaded = true;
}); });
+1 -1
View File
@@ -3,6 +3,6 @@
import { onMount } from 'svelte'; import { onMount } from 'svelte';
onMount(() => { onMount(() => {
goto('/admin/users'); goto('/admin/users', { replaceState: true });
}); });
</script> </script>
@@ -5,7 +5,7 @@
onMount(() => { onMount(() => {
if (!($config?.features.enable_admin_analytics ?? true)) { if (!($config?.features.enable_admin_analytics ?? true)) {
goto('/admin'); goto('/admin', { replaceState: true });
} else { } else {
goto('/?settings=admin%3Aanalytics', { replaceState: true }); goto('/?settings=admin%3Aanalytics', { replaceState: true });
} }
@@ -5,7 +5,7 @@
onMount(() => { onMount(() => {
if (!($config?.features.enable_admin_analytics ?? true)) { if (!($config?.features.enable_admin_analytics ?? true)) {
goto('/admin'); goto('/admin', { replaceState: true });
} else { } else {
goto('/?settings=admin%3Aanalytics', { replaceState: true }); goto('/?settings=admin%3Aanalytics', { replaceState: true });
} }
@@ -3,6 +3,6 @@
import { onMount } from 'svelte'; import { onMount } from 'svelte';
onMount(() => { onMount(() => {
goto('/admin/evaluations/leaderboard'); goto('/admin/evaluations/leaderboard', { replaceState: true });
}); });
</script> </script>
@@ -8,7 +8,7 @@
onMount(async () => { onMount(async () => {
if (!$config?.features?.enable_plugins) { if (!$config?.features?.enable_plugins) {
await goto('/admin'); await goto('/admin', { replaceState: true });
return; return;
} }
@@ -62,7 +62,7 @@
onMount(() => { onMount(() => {
if (!$config?.features?.enable_plugins) { if (!$config?.features?.enable_plugins) {
goto('/admin'); goto('/admin', { replaceState: true });
return; return;
} }
@@ -61,7 +61,7 @@
onMount(async () => { onMount(async () => {
if (!$config?.features?.enable_plugins) { if (!$config?.features?.enable_plugins) {
goto('/admin'); goto('/admin', { replaceState: true });
return; return;
} }
+1 -1
View File
@@ -3,6 +3,6 @@
import { onMount } from 'svelte'; import { onMount } from 'svelte';
onMount(async () => { onMount(async () => {
await goto('/admin/users/overview'); await goto('/admin/users/overview', { replaceState: true });
}); });
</script> </script>
+5 -5
View File
@@ -80,24 +80,24 @@
onMount(async () => { onMount(async () => {
if ($user?.role !== 'admin') { if ($user?.role !== 'admin') {
if ($page.url.pathname.includes('/models') && !$user?.permissions?.workspace?.models) { if ($page.url.pathname.includes('/models') && !$user?.permissions?.workspace?.models) {
goto('/'); goto('/', { replaceState: true });
} else if ( } else if (
$page.url.pathname.includes('/knowledge') && $page.url.pathname.includes('/knowledge') &&
!$user?.permissions?.workspace?.knowledge !$user?.permissions?.workspace?.knowledge
) { ) {
goto('/'); goto('/', { replaceState: true });
} else if ( } else if (
$page.url.pathname.includes('/prompts') && $page.url.pathname.includes('/prompts') &&
!$user?.permissions?.workspace?.prompts !$user?.permissions?.workspace?.prompts
) { ) {
goto('/'); goto('/', { replaceState: true });
} else if ( } else if (
$page.url.pathname.includes('/tools') && $page.url.pathname.includes('/tools') &&
(!$config?.features?.enable_plugins || !$user?.permissions?.workspace?.tools) (!$config?.features?.enable_plugins || !$user?.permissions?.workspace?.tools)
) { ) {
goto('/'); goto('/', { replaceState: true });
} else if ($page.url.pathname.includes('/skills') && !$user?.permissions?.workspace?.skills) { } else if ($page.url.pathname.includes('/skills') && !$user?.permissions?.workspace?.skills) {
goto('/'); goto('/', { replaceState: true });
} }
} }
+7 -7
View File
@@ -6,20 +6,20 @@
onMount(() => { onMount(() => {
if ($user?.role !== 'admin') { if ($user?.role !== 'admin') {
if ($user?.permissions?.workspace?.models) { if ($user?.permissions?.workspace?.models) {
goto('/workspace/models'); goto('/workspace/models', { replaceState: true });
} else if ($user?.permissions?.workspace?.knowledge) { } else if ($user?.permissions?.workspace?.knowledge) {
goto('/workspace/knowledge'); goto('/workspace/knowledge', { replaceState: true });
} else if ($user?.permissions?.workspace?.prompts) { } else if ($user?.permissions?.workspace?.prompts) {
goto('/workspace/prompts'); goto('/workspace/prompts', { replaceState: true });
} else if ($config?.features?.enable_plugins && $user?.permissions?.workspace?.tools) { } else if ($config?.features?.enable_plugins && $user?.permissions?.workspace?.tools) {
goto('/workspace/tools'); goto('/workspace/tools', { replaceState: true });
} else if ($user?.permissions?.workspace?.skills) { } else if ($user?.permissions?.workspace?.skills) {
goto('/workspace/skills'); goto('/workspace/skills', { replaceState: true });
} else { } else {
goto('/'); goto('/', { replaceState: true });
} }
} else { } else {
goto('/workspace/models'); goto('/workspace/models', { replaceState: true });
} }
}); });
</script> </script>
@@ -3,6 +3,6 @@
import { onMount } from 'svelte'; import { onMount } from 'svelte';
onMount(() => { onMount(() => {
goto('/admin/functions/create'); goto('/admin/functions/create', { replaceState: true });
}); });
</script> </script>
@@ -7,7 +7,7 @@
onMount(() => { onMount(() => {
if (!$config?.features?.enable_plugins) { if (!$config?.features?.enable_plugins) {
goto('/workspace'); goto('/workspace', { replaceState: true });
} }
}); });
</script> </script>