diff --git a/components/dashboard/network-timeline.tsx b/components/dashboard/network-timeline.tsx index 83e1bf5..305d565 100644 --- a/components/dashboard/network-timeline.tsx +++ b/components/dashboard/network-timeline.tsx @@ -136,6 +136,31 @@ export function NetworkTimeline({ return () => clearInterval(interval); }, [lastUpdate]); + // 复制任务ID + const copyTaskId = async (taskId: string) => { + try { + if (navigator.clipboard && window.isSecureContext) { + await navigator.clipboard.writeText(taskId); + setCopiedTaskId(taskId); + setTimeout(() => setCopiedTaskId(null), 1500); + } else { + const textArea = document.createElement('textarea'); + textArea.value = taskId; + textArea.style.position = 'fixed'; + textArea.style.left = '-9999px'; + document.body.appendChild(textArea); + textArea.focus(); + textArea.select(); + document.execCommand('copy'); + document.body.removeChild(textArea); + setCopiedTaskId(taskId); + setTimeout(() => setCopiedTaskId(null), 1500); + } + } catch (e) { + // noop + } + }; + // 计算任务统计信息 const taskStats = useMemo(() => { if (!tasks || tasks.length === 0) { @@ -1203,7 +1228,7 @@ export function NetworkTimeline({