| ... | @@ -1423,6 +1423,31 @@ function SavedBackendListRow({ | ... | @@ -1423,6 +1423,31 @@ function SavedBackendListRow({ |
| 1423 | : "bg-muted-foreground/40"; | 1423 | : "bg-muted-foreground/40"; |
| 1424 | const statusTooltip = connectionStatusText(environment.connection); | 1424 | const statusTooltip = connectionStatusText(environment.connection); |
| 1425 | const errorTraceId = environment.connection.traceId; | 1425 | const errorTraceId = environment.connection.traceId; |
| | 1426 | const { copyToClipboard: copyTraceIdToClipboard } = useCopyToClipboard<{ traceId: string }>({ |
| | 1427 | target: "trace ID", |
| | 1428 | onCopy: ({ traceId }) => { |
| | 1429 | toastManager.add({ |
| | 1430 | type: "success", |
| | 1431 | title: "Trace ID copied", |
| | 1432 | description: traceId, |
| | 1433 | }); |
| | 1434 | }, |
| | 1435 | onError: (error) => { |
| | 1436 | toastManager.add( |
| | 1437 | stackedThreadToast({ |
| | 1438 | type: "error", |
| | 1439 | title: "Could not copy trace ID", |
| | 1440 | description: error.message, |
| | 1441 | }), |
| | 1442 | ); |
| | 1443 | }, |
| | 1444 | }); |
| | 1445 | const copyTraceId = useCallback( |
| | 1446 | (traceId: string) => { |
| | 1447 | copyTraceIdToClipboard(traceId, { traceId }); |
| | 1448 | }, |
| | 1449 | [copyTraceIdToClipboard], |
| | 1450 | ); |
| 1426 | const versionMismatch = resolveServerConfigVersionMismatch(environment.serverConfig); | 1451 | const versionMismatch = resolveServerConfigVersionMismatch(environment.serverConfig); |
| 1427 | const sshTarget = | 1452 | const sshTarget = |
| 1428 | environment.entry.target._tag === "SshConnectionTarget" && | 1453 | environment.entry.target._tag === "SshConnectionTarget" && |
| ... | @@ -1468,7 +1493,7 @@ function SavedBackendListRow({ | ... | @@ -1468,7 +1493,7 @@ function SavedBackendListRow({ |
| 1468 | <button | 1493 | <button |
| 1469 | type="button" | 1494 | type="button" |
| 1470 | className="shrink-0 underline underline-offset-2" | 1495 | className="shrink-0 underline underline-offset-2" |
| 1471 | onClick={() => void navigator.clipboard.writeText(errorTraceId)} | 1496 | onClick={() => copyTraceId(errorTraceId)} |
| 1472 | > | 1497 | > |
| 1473 | Copy trace ID | 1498 | Copy trace ID |
| 1474 | </button> | 1499 | </button> |