Page MenuHomePhabricator

Create a basic editing dialog for editing JSON tabular data as a table
Closed, ResolvedPublic

Description

Add an "Edit as table" button on pages with Tabular.JsonConfig content, which opens a dialog for editing the data in a table widget. On clicking "Apply", the raw JSON in the editing textbox is updated.

This works similarly to the TemplateData editor for template documentation, accessible via the "Manage template data" button. Example: http://localhost/mediawiki/core/index.php?title=Template:Global_Heat_Maps_by_Year/doc&action=edit

The TableWidget editor is already in use for editing <graph> nodes via visual editor. Example: https://en.wikipedia.org/w/index.php?title=MATLAB&veaction=edit&section=9 (click on the graph and go to the "data" tab)

Screenshot:

Event Timeline

Restricted Application added a subscriber: Liuxinyu970226. · View Herald TranscriptMay 4 2020, 12:43 PM

Change 592695 had a related patch set uploaded (by Tchanders; owner: Tchanders):
[mediawiki/extensions/JsonConfig@master] Introduce basic edit dialog for editing tabular data

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

Tchanders moved this task from Incoming to Product Doing on the covid-19 board.May 4 2020, 5:32 PM
mxn added a subscriber: mxn.May 10 2020, 7:37 PM
Sj added a subscriber: Sj.May 10 2020, 9:49 PM
Sj added a comment.EditedMay 11 2020, 2:13 PM

This looks amazing, @Tchanders . Thank you :) Just waiting on review?

@1Veertje 's spreadsheet-to-json tool is still needed for the many datasources that begin life as a spreadsheet -- we still want some way to paste that into a sheet, and then generate a Tab file.
Is there a way to connect that to this workflow somehow?

Sj added a subscriber: 1Veertje.May 11 2020, 2:15 PM
This comment was removed by Sj.

Change 592695 merged by jenkins-bot:
[mediawiki/extensions/JsonConfig@master] Introduce basic edit dialog for editing tabular data

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

Tchanders closed this task as Resolved.May 11 2020, 5:35 PM
Yurik added a comment.May 11 2020, 5:45 PM

I just tried it at https://commons.wikimedia.beta.wmflabs.org/wiki/Data:ISO15924/trans.tab -- looks great, and offers an amazing base for further features! Did you remove the "delete row" button?

@Yurik Thanks for testing this! Yes, the ability to add and remove rows was removed for this first iteration, in favour of getting something basic up sooner. There's a follow-up task next up though: T252442: Allow adding and removing rows in dialog for editing JSON tabular data

@Sj @1Veertje The spreadsheet tool looks really useful - thanks for sharing.

I'd be open to suggestions about integrating the workflows, but for now I think they complement each other pretty well. The spreadsheet app looks very useful for generating the JSON and making larger structural changes. Then once the page has been created, I think it's helpful to have the dialog in the wiki for any quick fixes.

Yurik awarded a token.May 12 2020, 1:11 AM
Yurik added a comment.EditedMay 12 2020, 1:22 AM

I think the right way to integrate spreadsheets and .tab editor is the proper copy/paste handling. It should be possible to paste a spreadsheet directly into the editor, and handle when the paste data is a table from spreadsheet, or has considerable size, or has multiple lines, or has tabs (or commas?), and treat it as a table of text, and ask the user how to deal with it: replace data or append to it. Other cases to handle would be shape mismatch (different number of columns), and type mismatch (e.g. paste data has text in the numeric column). I do not think the special cases like "replace just one column while keeping others intact" should be handled -- for that people can just copy/paste the whole table.

Multilingual column may need additional thinking -- one solution is to flatten them. For example a multilingual column namecould be copied as multiple columns -- name:en , name:fr, ... - for all languages that exist in the data.