Skip to content

Agentic UI: Add backup import to the site overview - #4500

Merged
bcotrim merged 17 commits into
trunkfrom
stu-2008-add-import-export-to-agentic-ui
Aug 13, 2026
Merged

Agentic UI: Add backup import to the site overview#4500
bcotrim merged 17 commits into
trunkfrom
stu-2008-add-import-export-to-agentic-ui

Conversation

@bcotrim

@bcotrim bcotrim commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Related issues

How AI was used in this PR

Claude Code wrote the implementation and tests. I reviewed the diff and verified the behaviour in the browser (both themes) before pushing.

Proposed Changes

Import was only reachable in the Agentic UI while creating a site, so there was no way to restore a backup over a site you already had — you had to start site creation over. Export already lived in the site overview; import now sits beside it.

Picking a backup asks for confirmation before overwriting, then reports progress, success, and failure. Import and export block each other while either is running, matching Classic.

Also brings site creation in line with Classic on .sql: a database dump has no files to go with it, so it can only be imported over an existing site, not used to create one. The Agentic onboarding card accepted .sql and nothing downstream rejected it, so it would create a site from bundled WordPress files and apply a dump whose themes and plugins were missing from disk.

Light Dark Confirmation
image image image

Testing Instructions

  1. Open a site → OverviewManage. Click Import, pick a backup, confirm the overwrite. Check the progress, then the result.
  2. Pick an unsupported file (e.g. .txt) — it should be rejected before the confirmation appears.
  3. While an export is running, Import should be disabled, and vice versa.
  4. On Add a siteImport from a backup, a .sql file should now be rejected; a .zip/.tar.gz should still go through.
  5. Check both light and dark.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@wpmobilebot

wpmobilebot commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing 4ba390e vs trunk

app-size

Metric trunk 4ba390e Diff Change
App Size (Mac) 1406.64 MB 1406.65 MB +0.01 MB ⚪ 0.0%

site-editor

Metric trunk 4ba390e Diff Change
load 1074 ms 1065 ms 9 ms ⚪ 0.0%

site-startup

Metric trunk 4ba390e Diff Change
siteCreation 7528 ms 7545 ms +17 ms ⚪ 0.0%
siteStartup 2879 ms 2883 ms +4 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@katinthehatsite katinthehatsite left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that: apps/ui/src/data/queries/use-import-site.ts file has the following comment:

/**

  • Runs a backup import against a site that has just been created. The
  • The cached site list is invalidated so metadata changed by the importer is
  • picked up.
    */

We should probably adjust it since we are now using the hook not only for the newly created site.

@katinthehatsite

Copy link
Copy Markdown
Contributor

Generally, it works well but I noticed that i can duplicate a site while it is importing, should we disable the duplication in that case?

@bcotrim

bcotrim commented Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

Generally, it works well but I noticed that i can duplicate a site while it is importing, should we disable the duplication in that case?

Yes, I think we should disable it
I am working around blocking operations in #4406 so I will confirm this use case there

@katinthehatsite

Copy link
Copy Markdown
Contributor

I am working around blocking operations in #4406 so I will confirm this use case there

Sounds good 👍

@katinthehatsite katinthehatsite left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The import itself worked well for me but I noticed that I am having a hard time reaching the Overview tab of another site while the import is in progress. I tried to capture it in the screencast below:

Screen.Recording.2026-08-12.at.9.33.04.AM.mov

Do you see something similar?

description={ __(
'Importing a backup will replace the existing files and database for your site.'
) }
confirmButtonText={ __( 'Import' ) }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure whether this button needs to have destructive styling:

Image

It seems a bit intense there, what do you think? Although can be left as is if that's the intention

@bcotrim

bcotrim commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review @katinthehatsite!

Both of your findings are fixed:

  • Sluggish navigation mid-import
  • The Import confirm is no longer red

Also changed while in here:

  • Progress moved out of the toast into the per-site activity row (sidebar + site dropdown), so simultaneous imports stay told apart by site.
  • Progress labels now lead with a zero-padded percentage (03% · Creating remote backup…) so they don't shift as they tick. This also changes the CLI sync strings.
  • The overview refetches WP version, disk usage and the screenshot after an import.

Can you take another look, please? 🙇

} ) );

vi.mock( '@/data/queries/use-sites', () => ( {
// The real `useImportSite` invalidates this key on success.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can drop this comment, it seems self-explanatory

useOffline: vi.fn(),
} ) );

// Real store elsewhere — the pending/success entries drive the button states

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can also be cleaned up as the pattern is evident from the code

);
await waitFor( () => expect( emitProgress ).toBeDefined() );

// 500 chunks spanning two whole-percent steps of the same 10-file backup.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that this just descibes what the loop does so I would drop it as well

@katinthehatsite katinthehatsite left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The functionality worked well and switching between the sites while import is in progress also looked good 👍

Also, thanks for adjusting this Import button:

Image

I left a couple of comments regarding cleaning up the redundant comments but these are non-blocking

…export-to-agentic-ui

# Conflicts:
#	apps/ui/src/components/site-dropdown/main-view.tsx
#	apps/ui/src/components/site-overview-view/index.test.tsx
#	apps/ui/src/hooks/use-site-management-actions.ts
@bcotrim
bcotrim enabled auto-merge (squash) August 13, 2026 09:13
@bcotrim
bcotrim merged commit 6f39f92 into trunk Aug 13, 2026
14 checks passed
@bcotrim
bcotrim deleted the stu-2008-add-import-export-to-agentic-ui branch August 13, 2026 09:46
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.

3 participants