Page MenuHomePhabricator

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


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: (click on the graph and go to the "data" tab)


image.png (774×1 px, 116 KB)

Event Timeline

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

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?

This comment was removed by Sj.

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

I just tried it at -- 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.

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.