Page MenuHomePhabricator

Make the JSON editor not Web2Cit-specific
Open, Needs TriagePublic

Description

The JSON editor is a temporary workaround to more easily edit configuration files until the Web2Cit-Editor is available.

Because the Web2Cit-Editor may take some time to implement, and because the JSON editor can become a tool independent of Web2Cit, we may consider making some improvements:

  • Have the editor accept an optional "fallback" parameter, indicating an alternative JSON file to pre-populate the form with, in case the main file could not be loaded. In the Web2Cit case, we could use this to load the fallback template.
  • Pass the timestamp of when the pre-existing JSON file was fetched to the mediawiki editor, to handle edit conflicts.
  • If the schema file specified can't be retrieved, json-editor fails and the error isn't caught by our script. This must be fixed.
  • Split the script out of the HTML and create a TS file instead.
  • The itemwise option is not overwritten with its default when switching transformation step types.

Event Timeline

Have the editor accept an optional "fallback" parameter

Alternatively, for the specific Web2Cit case, default procedures have been defined (based on the fallback template) for each template field on the templates JSON schema. See 435dec84.

Pass the timestamp of when the pre-existing JSON file was fetched

Note that this may cause problems in some cases. It is reasonable that users may follow this work flow:

  1. Open the translation results
  2. Click on "edit" to open the JSON editor (this is when the timestamp of the pre-existing JSON file would be fetched)
  3. Edit the JSON file
  4. Save it to Meta
  5. Try the new configuration
  6. Make additional changes

If users do not reload the JSON editor to do these additional changes, the timestamp of the new revision saved on step 4 would not be known to the editor, which may cause problems when trying to save again.

The itemwise option is not overwritten with its default

This seems to be related to issue #1133 in json-editor. In the meantime, I added an infoText indicating what is the default itemwise value for each template field (see 659ce137).

Also, this should be less relevant once T303331 has been addressed.

The itemwise option is not overwritten with its default when switching transformation step types.

This seems to have been fixed already.

diegodlh renamed this task from Consider improving the JSON editor to Make the JSON editor not Web2Cit-specific.Aug 31 2022, 3:13 PM
diegodlh updated the task description. (Show Details)

the JSON editor can become a tool independent of Web2Cit

To do this we could:

  1. Split the JSON editor code out of the web2cit-server repository into a separate non-Web2Cit repository
  2. Make the changes listed above to make this editor Web2Cit-independent. Consider adding support for internationalization and translation, not only of the editor interface, but for the schemas as well.
  3. Host this general-purpose Wikimedia JSON editor on a separate Toolforge account
  4. Make the necessary changes to the web2cit-server source code so that it uses the new general-purpose editor instead.

An on-wiki JSON configuration file editor has been created by the Growth team; see T331865.