Close workbench P0 resource lifecycle gaps

This commit is contained in:
lix-2026
2026-05-20 20:48:18 +08:00
parent e0b0e70fb8
commit fe13444dbc
14 changed files with 610 additions and 7 deletions
+29 -4
View File
@@ -3844,7 +3844,7 @@ const SIDEBAR_TREE_JS: &str = r##"
if (folderCount > 0) parts.push(folderCount + ' ');
if (fileCount > 0) parts.push(fileCount + ' 10 ');
if (mindmapCount > 0) parts.push(mindmapCount + ' 10 ');
if (tableCount > 0) parts.push(tableCount + ' 线');
if (tableCount > 0) parts.push(tableCount + (currentSourceKind() === 'local_folder' ? ' 线10 ' : ' 线'));
return ' ' + parts.join(' + ') + ' ';
}
@@ -4006,10 +4006,18 @@ const SIDEBAR_TREE_JS: &str = r##"
var tableRow = plan.tableRows[t];
var tableId = fileTreeRowAssetId(tableRow);
try {
var tableResponse = await fetch('/api/tables/' + encodeURIComponent(tableId), { method: 'DELETE' });
if (!tableResponse.ok) throw new Error('table_delete_failed_' + tableResponse.status);
if (currentSourceKind() === 'local_folder') {
await dispatchTreeCommand(trigger || tableRow, {
action: 'archive',
workspaceId: resolveWorkspaceId(tableRow),
documentId: tableId
});
} else {
var tableResponse = await fetch('/api/tables/' + encodeURIComponent(tableId), { method: 'DELETE' });
if (!tableResponse.ok) throw new Error('table_delete_failed_' + tableResponse.status);
window.dispatchEvent(new CustomEvent('online-table-deleted', { detail: { tableId: tableId } }));
}
removeFileTreeAssetRow(tableId);
window.dispatchEvent(new CustomEvent('online-table-deleted', { detail: { tableId: tableId } }));
} catch (error) {
failures.push(tableId);
}
@@ -9187,6 +9195,23 @@ mod tests {
assert!(SIDEBAR_TREE_JS.contains("确认删除选中的 "));
}
#[test]
fn sidebar_filetree_local_table_bulk_delete_uses_tree_command() {
let table_loop_start = SIDEBAR_TREE_JS
.find("for (var t = 0; t < plan.tableRows.length; t += 1)")
.expect("table bulk delete loop");
let table_loop_end = SIDEBAR_TREE_JS[table_loop_start..]
.find("sidebarFileTreeSelection.selectedRowIds")
.map(|offset| table_loop_start + offset)
.expect("table bulk delete loop end");
let table_loop = &SIDEBAR_TREE_JS[table_loop_start..table_loop_end];
assert!(table_loop.contains("currentSourceKind() === 'local_folder'"));
assert!(table_loop.contains("dispatchTreeCommand(trigger || tableRow"));
assert!(table_loop.contains("action: 'archive'"));
assert!(table_loop.contains("documentId: tableId"));
assert!(table_loop.contains("/api/tables/"));
}
#[test]
fn sidebar_tree_runtime_keeps_pdf_and_code_assets_out_of_onlyoffice() {
assert!(SIDEBAR_TREE_JS.contains("function inferOnlyOfficeFileType"));
+18
View File
@@ -2426,6 +2426,24 @@ body {
opacity: 0.65;
}
.mnote-close-guard-notice {
display: flex;
align-items: center;
min-height: 34px;
padding: 7px 16px;
border-bottom: 1px solid #fecaca;
background: #fff3f3;
color: #991b1b;
font-size: 13px;
line-height: 1.45;
transition: opacity 160ms ease;
}
.mnote-close-guard-notice.is-hiding {
opacity: 0;
pointer-events: none;
}
.mnote-main-tab-badge {
width: 14px;
height: 14px;