fix(ui): replace history entry on redirect so browser back navigation works (#27478)
This commit is contained in:
@@ -14,12 +14,12 @@
|
||||
|
||||
onMount(async () => {
|
||||
if ($user?.role !== 'admin') {
|
||||
await goto('/');
|
||||
await goto('/', { replaceState: true });
|
||||
} else if (
|
||||
!$config?.features?.enable_plugins &&
|
||||
$page.url.pathname.includes('/admin/functions')
|
||||
) {
|
||||
await goto('/admin');
|
||||
await goto('/admin', { replaceState: true });
|
||||
}
|
||||
loaded = true;
|
||||
});
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
onMount(() => {
|
||||
goto('/admin/users');
|
||||
goto('/admin/users', { replaceState: true });
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
onMount(() => {
|
||||
if (!($config?.features.enable_admin_analytics ?? true)) {
|
||||
goto('/admin');
|
||||
goto('/admin', { replaceState: true });
|
||||
} else {
|
||||
goto('/?settings=admin%3Aanalytics', { replaceState: true });
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
onMount(() => {
|
||||
if (!($config?.features.enable_admin_analytics ?? true)) {
|
||||
goto('/admin');
|
||||
goto('/admin', { replaceState: true });
|
||||
} else {
|
||||
goto('/?settings=admin%3Aanalytics', { replaceState: true });
|
||||
}
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
onMount(() => {
|
||||
goto('/admin/evaluations/leaderboard');
|
||||
goto('/admin/evaluations/leaderboard', { replaceState: true });
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
onMount(async () => {
|
||||
if (!$config?.features?.enable_plugins) {
|
||||
await goto('/admin');
|
||||
await goto('/admin', { replaceState: true });
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
|
||||
onMount(() => {
|
||||
if (!$config?.features?.enable_plugins) {
|
||||
goto('/admin');
|
||||
goto('/admin', { replaceState: true });
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
|
||||
onMount(async () => {
|
||||
if (!$config?.features?.enable_plugins) {
|
||||
goto('/admin');
|
||||
goto('/admin', { replaceState: true });
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
onMount(async () => {
|
||||
await goto('/admin/users/overview');
|
||||
await goto('/admin/users/overview', { replaceState: true });
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -80,24 +80,24 @@
|
||||
onMount(async () => {
|
||||
if ($user?.role !== 'admin') {
|
||||
if ($page.url.pathname.includes('/models') && !$user?.permissions?.workspace?.models) {
|
||||
goto('/');
|
||||
goto('/', { replaceState: true });
|
||||
} else if (
|
||||
$page.url.pathname.includes('/knowledge') &&
|
||||
!$user?.permissions?.workspace?.knowledge
|
||||
) {
|
||||
goto('/');
|
||||
goto('/', { replaceState: true });
|
||||
} else if (
|
||||
$page.url.pathname.includes('/prompts') &&
|
||||
!$user?.permissions?.workspace?.prompts
|
||||
) {
|
||||
goto('/');
|
||||
goto('/', { replaceState: true });
|
||||
} else if (
|
||||
$page.url.pathname.includes('/tools') &&
|
||||
(!$config?.features?.enable_plugins || !$user?.permissions?.workspace?.tools)
|
||||
) {
|
||||
goto('/');
|
||||
goto('/', { replaceState: true });
|
||||
} else if ($page.url.pathname.includes('/skills') && !$user?.permissions?.workspace?.skills) {
|
||||
goto('/');
|
||||
goto('/', { replaceState: true });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,20 +6,20 @@
|
||||
onMount(() => {
|
||||
if ($user?.role !== 'admin') {
|
||||
if ($user?.permissions?.workspace?.models) {
|
||||
goto('/workspace/models');
|
||||
goto('/workspace/models', { replaceState: true });
|
||||
} else if ($user?.permissions?.workspace?.knowledge) {
|
||||
goto('/workspace/knowledge');
|
||||
goto('/workspace/knowledge', { replaceState: true });
|
||||
} else if ($user?.permissions?.workspace?.prompts) {
|
||||
goto('/workspace/prompts');
|
||||
goto('/workspace/prompts', { replaceState: true });
|
||||
} else if ($config?.features?.enable_plugins && $user?.permissions?.workspace?.tools) {
|
||||
goto('/workspace/tools');
|
||||
goto('/workspace/tools', { replaceState: true });
|
||||
} else if ($user?.permissions?.workspace?.skills) {
|
||||
goto('/workspace/skills');
|
||||
goto('/workspace/skills', { replaceState: true });
|
||||
} else {
|
||||
goto('/');
|
||||
goto('/', { replaceState: true });
|
||||
}
|
||||
} else {
|
||||
goto('/workspace/models');
|
||||
goto('/workspace/models', { replaceState: true });
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
onMount(() => {
|
||||
goto('/admin/functions/create');
|
||||
goto('/admin/functions/create', { replaceState: true });
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
onMount(() => {
|
||||
if (!$config?.features?.enable_plugins) {
|
||||
goto('/workspace');
|
||||
goto('/workspace', { replaceState: true });
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user