Page MenuHomePhabricator

Codex: Dynamic form submit for Codex FileImporter
Closed, ResolvedPublic

Description

We want to avoid avoid a potentially longer blocking page for the user due the time it takes to do the actual import. So the idea would be to dynamically submit the form with the POST data and edit token needed and then wait for a response in the background. Here's a rough plan on how this can be done.

  • When clicking the submit button a handler set up by Codex UI stops the actual submission and triggers a POST request in the background to the special page with a flag to indicate a Codex submission
  • An overlay with a spinner blocks the page as long as we wait for the response on that request https://doc.wikimedia.org/codex/latest/components/demos/progress-bar.html#using-progress-bars
  • The Special page retrieves the submit request and executes the steps in doImport e.g. in a new method doCodexImport
  • doCodexImport returns JSON that can be retried by the Codex UI to communicate the outcome of the import process

PoC:

  • When the import is successful the Codex UI redirects to the result as it is now. When there's an issue we just show a generic error message.

Next steps:

Outcome

Peek 2023-11-06 15-09.gif (978×1 px, 3 MB)

Event Timeline

Change 967413 had a related patch set uploaded (by Mareike Heuer; author: Mareike Heuer):

[mediawiki/extensions/FileImporter@master] Bug: T347458

https://gerrit.wikimedia.org/r/967413

WMDE-Fisch renamed this task from Dynamic form submit for Codex FileImporter to Codex: Dynamic form submit for Codex FileImporter.Oct 25 2023, 2:58 PM
WMDE-Fisch updated the task description. (Show Details)
lilients_WMDE moved this task from Backlog to Doing on the WMDE-TechWish-Maintenance-2023 board.
lilients_WMDE updated Other Assignee, added: WMDE-Fisch.

Change 969120 had a related patch set uploaded (by Svantje Lilienthal; author: Svantje Lilienthal):

[mediawiki/extensions/FileImporter@master] [WIP] Dynamic form submit for Codex FileImporter

https://gerrit.wikimedia.org/r/969120

Change 965522 had a related patch set uploaded (by WMDE-Fisch; author: WMDE-Fisch):

[mediawiki/extensions/FileImporter@master] Codex: Avoid displaying the interface twice on submit errors

https://gerrit.wikimedia.org/r/965522

Although the documentation shows a nice overlay effect for the progress bar, there does not seem to be a built-in mechanism to display the progress bar with an overlay effect. Or did we somehow miss it? If not, maybe it could be added? Not sure where to put these questions ... [Update: I added a ticket to the codex dashboard: T350805: Include overlay in progress bar component]

Change 965522 abandoned by WMDE-Fisch:

[mediawiki/extensions/FileImporter@master] Codex: Avoid displaying the interface twice on submit errors

Reason:

Not needed anymore see Ib76d133e339b9e064a5e8fd46e68e6573b2800ca

https://gerrit.wikimedia.org/r/965522

I just found this open feature request for the codex library: T350769: [S] Implement progress indicator style on submit button. It could be an alternative approach to the implemented progress bar.

Change 969120 merged by jenkins-bot:

[mediawiki/extensions/FileImporter@master] Codex: Dynamic form submit for FileImporter

https://gerrit.wikimedia.org/r/969120

Change 973205 had a related patch set uploaded (by Svantje Lilienthal; author: Svantje Lilienthal):

[mediawiki/extensions/FileImporter@master] Change background color of progress bar backdrop to standard value

https://gerrit.wikimedia.org/r/973205

Change 973205 merged by jenkins-bot:

[mediawiki/extensions/FileImporter@master] Change background color of progress bar backdrop to standard value

https://gerrit.wikimedia.org/r/973205