Page MenuHomePhabricator

Publish component: Create a publish component used in all Wikifunctions create and edit pages
Closed, ResolvedPublic

Description

Description

Implement the Publish component according to the design specifications from T270304

What we call "Publish component" includes the page "Publish" button (visible in all edit/create pages) as well as the dialog that is shown before finally submitting the ZObject to the backend. It controls the save/edit flow and also displays error/warning messages to the user if necessary.

This task includes the creation of the Publish component as well as its incorporation into the Function edit and ZObject edit pages, and removal of current components used for this purpose.

Desired behavior/Acceptance criteria

  • The publish component/button/flow should be the same in all create/edit pages in Wikifunctions (ZObject and Function editor)
  • A "Publish" button should be always visible on top of every edit/create page
  • The global state should track whether any changes have been made in the page that need saving, so that:
    • The "Publish" button states in a disabled state when there are no changes in the page
    • If the user tries to exit a create/edit page without saving their changes, a dialog should warn them
  • On clicking the page "Publish" button, a dialog should be shown, with the following features:
    • Should be able to show warning and error messages (see Clarification 1)
    • Should have an input text message for the user to write their save summary (see Clarification 2)
    • Should show the required legal texts (see Clarification 3)
    • Should have an always enabled "Publish" button, that will trigger the call to the wikilambda_edit API and wait for its return:
      • On Success: navigate to the view page
      • On Error: show the error in the space allocated for it in the Publish dialog (see Clarification 4)

Clarifications:

  1. For now, show error/warning messages stored in a variable, this will be a temporal state until we finish T315099 and we can incorporate our global error state handling system into this component.
  2. For now, create a simple text input field. We will take suggestions or automatically generated edit summary to a future task.
  3. The texts approved by legal are:
  4. For now, save the returned error locally. This will be temporal until we finish the global error state handling task (T315099) and we can incorporate its flow to this component.

Devices and Design (URLs or screenshots)

  • Desktop: ...
  • Small screens/mobile: ...

Completion checklist

Related Objects

Event Timeline

TODO: check we want to show all warnings/errors in the same red/yellow "square", or if each should have their own in the publish component.

Update from design team: Each error/warning should have their own message.

Change 851036 had a related patch set uploaded (by Dani DW; author: Dani DW):

[mediawiki/extensions/WikiLambda@master] Connect the Publish Dialog component to the store, and add it to the function editor page.

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

Change 852926 had a related patch set uploaded (by Dani DW; author: Dani DW):

[mediawiki/extensions/WikiLambda@master] Swap the "save changes" button in the zobject editor out for the "publish" button - publish dialog flow.

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

Change 852928 had a related patch set uploaded (by Dani DW; author: Dani DW):

[mediawiki/extensions/WikiLambda@master] And the "confirm" dialog to the function editor when a user attempts to click away from the page after making edits and before saving.

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

Change 851036 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] Connect the Publish Dialog component to the store, and add it to the function-editor page.

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

Change 852926 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] Swap the "save changes" button in the zobject editor out for the "publish" button - publish dialog flow.

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

Change 852928 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] And the "confirm" dialog to the function editor when a user attempts to click away from the page after making edits and before saving.

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

Change 855629 had a related patch set uploaded (by Dani DW; author: Dani DW):

[mediawiki/extensions/WikiLambda@master] Setup zObject editor "isDirty", which is connected to the "publish" button active/disabled.

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

Change 855635 had a related patch set uploaded (by Dani DW; author: Dani DW):

[mediawiki/extensions/WikiLambda@master] Add the Leave Editor Dialog to the ZObjectEditor, for when a user tries to navigate away from the the page with unsaved changes.

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

Change 855629 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] Setup zObject editor "isDirty", which is connected to the Publish Button being disabled or active.

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

Change 855635 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] Add the Leave Editor Dialog to the ZObjectEditor, for when a user tries to navigate away from the the page with unsaved changes.

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

RWambua-WMF updated the task description. (Show Details)
RWambua-WMF updated the task description. (Show Details)
DVrandecic updated the task description. (Show Details)