feat(wiki): add "View in Graph" entry on wiki page

Add a link in the wiki page header that navigates to the graph tab
with the page slug pre-selected, so users can jump from a wiki page
to its corresponding graph node in one click.
This commit is contained in:
wizardchen
2026-05-22 20:58:29 +08:00
committed by lyingbug
parent 744a367f16
commit a469ee6a36
2 changed files with 23 additions and 1 deletions
@@ -72,6 +72,12 @@ const wikiIndexingTip = computed(() => {
const onWikiStatusChange = (payload: { pendingTasks: number; isActive: boolean; pendingIssues: number }) => {
wikiStatus.value = payload
}
const onViewWikiInGraph = async (slug: string) => {
// Write tab+slug first so the activeKbTab watcher's later replace
// (which spreads route.query) preserves slug instead of clobbering it.
await router.replace({ query: { ...route.query, tab: 'graph', slug } })
activeKbTab.value = 'graph'
}
let wikiStatusTimer: ReturnType<typeof setInterval> | null = null
let wikiStatusProbeTimers: Array<ReturnType<typeof setTimeout>> = []
@@ -2099,7 +2105,8 @@ async function createNewSession(value: string): Promise<void> {
<!-- Wiki Browser / Graph (shown when wiki or graph tab is active) -->
<div v-if="isWiki && (activeKbTab === 'wiki' || activeKbTab === 'graph')" class="wiki-main-area">
<WikiBrowser v-if="kbId" :knowledge-base-id="kbId" :view="activeKbTab === 'graph' ? 'graph' : 'browser'"
:can-edit="canEdit" @open-source-doc="openSourceDoc" @status-change="onWikiStatusChange" />
:can-edit="canEdit" @open-source-doc="openSourceDoc" @status-change="onWikiStatusChange"
@view-graph="onViewWikiInGraph" />
</div>
<template v-if="activeKbTab === 'documents' || !isWiki">