chore: improve download graph log

This commit is contained in:
hjlarry
2026-02-11 10:54:07 +08:00
parent 439d931e9f
commit d64d796815
2 changed files with 35 additions and 3 deletions

View File

@ -42,6 +42,13 @@ const Header = () => {
else
setShowAccountSettingModal({ payload: ACCOUNT_SETTING_TAB.BILLING })
}, [isFreePlan, setShowAccountSettingModal, setShowPricingModal])
const handleDownloadGraphImportLog = useCallback(() => {
void import('@/app/components/workflow/collaboration/core/collaboration-manager')
.then(({ collaborationManager }) => {
collaborationManager.downloadGraphImportLog()
})
.catch(() => {})
}, [])
const renderLogo = () => (
<h1>
@ -106,6 +113,14 @@ const Header = () => {
{!isCurrentWorkspaceDatasetOperator && <ToolsNav className={navClassName} />}
</div>
<div className="flex min-w-0 flex-[1] items-center justify-end pl-2 pr-3 min-[1280px]:pl-3">
<button
type="button"
data-testid="workflow-import-log-download"
className="left-full top-1/2 ml-1 h-3 w-3 -translate-y-1/2 opacity-0"
aria-hidden="true"
tabIndex={-1}
onClick={handleDownloadGraphImportLog}
/>
<EnvNav />
<div className="mr-2">
<PluginsNav />

View File

@ -1079,13 +1079,30 @@ export class CollaborationManager {
}
downloadGraphImportLog(): void {
if (this.graphImportLogs.length === 0)
return
const reactFlowState = this.reactFlowStore?.getState()
const payload = {
appId: this.currentAppId,
generatedAt: new Date().toISOString(),
entries: this.graphImportLogs,
summary: {
logCount: this.graphImportLogs.length,
leaderId: this.leaderId,
isLeader: this.isLeader,
graphViewActive: this.graphViewActive,
pendingInitialSync: this.pendingInitialSync,
isConnected: this.isConnected(),
hasDoc: Boolean(this.doc),
hasReactFlowStore: Boolean(this.reactFlowStore),
onlineUsersCount: this.onlineUsers.length,
crdtCounts: {
nodes: this.getNodes().length,
edges: this.getEdges().length,
},
reactFlowCounts: {
nodes: reactFlowState?.getNodes().length ?? 0,
edges: reactFlowState?.getEdges().length ?? 0,
},
},
}
const stamp = new Date().toISOString().replace(/[:.]/g, '-')
const appSuffix = this.currentAppId ?? 'unknown'