Skip to content

feat: network connection UX, download-by-datamap, and connect/upload simplification - #22

Merged
Nic-dorman merged 14 commits into
mainfrom
refactor/simplify-connect-and-upload
Apr 16, 2026
Merged

feat: network connection UX, download-by-datamap, and connect/upload simplification#22
Nic-dorman merged 14 commits into
mainfrom
refactor/simplify-connect-and-upload

Conversation

@mickvandijke

@mickvandijke mickvandijke commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR bundles several related connection, upload, and download improvements:

Connection

  • Simplify connection state handling: remove per-attempt tracking and retry logic in autonomi_ops.rs, align with ant-cli behavior.
  • Add a network connection status indicator in the header (connecting / connected / failed) with retry-on-failure, backed by a new connectionStore.
  • Install the connection-status listener before fetching initial status so the Idle → Connecting transition can't be lost to a race, and treat idle like connecting so the header spinner shows from cold start.

Uploads

  • Streamline upload-quote logic in stores/files.ts: unify listener setup to prevent race conditions, remove redundant timeouts on long-running backend ops, and delegate shared logic to getUploadQuote.

Downloads

  • Add Download by Datamap flow: new dialog + backend methods to persist, read, and process .datamap files; file store lazy-loads JSON from disk and supports re-downloading known datamaps.
  • Wait for an active network connection (with retry) before starting downloads so offline scenarios fail gracefully.
  • Split uploads and downloads into separate in-memory tables — re-downloading no longer mutates upload-history rows; each table has its own sort state and clear control.
  • Remove the Source column from the downloads table.

Payment

  • Reduce waitForTransactionReceipt polling interval to 2s to better match Arbitrum block time and avoid spurious TransactionReceiptNotFoundError.

Test plan

  • Cold start: header shows the connecting spinner immediately, then transitions to connected.
  • Force a connection failure: header shows failed state and retry works.
  • Trigger an upload quote on a large/slow upload: no premature timeout; cancel + re-trigger shows no listener races.
  • Download by datamap: pick a .datamap file, confirm download starts and completes; re-download a known datamap.
  • Start a download while offline: connection retry kicks in; surfaces a clean failure if it can't connect.
  • Upload a file, then download it: rows appear in separate Uploads / Downloads tables with independent sort and clear.
  • Run a payment flow on Arbitrum and confirm receipts are detected without the previous not-found errors.

🤖 Generated with Claude Code

mickvandijke and others added 10 commits April 16, 2026 14:15
…timeouts

Simplified listener setup to prevent race conditions and unified timeout handling. Removed unnecessary timeouts for long-running backend operations, ensuring reliability on slow networks or large uploads. Delegated shared logic to `getUploadQuote` for consistency.
Streamlined connection status handling by removing per-attempt tracking and retries. Eliminated redundant timeouts, aligning behavior with `ant-cli` for consistency. Updated frontend logic to reflect the simplified state transitions and adjusted backend connection loop accordingly.
…ction detection

Adjusted `waitForTransactionReceipt` in payment processing to use a 2s polling interval, minimizing the chance of `TransactionReceiptNotFoundError` by better aligning with Arbitrum's block time.
Added `waitForConnection` logic to ensure network connectivity before initiating downloads. Updated `handleDownload` to retry connection and handle failures gracefully, improving reliability in offline scenarios.
Implemented connection state indicators (connecting, connected, failed) in the header with retry logic for failed connections. Integrated `connectionStore` to manage network status display.
Introduced a new dialog and workflow for users to download files using `.datamap` files directly. Updated file store logic to handle datamap paths, lazy-load JSON from disk, and support re-downloads of known datamaps. Integrated backend methods to persist, read, and process datamap files securely while ensuring reliable download initiation.
Install the `connection-status` listener before fetching the initial
status so the Idle → Connecting transition can't be lost to a race,
and treat `idle` the same as `connecting` in `isConnecting` so the
header spinner shows from cold start until a real state arrives.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Downloads are now a distinct in-memory table that starts fresh each
session, so re-downloading a file no longer mutates its upload-history
row. Each table has its own sort state and clear control.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The download-by-datamap flow now mirrors download-by-address: after
picking a previous upload or browsing for a .datamap file, a small
"Save as" dialog lets the user edit the filename before the transfer
starts. Default is the upload's original name for list picks, and the
datamap's basename (minus .datamap) for browsed files.

Also drops the redundant Source column from the downloads table —
the "Saved to" column already conveys where the bytes landed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mickvandijke mickvandijke changed the title refactor: simplify connection states and streamline upload quote logic feat: network connection UX, download-by-datamap, and connect/upload simplification Apr 16, 2026
mickvandijke and others added 4 commits April 16, 2026 19:21
Splitting uploads/downloads into separate tables dropped the implicit
address→datamap lookup, so pasting a known address created an empty
download row and failed with "No data map available". Now startDownload
reuses a matching upload's datamap when found, and startRealDownload
falls back to a new download_public command that fetches the DataMap
chunk from the network by address via ant-core's data_map_fetch.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Introduced a backend command to determine the OS-specific default downloads directory and integrated it into the settings store. Updated file handling to use the default directory as a fallback if no custom download directory is set.
…launch

Backfill the platform's default downloads directory into the user's config
when none is set, so it's visible in settings and used by downloads without
a runtime fallback. Old configs missing the field migrate automatically on
next load.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…nect-and-upload

# Conflicts:
#	src-tauri/src/autonomi_ops.rs
@Nic-dorman
Nic-dorman merged commit 32e7a94 into main Apr 16, 2026
4 checks passed
@Nic-dorman
Nic-dorman deleted the refactor/simplify-connect-and-upload branch April 17, 2026 08:18
jacderida pushed a commit to jacderida/ant-ui that referenced this pull request Apr 27, 2026
- Add get_dir_size Tauri command for recursive directory size calculation
- Add nodeDetail API method (GET /api/v1/nodes/{id}) from ant-client PR WithAutonomi#22
- Enrich nodes with data_dir and storage_bytes on 30s interval
- Fix storage display to show "0 B" for empty dirs instead of "-"
- Replace payment mode card selector with compact text label

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants