fix: show inbox capture target context

This commit is contained in:
mirivlad 2026-06-05 08:10:33 +08:00
parent a8df9d118c
commit 22b05f57b4
4 changed files with 22 additions and 11 deletions

View File

@ -1487,6 +1487,15 @@
if (!source) return ''
return t('capture.source.' + source)
}
function inboxMetaText(item) {
const parts = []
if (item.captureKind) parts.push(captureKindLabel(item.captureKind))
if (item.captureSource) parts.push(captureSourceLabel(item.captureSource))
if (item.captureContextLabel) parts.push(`${t('inbox.capturedIn')}: ${item.captureContextLabel}`)
if (item.suggestedTargetLabel) parts.push(`${t('inbox.suggestedTarget')}: ${item.suggestedTargetLabel}`)
parts.push(formatDate(item.capturedAt || item.createdAt))
return parts.filter(Boolean).join(' · ')
}
function addInboxCapture(item) {
if (!item || !item.id) return
inboxNodes = [item, ...inboxNodes.filter(existing => existing.id !== item.id)]
@ -2345,12 +2354,7 @@
<div class="inbox-item" role="button" tabindex="0" on:click={() => openInboxArtifact(item)} on:keydown={(e) => e.key === 'Enter' && openInboxArtifact(item)}>
<div class="inbox-item-main">
<span class="inbox-item-title">{item.title}</span>
<span class="inbox-item-meta">
{#if item.captureKind}{captureKindLabel(item.captureKind)} · {/if}
{#if item.captureSource}{captureSourceLabel(item.captureSource)} · {/if}
{#if item.captureContextLabel}{t('inbox.capturedIn')}: {item.captureContextLabel} · {/if}
{formatDate(item.capturedAt || item.createdAt)}
</span>
<span class="inbox-item-meta">{inboxMetaText(item)}</span>
</div>
<div class="inbox-item-actions">
<button class="btn btn-sm btn-primary" on:click|stopPropagation={() => resolveInboxHere(item)}>{t('inbox.keepHere')}</button>
@ -2577,11 +2581,7 @@
<div class="inbox-item" role="button" tabindex="0" on:click={() => openInboxArtifact(item)} on:keydown={(e) => e.key === 'Enter' && openInboxArtifact(item)}>
<div class="inbox-item-main">
<span class="inbox-item-title">{item.title}</span>
<span class="inbox-item-meta">
{#if item.captureKind}{captureKindLabel(item.captureKind)} · {/if}
{#if item.captureSource}{captureSourceLabel(item.captureSource)} · {/if}
{formatDate(item.createdAt)}
</span>
<span class="inbox-item-meta">{inboxMetaText(item)}</span>
</div>
<div class="inbox-item-actions">
{#if item.suggestedTargetNodeId}

View File

@ -34,6 +34,7 @@ export default {
'inbox.keepHere': 'Keep here',
'inbox.localEmpty': 'No unprocessed materials for this case',
'inbox.capturedIn': 'Captured in',
'inbox.suggestedTarget': 'Target',
'inbox.assignTitle': 'Assign material',
'inbox.assignTarget': 'Case',
'inbox.assignSearchPlaceholder': 'Find case',

View File

@ -35,6 +35,7 @@ export default {
'inbox.keepHere': 'Оставить здесь',
'inbox.localEmpty': 'Для этого дела неразобранных материалов нет',
'inbox.capturedIn': 'Захвачено в',
'inbox.suggestedTarget': 'Цель',
'inbox.assignTitle': 'Разложить материал',
'inbox.assignTarget': 'Дело',
'inbox.assignSearchPlaceholder': 'Найти дело',

View File

@ -263,6 +263,15 @@ async function runReadyScenario(cdp, url) {
await clickText(cdp, '.tab', 'Активность')
await assertText(cdp, 'Smoke activity', 'activity: per-node activity visible')
await emitDroppedFiles(cdp, ['/tmp/project-context-file.txt'])
await clickText(cdp, '.nav-item', 'Неразобранное')
await assertText(cdp, 'project-context-file.txt', 'inbox: node-context capture visible globally')
await assertText(cdp, 'Захвачено в: Smoke Project', 'inbox: global list shows capture context')
await assertText(cdp, 'Цель: Smoke Project', 'inbox: global list shows suggested target')
await clickInboxItemButton(cdp, 'project-context-file.txt', 'Удалить')
await clickText(cdp, '.overlay .btn', 'Удалить')
await assertEval(cdp, `!document.querySelector('.inbox-screen')?.innerText.includes('project-context-file.txt')`, 'inbox: node-context capture can be deleted')
await clickText(cdp, '.nav-item', 'Сегодня')
await assertText(cdp, 'Сегодня', 'today: system view opens')
await assertText(cdp, 'Smoke Project', 'today: dashboard data visible')