Close workbench P0 resource lifecycle gaps
This commit is contained in:
@@ -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"));
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user