From 68d0b046479c118529ccf5ccd7b22f66e0be2695 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 7 Dec 2025 01:01:28 +0000 Subject: Add info icon with transfer details popup to Size column Co-authored-by: jpdillingham <17145758+jpdillingham@users.noreply.github.com> --- src/web/src/components/Transfers/TransferList.jsx | 134 +++++++++++++++++++++- 1 file changed, 129 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/web/src/components/Transfers/TransferList.jsx b/src/web/src/components/Transfers/TransferList.jsx index b81049ec..963d7333 100644 --- a/src/web/src/components/Transfers/TransferList.jsx +++ b/src/web/src/components/Transfers/TransferList.jsx @@ -1,4 +1,9 @@ -import { formatBytes, formatBytesAsUnit, getFileName } from '../../lib/util'; +import { + formatBytes, + formatBytesAsUnit, + formatDate, + getFileName, +} from '../../lib/util'; import React, { Component } from 'react'; import { Button, @@ -6,6 +11,7 @@ import { Header, Icon, List, + Popup, Progress, Table, } from 'semantic-ui-react'; @@ -38,6 +44,53 @@ const formatBytesTransferred = ({ size, transferred }) => { return `${t}/${s} ${sExtension}`; }; +// Convert camelCase to Title Case with spaces +const formatFieldName = (fieldName) => { + return fieldName + .replaceAll(/([A-Z])/gu, ' $1') + .replace(/^./u, (string) => string.toUpperCase()) + .trim(); +}; + +// Format value based on field type +const formatValue = (key, value) => { + if (value === null || value === undefined) { + return 'N/A'; + } + + // Format datetime fields + if ( + (key.toLowerCase().includes('at') || key.toLowerCase().includes('time')) && + typeof value === 'string' && + value.includes(':') + ) { + // Check if it's a duration (HH:MM:SS format) + if (/^\d{2}:\d{2}:\d{2}/u.test(value)) { + return value; + } + + // Otherwise it's a datetime + return formatDate(value); + } + + // Format byte-related fields + if (key.toLowerCase().includes('bytes') || key === 'size') { + return formatBytes(value); + } + + // Format speed + if (key.toLowerCase().includes('speed')) { + return `${formatBytes(value)}/s`; + } + + // Format percentage + if (key.toLowerCase().includes('percent')) { + return `${value.toFixed(2)}%`; + } + + return value.toString(); +}; + class TransferList extends Component { constructor(props) { super(props); @@ -67,6 +120,52 @@ class TransferList extends Component { this.setState((previousState) => ({ isFolded: !previousState.isFolded })); }; + renderTransferDetails = (file) => { + // Fields to display in the popup + const fields = [ + 'id', + 'username', + 'direction', + 'filename', + 'size', + 'startOffset', + 'state', + 'stateDescription', + 'requestedAt', + 'enqueuedAt', + 'startedAt', + 'endedAt', + 'bytesTransferred', + 'averageSpeed', + 'bytesRemaining', + 'elapsedTime', + 'percentComplete', + 'remainingTime', + ]; + + return ( +