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:
@@ -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">
|
||||
|
||||
@@ -424,6 +424,15 @@
|
||||
</t-tag>
|
||||
<span class="wiki-reader-meta-text">{{ $t('knowledgeEditor.wikiBrowser.version', { ver: selectedPage.version }) }}</span>
|
||||
<span class="wiki-reader-meta-text">{{ formatDate(selectedPage.updated_at) }}</span>
|
||||
<t-link
|
||||
theme="primary"
|
||||
hover="color"
|
||||
class="wiki-reader-graph-link"
|
||||
@click="emit('view-graph', selectedPage.slug)"
|
||||
>
|
||||
<template #prefixIcon><t-icon name="chart-bubble" /></template>
|
||||
{{ $t('knowledgeEditor.wikiBrowser.viewInGraph') }}
|
||||
</t-link>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -684,6 +693,7 @@ const props = defineProps<{
|
||||
const emit = defineEmits<{
|
||||
(e: 'open-source-doc', knowledgeId: string): void
|
||||
(e: 'status-change', payload: { pendingTasks: number; isActive: boolean; pendingIssues: number }): void
|
||||
(e: 'view-graph', slug: string): void
|
||||
}>()
|
||||
const pages = ref<WikiPage[]>([])
|
||||
const selectedPage = ref<WikiPage | null>(null)
|
||||
@@ -3934,6 +3944,11 @@ onUnmounted(() => {
|
||||
color: var(--td-text-color-placeholder);
|
||||
}
|
||||
|
||||
.wiki-reader-graph-link {
|
||||
margin-left: auto;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.wiki-reader-links {
|
||||
padding: 12px 16px;
|
||||
background: var(--td-bg-color-secondarycontainer);
|
||||
|
||||
Reference in New Issue
Block a user