Skip to content

Commit 4add20a

Browse files
author
Jicheng Lu
committed
add reporting slug
1 parent 9975c07 commit 4add20a

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

src/routes/page/agent/reporting/+page.svelte renamed to src/routes/page/agent/reporting/[reportType]/+page.svelte

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,31 @@
11
<script>
2-
import { onMount, onDestroy } from 'svelte';
2+
import { onMount, onDestroy, afterUpdate } from 'svelte';
3+
import { derived } from 'svelte/store';
34
import { page } from '$app/stores';
45
import { _ } from 'svelte-i18n';
56
import { Card, CardBody, Col, Row } from '@sveltestrap/sveltestrap';
67
import HeadTitle from "$lib/common/HeadTitle.svelte";
78
import Breadcrumb from '$lib/common/Breadcrumb.svelte';
89
import { globalMenuStore } from '$lib/helpers/store';
10+
911
1012
/** @type {any} */
11-
let unsubscriber;
13+
let menuUnsubscribe;
14+
15+
/** @type {string} */
16+
let curSlug = '';
17+
18+
const slug = derived(page, $page => $page.params.reportType);
19+
20+
const contentSubscribe = slug.subscribe(value => {
21+
if (curSlug && curSlug !== value) {
22+
location.reload();
23+
}
24+
curSlug = value;
25+
});
1226
1327
onMount(async () => {
14-
unsubscriber = globalMenuStore.subscribe((/** @type {import('$pluginTypes').PluginMenuDefModel[]} */ menu) => {
28+
menuUnsubscribe = globalMenuStore.subscribe((/** @type {import('$pluginTypes').PluginMenuDefModel[]} */ menu) => {
1529
const url = getPathUrl();
1630
let data = menu.find(x => x.link === url)?.embeddingInfo || null;
1731
if (!data) {
@@ -23,7 +37,8 @@
2337
});
2438
2539
onDestroy(() => {
26-
unsubscriber?.();
40+
menuUnsubscribe?.();
41+
contentSubscribe?.();
2742
});
2843
2944

svelte.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const config = {
4949
"/page/agent",
5050
"/page/agent/router",
5151
"/page/agent/evaluator",
52-
"/page/agent/reporting",
52+
"/page/agent/reporting/[reportType]",
5353
"/page/agent/[agentId]",
5454
"/page/agent/[agentId]/build",
5555
"/page/agent/[agentId]/train",

0 commit comments

Comments
 (0)