Page MenuHomePhabricator

‘Submit’ Button functionality to create the new Lexeme
Closed, ResolvedPublic8 Estimated Story Points

Description

As a user, when I finish filling out the new Lexeme form I would like to create a new lexeme by clicking on the ‘Create Lexeme’ button in order to save my contribution.

Problem:
We need to let editors submit the data for the new Lexeme that is supposed to be created and then create the Lexeme.

Screenshots/mockups:
https://www.figma.com/file/XoYktoKEBnC0VIf1SRuxJK/Lexicographical-Data-UI?node-id=493%3A3179

BDD
GIVEN the special page to create new Lexemes
AND the input fields are filled out
WHEN clicking “Submit”
THEN the input is validated
AND the new Lexeme created if validation was successful

Acceptance criteria:

  • input is validated
  • Lexeme is created if input is valid

Notes:

  • Button Copy: Create Lexeme
  • Wikit component Button: progressive
  • Errors (pre submit): no entities selected in the entity selectors, invalid input in the entity selectors, Lemma field is empty, spelling variant is invalid, Lemma is too long
  • validation should be included in serverside, improved validation (if desired) should be in a new task

error post submit (permission errors) to be handled here: T302264 design / T303393 implementation
error "spelling variant is invalid" added to spelling variant field creation task: T298145

Event Timeline

karapayneWMDE renamed this task from ‘Submit’ Button to create the new Lexeme to ‘Submit’ Button functionality to create the new Lexeme.Feb 8 2022, 12:09 PM
karapayneWMDE updated the task description. (Show Details)
karapayneWMDE set the point value for this task to 8.

Change 763719 had a related patch set uploaded (by Michael Große; author: Michael Große):

[mediawiki/extensions/WikibaseLexeme@master] Allow no lexeme input handling by adding noscript skeleton form

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

Task Breakdown Notes:

What was done:

  1. CSRF Token Injection into Vue App (merged)
  2. Provide CSRF token from the WikibaseLexeme.git PATCH
  3. <noscript> version of form, with the required fields PATCH Note for future: T302070
  4. Action handler on Server side: re-renders form (with error messages that might be displayed with JS disabled) PATCH
  5. Make vue form submittable in a way that is compatible with server side form action handling. PATCH

What's left to do

With a minimal version (without validation messages), the only thing left to do is to review.

With validation messages, we can already handle field errors on the client side:

  1. Define validation logic for each of the following errors:
    • Required fields (all)
    • Invalid ItemId format (regex for now ⇒ language, lexical category)
    • Max length for lemma (Involves resolving a long-standing to-do in the current Lexeme data model: 1000 chars. @Lydia_Pintscher is this correct? The current value is hard-coded)
  1. Display messages (as shown in Figma) below invalid fields. @Erdinc_Ciftci_WMDE @Lydia_Pintscher Do we have the copy for all of these messages?

Open Questions: should we send the form via the browser with the traditional form action, or should we submit it with an XHR?

@Lydia_Pintscher @karapayneWMDE There is an open question regarding the scope of this task. Should it also include error signaling or not? Validation (on the server side - is already done, in the way that it prevents Lexeme creation rather than signaling errors). Can you please shed some light on this? Do we expect errors to be displayed to the user as part of this task?

@ItamarWMDE you mean telling the editor what the specific error is that prevented the creation of the Lexeme? I initially included it here but let's leave it out of this ticket now and create a new one once T302264 is done.

Yes, I mean displaying messages to the user. But I agree on the scope reduction. We can look at the newly created ticket in the backlog grooming.

Change 763719 merged by jenkins-bot:

[mediawiki/extensions/WikibaseLexeme@master] Let Special:NewLexemeAlpha create lexemes

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

Works on beta, see https://wikidata.beta.wmflabs.org/wiki/Special:NewLexemeAlpha. (Though we forgot to include the i18n messages in the ResourceLoader module.) https://wikidata.beta.wmflabs.org/wiki/Lexeme:L36707 was created successfully.

Change 767517 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/WikibaseLexeme@master] Add missing Special:NewLexemeAlpha i18n messages

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

Change 767517 merged by jenkins-bot:

[mediawiki/extensions/WikibaseLexeme@master] Add missing Special:NewLexemeAlpha i18n messages

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

@Lydia_Pintscher: In the task breakdown, we decided that redirecting to the new lexeme would not be part of the subtask T302961: Use API endpoint when creating a new Lexeme (T302961#7766524). Should that functionality be part of this story (new subtask, probably still part of the sprint), or do you want to track it separately?