fix: hide explorer action for inbox links
This commit is contained in:
parent
91b5629e01
commit
a8df9d118c
|
|
@ -902,6 +902,11 @@
|
|||
return item?.sourceKind || item?.captureKind || item?.type || ''
|
||||
}
|
||||
|
||||
function canShowInboxArtifactInFolder(item) {
|
||||
const kind = inboxArtifactKind(item)
|
||||
return kind !== 'url' && item?.type !== 'link'
|
||||
}
|
||||
|
||||
function fileRecordToPreviewItem(item, record) {
|
||||
return {
|
||||
id: item.id,
|
||||
|
|
@ -2584,7 +2589,9 @@
|
|||
{/if}
|
||||
<button class="btn btn-sm btn-primary" on:click|stopPropagation={() => openAssignInbox(item)}>{t('inbox.assign')}</button>
|
||||
<button class="btn btn-sm" on:click|stopPropagation={() => openInboxArtifact(item)}>{t('common.open')}</button>
|
||||
{#if canShowInboxArtifactInFolder(item)}
|
||||
<button class="btn btn-sm" on:click|stopPropagation={() => openNodeFolder(item)}>{t('file.showInExplorer')}</button>
|
||||
{/if}
|
||||
<button class="btn btn-sm btn-danger" on:click|stopPropagation={() => confirmDeleteInbox(item)}>{t('common.delete')}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -144,6 +144,7 @@ async function runReadyScenario(cdp, url) {
|
|||
await clickText(cdp, '.inbox-header .btn', 'Вставить из буфера')
|
||||
await assertText(cdp, 'example.test', 'inbox: clipboard URL captured')
|
||||
await assertText(cdp, 'Ссылка', 'inbox: clipboard URL kind visible')
|
||||
await assertInboxItemButtonAbsent(cdp, 'example.test', 'Показать в проводнике', 'inbox: link has no explorer action')
|
||||
await clickInboxItemButton(cdp, 'example.test', 'Открыть')
|
||||
await assertEval(cdp, `window.__VERSTAK_GUI_SMOKE__.state.openedUrls.includes('https://example.test/from-clipboard')`, 'inbox: open URL launches external URL')
|
||||
await clickInboxItemButton(cdp, 'example.test', 'Разложить')
|
||||
|
|
@ -485,6 +486,19 @@ async function clickInboxItemButton(cdp, title, buttonText) {
|
|||
await sleep(250)
|
||||
}
|
||||
|
||||
async function assertInboxItemButtonAbsent(cdp, title, buttonText, label) {
|
||||
await assertEval(cdp, `
|
||||
(() => {
|
||||
const norm = (value) => (value || '').replace(/\\s+/g, ' ').trim();
|
||||
const row = [...document.querySelectorAll('.inbox-item')]
|
||||
.find((node) => norm(node.innerText || node.textContent).includes(${JSON.stringify(title)}));
|
||||
if (!row) return false;
|
||||
return ![...row.querySelectorAll('button')]
|
||||
.some((node) => norm(node.innerText || node.textContent).includes(${JSON.stringify(buttonText)}));
|
||||
})()
|
||||
`, label)
|
||||
}
|
||||
|
||||
async function evalValue(cdp, expression) {
|
||||
const result = await cdp.send('Runtime.evaluate', {
|
||||
expression,
|
||||
|
|
|
|||
Loading…
Reference in New Issue