refactor: extract filetree document workspace preflight

This commit is contained in:
lix-2026
2026-05-25 09:28:50 +08:00
parent 5e427a469a
commit 812504924f
3 changed files with 43 additions and 1 deletions
@@ -3116,6 +3116,12 @@ const SIDEBAR_TREE_JS: &str = r##"
}
function fileTreeDocumentWorkspacesForUploadPreflight(workspaceId) {
var runtimeFn = fileTreeRuntimeFunction('fileTreeDocumentWorkspacesForUploadPreflight');
if (runtimeFn) {
return runtimeFn(workspaceId, Object.assign({}, fileTreeRuntimeDeps(), {
fileTreeRowsForUploadPreflight: fileTreeRowsForUploadPreflight
}));
}
var seen = new Set();
return fileTreeRowsForUploadPreflight().filter(function(row) {
if (!row.documentId || seen.has(row.documentId)) return false;
@@ -11186,6 +11192,9 @@ mod tests {
assert!(FILETREE_RUNTIME_JS.contains("function fileTreeDocumentParentsForPreflight"));
assert!(FILETREE_RUNTIME_JS.contains("function fileTreeTargetChildrenForPreflight"));
assert!(FILETREE_RUNTIME_JS.contains("function fileTreeDropPreflightRows"));
assert!(
FILETREE_RUNTIME_JS.contains("function fileTreeDocumentWorkspacesForUploadPreflight")
);
assert!(FILETREE_RUNTIME_JS.contains("function readProjection"));
assert!(FILETREE_RUNTIME_JS.contains("function readSidebarDataset"));
assert!(FILETREE_RUNTIME_JS.contains("function readDatasetProjection"));
@@ -11217,6 +11226,13 @@ mod tests {
assert!(
FILETREE_RUNTIME_JS.contains("fileTreeDropPreflightRows: fileTreeDropPreflightRows")
);
assert!(FILETREE_RUNTIME_JS.contains(
"fileTreeDocumentWorkspacesForUploadPreflight: fileTreeDocumentWorkspacesForUploadPreflight"
));
assert!(SIDEBAR_TREE_JS
.contains("fileTreeRuntimeFunction('fileTreeDocumentWorkspacesForUploadPreflight')"));
assert!(SIDEBAR_TREE_JS
.contains("fileTreeRowsForUploadPreflight: fileTreeRowsForUploadPreflight"));
assert!(FILETREE_RUNTIME_JS
.contains("uploadIntent: String(detail.uploadIntent || 'filetree.folder.drop')"));
assert!(FILETREE_RUNTIME_JS