Page MenuHomePhabricator

Rework field configurability in the details step
Closed, ResolvedPublic

Description

Currently the support for customizing the behavior of fields in the details step of the uploader is patchy and inconsistent. We will want to ensure that the following requirements are met:

  • There is feature parity between the main config and campaign configs
  • All fields should be explicitly listed in the config (including those included by default), so that they can be modified or removed.
  • New fields of multiple types can be added, including text, number and dropdown inputs.
  • The fields can be freely reordered.
  • The fields can be configured:
    • hidden/visible
    • enabled/disabled
    • default value
    • required/recommended/optional
    • label, tooltip
    • other field type-specific options (e.g. max string length)
  • Values for all fields can be passed in the query string.
  • Coordinate with T275027: Improve file description syntax configurability – allow each field to have custom wikitext syntax. This should be both powerful and simple, so that something as common as adding another parameter to a template should be trivial.
  • It is possible to attach custom JS to these fields somehow, e.g. for input filtering and validation. For example, an custom input filter on the categories field could be used to better suggest media-related categories.

To avoid reinventing the wheel, the configuration settings should probably correspond somehow to OOUI/WVUI element and option names. We'll have to investigate this further, though.

Of course all of this should be documented in a clear manner, preferably with example snippets that can be copied.

Event Timeline

Ostrzyciel triaged this task as Medium priority.Feb 20 2021, 9:03 AM
Ostrzyciel moved this task from To Triage to Feature on the MediaUploader board.
Ostrzyciel updated the task description. (Show Details)

Ok, let's formalize this. Let U be the Hermitian matrix representing the user at time step t0... no, just kidding.

There will be one config setting for specifying the fields that should appear in the details step. It will be a mapping from field name to its specification. Using a mapping is needed so that users can override the field settings sanely when creating campaigns (e.g., changing defaults, reordering, removing one field). The specification will include the following fields:

  • type (required) – the type of the field. This would include simple text fields, multi-language fields, geolocation, dropdown, etc.
  • order (required) – any integer, sortkey to establish the ordering of the fields in the details step.
  • label (required) – wikitext to show as the field's label.
  • help (optional) – wikitext to be show as the explanatory text below the label.
  • required (optional, default "optional") – three-valued setting.
    • "required" will force the user to fill out the field.
    • "recommended" will nag the user to fill out the field, but won't stop them from proceeding.
    • "optional" won't care about whether the user filled out the field or not.
  • default (optional, default empty string) – the default value for the field. Empty string is equivalent to no value.
  • hidden (optional, default false) – hides the field in UI, but still allows the code to interact with it (it will be included in the output).
  • enabled (optional, default true) – allows to show the field, but prevents the user from entering anything
  • auxiliary (optional, default false) – moves the field to the collapsed "additional information" section.
  • other field-type specific options (max string length etc.)

Note: this will completely break back-compat for field specifications in UploadWizard. I don't think the two approaches can be reasonably reconciled, so this seems like a fair deal.

Change 743689 had a related patch set uploaded (by Ostrzyciel; author: Ostrzyciel):

[mediawiki/extensions/MediaUploader@master] Merge branch 'master' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MediaUploader into T275264

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

Change 743690 had a related patch set uploaded (by Ostrzyciel; author: Ostrzyciel):

[mediawiki/extensions/MediaUploader@master] Rework field configuration in the details step

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

Change 743689 abandoned by Ostrzyciel:

[mediawiki/extensions/MediaUploader@master] Merge branch 'master' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MediaUploader into T275264

Reason:

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

Change 743690 merged by jenkins-bot:

[mediawiki/extensions/MediaUploader@master] Rework field configuration in the details step

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

Ostrzyciel claimed this task.