When the edit form is filled out with valid information, clicking the publish button saves the entry
A/C
- User can enter in the simple text input (string)
- the publish button saves edits
- When the user clicks publish the button becomes disabled, so the user doesn't bomb click it.
- while we wait for the server to process the save, we remain on the dialog page
- test are updated/created as needed
Suggested outline for how to approach this (from comment on parent T402620#11132237)
- disable “publish” button after you click it; for now, let’s also disable the “cancel” and “X” buttons
- move the statement data to the store, so that the StatementGroupView can show the updated data after the EditStatementGroup is done and gone
- tie the data currently being edited to the store – separately, not just modifying the existing data directly, so that upon canceling we can throw the edited data away and still show the previous (saved) data; probably some kind of “the currently edited statement group” store
- write a store action that makes an API request to edit the statement group with the new data, and wire that up to the “publish” button; any errors should just be logged to the console for now
- when the API request returns, update the statement data store with the data returned by the server side (note: this is not necessarily exactly the data we sent! there might have been edit conflicts resolved server-side)
- ask the API to format the value being edited (wbformatvalue) so we can display it afterwards
- Wikibase desktop also does this constantly as you edit the input, and it also uses two formats (preview HTML and plain text), which I don’t think we need; we can do this either together with the wbparsevalue API call (mentioned above), or only after saving the edit
- close the edit dialog and show the edited statement value in the statement view
- show the “success” message sliding in from the bottom
- add a loading spinner while the statement is saving
Tech note: this will first require sending the bare user-entered string to the wbparsevalue API to turn it into a data value which we can then save.
Notes: