MCPcopy Create free account
hub / github.com/bywwcnll/StreamPanel / exportCurrentToCSV

Function exportCurrentToCSV

devtools/panel.bundle.js:2628–2649  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2626 }
2627
2628 function exportCurrentToCSV() {
2629 const connection = state.connections[state.selectedConnectionId];
2630 if (!connection) {
2631 alert('请先选择一个连接');
2632 return;
2633 }
2634
2635 const messages = getVisibleMessages(connection.messages);
2636 if (messages.length === 0) {
2637 alert('当前连接没有消息可导出');
2638 return;
2639 }
2640
2641 const formattedMessages = messages.map(msg => ({
2642 ...msg,
2643 timestamp: formatTimestampForExport(msg.timestamp)
2644 }));
2645
2646 const csv = messagesToCSV(formattedMessages, getConnectionExportInfo(connection));
2647 const filename = `stream-messages-${connection.id.substring(0, 8)}-${Date.now()}.csv`;
2648 downloadFile(csv, filename, 'text/csv');
2649 }
2650
2651 function exportAllToCSV() {
2652 const connections = Object.values(state.connections);

Callers 1

handleExportFunction · 0.70

Calls 5

getVisibleMessagesFunction · 0.70
formatTimestampForExportFunction · 0.70
messagesToCSVFunction · 0.70
getConnectionExportInfoFunction · 0.70
downloadFileFunction · 0.70

Tested by

no test coverage detected